summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Nusinow <dnusinow@debian.org>2006-10-14 22:42:57 +0000
committerDavid Nusinow <dnusinow@debian.org>2006-10-14 22:42:57 +0000
commit75733e42375e74d990afd2432e3072bc1586305b (patch)
tree794bc9de497c0befbe4b9b664e7a9fd7c3d6b416
parentbc8084da742c20531bb2f935afad522e22381832 (diff)
Commit diff of 6.5.1-0.2 so we've got a record of it here.mesa-6.5.1-0.2
-rwxr-xr-xbin/installmesa74
-rw-r--r--configs/debian2
-rw-r--r--configs/debian-debug-i3867
-rw-r--r--configs/debian-debug_i3862
-rw-r--r--configs/debian-dri8
-rw-r--r--configs/debian-dri-amd645
-rw-r--r--configs/debian-dri-i3864
-rw-r--r--configs/debian-dri-powerpc5
-rw-r--r--configs/debian-glide-i3867
-rw-r--r--configs/debian-glide_i3862
-rw-r--r--configs/debian-i3867
-rw-r--r--configs/debian-static2
-rw-r--r--configs/debian-static-i3867
-rw-r--r--configs/debian-static_i3862
-rw-r--r--configs/debian_i3862
-rw-r--r--debian/changelog16
-rw-r--r--debian/mesa-swx11-source.install469
-rwxr-xr-xdebian/rules4
-rw-r--r--docs/README.X11314
-rw-r--r--docs/VERSIONS1492
-rw-r--r--docs/enums.txt42
-rw-r--r--docs/mesa.css33
-rw-r--r--doxygen/.cvsignore15
-rw-r--r--doxygen/Makefile33
-rw-r--r--doxygen/README10
-rw-r--r--doxygen/array_cache.doxy50
-rw-r--r--doxygen/common.doxy1153
-rw-r--r--doxygen/core_subset.doxy226
-rw-r--r--doxygen/doxy.bat19
-rw-r--r--doxygen/glapi.doxy49
-rw-r--r--doxygen/header.html17
-rw-r--r--doxygen/header_subset.html11
-rw-r--r--doxygen/main.doxy50
-rw-r--r--doxygen/math.doxy49
-rw-r--r--doxygen/math_subset.doxy177
-rw-r--r--doxygen/miniglx.doxy179
-rw-r--r--doxygen/radeon_subset.doxy203
-rw-r--r--doxygen/shader.doxy49
-rw-r--r--doxygen/swrast.doxy48
-rw-r--r--doxygen/swrast_setup.doxy49
-rw-r--r--doxygen/tnl.doxy50
-rw-r--r--doxygen/tnl_dd.doxy49
-rw-r--r--include/GL/Makefile.am43
-rw-r--r--include/GL/foomesa.h76
-rw-r--r--include/GL/glut_h.dja340
-rw-r--r--include/GL/miniglx.h482
-rw-r--r--include/GLES/egl.h324
-rw-r--r--include/GLES/egltypes.h45
-rw-r--r--progs/demos/.cvsignore48
-rw-r--r--progs/demos/Windows/all.dsp101
-rw-r--r--progs/demos/Windows/bounce.dsp112
-rw-r--r--progs/demos/Windows/clearspd.dsp112
-rw-r--r--progs/demos/Windows/cubemap.dsp112
-rw-r--r--progs/demos/Windows/demos.dsw782
-rw-r--r--progs/demos/Windows/drawpix.dsp112
-rw-r--r--progs/demos/Windows/fire.dsp112
-rw-r--r--progs/demos/Windows/gears.dsp112
-rw-r--r--progs/demos/Windows/geartrain.dsp112
-rw-r--r--progs/demos/Windows/glinfo.dsp112
-rw-r--r--progs/demos/Windows/gloss.dsp112
-rw-r--r--progs/demos/Windows/gltestperf.dsp112
-rw-r--r--progs/demos/Windows/glutfx.dsp112
-rw-r--r--progs/demos/Windows/ipers.dsp112
-rw-r--r--progs/demos/Windows/isosurf.dsp112
-rw-r--r--progs/demos/Windows/loadbias.dsp112
-rw-r--r--progs/demos/Windows/morph3d.dsp112
-rw-r--r--progs/demos/Windows/multiarb.dsp112
-rw-r--r--progs/demos/Windows/occlude.dsp112
-rw-r--r--progs/demos/Windows/osdemo.dsp112
-rw-r--r--progs/demos/Windows/paltex.dsp112
-rw-r--r--progs/demos/Windows/pixeltex.dsp112
-rw-r--r--progs/demos/Windows/pointblast.dsp112
-rw-r--r--progs/demos/Windows/rain.dsp112
-rw-r--r--progs/demos/Windows/ray.dsp112
-rw-r--r--progs/demos/Windows/readpix.dsp112
-rw-r--r--progs/demos/Windows/reflect.dsp112
-rw-r--r--progs/demos/Windows/renormal.dsp112
-rw-r--r--progs/demos/Windows/shadowtex.dsp112
-rw-r--r--progs/demos/Windows/spectex.dsp112
-rw-r--r--progs/demos/Windows/spriteblast.dsp112
-rw-r--r--progs/demos/Windows/stex3d.dsp112
-rw-r--r--progs/demos/Windows/teapot.dsp112
-rw-r--r--progs/demos/Windows/terrain.dsp112
-rw-r--r--progs/demos/Windows/tessdemo.dsp112
-rw-r--r--progs/demos/Windows/texcyl.dsp112
-rw-r--r--progs/demos/Windows/texdown.dsp112
-rw-r--r--progs/demos/Windows/texenv.dsp112
-rw-r--r--progs/demos/Windows/texobj.dsp112
-rw-r--r--progs/demos/Windows/trispd.dsp112
-rw-r--r--progs/demos/Windows/tunnel.dsp112
-rw-r--r--progs/demos/Windows/tunnel2.dsp112
-rw-r--r--progs/demos/Windows/winpos.dsp112
-rw-r--r--progs/demos/occlude.c234
-rw-r--r--progs/egl/Makefile65
-rw-r--r--progs/egl/demo1.c145
-rw-r--r--progs/egl/demo2.c190
-rw-r--r--progs/egl/demo3.c636
-rw-r--r--progs/egl/eglgears.c475
-rw-r--r--progs/egl/eglinfo.c166
-rw-r--r--progs/fbdev/Makefile53
-rw-r--r--progs/fbdev/glfbdevtest.c524
-rw-r--r--progs/fp/Makefile127
-rw-r--r--progs/fp/tri-abs.c107
-rw-r--r--progs/fp/tri-add.c110
-rw-r--r--progs/fp/tri-cmp.c110
-rw-r--r--progs/fp/tri-cos.c113
-rw-r--r--progs/fp/tri-depth.c111
-rw-r--r--progs/fp/tri-depth2.c116
-rw-r--r--progs/fp/tri-depthwrite.c107
-rw-r--r--progs/fp/tri-depthwrite2.c107
-rw-r--r--progs/fp/tri-dp3.c109
-rw-r--r--progs/fp/tri-dp4.c109
-rw-r--r--progs/fp/tri-dph.c109
-rw-r--r--progs/fp/tri-dst.c109
-rw-r--r--progs/fp/tri-ex2.c110
-rw-r--r--progs/fp/tri-flr.c110
-rw-r--r--progs/fp/tri-fp.c109
-rw-r--r--progs/fp/tri-frc.c111
-rw-r--r--progs/fp/tri-inv.c109
-rw-r--r--progs/fp/tri-kil.c111
-rw-r--r--progs/fp/tri-lg2.c110
-rw-r--r--progs/fp/tri-lit.c111
-rw-r--r--progs/fp/tri-lrp.c109
-rw-r--r--progs/fp/tri-mad.c109
-rw-r--r--progs/fp/tri-max.c109
-rw-r--r--progs/fp/tri-min.c109
-rw-r--r--progs/fp/tri-mov.c102
-rw-r--r--progs/fp/tri-mul.c109
-rw-r--r--progs/fp/tri-param.c114
-rw-r--r--progs/fp/tri-position.c109
-rw-r--r--progs/fp/tri-pow.c109
-rw-r--r--progs/fp/tri-rcp.c110
-rw-r--r--progs/fp/tri-rsq.c110
-rw-r--r--progs/fp/tri-scs.c111
-rw-r--r--progs/fp/tri-sge.c109
-rw-r--r--progs/fp/tri-sge2.c114
-rw-r--r--progs/fp/tri-sin.c114
-rw-r--r--progs/fp/tri-slt.c109
-rw-r--r--progs/fp/tri-sub.c109
-rw-r--r--progs/fp/tri-swz.c109
-rw-r--r--progs/fp/tri-swz2.c109
-rw-r--r--progs/fp/tri-tex.c130
-rw-r--r--progs/fp/tri-xpd.c108
-rw-r--r--progs/ggi/blah2
-rw-r--r--progs/ggi/blat7
-rw-r--r--progs/ggi/box.asc66
-rw-r--r--progs/ggi/cone.asc198
-rw-r--r--progs/ggi/sphere.asc132
-rw-r--r--progs/ggi/torus.asc264
-rw-r--r--progs/ggi/tube.asc396
-rw-r--r--progs/miniglx/Makefile58
-rw-r--r--progs/miniglx/glfbdevtest.c478
-rw-r--r--progs/miniglx/manytex.c382
-rw-r--r--progs/miniglx/miniglxsample.c128
-rw-r--r--progs/miniglx/miniglxtest.c195
-rw-r--r--progs/miniglx/sample_server.c112
-rw-r--r--progs/miniglx/sample_server2.c229
-rw-r--r--progs/miniglx/texline.c268
-rw-r--r--progs/redbook/.cvsignore64
-rw-r--r--progs/redbook/Imakefile221
-rw-r--r--progs/redbook/Windows/redbook.dsw29
-rw-r--r--progs/redbook/Windows/teapots.dsp112
-rw-r--r--progs/samples/.cvsignore45
-rw-r--r--progs/samples/Imakefile101
-rw-r--r--progs/tests/.cvsignore54
-rw-r--r--progs/tests/Makefile154
-rw-r--r--progs/tests/Makefile.win44
-rw-r--r--progs/tests/afsmultiarb.c469
-rw-r--r--progs/tests/antialias.c229
-rw-r--r--progs/tests/api_speed.c146
-rwxr-xr-xprogs/tests/api_speed.py143
-rw-r--r--progs/tests/arbfpspec.c192
-rw-r--r--progs/tests/arbfptest1.c210
-rw-r--r--progs/tests/arbfptexture.c153
-rw-r--r--progs/tests/arbfptrig.c156
-rw-r--r--progs/tests/arbnpot.c174
-rw-r--r--progs/tests/arbvptest1.c164
-rw-r--r--progs/tests/arbvptest3.c127
-rw-r--r--progs/tests/arbvptorus.c191
-rw-r--r--progs/tests/arbvpwarpmesh.c246
-rw-r--r--progs/tests/auxbuffer.c499
-rw-r--r--progs/tests/blendminmax.c209
-rw-r--r--progs/tests/blendsquare.c178
-rw-r--r--progs/tests/bufferobj.c359
-rw-r--r--progs/tests/bug_3050.c162
-rw-r--r--progs/tests/bug_3101.c128
-rw-r--r--progs/tests/bug_3195.c275
-rw-r--r--progs/tests/copypixrate.c259
-rw-r--r--progs/tests/crossbar.c235
-rw-r--r--progs/tests/cva.c164
-rw-r--r--progs/tests/debugger.c733
-rw-r--r--progs/tests/descrip.mms84
-rw-r--r--progs/tests/dinoshade.c914
-rw-r--r--progs/tests/ext422square.c258
-rw-r--r--progs/tests/fbotest1.c204
-rw-r--r--progs/tests/fbotest2.c199
-rw-r--r--progs/tests/fbotexture.c404
-rw-r--r--progs/tests/floattex.c169
-rw-r--r--progs/tests/fog.c199
-rw-r--r--progs/tests/fogcoord.c102
-rw-r--r--progs/tests/fptest1.c225
-rw-r--r--progs/tests/fptexture.c151
-rw-r--r--progs/tests/getprocaddress.c438
-rw-r--r--progs/tests/getprocaddress.py93
-rw-r--r--progs/tests/interleave.c406
-rw-r--r--progs/tests/invert.c195
-rw-r--r--progs/tests/jkrahntest.c181
-rw-r--r--progs/tests/manytex.c382
-rw-r--r--progs/tests/mipmap_limits.c233
-rw-r--r--progs/tests/multipal.c377
-rw-r--r--progs/tests/multitexarray.c238
-rw-r--r--progs/tests/multiwindow.c169
-rw-r--r--progs/tests/no_s3tc.c97
-rw-r--r--progs/tests/packedpixels.c342
-rw-r--r--progs/tests/pbo.c296
-rw-r--r--progs/tests/projtex.c1028
-rw-r--r--progs/tests/readrate.c285
-rw-r--r--progs/tests/seccolor.c145
-rw-r--r--progs/tests/sharedtex.c438
-rw-r--r--progs/tests/stencil_wrap.c257
-rw-r--r--progs/tests/stencilwrap.c281
-rw-r--r--progs/tests/subtexrate.c350
-rw-r--r--progs/tests/tex1d.c139
-rw-r--r--progs/tests/texcmp.c414
-rw-r--r--progs/tests/texcompress2.c273
-rw-r--r--progs/tests/texfilt.c398
-rw-r--r--progs/tests/texgenmix.c640
-rw-r--r--progs/tests/texline.c269
-rw-r--r--progs/tests/texobjshare.c219
-rw-r--r--progs/tests/texrect.c360
-rw-r--r--progs/tests/texwrap.c304
-rw-r--r--progs/tests/vparray.c294
-rw-r--r--progs/tests/vpeval.c231
-rw-r--r--progs/tests/vptest1.c170
-rw-r--r--progs/tests/vptest2.c151
-rw-r--r--progs/tests/vptest3.c120
-rw-r--r--progs/tests/vptorus.c174
-rw-r--r--progs/tests/vpwarpmesh.c236
-rw-r--r--progs/tests/yuvrect.c193
-rw-r--r--progs/tests/yuvsquare.c232
-rw-r--r--progs/tests/zreaddraw.c116
-rw-r--r--progs/util/descrip.mms42
-rw-r--r--progs/util/imagesgi.cpp369
-rw-r--r--progs/vp/Makefile53
-rw-r--r--progs/vp/abs.txt7
-rw-r--r--progs/vp/add.txt6
-rw-r--r--progs/vp/arl.txt9
-rw-r--r--progs/vp/dp3.txt5
-rw-r--r--progs/vp/dp4.txt5
-rw-r--r--progs/vp/dph.txt5
-rw-r--r--progs/vp/dst.txt5
-rw-r--r--progs/vp/ex2.txt6
-rw-r--r--progs/vp/flr.txt6
-rw-r--r--progs/vp/frc.txt6
-rw-r--r--progs/vp/lg2.txt6
-rw-r--r--progs/vp/lit.txt6
-rw-r--r--progs/vp/mad.txt5
-rw-r--r--progs/vp/max.txt5
-rw-r--r--progs/vp/min.txt5
-rw-r--r--progs/vp/mov.txt5
-rw-r--r--progs/vp/mul.txt5
-rw-r--r--progs/vp/pow.txt5
-rw-r--r--progs/vp/rcp.txt7
-rw-r--r--progs/vp/rsq.txt7
-rw-r--r--progs/vp/sge.txt5
-rw-r--r--progs/vp/slt.txt5
-rw-r--r--progs/vp/sub.txt5
-rw-r--r--progs/vp/swz.txt5
-rw-r--r--progs/vp/swz2.txt5
-rw-r--r--progs/vp/vp-tris.c216
-rw-r--r--progs/vp/xpd.txt5
-rw-r--r--progs/xdemos/.cvsignore16
-rw-r--r--src/egl/Makefile24
-rw-r--r--src/egl/docs/EGL_MESA_screen_surface578
-rw-r--r--src/egl/drivers/demo/Makefile31
-rw-r--r--src/egl/drivers/demo/demo.c316
-rw-r--r--src/egl/drivers/dri/Makefile64
-rw-r--r--src/egl/drivers/dri/egldri.c1138
-rw-r--r--src/egl/drivers/dri/egldri.h113
-rw-r--r--src/egl/main/Makefile66
-rw-r--r--src/egl/main/eglapi.c586
-rw-r--r--src/egl/main/eglapi.h119
-rw-r--r--src/egl/main/eglconfig.c638
-rw-r--r--src/egl/main/eglconfig.h67
-rw-r--r--src/egl/main/eglcontext.c276
-rw-r--r--src/egl/main/eglcontext.h71
-rw-r--r--src/egl/main/egldisplay.c71
-rw-r--r--src/egl/main/egldisplay.h44
-rw-r--r--src/egl/main/egldriver.c272
-rw-r--r--src/egl/main/egldriver.h81
-rw-r--r--src/egl/main/eglglobals.c148
-rw-r--r--src/egl/main/eglglobals.h68
-rw-r--r--src/egl/main/eglhash.c347
-rw-r--r--src/egl/main/eglhash.h39
-rw-r--r--src/egl/main/egllog.c57
-rw-r--r--src/egl/main/egllog.h16
-rw-r--r--src/egl/main/eglmode.c431
-rw-r--r--src/egl/main/eglmode.h54
-rw-r--r--src/egl/main/eglscreen.c328
-rw-r--r--src/egl/main/eglscreen.h90
-rw-r--r--src/egl/main/eglsurface.c530
-rw-r--r--src/egl/main/eglsurface.h117
-rw-r--r--src/egl/main/egltypedefs.h34
-rw-r--r--src/glu/mesa/Makefile56
-rw-r--r--src/glu/mesa/Makefile.DJ100
-rw-r--r--src/glu/mesa/Makefile.m3263
-rw-r--r--src/glu/mesa/Makefile.ugl96
-rw-r--r--src/glu/mesa/MesaGLU.def62
-rw-r--r--src/glu/mesa/README1195
-rw-r--r--src/glu/mesa/README243
-rw-r--r--src/glu/mesa/all.h54
-rw-r--r--src/glu/mesa/descrip.mms61
-rw-r--r--src/glu/mesa/glu.c416
-rw-r--r--src/glu/mesa/gluP.h97
-rw-r--r--src/glu/mesa/mipmap.c824
-rw-r--r--src/glu/mesa/mms_depend15
-rw-r--r--src/glu/mesa/nurbs.c628
-rw-r--r--src/glu/mesa/nurbs.h252
-rw-r--r--src/glu/mesa/nurbscrv.c444
-rw-r--r--src/glu/mesa/nurbssrf.c1317
-rw-r--r--src/glu/mesa/nurbsutl.c1309
-rw-r--r--src/glu/mesa/polytest.c937
-rw-r--r--src/glu/mesa/project.c401
-rw-r--r--src/glu/mesa/quadric.c819
-rw-r--r--src/glu/mesa/tess.c327
-rw-r--r--src/glu/mesa/tess.h107
-rw-r--r--src/glu/mesa/tesselat.c406
-rw-r--r--src/glu/mini/all.h55
-rw-r--r--src/glu/mini/glu.c417
-rw-r--r--src/glu/mini/gluP.h142
-rw-r--r--src/glu/mini/mipmap.c764
-rw-r--r--src/glu/mini/nurbs.c158
-rw-r--r--src/glu/mini/nurbs.h253
-rw-r--r--src/glu/mini/nurbscrv.c133
-rw-r--r--src/glu/mini/polytest.c938
-rw-r--r--src/glu/mini/project.c402
-rw-r--r--src/glu/mini/quadric.c774
-rw-r--r--src/glu/mini/tess.c328
-rw-r--r--src/glu/mini/tess.h108
-rw-r--r--src/glu/mini/tesselat.c407
-rw-r--r--src/glut/mini/Makefile80
-rw-r--r--src/glx/mini/Makefile82
-rw-r--r--src/glx/mini/NOTES115
-rw-r--r--src/glx/mini/dispatch.c64
-rw-r--r--src/glx/mini/driver.h170
-rw-r--r--src/glx/mini/example.miniglx.conf36
-rw-r--r--src/glx/mini/miniglx.c2567
-rw-r--r--src/glx/mini/miniglxP.h205
-rw-r--r--src/glx/mini/miniglx_events.c984
-rw-r--r--src/glx/x11/glxext.c2
-rw-r--r--src/mesa/drivers/allegro/amesa.c404
-rw-r--r--src/mesa/drivers/allegro/direct.h189
-rw-r--r--src/mesa/drivers/allegro/generic.h234
-rw-r--r--src/mesa/drivers/d3d/D3DCAPS.CPP250
-rw-r--r--src/mesa/drivers/d3d/D3DHAL.H68
-rw-r--r--src/mesa/drivers/d3d/D3DInit.cpp891
-rw-r--r--src/mesa/drivers/d3d/D3DMESA.H84
-rw-r--r--src/mesa/drivers/d3d/D3DRaster.cpp213
-rw-r--r--src/mesa/drivers/d3d/D3DShared.h154
-rw-r--r--src/mesa/drivers/d3d/D3DTEXT.CPP576
-rw-r--r--src/mesa/drivers/d3d/D3DTextureMgr.cpp947
-rw-r--r--src/mesa/drivers/d3d/D3DTextureMgr.h62
-rw-r--r--src/mesa/drivers/d3d/D3DUTILS.CPP638
-rw-r--r--src/mesa/drivers/d3d/D3Dvbrender.c2149
-rw-r--r--src/mesa/drivers/d3d/DDrawPROCS.c399
-rw-r--r--src/mesa/drivers/d3d/DEBUG.C143
-rw-r--r--src/mesa/drivers/d3d/DEBUG.H90
-rw-r--r--src/mesa/drivers/d3d/DbgEnv.bat25
-rw-r--r--src/mesa/drivers/d3d/MAKEFILE101
-rw-r--r--src/mesa/drivers/d3d/NULLProcs.h49
-rw-r--r--src/mesa/drivers/d3d/NullProcs.c49
-rw-r--r--src/mesa/drivers/d3d/OPENGL32.DEF442
-rw-r--r--src/mesa/drivers/d3d/WGL.C1262
-rw-r--r--src/mesa/drivers/d3d/d3dText.h53
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/Makefile96
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py191
-rw-r--r--src/mesa/drivers/dri/dri_client/Makefile60
-rw-r--r--src/mesa/drivers/dri/dri_client/imports/xf86drm.h636
-rw-r--r--src/mesa/drivers/dri/dri_client/xf86drm.c2333
-rw-r--r--src/mesa/drivers/dri/dri_client/xf86drmHash.c433
-rw-r--r--src/mesa/drivers/dri/dri_client/xf86drmRandom.c217
-rw-r--r--src/mesa/drivers/dri/dri_client/xf86drmSL.c488
-rw-r--r--src/mesa/drivers/dri/i915-tex/Makefile78
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_context.c120
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_context.h217
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_metaops.c910
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_reg.h641
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_state.c1101
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_tex.c106
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_texblend.c465
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_texstate.c321
-rw-r--r--src/mesa/drivers/dri/i915-tex/i830_vtbl.c585
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_context.c184
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_context.h373
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_debug.c299
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_fragprog.c1066
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_metaops.c889
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_program.c486
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_program.h163
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_reg.h839
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_state.c1006
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_tex.c122
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_tex_layout.c338
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_texprog.c670
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_texstate.c354
-rw-r--r--src/mesa/drivers/dri/i915-tex/i915_vtbl.c572
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_batchbuffer.c759
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_batchbuffer.h137
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_blit.c437
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_blit.h60
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_buffer_objects.c201
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_buffer_objects.h70
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_buffers.c730
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_buffers.h58
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_bufmgr.c444
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_bufmgr.h132
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_context.c843
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_context.h615
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_depthstencil.c281
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_depthstencil.h13
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_fbo.c638
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_fbo.h75
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_ioctl.c529
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_ioctl.h82
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.c300
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.h183
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_pixel.c511
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_pixel.h64
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_pixel_copy.c346
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_pixel_draw.c358
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_pixel_read.c315
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_reg.h84
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_regions.c264
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_regions.h119
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_render.c248
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_rotate.c221
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_rotate.h41
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_screen.c756
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_screen.h123
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_span.c401
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_span.h39
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_state.c404
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex.c298
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex.h139
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex_copy.c296
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex_format.c148
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex_image.c440
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex_subimage.c178
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tex_validate.c247
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_texmem.c72
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tris.c1057
-rw-r--r--src/mesa/drivers/dri/i915-tex/intel_tris.h63
-rw-r--r--src/mesa/drivers/dri/i915-tex/server/i830_common.h197
-rw-r--r--src/mesa/drivers/dri/i915-tex/server/i830_dri.h73
-rw-r--r--src/mesa/drivers/dri/mga/README26
-rw-r--r--src/mesa/drivers/dri/r300/pixel_shader.h103
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_swz.c1328
-rw-r--r--src/mesa/drivers/dri/tdfx/BUGS64
-rw-r--r--src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S84
-rw-r--r--src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h314
-rw-r--r--src/mesa/drivers/ggi/default/.cvsignore1
-rw-r--r--src/mesa/drivers/ggi/default/genkgi.h76
-rw-r--r--src/mesa/drivers/ggi/display/.cvsignore1
-rw-r--r--src/mesa/drivers/windows/fx/fx.rc39
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c1196
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h292
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h77
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c346
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c77
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c1448
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c2196
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c257
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c423
-rw-r--r--src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c1611
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c1176
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h324
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h77
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c344
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c77
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c1446
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c2046
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c249
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c449
-rw-r--r--src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c1335
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c1206
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h327
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h77
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c344
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c77
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c1446
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c2104
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c263
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c444
-rw-r--r--src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c1345
-rw-r--r--src/mesa/drivers/windows/gldirect/gldirect.rc43
-rw-r--r--src/mesa/drivers/windows/gldirect/mesasw/colors.h523
-rw-r--r--src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c1719
-rw-r--r--src/mesa/drivers/windows/gldirect/opengl32.ref495
-rw-r--r--src/mesa/glapi/.cvsignore11
-rw-r--r--src/mesa/glapi/EXT_framebuffer_object.xml188
-rw-r--r--src/mesa/glapi/Makefile102
-rw-r--r--src/mesa/glapi/extension_helper.py316
-rw-r--r--src/mesa/glapi/glX_XML.py531
-rw-r--r--src/mesa/glapi/glX_doc.py280
-rw-r--r--src/mesa/glapi/glX_proto_common.py95
-rw-r--r--src/mesa/glapi/glX_proto_recv.py563
-rw-r--r--src/mesa/glapi/glX_proto_send.py1044
-rw-r--r--src/mesa/glapi/glX_proto_size.py707
-rw-r--r--src/mesa/glapi/gl_API.dtd134
-rw-r--r--src/mesa/glapi/gl_API.xml11520
-rw-r--r--src/mesa/glapi/gl_SPARC_asm.py135
-rw-r--r--src/mesa/glapi/gl_XML.py813
-rw-r--r--src/mesa/glapi/gl_apitemp.py216
-rw-r--r--src/mesa/glapi/gl_enums.py217
-rw-r--r--src/mesa/glapi/gl_offsets.py105
-rw-r--r--src/mesa/glapi/gl_procs.py155
-rw-r--r--src/mesa/glapi/gl_table.py194
-rw-r--r--src/mesa/glapi/gl_x86-64_asm.py320
-rw-r--r--src/mesa/glapi/gl_x86_asm.py244
-rw-r--r--src/mesa/glapi/license.py47
-rw-r--r--src/mesa/glapi/mesadef.py223
-rwxr-xr-xsrc/mesa/glapi/next_available_offset.sh39
-rw-r--r--src/mesa/glapi/typeexpr.py292
-rw-r--r--src/mesa/main/Imakefile129
-rw-r--r--src/mesa/main/KNOWN_BUGS21
-rw-r--r--src/mesa/main/Makefile.ugl364
-rw-r--r--src/mesa/main/Makefile.win208
-rw-r--r--src/mesa/main/get_gen.py1194
-rw-r--r--src/mesa/shader/arbprogram.syn2786
-rw-r--r--src/mesa/shader/asmopcodes.reg78
-rw-r--r--src/mesa/shader/grammar/grammar.syn567
-rwxr-xr-xsrc/mesa/shader/slang/Include/BaseTypes.h133
-rwxr-xr-xsrc/mesa/shader/slang/Include/Common.h288
-rwxr-xr-xsrc/mesa/shader/slang/Include/ConstantUnion.h50
-rwxr-xr-xsrc/mesa/shader/slang/Include/InfoSink.h135
-rwxr-xr-xsrc/mesa/shader/slang/Include/InitializeGlobals.h43
-rwxr-xr-xsrc/mesa/shader/slang/Include/InitializeParseContext.h44
-rwxr-xr-xsrc/mesa/shader/slang/Include/PoolAlloc.h346
-rwxr-xr-xsrc/mesa/shader/slang/Include/ResourceLimits.h61
-rwxr-xr-xsrc/mesa/shader/slang/Include/ShHandle.h177
-rwxr-xr-xsrc/mesa/shader/slang/Include/Types.h297
-rwxr-xr-xsrc/mesa/shader/slang/Include/intermediate.h516
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp2942
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/Gen_glslang_tab.cpp4354
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/InfoSink.cpp107
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/Initialize.cpp948
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/Initialize.h58
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/IntermTraverse.cpp243
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/Intermediate.cpp2110
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/MMap.h84
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/ParseHelper.cpp1452
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/ParseHelper.h143
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/PoolAlloc.cpp349
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/QualifierAlive.cpp91
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/QualifierAlive.h35
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/RemoveTree.cpp98
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/RemoveTree.h35
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/ShaderLang.cpp607
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/SymbolTable.cpp235
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/SymbolTable.h320
-rw-r--r--src/mesa/shader/slang/MachineIndependent/glslang.l614
-rw-r--r--src/mesa/shader/slang/MachineIndependent/glslang.y2009
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/glslang_tab.h260
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/intermOut.cpp496
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/localintermediate.h91
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/parseConst.cpp344
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/atom.c768
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/atom.h96
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/compile.h132
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/cpp.c1037
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/cpp.h119
-rw-r--r--src/mesa/shader/slang/MachineIndependent/preprocessor/cpp_comment_fix.c76
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/cppstruct.c185
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/memory.c191
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/memory.h89
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/parser.h126
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/preprocess.h84
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/scanner.c789
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/scanner.h118
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/slglobals.h115
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/symbols.c318
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/symbols.h145
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/tokens.c462
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/preprocessor/tokens.h122
-rwxr-xr-xsrc/mesa/shader/slang/MachineIndependent/unistd.h1
-rwxr-xr-xsrc/mesa/shader/slang/OGLCompilersDLL/Initialisation.cpp151
-rwxr-xr-xsrc/mesa/shader/slang/OGLCompilersDLL/Initialisation.h47
-rwxr-xr-xsrc/mesa/shader/slang/OSDependent/Linux/osinclude.h78
-rwxr-xr-xsrc/mesa/shader/slang/OSDependent/Linux/ossource.cpp140
-rwxr-xr-xsrc/mesa/shader/slang/OSDependent/Windows/osinclude.h68
-rwxr-xr-xsrc/mesa/shader/slang/OSDependent/Windows/ossource.cpp119
-rwxr-xr-xsrc/mesa/shader/slang/Public/ShaderLang.h212
-rwxr-xr-xsrc/mesa/shader/slang/Public/ShaderLangExt.h57
-rw-r--r--src/mesa/shader/slang/dummy.c12
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_common_builtin.gc1469
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_core.gc1679
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_fragment_builtin.gc172
-rw-r--r--src/mesa/shader/slang/library/slang_shader.syn1517
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_version.syn118
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_version_syn.h64
-rwxr-xr-xsrc/mesa/shader/slang/library/slang_vertex_builtin.gc128
-rw-r--r--src/mesa/shader/slang/slang_mesa.cpp144
-rw-r--r--src/mesa/swrast/NOTES55
-rw-r--r--src/mesa/swrast/s_texsample.h700
-rw-r--r--src/mesa/swrast_setup/NOTES65
-rw-r--r--src/mesa/tnl/NOTES102
-rw-r--r--src/mesa/x86-64/calling_convention.txt50
607 files changed, 31 insertions, 192298 deletions
diff --git a/bin/installmesa b/bin/installmesa
deleted file mode 100755
index fb68047af8c..00000000000
--- a/bin/installmesa
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-
-#
-# Simple shell script for installing Mesa's header and library files.
-# If the copy commands below don't work on a particular system (i.e. the
-# -f or -d flags), we may need to branch on `uname` to do the right thing.
-#
-
-
-TOP=.
-
-INCLUDE_DIR="/usr/local/include"
-LIB_DIR="/usr/local/lib"
-
-if [ "x$#" = "x0" ] ; then
-echo
-echo "***** Mesa installation - You may need root privileges to do this *****"
-echo
-echo "Default directory for header files is:" ${INCLUDE_DIR}
-echo "Enter new directory or press <Enter> to accept this default."
-
-read INPUT
-if [ "x${INPUT}" != "x" ] ; then
- INCLUDE_DIR=${INPUT}
-fi
-
-echo
-echo "Default directory for library files is:" ${LIB_DIR}
-echo "Enter new directory or press <Enter> to accept this default."
-
-read INPUT
-if [ "x${INPUT}" != "x" ] ; then
- LIB_DIR=${INPUT}
-fi
-
-echo
-echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL
-echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR}
-echo "Press <Enter> to continue, or <ctrl>-C to abort."
-
-read INPUT
-
-else
-INCLUDE_DIR=$1/include
-LIB_DIR=$1/lib
-fi
-
-# flags:
-# -f = force
-# -d = preserve symlinks (does not work on BSD)
-
-if [ `uname` = "FreeBSD" ] ; then
- CP_FLAGS="-f"
-elif [ `uname` = "Darwin" ] ; then
- CP_FLAGS="-f"
-elif [ `uname` = "AIX" ] ; then
- CP_FLAGS="-fh"
-else
- CP_FLAGS="-fd"
-fi
-
-
-set -v
-
-mkdir ${INCLUDE_DIR}
-mkdir ${INCLUDE_DIR}/GL
-mkdir ${INCLUDE_DIR}/GLES
-mkdir ${LIB_DIR}
-cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL
-cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL
-# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES
-cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR}
-
-echo "Done."
diff --git a/configs/debian b/configs/debian
index 4f668ea2439..793fb606852 100644
--- a/configs/debian
+++ b/configs/debian
@@ -7,7 +7,7 @@ CXX = c++
DEBIAN_COMMON_CPPFLAGS = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DUSE_XSHM -DPTHREADS `pkg-config --cflags x11 xext`
-DEBIAN_COMMON_CFLAGS = -ansi -pedantic -Wall -fPIC -std=c99
+DEBIAN_COMMON_CFLAGS = -std=c99 -pedantic -Wall -fPIC
DEBIAN_COMMON_CXXFLAGS = -ansi -pedantic -Wall -fPIC
diff --git a/configs/debian-debug-i386 b/configs/debian-debug-i386
deleted file mode 100644
index b9e0eebbd3f..00000000000
--- a/configs/debian-debug-i386
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(TOP)/configs/debian-debug
-
-CONFIG_NAME = debian-debug-i386
-
-DEBIAN_OPT_CFLAGS = -march=i686 -msse -mfpmath=sse -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
-
-ASM_SOURCES = $(X86_SOURCES) $(X86_API)
diff --git a/configs/debian-debug_i386 b/configs/debian-debug_i386
index b9e0eebbd3f..67f19ccf30a 100644
--- a/configs/debian-debug_i386
+++ b/configs/debian-debug_i386
@@ -2,6 +2,6 @@ include $(TOP)/configs/debian-debug
CONFIG_NAME = debian-debug-i386
-DEBIAN_OPT_CFLAGS = -march=i686 -msse -mfpmath=sse -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
+DEBIAN_OPT_CFLAGS = -march=i686 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
diff --git a/configs/debian-dri b/configs/debian-dri
index 519f20d4b83..c024d236e36 100644
--- a/configs/debian-dri
+++ b/configs/debian-dri
@@ -31,11 +31,15 @@ WINDOW_SYSTEM=dri
DRI_DIRS = mach64 mga r128 r200 r300 radeon s3v savage tdfx trident
ifeq ($(DEB_HOST_ARCH),i386)
-DRI_DIRS += i810 i915 sis ffb unichrome
+DRI_DIRS += i810 i915 i965 sis unichrome
endif
ifeq ($(DEB_HOST_ARCH),amd64)
-DRI_DIRS += i915
+DRI_DIRS += i915 i965 unichrome
+endif
+
+ifeq ($(DEB_HOST_ARCH),sparc)
+DRI_DIRS += ffb
endif
endif # DRI or debian-indirect
diff --git a/configs/debian-dri-amd64 b/configs/debian-dri-amd64
deleted file mode 100644
index e2cf49695a0..00000000000
--- a/configs/debian-dri-amd64
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(TOP)/configs/debian-dri
-
-CONFIG_NAME = debian-dri-amd64
-
-DRI_DIRS = i915 mach64 mga r128 r200 r300 radeon savage tdfx unichrome
diff --git a/configs/debian-dri-i386 b/configs/debian-dri-i386
deleted file mode 100644
index 1079660adda..00000000000
--- a/configs/debian-dri-i386
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(TOP)/configs/debian_i386
-include $(TOP)/configs/debian-dri
-
-CONFIG_NAME = debian-dri-i386
diff --git a/configs/debian-dri-powerpc b/configs/debian-dri-powerpc
deleted file mode 100644
index 9b6cdad4297..00000000000
--- a/configs/debian-dri-powerpc
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(TOP)/configs/debian-dri
-
-CONFIG_NAME = debian-dri-powerpc
-
-DRI_DIRS = mach64 r128 r200 r300 radeon tdfx
diff --git a/configs/debian-glide-i386 b/configs/debian-glide-i386
deleted file mode 100644
index dd0ab727a63..00000000000
--- a/configs/debian-glide-i386
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(TOP)/configs/debian-i386
-
-CONFIG_NAME = debian-glide-i386
-
-DEBIAN_COMMON_CPPFLAGS += -DFX -I/usr/include/glide3
-
-GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lglide3x -lm -lpthread
diff --git a/configs/debian-glide_i386 b/configs/debian-glide_i386
index dd0ab727a63..eb323c63368 100644
--- a/configs/debian-glide_i386
+++ b/configs/debian-glide_i386
@@ -1,4 +1,4 @@
-include $(TOP)/configs/debian-i386
+include $(TOP)/configs/debian_i386
CONFIG_NAME = debian-glide-i386
diff --git a/configs/debian-i386 b/configs/debian-i386
deleted file mode 100644
index a4a7e68fa78..00000000000
--- a/configs/debian-i386
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(TOP)/configs/debian
-
-CONFIG_NAME = debian-i386
-
-override DEBIAN_OPT_CFLAGS = -O3 -march=i686 -msse -mfpmath=387 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
-
-ASM_SOURCES = $(X86_SOURCES) $(X86_API)
diff --git a/configs/debian-static b/configs/debian-static
index bc300d5b7e1..0b5318e53a8 100644
--- a/configs/debian-static
+++ b/configs/debian-static
@@ -7,7 +7,7 @@ CXX = c++
DEBIAN_COMMON_CPPFLAGS = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
-DEBIAN_COMMON_CFLAGS = -ansi -pedantic -Wall
+DEBIAN_COMMON_CFLAGS = -std=c99 -pedantic -Wall
DEBIAN_COMMON_CXXFLAGS = -ansi -pedantic -Wall
diff --git a/configs/debian-static-i386 b/configs/debian-static-i386
deleted file mode 100644
index 4f1ae52f944..00000000000
--- a/configs/debian-static-i386
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(TOP)/configs/debian-static
-
-CONFIG_NAME = debian-static-i386
-
-DEBIAN_OPT_CFLAGS = -O3 -march=i686 -msse -mfpmath=sse -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
-
-ASM_SOURCES = $(X86_SOURCES) $(X86_API)
diff --git a/configs/debian-static_i386 b/configs/debian-static_i386
index 4f1ae52f944..df86c83cc4d 100644
--- a/configs/debian-static_i386
+++ b/configs/debian-static_i386
@@ -2,6 +2,6 @@ include $(TOP)/configs/debian-static
CONFIG_NAME = debian-static-i386
-DEBIAN_OPT_CFLAGS = -O3 -march=i686 -msse -mfpmath=sse -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
+DEBIAN_OPT_CFLAGS = -O3 -march=i686 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
diff --git a/configs/debian_i386 b/configs/debian_i386
index 2865617a520..1def21d39f0 100644
--- a/configs/debian_i386
+++ b/configs/debian_i386
@@ -2,6 +2,6 @@ include $(TOP)/configs/debian
CONFIG_NAME = debian-i386
-DEBIAN_OPT_CFLAGS = -O3 -march=i686 -msse -mfpmath=387 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
+DEBIAN_OPT_CFLAGS = -O3 -march=i686 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES) $(X86_API)
diff --git a/debian/changelog b/debian/changelog
index aaa7c6e14f9..7473aee54a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+mesa (6.5.1-0.2) unstable; urgency=low
+
+ * Non-maintainer upload
+ * Disable generation of SSE instructions (closes: #390560)
+ * Remove duplicate and unused build configurations
+ * Remove extra source files left from CVS snapshots (closes: #389283)
+ * Enable i965 DRI driver on i386 and amd64. Thanks to Ryan Richter
+ for the patch. (closes: #392030)
+ * Enable Unichrome DRI driver on amd64 (closes: #391900)
+ * Enable FFB DRI driver on sparc, not i386 (closes: #388025)
+ * Consistently compile C sources as C99 (closes: #373623)
+ * Fix X display locking error in GLX. Thanks to Josh Triplett for
+ the patch. (closes: #391681)
+
+ -- Ben Hutchings <ben@decadent.org.uk> Fri, 13 Oct 2006 02:25:52 +0100
+
mesa (6.5.1-0.1) unstable; urgency=low
* New upstream version
diff --git a/debian/mesa-swx11-source.install b/debian/mesa-swx11-source.install
deleted file mode 100644
index 07d66134eaf..00000000000
--- a/debian/mesa-swx11-source.install
+++ /dev/null
@@ -1,469 +0,0 @@
-src/mesa/drivers/dri/glcore/glcore_driver.c usr/share/mesa-source/src/mesa/drivers/dri/glcore
-src/mesa/drivers/dri/common/xmlconfig.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/depthtmp.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/spantmp.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/stenciltmp.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/xmlconfig.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/extension_helper.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/dri_util.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/drirenderbuffer.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/vblank.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/vblank.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/dri_util.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/spantmp2.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/mmio.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/mmx.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/utils.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/memops.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/texmem.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/glcontextmodes.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/utils.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/glcontextmodes.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/spantmp_common.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/drirenderbuffer.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/texmem.c usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/xmlpool.h usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/xmlpool usr/share/mesa-source/src/mesa/drivers/dri/common
-src/mesa/drivers/dri/common/xmlpool/nl.po usr/share/mesa-source/src/mesa/drivers/dri/common/xmlpool
-src/mesa/drivers/dri/common/xmlpool/de.po usr/share/mesa-source/src/mesa/drivers/dri/common/xmlpool
-src/mesa/drivers/dri/common/xmlpool/t_options.h usr/share/mesa-source/src/mesa/drivers/dri/common/xmlpool
-src/mesa/drivers/dri/common/xmlpool/fr.po usr/share/mesa-source/src/mesa/drivers/dri/common/xmlpool
-src/mesa/drivers/dri/common/xmlpool/es.po usr/share/mesa-source/src/mesa/drivers/dri/common/xmlpool
-src/mesa/drivers/dri/common/xmlpool/options.h usr/share/mesa-source/src/mesa/drivers/dri/common/xmlpool
-src/mesa/drivers/x11/xm_dd.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xm_line.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/glxapi.h usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xfonts.h usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/glxapi.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/fakeglx.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xfonts.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xm_api.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xm_buffer.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/glxheader.h usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xm_span.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/realglx.h usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xm_tri.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/xmesaP.h usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/x11/realglx.c usr/share/mesa-source/src/mesa/drivers/x11
-src/mesa/drivers/common/driverfuncs.c usr/share/mesa-source/src/mesa/drivers/common
-src/mesa/drivers/common/driverfuncs.h usr/share/mesa-source/src/mesa/drivers/common
-src/mesa/shader/arbprogparse.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/arbprogram.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/programopt.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/arbprogram_syn.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvvertexec.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/arbprogparse.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/shaderobjects.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvvertparse.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvfragparse.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/shaderobjects.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvprogram.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvvertparse.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvfragparse.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/shaderobjects_3dlabs.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/program_instruction.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/program.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvprogram.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/shaderobjects_3dlabs.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/program.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/atifragshader.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/arbprogram.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/nvvertexec.h usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/atifragshader.c usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/slang usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/slang/slang_storage.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_utility.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_typeinfo.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_execute.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/traverse_wrap.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_storage.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_utility.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_function.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_execute.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_analyse.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_function.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_analyse.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_library_texsample.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_assignment.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_library_texsample.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_export.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_assignment.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_export.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_operation.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_operation.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_execute_x86.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_library_noise.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_constructor.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_link.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_variable.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_struct.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_library_noise.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_constructor.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_link.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_variable.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_compile_struct.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_preprocess.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_mesa.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_preprocess.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_conditional.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_conditional.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/slang_assemble_typeinfo.h usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/dummy.c usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/library usr/share/mesa-source/src/mesa/shader/slang
-src/mesa/shader/slang/library/slang_fragment_builtin_gc.h usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/slang/library/slang_core_gc.h usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/slang/library/slang_shader_syn.h usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/slang/library/slang_version_syn.h usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/slang/library/slang_vertex_builtin_gc.h usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/slang/library/gc_to_bin.c usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/slang/library/slang_common_builtin_gc.h usr/share/mesa-source/src/mesa/shader/slang/library
-src/mesa/shader/grammar usr/share/mesa-source/src/mesa/shader
-src/mesa/shader/grammar/grammar_mesa.c usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/shader/grammar/grammar.h usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/shader/grammar/grammar.c usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/shader/grammar/grammar_syn.h usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/shader/grammar/grammar_crt.h usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/shader/grammar/grammar_mesa.h usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/shader/grammar/grammar_crt.c usr/share/mesa-source/src/mesa/shader/grammar
-src/mesa/tnl_dd usr/share/mesa-source/src/mesa
-src/mesa/tnl_dd/t_dd_vertex.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_triemit.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd.c usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_vbtmp.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_dmatmp2.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_vb.c usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_unfilled.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_dmatmp.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_rendertmp.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/t_dd_tritmp.h usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/imm usr/share/mesa-source/src/mesa/tnl_dd
-src/mesa/tnl_dd/imm/t_dd_imm_capi.h usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/t_dd_imm_vbtmp.h usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/t_dd_imm_napi.h usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/NOTES.imm usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/t_dd_imm_vb.c usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/t_dd_imm_vapi.h usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/t_dd_imm_tapi.h usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/tnl_dd/imm/t_dd_imm_primtmp.h usr/share/mesa-source/src/mesa/tnl_dd/imm
-src/mesa/swrast_setup usr/share/mesa-source/src/mesa
-src/mesa/swrast_setup/ss_triangle.c usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/swrast_setup/ss_tritmp.h usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/swrast_setup/ss_context.c usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/swrast_setup/swrast_setup.h usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/swrast_setup/ss_vb.h usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/swrast_setup/ss_context.h usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/swrast_setup/ss_triangle.h usr/share/mesa-source/src/mesa/swrast_setup
-src/mesa/array_cache usr/share/mesa-source/src/mesa
-src/mesa/array_cache/ac_import.c usr/share/mesa-source/src/mesa/array_cache
-src/mesa/array_cache/ac_context.h usr/share/mesa-source/src/mesa/array_cache
-src/mesa/array_cache/acache.h usr/share/mesa-source/src/mesa/array_cache
-src/mesa/array_cache/ac_context.c usr/share/mesa-source/src/mesa/array_cache
-src/mesa/tnl usr/share/mesa-source/src/mesa
-src/mesa/tnl/t_pipeline.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vp_build.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_array_api.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_pipeline.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vp_build.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_vertex.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_points.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_normals.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_light.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_program.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_save_api.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_context.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_texmat.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_save_api.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_context.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_lighttmp.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vertex.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_texgen.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/tnl.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_api.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_generic.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_array_import.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vertex.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_api.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vertex_generic.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_save_loopback.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_array_import.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_render.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_save_playback.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_cliptmp.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_fog.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_rendertmp.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_eval.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_arbprogram.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_arbprogram_sse.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_x86.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_cull.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_exec.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vertex_sse.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vtx_x86_gcc.S usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_arbshader.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_array_api.h usr/share/mesa-source/src/mesa/tnl
-src/mesa/tnl/t_vb_arbprogram.c usr/share/mesa-source/src/mesa/tnl
-src/mesa/glapi usr/share/mesa-source/src/mesa
-src/mesa/glapi/glapi.c usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glthread.c usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glapitable.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glapitemp.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/dispatch.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glapi.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glthread.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glprocs.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/glapi/glapioffsets.h usr/share/mesa-source/src/mesa/glapi
-src/mesa/math usr/share/mesa-source/src/mesa
-src/mesa/math/m_debug_norm.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_xform_tmp.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_clip_tmp.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_trans_tmp.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_matrix.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_vector.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_matrix.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_vector.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_translate.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_debug_xform.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_xform.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_dotprod_tmp.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_norm_tmp.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_copy_tmp.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_debug_clip.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_eval.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_xform.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_debug.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_translate.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_eval.c usr/share/mesa-source/src/mesa/math
-src/mesa/math/mathmod.h usr/share/mesa-source/src/mesa/math
-src/mesa/math/m_debug_util.h usr/share/mesa-source/src/mesa/math
-src/mesa/main/histogram.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/eval.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/enable.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/context.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/eval.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/pixel.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/enable.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/state.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/context.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/get.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/execmem.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/pixel.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/state.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/fog.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/get.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texformat.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/fog.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/colortab.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texformat.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/matrix.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/teximage.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/getstring.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texrender.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/colortab.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/matrix.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/teximage.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/imports.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/buffers.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texrender.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texobj.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/rastpos.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texformat_tmp.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/imports.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/buffers.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/rastpos.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/simple_list.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_eval.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/occlude.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/fbobject.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texcompress.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/occlude.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_arrayelt.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/fbobject.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texcompress.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_arrayelt.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/mm.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texobj.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_noop.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/hint.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texstate.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/varray.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_noop.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/hint.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texstate.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/convolve.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/polygon.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/clip.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/convolve.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/depthstencil.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/version.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/vsnprintf.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/macros.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/feedback.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_loopback.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/polygon.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/clip.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_validate.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/depthstencil.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/feedback.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_loopback.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/api_validate.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/glheader.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/lines.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/lines.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/bufferobj.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texcompress_s3tc.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/mm.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/varray.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/stencil.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/colormac.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/bufferobj.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/extensions.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texenvprogram.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/stencil.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texenvprogram.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/vtxfmt.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/extensions.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/enums.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/debug.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/attrib.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/blend.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/framebuffer.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/vtxfmt.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/hash.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/accum.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/image.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/enums.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/mtypes.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/debug.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/attrib.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/blend.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/dlist.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/framebuffer.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/drawpix.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/hash.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texstore.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/image.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/points.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/dlist.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/texcompress_fxt1.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/dd.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/accum.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/drawpix.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/vtxfmt_tmp.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/renderbuffer.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/points.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/light.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/config.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/texstore.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/depth.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/light.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/depth.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/histogram.h usr/share/mesa-source/src/mesa/main
-src/mesa/main/dispatch.c usr/share/mesa-source/src/mesa/main
-src/mesa/main/renderbuffer.c usr/share/mesa-source/src/mesa/main
-src/mesa/swrast usr/share/mesa-source/src/mesa
-src/mesa/swrast/s_nvfragprog.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_triangle.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_depth.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_texsample.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/swrast.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_span.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_triangle.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_depth.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_span.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_masking.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_readpix.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_copypix.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_zoom.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_tritemp.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_masking.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_context.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_feedback.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_zoom.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_pointtemp.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_aalinetemp.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_context.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_feedback.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_fog.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_lines.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_bitmap.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_aatriangle.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_fog.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_imaging.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_lines.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_texfilter.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_aatriangle.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_atifragshader.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_stencil.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_texfilter.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_texcombine.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_logic.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_stencil.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_arbshader.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_aaline.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_texcombine.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_logic.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_accum.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_spantemp.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_buffers.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_arbshader.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_atifragshader.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_alpha.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_blit.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_aaline.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_blend.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_accum.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_trispan.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_alpha.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_blend.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_drawpix.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_linetemp.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_points.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_aatritemp.h usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_drawpix.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_texstore.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_points.c usr/share/mesa-source/src/mesa/swrast
-src/mesa/swrast/s_nvfragprog.h usr/share/mesa-source/src/mesa/swrast
-src/glx/x11/indirect_vertex_array.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glx_texture_compression.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_init.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_vertex_program.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/eval.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/vertarr.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/packsingle.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_init.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/packrender.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/pixel.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glx_query.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glxextensions.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/single2.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glxextensions.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/singlepix.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/render2.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glxcmds.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/renderpix.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glx_pbuffer.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/xf86dri.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_size.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/pixelstore.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/glxclient.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/glcontextmodes.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_size.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/XF86dri.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/compsize.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/xf86dristr.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_va_private.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/clientattrib.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_transpose_matrix.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/dri_glx.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_window_pos.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/indirect_vertex_array.h usr/share/mesa-source/src/glx/x11
-src/glx/x11/glxext.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/dri_glx.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/xfont.c usr/share/mesa-source/src/glx/x11
-src/glx/x11/dispatch.c usr/share/mesa-source/src/glx/x11
diff --git a/debian/rules b/debian/rules
index 97beb4f9f9d..484e7c615d7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -155,7 +155,7 @@ binary-indep: debian/mesa-swx11-source.install build
@echo Target $@
dh_testdir
dh_testroot
- dh_installchangelogs docs/VERSIONS
+ dh_installchangelogs
dh_installdocs
dh_installdirs
# dh_installexamples
@@ -176,7 +176,7 @@ binary-arch: build install
@echo Target $@
dh_testdir -s
dh_testroot -s
- dh_installchangelogs -s docs/VERSIONS
+ dh_installchangelogs -s
dh_installdocs -s
# dh_installexamples -s
dh_install -s
diff --git a/docs/README.X11 b/docs/README.X11
deleted file mode 100644
index 4cbd1261817..00000000000
--- a/docs/README.X11
+++ /dev/null
@@ -1,314 +0,0 @@
-
- Mesa Unix/X11 Information
-
-
-
-Installation
-============
-
-There are two ways to compile Mesa on Unix/X11 systems:
-
-1. The old way:
- First type 'make' alone to see the list of system
- configurations currently supported. If you see your configuration on the
- list, type 'make <config>'. Most popular Unix/X workstations are currently
- supported.
-
- If your system configuration is not listed by 'make', you'll have to modify
- the top-level Makefile and Make-config files. There are instructions in
- each file.
-
- When finished, the Mesa libraries will be in the Mesa-x.y/lib/ directory.
-
-
-2. The new way:
- Type './configure' and then 'make'. This uses GNU autoconfig.
- Run 'make check' to build the demos.
- See docs/INSTALL for more details.
- When finished, the Mesa libraries will be in the Mesa-x.y/src/.libs/,
- Mesa-x.y/si-glu/.libs, etc directories.
-
-
-Notes on assembly language optimizations:
-
- When using the old-style Makefiles, you can specify a configuration
- that uses X86 assembly language optimizations (linux-3dnow for example).
-
- The detection of MMX, 3DNow!, PIII/SSE, etc capability is done at
- runtime. That means you can compile Mesa for 3DNow! optimizations
- even if you don't have an AMD CPU.
-
- However, your Linux binutils and assembler must understand the
- special instructions in order to compile them. If you have
- compilation problems, try upgrading your binutils.
-
-
-Header and library files:
- After you've compiled Mesa and tried the demos I recommend the following
- procedure for "installing" Mesa.
-
- Copy the Mesa include/GL directory to /usr/local/include:
- cp -r include/GL /usr/local/include
-
- Copy the Mesa library files to /usr/local/lib:
- cp lib/* /usr/local/lib
-
- (actually, use "cp -d" on Linux to preserve symbolic links)
-
-
-Xt/Motif widgets:
- If you want to use Mesa or OpenGL in your Xt/Motif program you can build
- the widgets found in either the widgets-mesa or widgets-sgi directories.
- The former were written for Mesa and the later are the original SGI
- widgets. Look in those directories for more information.
-
-
-Notes:
- HP users: a Mesa user reports that the HP-UX 10.01 C compiler has
- a bug which effects glReadPixels. A patch for the compiler (PHSS_5743) is
- available. Otherwise be sure your compiler is version 10.13 or later.
-
- QNX users: if you have problems running the demos try setting the
- stack size to 200K or larger with -N200K, for example.
-
- SunOS 5.x users: The X shared memory extension may not work
- correctly. If Mesa prints an error message to the effect of "Shared memory
- error" then you'll have to append the following three lines to the end of
- your /etc/system file then reboot:
- set shmsys:shminfo_shmmax = 0x2000000
- set shmsys:shminfo_shmmni = 0x1000
- set shmsys:shminfo_shmseg = 0x100
-
-
-
-Using the library
-=================
-
-Configuration options:
- The file src/mesa/main/config.h has many parameters which you can adjust
- such as maximum number of lights, clipping planes, maximum texture size,
- etc. In particular, you may want to change DEPTH_BITS from 16 to 32
- if a 16-bit depth buffer isn't precise enough for your application.
-
-
-Shared libraries:
- If you compile shared libraries you may have to set an environment
- variable to specify where the Mesa libraries are located. On Linux and
- Sun systems for example, set the LD_LIBRARY_PATH variable to include
- /your-dir/Mesa-2.6/lib. Otherwise, when you try to run a demo it
- may fail with a message saying that one or more libraries couldn't be
- found.
-
-
-Remote display of OpenGL/GLX programs:
- As of version 1.2.3, Mesa's header files use the same GLenum and GLUenum
- values as SGI's (and most/all other vendor's) OpenGL headers. This means
- you can freely mix object files compiled with OpenGL or Mesa headers.
- In fact, on systems with dynamic runtime linkers it's possible to dynam-
- ically link with Mesa or OpenGL shared libraries at runtime, without
- recompiling or relinking anything!
-
- Using IRIX 5.x as an example, you can run SGI's OpenGL demos with the
- Mesa shared libraries as follows. Let's assume you're installing Mesa
- in /usr/local/Mesa and using the C-shell:
- % cd /usr/local/Mesa
- % make irix5-dso
- % setenv _RLD_LIST "/usr/local/Mesa/lib/libGL.so:DEFAULT"
- % /usr/demos/bin/ideas_ogl // this is a test
-
- You can now run OpenGL executables on almost any X display! There may
- be some problems from the fact that Mesa supports many X visual types
- that an OpenGL client may not expect (grayscale for example). In this
- case the application may abort, print error messages, or just behave
- strangely. You may have to experiment with the MESA_RGB_VISUAL envi-
- ronment variable.
-
-
-Xt/Motif Widgets:
- Two versions of the Xt/Motif OpenGL drawing area widgets are included:
-
- widgets-sgi/ SGI's stock widgets
- widgets-mesa/ Mesa-tuned widgets
-
- Look in those directories for details
-
-
-Togl:
- Togl is an OpenGL/Mesa widget for Tcl/Tk.
- See http://togl.sourceforge.net for more information.
-
-
-
-X Display Modes:
- Mesa supports RGB(A) rendering into almost any X visual type and depth.
-
- The glXChooseVisual function tries its best to pick an appropriate visual
- for the given attribute list. However, if this doesn't suit your needs
- you can force Mesa to use any X visual you want (any supported by your
- X server that is) by setting the MESA_RGB_VISUAL and MESA_CI_VISUAL
- environment variables. When an RGB visual is requested, glXChooseVisual
- will first look if the MESA_RGB_VISUAL variable is defined. If so, it
- will try to use the specified visual. Similarly, when a color index
- visual is requested, glXChooseVisual will look for the MESA_CI_VISUAL
- variable.
-
- The format of accepted values is: <visual-class> <depth>
- Here are some examples:
-
- using the C-shell:
- % setenv MESA_RGB_VISUAL "TrueColor 8" // 8-bit TrueColor
- % setenv MESA_CI_VISUAL "PseudoColor 12" // 12-bit PseudoColor
- % setenv MESA_RGB_VISUAL "PseudoColor 8" // 8-bit PseudoColor
-
- using the KornShell:
- $ export MESA_RGB_VISUAL="TrueColor 8"
- $ export MESA_CI_VISUAL="PseudoColor 12"
- $ export MESA_RGB_VISUAL="PseudoColor 8"
-
-
-Double buffering:
- Mesa can use either an X Pixmap or XImage as the backbuffer when in
- double buffer mode. Using GLX, the default is to use an XImage. The
- MESA_BACK_BUFFER environment variable can override this. The valid
- values for MESA_BACK_BUFFER are: Pixmap and XImage (only the first
- letter is checked, case doesn't matter).
-
- A pixmap is faster when drawing simple lines and polygons while an
- XImage is faster when Mesa has to do pixel-by-pixel rendering. If you
- need depth buffering the XImage will almost surely be faster. Exper-
- iment with the MESA_BACK_BUFFER variable to see which is faster for
- your application.
-
-
-Colormaps:
- When using Mesa directly or with GLX, it's up to the application writer
- to create a window with an appropriate colormap. The aux, tk, and GLUT
- toolkits try to minimize colormap "flashing" by sharing colormaps when
- possible. Specifically, if the visual and depth of the window matches
- that of the root window, the root window's colormap will be shared by
- the Mesa window. Otherwise, a new, private colormap will be allocated.
-
- When sharing the root colormap, Mesa may be unable to allocate the colors
- it needs, resulting in poor color quality. This can happen when a
- large number of colorcells in the root colormap are already allocated.
- To prevent colormap sharing in aux, tk and GLUT, define the environment
- variable MESA_PRIVATE_CMAP. The value isn't significant.
-
-
-Gamma correction:
- To compensate for the nonlinear relationship between pixel values
- and displayed intensities, there is a gamma correction feature in
- Mesa. Some systems, such as Silicon Graphics, support gamma
- correction in hardware (man gamma) so you won't need to use Mesa's
- gamma facility. Other systems, however, may need gamma adjustment
- to produce images which look correct. If in the past you thought
- Mesa's images were too dim, read on.
-
- Gamma correction is controlled with the MESA_GAMMA environment
- variable. Its value is of the form "Gr Gg Gb" or just "G" where
- Gr is the red gamma value, Gg is the green gamma value, Gb is the
- blue gamma value and G is one gamma value to use for all three
- channels. Each value is a positive real number typically in the
- range 1.0 to 2.5. The defaults are all 1.0, effectively disabling
- gamma correction. Examples using csh:
-
- % setenv MESA_GAMMA "2.3 2.2 2.4" // separate R,G,B values
- % setenv MESA_GAMMA "2.0" // same gamma for R,G,B
-
- The demos/gamma.c program may help you to determine reasonable gamma
- value for your display. With correct gamma values, the color intensities
- displayed in the top row (drawn by dithering) should nearly match those
- in the bottom row (drawn as grays).
-
- Alex De Bruyn reports that gamma values of 1.6, 1.6 and 1.9 work well
- on HP displays using the HP-ColorRecovery technology.
-
- Mesa implements gamma correction with a lookup table which translates
- a "linear" pixel value to a gamma-corrected pixel value. There is a
- small performance penalty. Gamma correction only works in RGB mode.
- Also be aware that pixel values read back from the frame buffer will
- not be "un-corrected" so glReadPixels may not return the same data
- drawn with glDrawPixels.
-
- For more information about gamma correction see:
- http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html
-
-
-Overlay Planes
-
- Overlay planes in the frame buffer are supported by Mesa but require
- hardware and X server support. To determine if your X server has
- overlay support you can test for the SERVER_OVERLAY_VISUALS property:
-
- xprop -root | grep SERVER_OVERLAY_VISUALS
-
-
-HPCR glClear(GL_COLOR_BUFFER_BIT) dithering
-
- If you set the MESA_HPCR_CLEAR environment variable then dithering
- will be used when clearing the color buffer. This is only applicable
- to HP systems with the HPCR (Color Recovery) system.
-
-
-Extensions
-==========
- There are three Mesa-specific GLX extensions at this time.
-
- GLX_MESA_pixmap_colormap
-
- This extension adds the GLX function:
-
- GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
- Pixmap pixmap, Colormap cmap )
-
- It is an alternative to the standard glXCreateGLXPixmap() function.
- Since Mesa supports RGB rendering into any X visual, not just True-
- Color or DirectColor, Mesa needs colormap information to convert RGB
- values into pixel values. An X window carries this information but a
- pixmap does not. This function associates a colormap to a GLX pixmap.
- See the xdemos/glxpixmap.c file for an example of how to use this
- extension.
-
- GLX_MESA_release_buffers
-
- Mesa associates a set of ancillary (depth, accumulation, stencil and
- alpha) buffers with each X window it draws into. These ancillary
- buffers are allocated for each X window the first time the X window
- is passed to glXMakeCurrent(). Mesa, however, can't detect when an
- X window has been destroyed in order to free the ancillary buffers.
-
- The best it can do is to check for recently destroyed windows whenever
- the client calls the glXCreateContext() or glXDestroyContext()
- functions. This may not be sufficient in all situations though.
-
- The GLX_MESA_release_buffers extension allows a client to explicitly
- deallocate the ancillary buffers by calling glxReleaseBuffersMESA()
- just before an X window is destroyed. For example:
-
- #ifdef GLX_MESA_release_buffers
- glXReleaseBuffersMESA( dpy, window );
- #endif
- XDestroyWindow( dpy, window );
-
- This extension is new in Mesa 2.0.
-
- GLX_MESA_copy_sub_buffer
-
- This extension adds the glXCopySubBufferMESA() function. It works
- like glXSwapBuffers() but only copies a sub-region of the window
- instead of the whole window.
-
- This extension is new in Mesa version 2.6
-
-
-
-Summary of X-related environment variables:
- MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only)
- MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only)
- MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only)
- MESA_PRIVATE_CMAP - force aux/tk libraries to use private colormaps (X only)
- MESA_GAMMA - gamma correction coefficients (X only)
-
-
-----------------------------------------------------------------------
-$Id: README.X11,v 3.11 2003/12/17 15:14:31 brianp Exp $
diff --git a/docs/VERSIONS b/docs/VERSIONS
deleted file mode 100644
index 2a64a410dc6..00000000000
--- a/docs/VERSIONS
+++ /dev/null
@@ -1,1492 +0,0 @@
-
-
-Mesa Version History
-====================
-
-1.0 beta February 1995
- Initial release
-
-1.1 beta March 4, 1995
- Changes:
- faster point and line drawing (2x faster)
- more systems supported, better Makefiles
- Renamed lib*.a files to avoid collisions
- many small bug fixes
- New:
- pseudo-GLX functions added
- new implementation of evaluators (eval2.c)
- GLUT support
-
-1.1.1 beta March 7, 1995
- Changes:
- Reverted from eval2.c to eval.c due to FPE on Linux
- more speed improvements
- more Makefile changes
-
-1.1.2 beta March 14, 1995
- New:
- implementation of SGI's blending extensions
- glXUseXFont implemented
- added MESA_DEBUG environment variable support
- Changes:
- Using eval2.c again
- more FPE-prevention checks (0-length normals are OK)
- a few small bug fixes
- much faster pixel logic ops!
- faster transformation arithmetic
-
-1.1.3 beta March 31, 1995
- New:
- gluScaleImage() and gluBuild2DMipMaps() implemented
- Mesa widgets for Xt/Motif
- blendEXT demos
- added environment variables for selecting visuals
- Changes:
- almost all GLUT demos work correctly now
- faster X device driver functions
- more bug fixes
-
-1.1.4 beta April 20, 1995
- Bug fixes:
- - missing #define SEEK_SET in src-tk/image.c
- - compile glShadeModel into display lists
- - fixed pow() domain error in src/light.c
- - fixed "flickering bitmaps" in double buffer mode
- - fixed tk.h and aux.h for C++
- - state of LIGHT_MODEL_LOCAL_VIEWER was inverted
- New features:
- - MUCH, MUCH nicer dithering in 8-bit RGB mode
- - updated widgets and widget demos
- - Implemented GLXPixmap functions
- - Added GLU 1.1 and GLX 1.1 functions
- - Changed the X/Mesa interface API, more versatile
- - Implemented gluPartialDisk()
-
-1.2 May 22, 1995
- Bug fixes:
- - IRIX 4.x makefile problem
- - modified tk to share root colormap as needed
- - gluLookAt normalization problem
- - suppress Expose, NoExpose events in swapbuffers
- - glBitmap() and glDrawPixels() clipping
- New features:
- - GL_BLEND, GL_MODULATE, GL_DECAL, and GL_REPLACE_EXT texture
- modes implemented
- - texture maps stored more efficiently
- - texture maps can be compiled into display lists
- - Bogdan Sikorski's GLU polygon tesselation code
- - Linas Vepstas's sweep and extrusion library
- - glXCreateContext()'s shareList parameter works as it's supposed to.
- XMesaCreateContext() updated to accept a shareList parameter too.
- - Mesa can be compiled with real OpenGL .h files
- - MESA_BACK_BUFFER environment variable
- - better GLX error checking
-
-1.2.1 June 22, 1995
- Bug fixes:
- - X/Mesa double buffer window resize crash
- - widgets now pass PointerMotion events
- - X/Mesa incorrect default clear color and drawing color
- - more robust X MIT-SHM support in X/Mesa
- - glTexImage( format=GL_LUMINANCE ) didn't work
- - GL_LINE mode polygons with line width > 1.0 could cause a crash
- - numerous feedback bugs
- - glReadPixels() from depth buffer was wrong
- - error prone depth and stencil buffer allocation
- New features:
- - Preliminary Microsoft Windows driver
- - Implemented a number of missing functions: glEvalCoord[12][df]v(),
- glGet...(), etc.
- - Added a few missing symbols to gl.h and glu.h
- - Faster rendering of smooth-shaded, RGBA, depth-buffered polygons.
- - Faster rendering of lines when width=2.0
- - Stencil-related functions now work in display lists
- Changes:
- - renamed aux.h as glaux.h (MS-DOS names can't start with aux)
- - most filenames are in 8.3 format to accomodate MS-DOS
- - use GLubytes to store arrays of colors instead of GLints
-
-1.2.2 August 2, 1995
- New features:
- - texture mapped points and lines
- - NURBS! (but not 100% complete)
- - viewports may safely extend beyond window boundaries
- - MESA_PRIVATE_CMAP environment variable
- - Grayscale X display support
- - two new demos: demos/gears.c and demos/shadow.c
- - MachTen for Macintosh configuration
- Bug fixes:
- - glGet*(GL_DEPTH_BITS) returned bytes, not bits
- - point, line, and bitmap rasterization suffered from roundoff errors
- - fixed a division by zero error in line clippping
- - occasional wrong default background color really fixed!
- - glDepthFunc(GL_ALWAYS) with glDepthMask(GL_FALSE) didn't work
- - gluBuild2DMipmaps malloc problem fixed
- - view volume clipping of smooth shaded lines resulted in bad colors
- Changes:
- - new visual selection method in glXChooseVisual()
- - improved GLU quadric functions
- - call XSync for glFinish and XFlush for glFlush
- - glVertex() calls now use a function pointer to avoid conditionals
- - removed contrib directory from Mesa tar file (available on ftp site)
- - AIX shared library support
- - Removed GLUenum type as it's not in OpenGL
-
-1.2.3 September 26, 1995
- New features:
- - Mesa header files now equivalent to SGI OpenGL headers
- - Support for HP's Color Recovery dithering displays
- - Faster vertex transformation
- - Faster raster operations into X windows under certain conditions
- - New configurations: HP w/ shared libs, Ultrix w/ GCC, Data General
- - 4-bit visuals now supported
- Bug fixes:
- - glScissor bug fixed
- - round-off errors in clipping lines against clip planes fixed
- - byte swapping between hosts and display servers implemented
- - glGetError() can be called without a current rendering context
- - problem with accidentally culled polygons is fixed
- - fixed some widget compilation problems
-
-1.2.4 November 17, 1995
- New features:
- - More speed improvements (lighting, fogging, polygon drawing)
- - Window system and OS-independent off-screen rendering
- - Preliminary Fortran bindings
- - glPolygonOffsetEXT implemented
- - glColorMask and glIndexMask now fully implemented
- - glPixelZoom implemented
- - display lists fully implemented
- - gamma correction
- - dithering in 8-bit TrueColor/DirectColor visuals
- Changes:
- - Improved device driver interface
- - tk.h renamed to gltk.h to avoid conflicts with Tcl's Tk
- - Dithering support moved from core into device driver
- Bug fixes:
- - glEnable/Disable( GL_LIGHTING ) didn't always take effect
- - glReadPixels byte swapping was broken
- - glMaterial with pname==GL_AMBIENT_AND_DIFFUSE was broken
- - duplicate glColor4b() prototype in GL/gl.h removed
- - stripes in wave -ci demo fixed
- - GL_LINEAR_MIPMAP_NEAREST had wrong value
- - bugs in HP Color Recovery support fixed
- - fixed bug when blending lines, points, bitmaps outside of window
-
-1.2.5 November 30, 1995
- New Features:
- - updated MS Windows driver
- - new implementation of StaticGray/GrayScale visual support
- Bug fixes:
- - pixelzooming with gamma correction or blending didn't work
- - HP color recovery visual wasn't being picked by glXChooseVisual
- - glClear didn't always observe glColorMask changes
- - olympic and offset demos didn't compile on some Suns
- - texcoord clamping wasn't correct
- - a polygon optimization introduced an occasional sampling problem
-
-1.2.6 January 26, 1996
- New Features:
- - faster line and polygon rendering under certain conditions. See
- Performance Tips 9 and 10 in README
- - profiling
- - lighting is a bit faster
- - better perspective corrected texture mapping
- - Amiga AmiWin (X11) support
- - preliminary Linux SVGA driver
- Changes:
- - now using a 16-bit depth buffer, faster, smaller
- - GL_NORMALIZE is disabled by default
- Bug fixes:
- - projective texture mapping
- - fixed a memory leak in the context destroy function
- - GL_POLYGON with less than 3 vertices caused a crash
- - glGet*() returned wrong result for GL_INDEX_MODE
- - reading pixels from an unmapped X window caused a BadMatch error
-
-1.2.7 March 5, 1996
- New:
- - faster lighting
- - faster 16-bit TrueColor rendering on Linux
- - faster 32-bit TrueColor rendering on Linux, HP, IBM
- - non-depth-buffered XImage polygons are faster
- - vertex array extension
- - software alpha planes
- - updated Macintosh driver
- - new NeXT driver
- - GLU quadric functions generate texture coordinates
- - reflect.c demo - reflective, textured surface demo
- Changes:
- - gamma correction code moved into the X driver for better performance
- Bug fixes:
- - multiple glClipPlane()'s didn't work reliably
- - glPolygonMode() didn't always work
- - glCullFace( GL_FRONT_AND_BACK ) didn't work
- - texture mapping with gamma correction was buggy
- - floating point exceptions in texture coordinate interpolation
- - XImage byte swapping didn't always work
- - polygon edge flags weren't always used correctly
-
-1.2.8 May 22, 1996
- New:
- - overlay planes on X servers with the SERVER_OVERLAY_VISUALS property
- - better monochrome output
- - more IRIX 6.x configurations
- - more robust RGB mode color allocation
- - added MESA_XSYNC environment variable
- - GLX_MESA_pixmap_colormap and GLX_EXT_visual_info extensions
- - GL_MESA_window_pos extension
- - faster glReadPixels/glDrawPixels for GL_DEPTH and GL_UNSIGNED_SHORT
- and GL_UNSIGNED_INT
- - driver for prototype Cirrus Mondello 3-D board
- - updated AmigaDOS driver
- - a few small speed optimizations in polygon rendering
- Changes:
- - internal device driver interface modified to simplify device
- driver implementations and to support hardware Z buffers
- - several changes to the X/Mesa interface (xmesa.h)
- Bug fixes:
- - fixed pow(0,0) domain error triggered on some systems
- - glStencilClear() in a display list caused an infinite loop
- - glRasterPos*() was sometimes off by +/-0.5 in X and Y
- - color masking and blending were performed in wrong order
- - auxSolidCylinder() sometimes drew a wire-frame cylinder
- - fixed file writing bug in osdemo.c
- - pixel mapping didn't always work
- - the GL_GEQUAL stencil func didn't work
- - the GL_INVERT stencil op didn't work
- - the stencil write mask didn't work
- - glPush/PopAttrib() didn't do enough error checking
- - glIsList() didn't always work correctly
-
-2.0 October 10, 1996
- New:
- - Implements OpenGL 1.1 API functions
- - all texture filtering modes supported (mipmapping)
- - faster texture mapping, see Performance Tip 11 in README
- - antialiased RGB points
- - X support for line and polygon stippling
- - glDrawBuffer( GL_FRONT_AND_BACK ) works
- - util/ directory of useful stuff
- - demos/texobj demo of texture objects
- Changes:
- - major internal changes for thread-safeness
- - new device driver interface
- - MESA_ALPHA env variable removed
- - triangle rasterizer replaces polygon rasterizer
- Bug fixes:
- - glPopAttrib() bug
- - glDrawBuffer(GL_NONE) works now
-
-2.1 December 14, 1996
- New:
- - VMS support
- - MS-DOS driver
- - OpenStep support
- - updated, combined Windows 95/NT driver
- - implemented glGetLighti() and glGetTexGen*()
- - GLX does garbage collection of ancillary buffers
- Bug fixes:
- - removed unused _EXT constants from gl.h
- - fixed polygon offset bugs
- - Z coordinates of clipped lines were incorrect
- - glEdgeFlag() in display lists didn't always work
- - glLight*() in display lists didn't work
- - fixed X line stipple bugs (Michael Pichler)
- - glXUseXfonts XFreeFont/XFreeFontInfo bug fixed
- - fixed a feedback bug
- - glTexGen*() now transforms GL_EYE_PLANE by inverse modelview matrix
- - polygons were sometimes culled instead of clipped
- - triangle rasterizer suffered from float/int overflow exceptions
- - fixed FP underflow exception in lighting (specular exponent)
- - glEnable/glDisable of GL_EXT_vertex_array enums didn't work
- - fixed free(NULL) in GLU tesselator code
- - using 24-bit color on some X servers resulted in garbage rendering
- - 32-bit per pixel mode for XFree86 now works
- - glRotate(a,0,0,0) gave unpredictable results
- - GL_LINE_STRIP with > 480 vertices had occasional clipping problems
- - 8-bit TrueColor GLXPixmap rendering incorrectly required a colormap
- - glMaterial() wasn't ignored when GL_COLOR_MATERIAL was enabled
- - glEnable(GL_COLOR_MATERIAL) followed by glColor() didn't work right
- - accumulation buffer was limited to positive values
- - projective textures didn't work
- - selection buffer overflows weren't handled correctly
- Changes:
- - restored the GL_EXT_polygon_offset extension
- - slightly faster RGB dithering
- - the SVGA driver works again
- - Amiga driver now distributed separately
- - NeXT driver updated for Mesa 2.x
-
-2.2 March 14, 1997
- New:
- - better color selection when dithering
- - added GL_EXT_texture_object extension
- - updated MS-DOS driver for DJGPP
- - added openbsd make configuration
- - faster dithered flat-shaded triangles
- - various compilation problems with Motif widgets fixed
- - gl.h, glx.h and glu.h name mangling option
- - BeOS driver
- - 3D texture mapping extension
- - GL_MESA_resize_buffers extension
- - morph3d, stex3d and spectex demos
- - 3Dfx support
- Bug fixes:
- - glColorMaterial should finally work right in all respects
- - linear interpolation of mipmap levels was incorrectly weighted
- - readpix.c didn't compile on Macintosh
- - GL_INVERT and related logic ops didn't work right
- - glTexImage[12]D() didn't check its parameters consistantly
- - fixed a memory leak in glTexImage[12]D()
- - kludged around a SunOS 5.x/GCC compiler bug in the feedback code
- - glReadPixels aborted instead of normally catching some errors
- - a few 1.1 constants were missing or misnamed in gl.h
- - glBegin(p); glBegin(q); didn't generate an error
- - fixed a memory leak in GLX code
- - clipping of concave polygons could cause a core dump
- - 1-component alpha texture maps didn't work
- - fixed a GLU polygon tesselator bug
- - polygons with colinear vertices were sometimes culled
- - feedback triangle colors were wrong when using smooth shading
- - textures with borders didn't work correctly
- - colors returned in feedback mode were wrong when using lighting
- - spotlights didn't effect ambient lighting correctly
- - gluPartialDisk() had a few bugs
- Changes:
- - device driver interface expanded to support texture mapping
- - faster matrix inversion subroutine
- - commented out #include "wmesa_extend.h" from src/wmesa.c
- - fixed many compiler warnings in the demo programs
-
-2.3 June 30, 1997
- New:
- - Mesa distribution divided into two pieces: library code and demos
- - faster vertex transformation, clip testing, lighting
- - faster line drawing
- - TrueColor visuals how have dithering (for depths < 24 bits)
- - added MESA_NO_DITHER environment variable
- - new device driver function: NearFar(), RenderVB(), RasterSetup()
- - added LynxOS configuration
- - added cygnus Win32 configuration
- - added texcyl.c GLUT demo
- - added XMesaDitherColor() to X/Mesa interface
- - new NURBS code from Bogdan Sikorski
- - added demos/shape.c (non-rectangular X window!)
- Bug fixes:
- - glEnable/DisableClientState() were missing from GL/gl.h
- - GL_SPHERE_MAP texcoord generation didn't work correctly
- - glXGetConfig() returned wrong number of depth, stencil, accum bits
- - glDrawPixels feedback/selection didn't examine RasterPos valid bit
- - black and white were reversed on some monochrome displays
- - fixed potential image memory leak (wasn't setting reference counter)
- - glDrawPixels sometimes didn't recognize some GL state changes
- - gluProject/UnProject() didn't check for divide by zero
- - stex3d demo called random() and srandom(), not portable
- - fixed memory leaks in context.c and drawpix.c
- - fixed NULL dereferencing problem in gl_update_texture_state()
- - glReadPixels between glBegin/glEnd didn't generate an error.
- - fixed memory leak in polygon tesselator (Randy Frank)
- - fixed seg fault bug drawing flat-shaded, depth-tested lines
- - clipped GL_TRIANGLE_STRIPs sometimes had wrong color when flat-shaded
- - glBindTexture sometimes didn't work
- - fixed a bug deep in glXReleaseBuffersMESA()
- - fog was mistakenly applied to alpha
- - glPopMatrix didn't set "dirty matrix" flag
- - glPolygonStipple pattern was sometimes wrong
- - glClear wasn't disabled during feedback and selection
- - fixed memory leak in glTexSubImage[123]D
- Changes:
- - many library source files reorganized
- - faster X color allocation, colors also freed when finished with them
- - new texture sampling function pointer in texture objects
- - incorporated 3Dfx VooDoo driver v0.16 into main source tree
- - many 3Dfx driver updates
- - cygnus Makefiles now included
- - updated DOS driver
- - made a few changes to dosmesa.c and wmesa.c (VB->Unclipped)
- - internally, colors now stored in GLubytes, not GLfixed
- - optimized changing of GL_SHININESS parameter
-
-2.4 September 18, 1997
- New:
- - updated 3Dfx Glide driver
- - hacks for 3Dfx rendering into an X window or fullscreen
- - added depth buffer access functions to X/Mesa and OS/Mesa interfaces
- Bug fixes:
- - pixel buffer could overflow with long, wide lines
- - fixed FP underflow problems in lighting
- - glTexSubImage1D() had an unitialized variable
- - incomplete texture objects could cause a segfault
- - glDrawPixels with GL_COMPILE_AND_EXECUTE caused infinite loop
- - flat-shaded quads in a strip were miscolored if clipped
- - mipmapped triangle lod computation now works correctly
- - fixed a few under/overflow bugs in triangle rasterizer
- - glArrayElement() assigned bad normal if normal array disabled
- - changed argument to glXReleaseBuffersMESA()
- - fixed small triangle underflow bugs in tritemp.h (hopefully)
- - glBindTexture(target, 0) caused a crash
- - glTexImage[123]D() with NULL image pointer caused crash
- - glPixelStore parameters are now ignored during display list execution
- - fixed a two-sided lighting w/ clipping bug (black vertices)
- - textures with width!=height were sometimes mis-rendered
- - "weird" projection matrices could cause div by 0, other fp errors
- Changes:
- - changed precompiled header symbol from PCH to PC_HEADER
- - split api.c into api1.c and api2.c
- - added hash.c source file (but not used yet)
- - a few Sun and HP configuration file changes
- - MESA_GLX_FX env var replaces MESA_FX_WINDOW and MESA_FX_FULLSCREEN
- - fixed a few cygnus build problems (src/Makefile.cygnus, src/wmesa.c)
-
-2.5 November 20, 1997
- New:
- - updated 3Dfx driver (v20) for GLQuake
- - added GL_EXT_paletted_texture extension
- - added GL_EXT_shared_texture_palette extension
- - added GL_EXT_point_parameters extension
- - now including Mark Kilgard's GLUT library v3.6
- - new GLUT-based demos in gdemos/
- - added a few more Unix config targets
- - added Intel X86 assembly language vertex transformation code
- - 3Dfx/Glide driver for Mesa now recognizes SST_SCREENREFRESH env var
- - Windows 95 S3 Virge driver
- Bug fixes:
- - glCopyTexImage?D would crash due to uninitialized variable
- - glColor w/ glColorMaterial in a display list caused a bug
- - fixed several glDrawPixels() and ReadPixels() bugs in 3Dfx driver
- - glVertex4*() vertices weren't always projected correctly
- - trying to use mipmapped textured points or lines caused crash
- - glColor[34][fd]() values now clamped to [0,1] before int conversion
- Changes:
- - new device driver functions for texture mapping
- - hash tables used for display list and texture object lookup
- - fixed GLX visual handling code to avoid saving redundant visuals
- - 3Dfx Glide libraries automatically linked to libMesaGL.so
- - dropped the Cirrus Logic Mondello code since it's obsolete
- - updated Cygnus Makefiles (Stephane Rehel)
- - updated Windows MSVC++ Makefiles (Oleg Letsinsky)
- - procedure for making library files has changed: scripts now take
- a major and minor version arguments. Make-config changed a lot.
- - new implementation of glTexSubImage2D()
- - updated widgets-mesa directory to create libMesaGLwM.a (Motif widget)
- - separate linux-glide and linux-386-glide configurations
-
-2.6 February 12, 1998
- New:
- - Windows WGL functions
- - updated VMS, DOS, Windows, Cygnus, BeOS, Amiga compilation support
- - v0.22 of 3Dfx Glide driver
- - more X86 assembly language optimizations
- - faster blending for some modes
- - XMesaSetFXmode() to switch between 3Dfx window and full-screen mode
- - added preliminary thread support
- - added GLX_MESA_copy_sub_buffer extension
- - some clipping optimizations
- Bug fixes:
- - fixed shading/material bug when drawing long primitive strips
- - fixed clipping problem in long primitive strips
- - fixed clipping bug when using 3Dfx driver
- - fixed a problem when trying to use X fonts w/ 3Dfx driver
- - fixed a texture filter bug in 3Dfx/Glide driver
- - fixed bug in 3Dfx/Glide driver involving depth mask & clearing
- - glLoadMatrix to set projection matrix confused the 3Dfx driver
- - non-identity texture matrices didn't work with linux-386 configs
- - glGenTextures() didn't reserve the returned texture IDs
- - NULL proxy image sent to glTexImageXD() caused crash
- - added texture state validation optimization (Henk Kok)
- - fixed colormap reuse problem when using both RGB and CI windows
- - 32bpp True/DirectColor X visuals weren't recognized
- - fixed potential problem in evaluators memory allocation
- - fixed assorted demo compilation bugs
- Changes:
- - replaced old Mesa/windows/ directory with Mesa/WIN32/ directory
- - converted a few old glaux/gltk demos to GLUT
- - renamed directories: demos -> xdemos, gdemos -> demos
-
-
-3.0 September 17, 1998
- New:
- - OpenGL 1.2 API
- - GL_EXT_abgr pixel format extension
- - GL_SGIS_texture_edge_clamp extension
- - GL_SGIS_multitexture extension (to be replaced by GL_ARB_multitex)
- - GL_EXT_multitexture extension (to be replaced by GL_ARB_multitex)
- - GL_EXT_rescale_normal extension and renormal.c demo
- - GLX_SGI_video_sync extension (a no-op)
- - antialiased lines
- - glGetTexImage() now implemented
- - glDraw/Copy/ReadPixels() optimizations
- - optimized textured triangle code (Marten Stromberg)
- - more optimization of dithered TrueColor triangles in X driver
- - Linux GGI driver
- - updated MGL driver
- Bug fixes:
- - lots of assorted compilation fixes
- - glInitNames didn't write initial hit record
- - glBitmap didn't always check for invalid raster position
- - switching between GLX and OSMesa contexts caused a crash
- - fixed uninitialized variable in Mesa widget code
- - fixed typo in texture code which caused book/texgen to crash
- - fixed texture sampling bug when filter=GL_LINEAR and wrap=GL_CLAMP
- - gluDisk() in POINT or LINE mode sometimes failed
- - fixed texture + fog bug
- - GL_COMPILE_AND_EXECUTE mode didn't work reliably
- - glMultMatrix in projection matrix mode w/ 3Dfx driver could fail
- - glDrawPixels(color index pixels) weren't converted to RGBA
- - fixed possible getenv() buffer overflow security bug
- - glBitmap in feedback mode was offset by xOrig, yOrig params
- - device driver's DrawPixels hook was never used
- - glDrawPixels with zoomY!=1 and top/bottom clipping didn't work
- - glDrawPixels optimized for GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLubyte
- - fixed MakeCurrent bug in GLwRedrawObjects() in MesaWorkstation.c
- - glCopyTexSubImage2D() didn't work with 3Dfx driver
- - lines with width = 2 could cause crash
- - glClear with scissor rect sometimes cleared whole buffer
- - glTexSubImage2D( .. GL_COLOR_INDEX .. ) didn't work
- - glTexImageXD( .. GL_ABGR_EXT .. ) didn't work
- - computation of inverse modelview matrix sometimes failed
- - fixed GL_CLAMP mode texture sampling bug
- - textured line interpolation was somewhat broken
- - textured triangle interpolation was also somewhat broken
- - glGet(MODELVIEW/PROJECTION/TEXTURE_MATRIX_STACK_DEPTH) off by one
- - evaluator state wasn't fully initialized
- - texture coordinate clipping was buggy
- - evaluator surfaces could be mis-colored
- - glAccum(GL_RETURN, s) didn't obey glColorMask() settings
- - zero area polygons shouldn't be culled if polygon mode is point/line
- - clipped width and height of glReadPixels was sometimes off by one
- - blending with alpha = 0 or 1.0 wasn't always exact
- - reading of pixels from clipped region was buggy
- - minor tweaking of X visual management in GLX emulator
- - glPolygonStipple now obeys pixel unpacking parameters
- - glGetPolygonStipple now obeys pixel packing parameters
- - interleaved vertex array texture coordinates were broken
- - query of proxy texture internal format was broken
- - alpha channel wasn't reliably cleared
- - fixed divide by zero error in gluScaleImage if dest size = 1 x 1
- Conformance bug fixes:
- - GL_SELECTION_BUFFER_POINTER and GL_SELECTION_BUFFER_SIZE were missing
- - GL_TEXTURE_INTERNAL_FORMAT was missing
- - glGet*(GL_POLYGON_STIPPLE) was broken
- - glPush/PopAttrib() didn't save/restore all texture state
- - glBitmap in feedback mode didn't work
- - feedback of texture coords didn't always work
- - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLbyte was broke
- - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLubyte was broke
- - glDrawPixels w/ format=GL_STENCIL_INDEX, type=GL_BITMAP was broke
- Changes:
- - upgraded GLUT to version 3.7
- - only GL and GLU library code included in MesaLib.tar.gz
- - GLUT and all demos now in MesaDemos.tar.gz
- - glaux and gltk libraries removed
- - IRIX -n32 and -64 libs go in lib32/ and lib64/ directories
-
-
-3.1 beta 1 November 19, 1998
- New:
- - GL_EXT_stencil_wrap extension
- - GL_INGR_blend_func_separate extension
- - GL_ARB_multitexture extension
- - GL_NV_texgen_reflection extension
- - newly optimized vertex transformation code
- - updated GLUT 3.7 code
- - better precision when using 32-bit Z buffer
- - Allegro DJGPP driver
- Bug fixes:
- - glCopyPixels between front/back buffers didn't copy alpha correctly
- - fixed out-of-bounds memory access in optimized 2-D texture code
- - glPixelStorei didn't accept GL_PACK/UNPACK_IMAGE_HEIGHT parameter
- - glGet*() didn't accept GL_MAX_3D_TEXTURE_SIZE parameter
- - clipping of texture coordinates sometimes had bad R,Q values
- - GL_CLAMP_TO_EDGE texture sampling was off by 0.5 texels
- - glEdgeFlagPointer() now takes a GLvoid * instead of GLboolean *
- - texture was sometimes applied twice with 3Dfx driver
- - glPush/PopAttrib() fouled up texture object reference counts
- - glDeleteLists(0, n) caused assertion failure
- - bilinear texture sampling wasn't accurate enough
- - glClear w/ glDepthMask(GL_FALSE) didn't work right on 3Dfx
- - color components were reversed on big endian 32 bpp X visuals
- Changes:
- - removed GL_EXT_multitexture extension
-
-
-3.1 beta 2 May 24, 1999
- New:
- - multi-textured points and lines (mjk@nvidia.com)
- - optimized 24bpp X rendering (bernd.paysan@gmx.de)
- - added allegro support (bernie-t@geocities.com)
- - cleaned-up Windows-related stuff (Ted Jump)
- - minor stereo changes (KendallB@scitechsoft.com)
- - new BeOS driver which implements BGLView class
- - new Direct3D driver (see src/D3D)
- - more efficient filled gluCylinder() function
- - utilities: util/showbuffer.[ch] and util/glstate.[ch]
- - fixed some IRIX compiler warnings
- - added support for building Mesa in XFree86 with
- SGI's GLX (kevin@precisioninsight.com)
- Bug fixes:
- - a variety of Windows/Mesa bug fixes (mjk@nvidia.com)
- - packed pixel images weren't unpacked correctly
- - patches some win32 files in GLUT (mjk@nvidia.com)
- - glTexImage[123]D() didn't accept internalFormat == GL_COLOR_INDEX
- - fixed lighting bug in Keith's new shading code
- - fixed texture segfault seen in Lament screensaver
- - fixed miscellaneous low-memory bugs
- - glClear(GL_COLOR_BUFFER_BIT) with RGBA or CI masking was broken
- - GL_LINEAR sampling of 3D textures was broken
- - fixed SVR4 'cc' compiler macro problem (dawes@xfree86.org)
- - added GL_TEXTURE_PRIORITY fix (keithh@netcomuk.co.uk)
- - fixed wide point and wide line conformance bugs (brianp)
- Changes:
- - some device driver changes (see src/dd.h)
- - new copyright on core Mesa code
-
-
-3.1 beta 3 September 17, 1999
- New:
- - optimized glAccum function
- - optimized 24bpp rendering in XMesa driver
- - GLU 1.2 polygon tessellator
- Bug Fixes:
- - glGetTexLevelParameter wasn't fully implemented
- - glXUseXFont now handles multi-byte fonts
- - glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result
- - alpha channel of blending points, lines was sometimes incorrect
- Changes:
- - New library names: "libGL" instead of "libMesaGL"
- - New library numbering: libGL.so.1.2.310
- - New subdirectories: docs/ and bin/
- - New Makefile-system (autoconf,automake,libtool)
-
-
-3.1 final December 14, 1999
- New:
- - added demos/gloss.c
- - added xdemos/glxdpyinfo.c
- - added GLX_ARB_get_proc_address extension
- - rewritten glTexImage code paths (faster, less memory, bug fixes)
- Bug Fixes:
- - several vertex array bug fixes
- - overlapping glCopyPixels with pixel zooming now works
- - glXUseXFont() bitmaps were vertically shifted by one pixel
- - glCopyPixels with pixel zooming now works
-
-
-3.2 final April 24, 2000
- 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
-
-
-3.2.1 July 19, 2000
- Bug fixes:
- - gluBuild2DMipmaps() didn't accept GL_BGRA
- - Fixed compile/makefile problems on IRIX
- - fixed segfault in 3dfx driver when using GL selection/feedback
- - no longer cull very, very tiny triangles
- - blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering)
- - fixed Motif detection code in widgets-mesa/configure.in
- - glColorMaterial and glMaterial updates to emissive and ambient
- didn't always work right
- - Specular highlights weren't always in the right place
- - clipped GL_LINE mode polygons had interior lines appear
- - blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken
- - GL_NICEST fog didn't always work with flat shading
- - glRect commands in display lists were sometimes miscolored
- - Line Z offset didn't always work
- - fixed texgen normal vector problem (gloss's teapot)
- - numerous GL conformance bugs fixed
- Changes:
- - glColorMask(false, false, false, false) handled better/faster
- - reverted to old GLU polygon tessellator, GLU 1.1
- - updated Win32 build files
-
-
-3.3 July 21, 2000
- New:
- - antialiased triangles now implemented
- - GL_EXT_texture_env_add texture mode extension
- - GLX 1.3 API
- - support for separate draw/read buffers (ie GL_SGI_make_current_read)
- - thread-safe API dispath
- - improved glxinfo program
- - demos/texdown program to measure texture download performance
- - glext.h header file
- - demos/geartrain program
- - GL_EXT_texture_lod_bias extension
- - demos/lodbias program
- - further optimized glRead/DrawPixels for 16-bit TrueColor X visuals
- - GLX_EXT_visual_rating extension (a no-op, however)
- - GL_HP_occlusion_test extension (for X and OS/Mesa drivers)
- - demos/occlude program
- - GL_SGIS_pixel_texture and GL_SGIX_pixel_texture extensions
- - demos/pixeltex program
- - GL_SGI_color_matrix extension
- - GL_SGI_color_table extension
- - GL_EXT_histogram extension
- - GL_ARB_texture_cube_map extension
- - added xdemos/glxheads and xdemos/manywin
- - demos/texenv.c demo
- - GL_EXT_texture_env_combine extension (by Holger Waechtler)
- - Xlib driver is now thread-safe (see xdemos/glthreads)
- Bug Fixes:
- - various GL conformance failures fixed since 3.2.1
- Changes:
- - gl.h now uses #defines instead of C enums for all tokens
- - glu.h now uses #defines instead of C enums for all tokens
- - moved programs from 3Dfx/demos/ into demos/ directory
-
-
-3.4 November 3, 2000
- 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
-
-
-3.4.1 February 14, 2001
- 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
-
-
-3.4.2 May 17, 2001
- 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
- - fixed stencil buffer clear width/height typo
- - fixed GL error glitches in gl[Client]ActiveTextureARB()
- - fixed Windows compilation problem in texutil.c
- - fixed 1/8-pixel AA triangle sampling error
- Changes:
- - optimized writing mono-colored pixel spans to X pixmaps
- - increased max viewport size to 2048 x 2048
-
-
-3.5 June 21, 2001
- 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
-
-
-4.0 October 22, 2001
- 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)
-
-
-4.0.1 December 17, 2001
- 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)
- - fixed separate_specular color bug found in Chimera (18 Dec 2001)
-
-
-4.0.2 April 2, 2002
- 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)
- Known bugs:
- - mipmap LOD computation
-
-
-4.0.3 June 25, 2002
- 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)
-
-
-4.0.4 October 3, 2002
- 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
-
-
-4.1 October 29, 2002
- 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,inf] 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
- - updated demos/stex3d with new options
-
-
-5.0 November 13, 2002
- 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
-
-
-5.0.1 March 30, 2003
- 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)
-
-
-5.0.2 September 5, 2003
- 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
-
-
-5.1 December 17, 2003
- New:
- - 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)
-
-
-6.0 January 16, 2004
- 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
-
-
-6.0.1 April 2, 2004
- 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
- - ARB_fragment_program KIL instruction was incorrect
-
-
-6.1 August 18, 2004
- 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)
-
-
-6.2 October 2, 2004
- 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)
-
-
-6.2.1 December 9, 2004
- 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
-
-
-6.3 July 20, 2005
- 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.)
- - Updated GL/glext.h to version 29
- 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
-
-
-6.3.1
- This was an intermediate release for X.org which wasn't otherwise released.
-
-
-6.3.2 August 19, 2005
- New:
- - The distribution now includes the DRI drivers and GLX code
- Changes:
- - Made the DRI "new" driver interface standard, remove old code
- Bug fixes:
- - GL_ARB_vertex/fragment_shader were mistakenly listed in the
- extensions string
- - negative relative addressing in vertex programs was broken
- - update/fix SPARC assembly code for vertex transformation
- - fixed memory leak when freeing GLX drawables/renderbuffers
- - fixed display list memory leak
- - the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer
- - wglGetProcAddress() didn't handle wgl-functions
- - fixed glxext.h cross-compile issue (Colin Harrison)
- - assorted DRI driver fixes
-
-
-6.4 October 24, 2005
- New:
- - Added a fast XOR line drawing function in Xlib driver
- - Added support for GL_ARB_texture_mirrored_repeat to savage
- driver (supported only on Savage4 hardware).
- Changes:
- - Mesa now packaged in three parts: Library, Demos and GLUT
- Bug fixes:
- - GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig
- - Some files were present multiple times in the 6.3.2 tarballs
- - r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207)
- - glxgears_fbconfig demo didn't work (bug 4237)
- - fixed bug when bilinear sampling 2d textures with borders
- - glXCreatePbuffer() could segfault instead of returning 0 (bug 4235)
- - fixed undefined frexp and rand in X.org libGLcore.a (bug 4242)
- - fixed a few problems with proxy color tables (bug 4270)
- - fixed precision problem in Z clearing (bug 4395)
- - glBitmap, glDraw/CopyPixels mistakenly generated selection hits
- - fixed potential segfault caused by reading pixels outside
- of renderbuffer bounds
- - glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB
- - fixed memory corruption bug involving software alpha buffers
- - glReadPixels clipped by window bounds was sometimes broken
- - glDraw/CopyPixels of stencil data ignored the stencil write mask
- - glReadPixels from a texture bound to a framebuffer object didn't work
- - glIsRender/FramebufferEXT weren't totally correct
- - fixed a number of point size attenuation/fade bugs
- - fixed glFogCoord bug 4729
- - GLX encoding for transpose matrix functions was broken
- - fixed broken fragment program KIL and SWZ instructions
- - fragment programs that wrote result.depth.z didn't work
-
-
-6.4.1 November 30, 2005
- Bug fixes:
- - redefining a vertex program string didn't take effect in TNL module
- - fixed occasional segfault upon vertex/fragment parsing error
- - vertex program LIT instruction didn't handle 0^0=1 correctly
- - fragment program fog option didn't work with glDrawPixels, glBitmap
- - USE_MGL_NAMESPACE didn't work for x86-64
- - OSMesa demos were missing from previous release tarballs
- - fixed problem with float->ushort conversion in glClear (bug 4992)
- - popping of GL_EYE_PLANE texgen state was broken (bug 4996)
- - popping of GL_SPOT_DIRECTION light state was broken (bug 5005)
- - fixed occasional triangle color interpolation problem on VMS
- - work around invalid free() call (bug 5131)
- - fixed BSD X server compilation problem by including stdint.h
-
-
-6.4.2 February 2, 2006
- New:
- - added OSMesaColorClamp() function/feature
- - added wglGetExtensionStringARB() function
- Bug fixes:
- - fixed some problems when building on Windows
- - GLw header files weren't installed by installmesa script (bug 5396)
- - GL/glfbdev.h file was missing from tarballs
- - fixed TNL initialization bug which could lead to crash (bug 5791)
-
-
-6.5 March 31, 2006
- New:
- - OpenGL Shading Language support through GL_ARB_shader_objects,
- GL_ARB_shading_language_100, GL_ARB_vertex_shader and
- GL_ARB_fragment_shader (done by Michal Krol)
- - GL_EXT_packed_depth_stencil extension
- - GL_EXT_timer_query extension
- - GL_EXT_framebuffer_blit extension
- - GL_ARB_half_float_pixel
- - reflect demo improved to support multiple windows
- - singlebuffer demo (shows no/little-flicker single-buffered rendering)
- - r200: enable GL_ARB_texture_env_crossbar, separate the texture
- sampling unit bits from the texture env combine enable bits
- - r200: add support for GL_ATI_fragment_shader
- - added fast XOR-mode line drawing optimization
- - radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
- and GL_EXT_fog_coord
- - MESA_GLX_ALPHA_BITS env var for xlib driver
- - many DRI driver updates (including screen rotation support
- for the Intel DRI driver)
- Changes:
- - removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
- - removed GL_SGIX/SGIS_pixel_texture extensions
- Bug fixes:
- - fixed glxcontextmodes.c datatype problem (bug 5835)
- - fixed aix-gcc build/install bugs (bug 5874)
- - fixed some bugs in texture env program generation
- - glXCopyContext() didn't handle texture object bindings properly
- - glXCopyContext() didn't copy all lighting state
- - fixed FreeBSD config (Pedro Giffuni)
- - fixed some minor framebuffer object bugs
- - replaced dprintf() with _glu_printf() in GLU (bug 6244)
- - fixed a number of thread safety bugs/regressions
- - fixed a number of GLU tesselator bugs (John Shell, bug 6339)
- - paletted texturing was broken w/ floating point palettes (K. Schultz)
- - lots of assorted framebuffer object bug fixes
-
-6.5.1 month, day, 2006
- New:
- Changes:
- - The glVertexAttribARB functions no longer alias the conventional
- vertex attributes.
- - glxinfo program prints more info with -l option
- Bug fixes:
- - fixed broken texture border handling for depth textures (bug 6498)
- - removed the test for duplicated framebuffer attachments, per
- version 117 of the GL_EXT_framebuffer_object specification
- - fixed a few render-to-texture bugs, including render to depth texture
- - clipping of lines against user-defined clip planes was broken (6512)
- - assembly language dispatch for SPARC was broken (bug 6484)
- - assorted compilation fixes on various Unix platforms (Dan Schikore)
- - glPopAttrib could restore an invalid value for GL_DRAW_BUFFER
- - assorted minor fixes for 16 and 32 bit/channel modes
- - fixed assorted bugs in texture compression paths
- - fixed indirect rendering vertex array crashes (bug 6863)
- - glDrawPixels GL_INDEX_OFFSET didn't always work
diff --git a/docs/enums.txt b/docs/enums.txt
deleted file mode 100644
index 218391c30df..00000000000
--- a/docs/enums.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-
-Blocks allocated to Mesa:
- 0x8750-0x875F
- 0x8BB0-0x8BBF
-
-
-GL_MESA_packed_depth_stencil
- GL_DEPTH_STENCIL_MESA 0x8750
- GL_UNSIGNED_INT_24_8_MESA 0x8751
- GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
- GL_UNSIGNED_SHORT_15_1_MESA 0x8753
- GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
-
-GL_MESA_trace.spec:
- GL_TRACE_ALL_BITS_MESA 0xFFFF
- GL_TRACE_OPERATIONS_BIT_MESA 0x0001
- GL_TRACE_PRIMITIVES_BIT_MESA 0x0002
- GL_TRACE_ARRAYS_BIT_MESA 0x0004
- GL_TRACE_TEXTURES_BIT_MESA 0x0008
- GL_TRACE_PIXELS_BIT_MESA 0x0010
- GL_TRACE_ERRORS_BIT_MESA 0x0020
- GL_TRACE_MASK_MESA 0x8755
- GL_TRACE_NAME_MESA 0x8756
-
-MESA_ycbcr_texture.spec:
- GL_YCBCR_MESA 0x8757
- GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */
- GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */
-
-GL_MESA_pack_invert.spec
- GL_PACK_INVERT_MESA 0x8758
-
-GL_MESA_program_debug.spec:
- GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x????
- GL_VERTEX_PROGRAM_CALLBACK_MESA 0x????
- GL_FRAGMENT_PROGRAM_POSITION_MESA 0x????
- GL_VERTEX_PROGRAM_POSITION_MESA 0x????
- GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x????
- GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x????
- GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x????
- GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x????
-
diff --git a/docs/mesa.css b/docs/mesa.css
deleted file mode 100644
index a53a9df8b0e..00000000000
--- a/docs/mesa.css
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Mesa CSS */
-body {
- background-color: #ffffff;
- font: 14px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif;
- color: black;
- link: #111188;
-}
-
-h1 {
- font: 24px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif;
- font-weight: bold;
- color: black;
-}
-
-h2 {
- font: 18px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif, bold;
- font-weight: bold;
- color: black;
-}
-
-code {
- font-family: monospace;
- font-size: 10pt;
- color: black;
-}
-
-
-pre {
- /*font-family: monospace;*/
- font-size: 10pt;
- /*color: black;*/
-}
-
diff --git a/doxygen/.cvsignore b/doxygen/.cvsignore
deleted file mode 100644
index 1b0edf90a6d..00000000000
--- a/doxygen/.cvsignore
+++ /dev/null
@@ -1,15 +0,0 @@
-*.tag
-agpgart
-array_cache
-core
-core_subset
-math
-math_subset
-miniglx
-radeon_subset
-radeondrm
-radeonfb
-swrast
-swrast_setup
-tnl
-tnl_dd
diff --git a/doxygen/Makefile b/doxygen/Makefile
deleted file mode 100644
index 055b17386df..00000000000
--- a/doxygen/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-
-default: full
-
-all: full subset
-
-%.tag: %.doxy
- doxygen $<
-
-FULL = \
- main.doxy \
- math.doxy \
- array_cache.doxy \
- glapi.doxy \
- shader.doxy \
- swrast.doxy \
- swrast_setup.doxy \
- tnl.doxy \
- tnl_dd.doxy
-
-full: $(FULL:.doxy=.tag)
- $(foreach FILE,$(FULL),doxygen $(FILE);)
-
-SUBSET = \
- main.doxy \
- math.doxy \
- miniglx.doxy
-
-subset: $(SUBSET:.doxy=.tag)
- $(foreach FILE,$(SUBSET),doxygen $(FILE);)
-
-clean:
- rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
- rm -rf *.tag
diff --git a/doxygen/README b/doxygen/README
deleted file mode 100644
index 9b820041d1b..00000000000
--- a/doxygen/README
+++ /dev/null
@@ -1,10 +0,0 @@
-
-This directory is for doxygen (a source code documentation system).
-
-See http://www.doxygen.org/ for more info.
-
-Either run 'make' (Unix) or 'doxy.bat' (Windows) to run doxygen
-and generate souce code documentation.
-
-Then, load either doxygen/main/index.html or doxygen/core_subset/index.html into
-your web browser.
diff --git a/doxygen/array_cache.doxy b/doxygen/array_cache.doxy
deleted file mode 100644
index ae0b1fa1391..00000000000
--- a/doxygen/array_cache.doxy
+++ /dev/null
@@ -1,50 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa array_cache"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/array_cache/
-FILE_PATTERNS = *.c \
- *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = array_cache
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = main.tag=../core \
- math.tag=../math \
- shader.tag=../shader \
- swrast.tag=../swrast \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl \
- tnl_dd.tag=../tnl_dd
-GENERATE_TAGFILE = array_cache.tag
diff --git a/doxygen/common.doxy b/doxygen/common.doxy
deleted file mode 100644
index 1b5e5fece60..00000000000
--- a/doxygen/common.doxy
+++ /dev/null
@@ -1,1153 +0,0 @@
-# Doxyfile 1.3.8
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = Mesa
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 6.2
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY =
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of source
-# files, where putting all generated files in the same directory would otherwise
-# cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is used
-# as the annotated text. Otherwise, the brief description is used as-is. If left
-# blank, the following values are used ("$name" is automatically replaced with the
-# name of the entity): "The $name class" "The $name widget" "The $name file"
-# "is" "provides" "specifies" "contains" "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = YES
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT =
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER = header.html
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH = ../include
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse the
-# parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = NO
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superseded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT = 1024
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes that
-# lay further from the root node will be omitted. Note that setting this option to
-# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that a graph may be further truncated if the graph's image dimensions are
-# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
-# If 0 is used for the depth value (the default), the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/doxygen/core_subset.doxy b/doxygen/core_subset.doxy
deleted file mode 100644
index 35faf565dc4..00000000000
--- a/doxygen/core_subset.doxy
+++ /dev/null
@@ -1,226 +0,0 @@
-# Doxyfile 0.1
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa Main"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY =
-OUTPUT_LANGUAGE = English
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-INTERNAL_DOCS = YES
-STRIP_CODE_COMMENTS = YES
-CASE_SENSE_NAMES = YES
-SHORT_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-VERBATIM_HEADERS = YES
-SHOW_INCLUDE_FILES = YES
-JAVADOC_AUTOBRIEF = NO
-INHERIT_DOCS = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-ALIASES =
-ENABLED_SECTIONS = subset
-MAX_INITIALIZER_LINES = 30
-OPTIMIZE_OUTPUT_FOR_C = NO
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = NO
-WARN_FORMAT =
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/main/
-FILE_PATTERNS = \
- accum.h \
- attrib.h \
- blend.[ch] \
- buffers.[ch] \
- dd.h \
- debug.h \
- depth.h \
- dlist.h \
- context.[ch] \
- config.h \
- colormac.h \
- colortab.h \
- enable.h \
- enums.h \
- eval.h \
- extensions.h \
- feedback.[ch] \
- fog.h \
- get.h \
- glheader.h \
- glthread.h \
- hash.[ch] \
- hint.h \
- histogram.h \
- image.[ch] \
- imports.[ch] \
- lines.[ch] \
- light.h \
- matrix.[ch] \
- macros.h \
- mmath.h \
- mtypes.h \
- pixel.h \
- points.[ch] \
- polygon.[ch] \
- rastpos.[ch] \
- simple_list.h \
- state.[ch] \
- stencil.[ch] \
- subset_*.c \
- texformat.h \
- teximage.h \
- texstate.h \
- texstore.h \
- texobj.[ch] \
- texutil_tmp.h \
- varray.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = NO
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = core_subset
-HTML_HEADER = header_subset.html
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT =
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT =
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT =
-MAN_EXTENSION =
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = \
- math_subset.tag=../math_subset \
- miniglx.tag=../miniglx
-GENERATE_TAGFILE = core_subset.tag
-ALLEXTERNALS = NO
-PERL_PATH =
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-TEMPLATE_RELATIONS = YES
-HIDE_UNDOC_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-GRAPHICAL_HIERARCHY = YES
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
-CGI_NAME =
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH =
-EXT_DOC_PATHS =
diff --git a/doxygen/doxy.bat b/doxygen/doxy.bat
deleted file mode 100644
index 2d8b567ce3a..00000000000
--- a/doxygen/doxy.bat
+++ /dev/null
@@ -1,19 +0,0 @@
-doxygen tnl_dd.doxy
-doxygen array_cache.doxy
-doxygen math.doxy
-doxygen swrast.doxy
-doxygen swrast_setup.doxy
-doxygen tnl.doxy
-doxygen core.doxy
-doxygen glapi.doxy
-doxygen shader.doxy
-
-echo Building again, to resolve tags
-doxygen tnl_dd.doxy
-doxygen array_cache.doxy
-doxygen math.doxy
-doxygen swrast.doxy
-doxygen swrast_setup.doxy
-doxygen tnl.doxy
-doxygen glapi.doxy
-doxygen shader.doxy
diff --git a/doxygen/glapi.doxy b/doxygen/glapi.doxy
deleted file mode 100644
index eafc2a109ad..00000000000
--- a/doxygen/glapi.doxy
+++ /dev/null
@@ -1,49 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa GL API dispatcher"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/glapi/
-FILE_PATTERNS = *.c *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = glapi
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = main.tag=../core \
- math.tag=../math \
- tnl_dd.tag=../tnl_dd \
- swrast.tag=../swrast \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl \
- array_cache.tag=array_cache
-GENERATE_TAGFILE = swrast.tag
diff --git a/doxygen/header.html b/doxygen/header.html
deleted file mode 100644
index 5ca2763e0df..00000000000
--- a/doxygen/header.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-<head>
-<title>Mesa Source Code Documentation</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-</head>
-<body>
-<div class="qindex">
-<a class="qindex" href="../main/index.html">core</a> |
-<a class="qindex" href="../glapi/index.html">glapi</a> |
-<a class="qindex" href="../array_cache/index.html">array_cache</a> |
-<a class="qindex" href="../math/index.html">math</a> |
-<a class="qindex" href="../shader/index.html">shader</a> |
-<a class="qindex" href="../swrast/index.html">swrast</a> |
-<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
-<a class="qindex" href="../tnl/index.html">tnl</a> |
-<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a>
-</div>
diff --git a/doxygen/header_subset.html b/doxygen/header_subset.html
deleted file mode 100644
index e7f001060ea..00000000000
--- a/doxygen/header_subset.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-<head><title>Mesa Source Code Documentation</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-</head>
-<body>
-<div class="qindex">
-<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
-<a class="qindex" href="../math_subset/index.html">math</a> |
-<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
-<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
-</div>
diff --git a/doxygen/main.doxy b/doxygen/main.doxy
deleted file mode 100644
index 3cb05967aa2..00000000000
--- a/doxygen/main.doxy
+++ /dev/null
@@ -1,50 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa Main"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/main/
-FILE_PATTERNS = *.c *.h
-RECURSIVE = NO
-EXCLUDE = ../src/glapitemp.h ../src/glapioffsets.h
-EXCLUDE_PATTERNS = subset_*
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = main
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = YES
-EXPAND_ONLY_PREDEF = YES
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED = _HAVE_FULL_GL=1
-EXPAND_AS_DEFINED = _glthread_DECLARE_STATIC_MUTEX
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = tnl_dd.tag=../tnl_dd \
- array_cache.tag=../array_cache \
- glapi.tag=../glapi \
- math.tag=../math \
- shader.tag=../shader \
- swrast.tag=../swrast \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl
-GENERATE_TAGFILE = main.tag
diff --git a/doxygen/math.doxy b/doxygen/math.doxy
deleted file mode 100644
index 72ec2e3cd26..00000000000
--- a/doxygen/math.doxy
+++ /dev/null
@@ -1,49 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa math module"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/math/
-FILE_PATTERNS = *.c \
- *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = math
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = tnl_dd.tag=../tnl_dd \
- main.tag=../core \
- swrast.tag=../swrast \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl \
- array_cache.tag=../array_cache
-GENERATE_TAGFILE = math.tag
diff --git a/doxygen/math_subset.doxy b/doxygen/math_subset.doxy
deleted file mode 100644
index 9f6e95ff62b..00000000000
--- a/doxygen/math_subset.doxy
+++ /dev/null
@@ -1,177 +0,0 @@
-# Doxyfile 0.1
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa math module"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY = .
-OUTPUT_LANGUAGE = English
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-INTERNAL_DOCS = NO
-STRIP_CODE_COMMENTS = YES
-CASE_SENSE_NAMES = YES
-SHORT_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-VERBATIM_HEADERS = YES
-SHOW_INCLUDE_FILES = YES
-JAVADOC_AUTOBRIEF = NO
-INHERIT_DOCS = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-ALIASES =
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-OPTIMIZE_OUTPUT_FOR_C = YES
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = NO
-WARN_FORMAT =
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/math/
-FILE_PATTERNS = m_matrix.[ch]
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = math_subset
-HTML_HEADER = header_subset.html
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT =
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT =
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT =
-MAN_EXTENSION =
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = core_subset.tag=../core_subset
-GENERATE_TAGFILE = math_subset.tag
-ALLEXTERNALS = NO
-PERL_PATH =
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-TEMPLATE_RELATIONS = YES
-HIDE_UNDOC_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-GRAPHICAL_HIERARCHY = YES
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
-CGI_NAME =
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH =
-EXT_DOC_PATHS =
diff --git a/doxygen/miniglx.doxy b/doxygen/miniglx.doxy
deleted file mode 100644
index 61c376caf20..00000000000
--- a/doxygen/miniglx.doxy
+++ /dev/null
@@ -1,179 +0,0 @@
-# Doxyfile 0.1
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "MiniGLX"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY =
-OUTPUT_LANGUAGE = English
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-INTERNAL_DOCS = YES
-STRIP_CODE_COMMENTS = YES
-CASE_SENSE_NAMES = YES
-SHORT_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-VERBATIM_HEADERS = NO
-SHOW_INCLUDE_FILES = NO
-JAVADOC_AUTOBRIEF = NO
-INHERIT_DOCS = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-ALIASES =
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-OPTIMIZE_OUTPUT_FOR_C = NO
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = NO
-WARN_FORMAT =
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/glx/mini/ ../include/GL/miniglx.h
-FILE_PATTERNS = *.h *.c
-RECURSIVE = NO
-EXCLUDE = ../src/glx/mini/glapi.c
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = miniglx
-HTML_HEADER = header_subset.html
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT =
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT =
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT =
-MAN_EXTENSION =
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = \
- core_subset.tag=../core_subset \
- math_subset.tag=../math_subset
-GENERATE_TAGFILE = miniglx.tag
-ALLEXTERNALS = NO
-PERL_PATH =
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-TEMPLATE_RELATIONS = YES
-HIDE_UNDOC_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-GRAPHICAL_HIERARCHY = YES
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
-CGI_NAME =
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH =
-EXT_DOC_PATHS =
diff --git a/doxygen/radeon_subset.doxy b/doxygen/radeon_subset.doxy
deleted file mode 100644
index fb9d0e9535a..00000000000
--- a/doxygen/radeon_subset.doxy
+++ /dev/null
@@ -1,203 +0,0 @@
-# Doxyfile 0.1
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Radeon Subset Driver"
-PROJECT_NUMBER =
-OUTPUT_DIRECTORY =
-OUTPUT_LANGUAGE = English
-EXTRACT_ALL = NO
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-INTERNAL_DOCS = YES
-STRIP_CODE_COMMENTS = YES
-CASE_SENSE_NAMES = YES
-SHORT_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-VERBATIM_HEADERS = NO
-SHOW_INCLUDE_FILES = NO
-JAVADOC_AUTOBRIEF = NO
-INHERIT_DOCS = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 8
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-ALIASES =
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-OPTIMIZE_OUTPUT_FOR_C = NO
-SHOW_USED_FILES = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = YES
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = NO
-WARN_FORMAT =
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = \
- ../src/mesa/drivers/dri/common/mm.c \
- ../src/mesa/drivers/dri/common/mm.h \
- ../src/mesa/drivers/dri/radeon/radeon_context.c \
- ../src/mesa/drivers/dri/radeon/radeon_context.h \
- ../src/mesa/drivers/dri/radeon/radeon_ioctl.c \
- ../src/mesa/drivers/dri/radeon/radeon_ioctl.h \
- ../src/mesa/drivers/dri/radeon/radeon_lock.c \
- ../src/mesa/drivers/dri/radeon/radeon_lock.h \
- ../src/mesa/drivers/dri/radeon/radeon_screen.c \
- ../src/mesa/drivers/dri/radeon/radeon_screen.h \
- ../src/mesa/drivers/dri/radeon/radeon_state.c \
- ../src/mesa/drivers/dri/radeon/radeon_state.h \
- ../src/mesa/drivers/dri/radeon/radeon_state_init.c \
- ../src/mesa/drivers/dri/radeon/radeon_subset.h \
- ../src/mesa/drivers/dri/radeon/radeon_subset_bitmap.c \
- ../src/mesa/drivers/dri/radeon/radeon_subset_readpix.c \
- ../src/mesa/drivers/dri/radeon/radeon_subset_select.c \
- ../src/mesa/drivers/dri/radeon/radeon_subset_tex.c \
- ../src/mesa/drivers/dri/radeon/radeon_subset_vtx.c \
- ../src/mesa/drivers/dri/radeon/radeon_tcl.h \
- ../src/mesa/drivers/dri/radeon/radeon_tex.h \
- ../src/mesa/drivers/dri/radeon/radeon_vtxfmt.h \
- ../src/mesa/drivers/dri/radeon/server
-FILE_PATTERNS = *.h *.c
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = radeon_subset
-HTML_HEADER = header_subset.html
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT =
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT =
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT =
-MAN_EXTENSION =
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = \
- core_subset.tag=../core_subset \
- math_subset.tag=../math_subset \
- miniglx.tag=../miniglx
-GENERATE_TAGFILE = radeon_subset.tag
-ALLEXTERNALS = NO
-PERL_PATH =
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-TEMPLATE_RELATIONS = YES
-HIDE_UNDOC_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-GRAPHICAL_HIERARCHY = YES
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
-CGI_NAME =
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH =
-EXT_DOC_PATHS =
diff --git a/doxygen/shader.doxy b/doxygen/shader.doxy
deleted file mode 100644
index 44fc7c4cfed..00000000000
--- a/doxygen/shader.doxy
+++ /dev/null
@@ -1,49 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa Vertex and Fragment Program code"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/shader/
-FILE_PATTERNS = *.c *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = shader
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = main.tag=../core \
- math.tag=../math \
- tnl_dd.tag=../tnl_dd \
- swrast.tag=../swrast \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl \
- array_cache.tag=array_cache
-GENERATE_TAGFILE = swrast.tag
diff --git a/doxygen/swrast.doxy b/doxygen/swrast.doxy
deleted file mode 100644
index b0ba953676b..00000000000
--- a/doxygen/swrast.doxy
+++ /dev/null
@@ -1,48 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa Software Rasterization (swrast)"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/swrast/
-FILE_PATTERNS = *.c *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = swrast
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH = ../include/
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = main.tag=../core \
- math.tag=../math \
- tnl_dd.tag=../tnl_dd \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl \
- array_cache.tag=array_cache
-GENERATE_TAGFILE = swrast.tag
diff --git a/doxygen/swrast_setup.doxy b/doxygen/swrast_setup.doxy
deleted file mode 100644
index 9e2d72e36e7..00000000000
--- a/doxygen/swrast_setup.doxy
+++ /dev/null
@@ -1,49 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa swrast_setup"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/swrast_setup/
-FILE_PATTERNS = *.c \
- *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = swrast_setup
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = tnl_dd.tag=../tnl_dd \
- main.tag=../core \
- math.tag=../math \
- swrast.tag=../swrast \
- tnl.tag=../tnl \
- array_cache.tag=../array_cache
-GENERATE_TAGFILE = swrast_setup.tag
diff --git a/doxygen/tnl.doxy b/doxygen/tnl.doxy
deleted file mode 100644
index 67f992f11e8..00000000000
--- a/doxygen/tnl.doxy
+++ /dev/null
@@ -1,50 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa Transform and Lighting (tnl)"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/tnl/
-FILE_PATTERNS = *.c \
- *.h
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = tnl
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = tnl_dd.tag=../tnl \
- main.tag=../core \
- math.tag=../math \
- shader.tag=../shader \
- swrast.tag=../swrast \
- swrast_setup.tag=swrast_setup \
- array_cache.tag=array_cache
-GENERATE_TAGFILE = tnl.tag
diff --git a/doxygen/tnl_dd.doxy b/doxygen/tnl_dd.doxy
deleted file mode 100644
index b7bd6e97440..00000000000
--- a/doxygen/tnl_dd.doxy
+++ /dev/null
@@ -1,49 +0,0 @@
-# Doxyfile 0.1
-
-@INCLUDE = common.doxy
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = "Mesa tnl_dd"
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../src/mesa/tnl_dd/
-FILE_PATTERNS = *.c *.h
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-HTML_OUTPUT = tnl_dd
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES = main.tag=../core \
- math.tag=../math \
- shader.tag=../shader \
- swrast.tag=../swrast \
- swrast_setup.tag=../swrast_setup \
- tnl.tag=../tnl \
- array_cache.tag=array_cache
-GENERATE_TAGFILE = tnl_dd.tag
diff --git a/include/GL/Makefile.am b/include/GL/Makefile.am
deleted file mode 100644
index 199bd5c8f3c..00000000000
--- a/include/GL/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-GLincludedir = $(includedir)/GL
-
-INC_FX = fxmesa.h
-INC_GGI = ggimesa.h
-INC_OSMESA = osmesa.h
-INC_SVGA = svgamesa.h
-INC_X11 = glx.h glxext.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
-INC_GLUT = glut.h glutf90.h
-
-if HAVE_FX
-sel_inc_fx = $(INC_FX)
-endif
-
-if HAVE_GGI
-sel_inc_ggi = $(INC_GGI)
-endif
-
-if HAVE_OSMESA
-sel_inc_osmesa = $(INC_OSMESA)
-endif
-
-if HAVE_SVGA
-sel_inc_svga = $(INC_SVGA)
-endif
-
-if HAVE_X11
-sel_inc_x11 = $(INC_X11)
-endif
-
-if NEED_GLUT
-sel_inc_glut = $(INC_GLUT)
-endif
-
-EXTRA_HEADERS = amesa.h dosmesa.h foomesa.h glut_h.dja mesa_wgl.h mglmesa.h \
- vms_x_fix.h wmesa.h \
- $(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT)
-
-GLinclude_HEADERS = gl.h glext.h gl_mangle.h glu.h glu_mangle.h \
- $(sel_inc_fx) $(sel_inc_ggi) $(sel_inc_osmesa) $(sel_inc_svga) \
- $(sel_inc_x11) $(sel_inc_glut)
-include $(top_srcdir)/common_rules.make
diff --git a/include/GL/foomesa.h b/include/GL/foomesa.h
deleted file mode 100644
index 8517d88388f..00000000000
--- a/include/GL/foomesa.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * Example Foo/Mesa interface. See src/ddsample.c for more info.
- */
-
-
-
-#ifndef FOOMESA_H
-#define FOOMESA_H
-
-
-
-typedef struct foo_mesa_visual *FooMesaVisual;
-
-typedef struct foo_mesa_buffer *FooMesaBuffer;
-
-typedef struct foo_mesa_context *FooMesaContext;
-
-
-
-#ifdef BEOS
-#pragma export on
-#endif
-
-
-extern FooMesaVisual FooMesaChooseVisual( /* your params */ );
-
-extern void FooMesaDestroyVisual( FooMesaVisual visual );
-
-
-extern FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual,
- void *your_window_id );
-
-extern void FooMesaDestroyBuffer( FooMesaBuffer buffer );
-
-
-extern FooMesaContext FooMesaCreateContext( FooMesaVisual visual,
- FooMesaContext sharelist );
-
-extern void FooMesaDestroyContext( FooMesaContext context );
-
-
-extern void FooMesaMakeCurrent( FooMesaContext context, FooMesaBuffer buffer );
-
-
-extern void FooMesaSwapBuffers( FooMesaBuffer buffer );
-
-
-/* Probably some more functions... */
-
-
-#ifdef BEOS
-#pragma export off
-#endif
-
-#endif
diff --git a/include/GL/glut_h.dja b/include/GL/glut_h.dja
deleted file mode 100644
index e76dcb985e3..00000000000
--- a/include/GL/glut_h.dja
+++ /dev/null
@@ -1,340 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.1
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This header file is based on the REAL glut.h by Mark J. Kilgard.
- *
- * The DJGPP/ALLEGRO (DJA) GLUT implementation was written by
- * Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose
- * of compiling all the sample programs (which use GLUT). Therefore,
- * is NOT AT ALL a complete version of GLUT!
- */
-
-
-#ifndef __AGLUT_H__
-#define __AGLUT_H__
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#define GLUTCALLBACK
-#define APIENTRY
-#define GLUTAPI extern
-
-#define GLUT_RGB 0
-#define GLUT_RGBA GLUT_RGB
-#define GLUT_INDEX 1
-#define GLUT_SINGLE 0
-#define GLUT_DOUBLE 2
-#define GLUT_ACCUM 4
-#define GLUT_ALPHA 8
-#define GLUT_DEPTH 16
-#define GLUT_STENCIL 32
-
-/* Mouse buttons. */
-#define GLUT_LEFT_BUTTON 0
-#define GLUT_MIDDLE_BUTTON 1
-#define GLUT_RIGHT_BUTTON 2
-
-/* Mouse button state. */
-#define GLUT_DOWN 0
-#define GLUT_UP 1
-
-/* function keys */
-#define GLUT_KEY_F1 1
-#define GLUT_KEY_F2 2
-#define GLUT_KEY_F3 3
-#define GLUT_KEY_F4 4
-#define GLUT_KEY_F5 5
-#define GLUT_KEY_F6 6
-#define GLUT_KEY_F7 7
-#define GLUT_KEY_F8 8
-#define GLUT_KEY_F9 9
-#define GLUT_KEY_F10 10
-#define GLUT_KEY_F11 11
-#define GLUT_KEY_F12 12
-
-/* directional keys */
-#define GLUT_KEY_LEFT 100
-#define GLUT_KEY_UP 101
-#define GLUT_KEY_RIGHT 102
-#define GLUT_KEY_DOWN 103
-#define GLUT_KEY_PAGE_UP 104
-#define GLUT_KEY_PAGE_DOWN 105
-#define GLUT_KEY_HOME 106
-#define GLUT_KEY_END 107
-#define GLUT_KEY_INSERT 108
-
-/* Entry/exit state. */
-#define GLUT_LEFT 0
-#define GLUT_ENTERED 1
-
-/* Visibility state. */
-#define GLUT_NOT_VISIBLE 0
-#define GLUT_VISIBLE 1
-
-/* Color index component selection values. */
-#define GLUT_RED 0
-#define GLUT_GREEN 1
-#define GLUT_BLUE 2
-
-/* Layers for use. */
-#define GLUT_NORMAL 0
-#define GLUT_OVERLAY 1
-
-/* Stroke font constants (use these in GLUT program). */
-#define GLUT_STROKE_ROMAN ((void*)0)
-#define GLUT_STROKE_MONO_ROMAN ((void*)1)
-
-/* Bitmap font constants (use these in GLUT program). */
-#define GLUT_BITMAP_9_BY_15 ((void*)2)
-#define GLUT_BITMAP_8_BY_13 ((void*)3)
-#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
-#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
-#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
-#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
-#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
-
-/* glutGet parameters. */
-#define GLUT_WINDOW_X 100
-#define GLUT_WINDOW_Y 101
-#define GLUT_WINDOW_WIDTH 102
-#define GLUT_WINDOW_HEIGHT 103
-#define GLUT_WINDOW_BUFFER_SIZE 104
-#define GLUT_WINDOW_STENCIL_SIZE 105
-#define GLUT_WINDOW_DEPTH_SIZE 106
-#define GLUT_WINDOW_RED_SIZE 107
-#define GLUT_WINDOW_GREEN_SIZE 108
-#define GLUT_WINDOW_BLUE_SIZE 109
-#define GLUT_WINDOW_ALPHA_SIZE 110
-#define GLUT_WINDOW_ACCUM_RED_SIZE 111
-#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
-#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
-#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
-#define GLUT_WINDOW_DOUBLEBUFFER 115
-#define GLUT_WINDOW_RGBA 116
-#define GLUT_WINDOW_PARENT 117
-#define GLUT_WINDOW_NUM_CHILDREN 118
-#define GLUT_WINDOW_COLORMAP_SIZE 119
-#define GLUT_WINDOW_NUM_SAMPLES 120
-#define GLUT_WINDOW_STEREO 121
-#define GLUT_WINDOW_CURSOR 122
-#define GLUT_SCREEN_WIDTH 200
-#define GLUT_SCREEN_HEIGHT 201
-#define GLUT_SCREEN_WIDTH_MM 202
-#define GLUT_SCREEN_HEIGHT_MM 203
-#define GLUT_MENU_NUM_ITEMS 300
-#define GLUT_DISPLAY_MODE_POSSIBLE 400
-#define GLUT_INIT_WINDOW_X 500
-#define GLUT_INIT_WINDOW_Y 501
-#define GLUT_INIT_WINDOW_WIDTH 502
-#define GLUT_INIT_WINDOW_HEIGHT 503
-#define GLUT_INIT_DISPLAY_MODE 504
-#define GLUT_ELAPSED_TIME 700
-#define GLUT_WINDOW_FORMAT_ID 123
-
-/* glutDeviceGet parameters. */
-#define GLUT_HAS_KEYBOARD 600
-#define GLUT_HAS_MOUSE 601
-#define GLUT_HAS_SPACEBALL 602
-#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
-#define GLUT_HAS_TABLET 604
-#define GLUT_NUM_MOUSE_BUTTONS 605
-#define GLUT_NUM_SPACEBALL_BUTTONS 606
-#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
-#define GLUT_NUM_DIALS 608
-#define GLUT_NUM_TABLET_BUTTONS 609
-#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
-#define GLUT_DEVICE_KEY_REPEAT 611
-#define GLUT_HAS_JOYSTICK 612
-#define GLUT_OWNS_JOYSTICK 613
-#define GLUT_JOYSTICK_BUTTONS 614
-#define GLUT_JOYSTICK_AXES 615
-#define GLUT_JOYSTICK_POLL_RATE 616
-
-/* glutLayerGet parameters. */
-#define GLUT_OVERLAY_POSSIBLE 800
-#define GLUT_LAYER_IN_USE 801
-#define GLUT_HAS_OVERLAY 802
-#define GLUT_TRANSPARENT_INDEX 803
-#define GLUT_NORMAL_DAMAGED 804
-#define GLUT_OVERLAY_DAMAGED 805
-
-/* glutVideoResizeGet parameters. */
-#define GLUT_VIDEO_RESIZE_POSSIBLE 900
-#define GLUT_VIDEO_RESIZE_IN_USE 901
-#define GLUT_VIDEO_RESIZE_X_DELTA 902
-#define GLUT_VIDEO_RESIZE_Y_DELTA 903
-#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
-#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
-#define GLUT_VIDEO_RESIZE_X 906
-#define GLUT_VIDEO_RESIZE_Y 907
-#define GLUT_VIDEO_RESIZE_WIDTH 908
-#define GLUT_VIDEO_RESIZE_HEIGHT 909
-
-/* glutUseLayer parameters. */
-#define GLUT_NORMAL 0
-#define GLUT_OVERLAY 1
-
-/* glutGetModifiers return mask. */
-#define GLUT_ACTIVE_SHIFT 1
-#define GLUT_ACTIVE_CTRL 2
-#define GLUT_ACTIVE_ALT 4
-
-/* glutSetCursor parameters. */
-/* Basic arrows. */
-#define GLUT_CURSOR_RIGHT_ARROW 0
-#define GLUT_CURSOR_LEFT_ARROW 1
-/* Symbolic cursor shapes. */
-#define GLUT_CURSOR_INFO 2
-#define GLUT_CURSOR_DESTROY 3
-#define GLUT_CURSOR_HELP 4
-#define GLUT_CURSOR_CYCLE 5
-#define GLUT_CURSOR_SPRAY 6
-#define GLUT_CURSOR_WAIT 7
-#define GLUT_CURSOR_TEXT 8
-#define GLUT_CURSOR_CROSSHAIR 9
-/* Directional cursors. */
-#define GLUT_CURSOR_UP_DOWN 10
-#define GLUT_CURSOR_LEFT_RIGHT 11
-/* Sizing cursors. */
-#define GLUT_CURSOR_TOP_SIDE 12
-#define GLUT_CURSOR_BOTTOM_SIDE 13
-#define GLUT_CURSOR_LEFT_SIDE 14
-#define GLUT_CURSOR_RIGHT_SIDE 15
-#define GLUT_CURSOR_TOP_LEFT_CORNER 16
-#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
-#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
-#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
-/* Inherit from parent window. */
-#define GLUT_CURSOR_INHERIT 100
-/* Blank cursor. */
-#define GLUT_CURSOR_NONE 101
-/* Fullscreen crosshair (if available). */
-#define GLUT_CURSOR_FULL_CROSSHAIR 102
-
-/* GLUT initialization sub-API. */
-GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
-GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
-GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
-GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
-GLUTAPI void APIENTRY glutMainLoop(void);
-
-/* GLUT window sub-API. */
-GLUTAPI int APIENTRY glutCreateWindow(const char *title);
-GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
-GLUTAPI void APIENTRY glutDestroyWindow(int win);
-GLUTAPI void APIENTRY glutPostRedisplay(void);
-GLUTAPI void APIENTRY glutSwapBuffers(void);
-GLUTAPI int APIENTRY glutGetWindow(void);
-GLUTAPI void APIENTRY glutSetWindow(int win);
-GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
-GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
-GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
-GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
-GLUTAPI void APIENTRY glutPopWindow(void);
-GLUTAPI void APIENTRY glutPushWindow(void);
-GLUTAPI void APIENTRY glutIconifyWindow(void);
-GLUTAPI void APIENTRY glutShowWindow(void);
-GLUTAPI void APIENTRY glutHideWindow(void);
-
-/* GLUT overlay sub-API. */
-GLUTAPI void APIENTRY glutEstablishOverlay(void);
-GLUTAPI void APIENTRY glutRemoveOverlay(void);
-GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
-GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
-GLUTAPI void APIENTRY glutShowOverlay(void);
-GLUTAPI void APIENTRY glutHideOverlay(void);
-
-/* GLUT menu sub-API. */
-GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int));
-GLUTAPI void APIENTRY glutDestroyMenu(int menu);
-GLUTAPI int APIENTRY glutGetMenu(void);
-GLUTAPI void APIENTRY glutSetMenu(int menu);
-GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
-GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
-GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
-GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
-GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
-GLUTAPI void APIENTRY glutAttachMenu(int button);
-GLUTAPI void APIENTRY glutDetachMenu(int button);
-
-/* GLUT window callback sub-API. */
-GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
-GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
-GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
-GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
-GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
-GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
-GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
-GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
-GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
-GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
-GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
-GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
-GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
-GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
-GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
-
-/* GLUT color index sub-API. */
-GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
-GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
-GLUTAPI void APIENTRY glutCopyColormap(int win);
-
-/* GLUT state retrieval sub-API. */
-GLUTAPI int APIENTRY glutGet(GLenum type);
-GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
-
-/* GLUT font sub-API */
-GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
-GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
-GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
-GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
-
-/* GLUT pre-built models sub-API */
-GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutWireCube(GLdouble size);
-GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
-GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-GLUTAPI void APIENTRY glutWireDodecahedron(void);
-GLUTAPI void APIENTRY glutSolidDodecahedron(void);
-GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
-GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
-GLUTAPI void APIENTRY glutWireOctahedron(void);
-GLUTAPI void APIENTRY glutSolidOctahedron(void);
-GLUTAPI void APIENTRY glutWireTetrahedron(void);
-GLUTAPI void APIENTRY glutSolidTetrahedron(void);
-GLUTAPI void APIENTRY glutWireIcosahedron(void);
-GLUTAPI void APIENTRY glutSolidIcosahedron(void);
-
-#endif /* __AGLUT_H__ */
diff --git a/include/GL/miniglx.h b/include/GL/miniglx.h
deleted file mode 100644
index 8c6180be60b..00000000000
--- a/include/GL/miniglx.h
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.1
- *
- * Copyright (C) 1999-2004 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 miniglx.h
- * \brief Mini GLX interface functions.
- * \author Brian Paul
- *
- * See comments miniglx.c for more information.
- */
-
-#ifndef MINIGLX_H
-#define MINIGLX_H
-
-#include <GL/gl.h>
-#include <stdlib.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * \name Replacement Xlib/GLX types
- */
-/*@{*/
-/**
- * \brief Boolean type.
- *
- * It can have the values #True or #False.
- */
-#ifndef MINIGLX_NO_XTYPES
-typedef int Bool;
-#endif
-typedef int MINI_Bool;
-
-/**
- * \brief Color map.
- *
- * Alias for private ::MiniGLXColormapRec structure.
- */
-typedef struct MiniGLXColormapRec *MINI_Colormap;
-#ifndef MINIGLX_NO_XTYPES
-typedef struct MiniGLXColormapRec *Colormap;
-#endif
-
-/**
- * \brief Window attributes.
- */
-typedef struct MiniGLXSetWindowAttributesRec {
- int background_pixel; /**< \brief background pixel */
- int border_pixel; /**< \brief border pixel value */
- MINI_Colormap colormap; /**< \brief color map to be associated with window */
- int event_mask; /**< \brief set of events that should be saved */
-} XSetWindowAttributes;
-
-/**
- * \brief Visual.
- *
- * Alias for the private ::MiniGLXVisualRec structure.
- *
- * \sa \ref datatypes.
- */
-typedef struct MiniGLXVisualRec Visual;
-
-/**
- * \brief Visual information.
- *
- * \sa \ref datatypes.
- */
-#ifndef MINIGLX_NO_XTYPES
-typedef unsigned long VisualID;
-#endif
-typedef unsigned long MINI_VisualID;
-typedef struct MiniGLXXVisualInfoRec {
- Visual *visual; /**< \brief pointer to the GLX Visual */
- MINI_VisualID visualid; /**< \brief visual ID */
- int screen; /**< \brief screen number */
- int depth; /**< \brief bit depth */
-#if defined(__cplusplus) || defined(c_plusplus)
- int c_class; /**< \brief class */
-#else
- int class; /**< \brief class */
-#endif
- int bits_per_rgb; /**< \brief total bits per pixel */
-} XVisualInfo;
-
-/**
- * \brief GLX Frame Buffer Configuration (for pbuffers)
- * \sa \ref datatypes.
- */
-typedef struct MiniGLXFBConfigRec {
- XVisualInfo *visInfo;
-} GLXFBConfig;
-
-
-/**
- * \brief Display handle.
- *
- * Alias for the private ::MiniGLXDisplayRec structure.
- *
- * \sa \ref datatypes.
- */
-#ifndef MINIGLX_NO_XTYPES
-typedef struct MiniGLXDisplayRec Display;
-#endif
-typedef struct MiniGLXDisplayRec MINI_Display;
-
-/**
- * \brief Window handle.
- *
- * Alias for the private ::MiniGLXWindowRec structure.
- *
- * \sa \ref datatypes.
- */
-#ifndef MINIGLX_NO_XTYPES
-typedef struct MiniGLXWindowRec *Window;
-#endif
-typedef struct MiniGLXWindowRec *MINI_Window;
-
-/**
- * \brief Drawable.
- *
- * Alias for the private ::MiniGLXWindowRec structure.
- *
- * For Mini GLX only the full-screen window can be used as source and
- * destination in graphics operations.
- *
- * \sa \ref datatypes.
- */
-#ifndef MINIGLX_NO_XTYPES
-typedef struct MiniGLXWindowRec *Drawable;
-#endif
-typedef struct MiniGLXWindowRec *MINI_Drawable;
-
-/**
- * \brief GLX drawable.
- *
- * Alias for the private ::MiniGLXWindowRec structure.
- *
- * Same as #Drawable.
- *
- * \sa \ref datatypes.
- */
-typedef struct MiniGLXWindowRec *GLXDrawable;
-
-/**
- * \brief GLX pbuffer.
- *
- * Alias for the private ::MiniGLXWindowRec structure.
- *
- * Same as #Drawable.
- *
- * \sa \ref datatypes.
- */
-typedef struct MiniGLXWindowRec *GLXPbuffer;
-
-/**
- * \brief GLX context.
- *
- * Alias for the private ::MiniGLXContext structure.
- *
- * \sa \ref datatypes.
- */
-typedef struct MiniGLXContextRec *GLXContext;
-/*@}*/
-
-
-typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- MINI_Bool send_event; /* true if this came from a SendEvent request */
- MINI_Display *display; /* Display the event was read from */
- MINI_Window window;
- int x, y;
- int width, height;
- int count; /* if non-zero, at least this many more */
-} XExposeEvent;
-
-typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- MINI_Bool send_event; /* true if this came from a SendEvent request */
- MINI_Display *display; /* Display the event was read from */
- MINI_Window parent; /* parent of the window */
- MINI_Window window; /* window id of window created */
- int x, y; /* window location */
- int width, height; /* size of window */
- int border_width; /* border width */
- MINI_Bool override_redirect; /* creation should be overridden */
-} XCreateWindowEvent;
-
-typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- MINI_Bool send_event; /* true if this came from a SendEvent request */
- MINI_Display *display; /* Display the event was read from */
- MINI_Window event;
- MINI_Window window;
-} XDestroyWindowEvent;
-
-typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- MINI_Bool send_event; /* true if this came from a SendEvent request */
- MINI_Display *display; /* Display the event was read from */
- MINI_Window event;
- MINI_Window window;
- MINI_Bool from_configure;
-} XUnmapEvent;
-
-typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- MINI_Bool send_event; /* true if this came from a SendEvent request */
- MINI_Display *display; /* Display the event was read from */
- MINI_Window event;
- MINI_Window window;
- MINI_Bool override_redirect; /* boolean, is override set... */
-} XMapEvent;
-
-
-typedef struct {
- int type;
- unsigned long serial; /* # of last request processed by server */
- MINI_Bool send_event; /* true if this came from a SendEvent request */
- MINI_Display *display; /* Display the event was read from */
- MINI_Window parent;
- MINI_Window window;
-} XMapRequestEvent;
-
-typedef union _XEvent {
- int type; /* must not be changed; first element */
- XExposeEvent xexpose;
- XCreateWindowEvent xcreatewindow;
- XDestroyWindowEvent xdestroywindow;
- XUnmapEvent xunmap;
- XMapEvent xmap;
- XMapRequestEvent xmaprequest;
- long pad[24];
-} XEvent;
-
-
-/**
- * \name Xlib constants
- */
-/*@{*/
-#define False 0
-#define True 1
-#define None 0
-#define AllocNone 0
-#define InputOutput 1
-#define ExposureMask (1L<<15)
-#define StructureNotifyMask (1L<<17)
-#define CWBackPixel (1L<<1)
-#define CWBorderPixel (1L<<3)
-#define CWEventMask (1L<<11)
-#define CWColormap (1L<<13)
-#define PseudoColor 3
-#define TrueColor 4
-#define VisualIDMask 0x1
-#define VisualScreenMask 0x2
-#define Expose 12
-#define CreateNotify 16
-#define DestroyNotify 17
-#define UnmapNotify 18
-#define MapNotify 19
-#define MapRequest 20
-
-/*@}*/
-
-/**
- * \name Standard GLX tokens
- */
-/*@{*/
-#define GLX_USE_GL 1
-#define GLX_BUFFER_SIZE 2
-#define GLX_LEVEL 3
-#define GLX_RGBA 4
-#define GLX_DOUBLEBUFFER 5
-#define GLX_STEREO 6
-#define GLX_AUX_BUFFERS 7
-#define GLX_RED_SIZE 8
-#define GLX_GREEN_SIZE 9
-#define GLX_BLUE_SIZE 10
-#define GLX_ALPHA_SIZE 11
-#define GLX_DEPTH_SIZE 12
-#define GLX_STENCIL_SIZE 13
-#define GLX_ACCUM_RED_SIZE 14
-#define GLX_ACCUM_GREEN_SIZE 15
-#define GLX_ACCUM_BLUE_SIZE 16
-#define GLX_ACCUM_ALPHA_SIZE 17
-#define GLX_BAD_ATTRIBUTE 1
-#define GLX_BAD_VISUAL 4
-/*@}*/
-
-
-/**
- * \name Unique to Mini GLX
- *
- * At compile time, the Mini GLX interface version can be tested with the
- * MINI_GLX_VERSION_1_x preprocessor tokens.
- *
- * \sa glXQueryVersion()
- */
-/*@{*/
-/** \brief Defined if version 1.0 of Mini GLX is supported. */
-#define MINI_GLX_VERSION_1_0 1
-/** \brief Defined if version 1.1 of Mini GLX is supported. */
-#define MINI_GLX_VERSION_1_1 1
-/*@}*/
-
-
-/**
- * \name Server-specific functions
- */
-extern MINI_Display *
-__miniglx_StartServer( const char *display_name );
-
-extern int
-__miniglx_Select( MINI_Display *dpy, int maxfd,
- fd_set *rfds, fd_set *wfds, fd_set *xfds,
- struct timeval *tv );
-
-
-/**
- * \name Simulated Xlib functions
- */
-/*@{*/
-extern MINI_Display *
-XOpenDisplay( const char *dpy_name );
-
-
-extern void
-XCloseDisplay( MINI_Display *display );
-
-extern MINI_Window
-XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y,
- unsigned int width, unsigned int height,
- unsigned int border_width, int depth, unsigned int winclass,
- Visual *visual, unsigned long valuemask,
- XSetWindowAttributes *attributes );
-
-extern int
-XNextEvent(MINI_Display *display, XEvent *event_return);
-
-extern MINI_Bool
-XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return );
-
-/**
- * \brief Return the root window.
- *
- * \param display the display handle. It is ignored by Mini GLX, but should be
- * the value returned by XOpenDisplay().
- * \param screen the screen number on the host server. It is ignored by Mini
- * GLX but should be zero.
- *
- * \return the root window. Always zero on Mini GLX.
- */
-#define RootWindow(display, screen) 0
-#define DefaultScreen(dpy) 0
-
-extern void
-XDestroyWindow( MINI_Display *display, MINI_Window w );
-
-extern void
-XMapWindow( MINI_Display *display, MINI_Window w );
-
-/* Should clients have access to this?
- */
-extern void
-XUnmapWindow( MINI_Display *display, MINI_Window w );
-
-extern MINI_Colormap
-XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc );
-
-extern void
-XFreeColormap( MINI_Display *display, MINI_Colormap cmap );
-
-extern void
-XFree( void *data );
-
-extern XVisualInfo *
-XGetVisualInfo( MINI_Display *display, long vinfo_mask,
- XVisualInfo *vinfo_template, int *nitems_return );
-/*@}*/
-
-
-
-/**
- * \name GLX functions
- */
-/*@{*/
-extern XVisualInfo*
-glXChooseVisual( MINI_Display *dpy, int screen, int *attribList );
-
-extern int
-glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value );
-
-extern GLXContext
-glXCreateContext( MINI_Display *dpy, XVisualInfo *vis,
- GLXContext shareList, MINI_Bool direct );
-
-extern void
-glXDestroyContext( MINI_Display *dpy, GLXContext ctx );
-
-extern MINI_Bool
-glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx);
-
-extern void
-glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable );
-
-extern GLXContext
-glXGetCurrentContext( void );
-
-extern GLXDrawable
-glXGetCurrentDrawable( void );
-
-extern void
-(*glXGetProcAddress(const GLubyte *procname))( void );
-
-extern MINI_Bool
-glXQueryVersion( MINI_Display *dpy, int *major, int *minor );
-
-/* Added in MiniGLX 1.1 */
-extern GLXPbuffer
-glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList );
-
-extern void
-glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf );
-
-extern GLXFBConfig *
-glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList,
- int *nitems );
-
-extern XVisualInfo *
-glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config );
-
-extern void *glXAllocateMemoryMESA(Display *dpy, int scrn,
- size_t size, float readFreq,
- float writeFreq, float priority);
-
-extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
-
-extern GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
- const void *pointer );
-/*@}*/
-
-extern void
-__glXScrEnableExtension( void *, const char * name );
-
-/*@}*/
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MINIGLX_H */
diff --git a/include/GLES/egl.h b/include/GLES/egl.h
deleted file mode 100644
index f18c86ca62d..00000000000
--- a/include/GLES/egl.h
+++ /dev/null
@@ -1,324 +0,0 @@
-#ifndef _EGL_H
-#define _EGL_H
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.0 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: The application programming interfaces
-** established by SGI in conjunction with the Original Code are The
-** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
-** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
-** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
-** Window System(R) (Version 1.3), released October 19, 1998. This software
-** was created using the OpenGL(R) version 1.2.1 Sample Implementation
-** published by SGI, but has not been independently verified as being
-** compliant with the OpenGL(R) version 1.2.1 Specification.
-*/
-
-#if 0/*XXX TEMPORARY HACK*/
-#include <GLES/gl.h>
-#else
-#include <GL/gl.h>
-#endif
-#include <GLES/egltypes.h>
-
-/* XXX should go in eglext.h */
-#define GL_OES_VERSION_1_0 1
-#define GL_OES_read_format 1
-#define GL_OES_compressed_paletted_texture 1
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-/* XXX */
-
-/*
-** Versioning and extensions
-*/
-#define EGL_VERSION_1_0 1
-#define EGL_VERSION_1_1 1
-
-/*
-** Boolean
-*/
-#define EGL_FALSE 0
-#define EGL_TRUE 1
-
-/*
-** Errors
-*/
-#define EGL_SUCCESS 0x3000
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-#define EGL_CONTEXT_LOST 0x300E
-/* 0x300F - 0x301F reserved for additional errors. */
-
-/*
-** Config attributes
-*/
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE 0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-/*#define EGL_PRESERVED_RESOURCES 0x3030*/
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-#define EGL_NONE 0x3038 /* Also a config value */
-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
-#define EGL_MIN_SWAP_INTERVAL 0x303B
-#define EGL_MAX_SWAP_INTERVAL 0x303C
-
-/*
-** Config values
-*/
-#define EGL_DONT_CARE ((EGLint) -1)
-
-#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
-#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */
-#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
-#define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */
-#define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */
-#define EGL_TEXTURE_RGBA 0x305E /* " */
-#define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */
-
-/*
-** Config attribute mask bits
-*/
-#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */
-#define EGL_PIXMAP_BIT 0x02 /* " */
-#define EGL_WINDOW_BIT 0x04 /* " */
-
-/*
-** String names
-*/
-#define EGL_VENDOR 0x3053 /* eglQueryString target */
-#define EGL_VERSION 0x3054 /* " */
-#define EGL_EXTENSIONS 0x3055 /* " */
-
-/*
-** Surface attributes
-*/
-#define EGL_HEIGHT 0x3056
-#define EGL_WIDTH 0x3057
-#define EGL_LARGEST_PBUFFER 0x3058
-#define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */
-#define EGL_TEXTURE_TARGET 0x3081 /* " */
-#define EGL_MIPMAP_TEXTURE 0x3082 /* " */
-#define EGL_MIPMAP_LEVEL 0x3083 /* " */
-
-/*
-** BindTexImage / ReleaseTexImage buffer target
-*/
-#define EGL_BACK_BUFFER 0x3084
-
-/*
-** Current surfaces
-*/
-#define EGL_DRAW 0x3059
-#define EGL_READ 0x305A
-
-/*
-** Engines
-*/
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-
-/* 0x305C-0x3FFFF reserved for future use */
-
-/*
-** Functions
-*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-GLAPI EGLint APIENTRY eglGetError (void);
-
-GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display);
-GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
-GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy);
-GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
-GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))(void);
-
-GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-
-GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
-GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
-GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
-GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-
-/* EGL 1.1 render-to-texture APIs */
-GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-
-/* EGL 1.1 swap control API */
-GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
-
-GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
-GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
-GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-GLAPI EGLContext APIENTRY eglGetCurrentContext (void);
-GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw);
-GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void);
-GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-
-GLAPI EGLBoolean APIENTRY eglWaitGL (void);
-GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
-GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
-GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
-
-
-
-/* EGL_MESA_screen extension >>> PRELIMINARY <<< */
-#ifndef EGL_MESA_screen_surface
-#define EGL_MESA_screen_surface 1
-
-#define EGL_BAD_SCREEN_MESA 0x4000
-#define EGL_BAD_MODE_MESA 0x4001
-#define EGL_SCREEN_COUNT_MESA 0x4002
-#define EGL_SCREEN_POSITION_MESA 0x4003
-#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004
-#define EGL_MODE_ID_MESA 0x4005
-#define EGL_REFRESH_RATE_MESA 0x4006
-#define EGL_OPTIMAL_MESA 0x4007
-#define EGL_INTERLACED_MESA 0x4008
-#define EGL_SCREEN_BIT_MESA 0x08
-
-GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-GLAPI EGLBoolean APIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
-GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-GLAPI EGLBoolean APIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-GLAPI const char * APIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
-
-#endif /* EGL_MESA_screen_surface */
-
-
-#ifndef EGL_MESA_copy_context
-#define EGL_MESA_copy_context 1
-
-GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
-
-#endif /* EGL_MESA_copy_context */
-
-
-/* XXX this is preliminary! */
-#ifndef EGL_VERSION_1_2
-#define EGL_VERSION_1_2 1
-
-typedef int EGLenum;
-typedef int EGLClientBuffer;
-
-#define EGL_DISPLAY_SCALING 10000
-#define EGL_UNKNOWN ((EGLint)-1)
-
-#define EGL_OPENGL_ES_BIT 0x1
-#define EGL_OPENVG_BIT 0x2
-
-#define EGL_OPENGL_ES_API 0x30A0
-#define EGL_OPENVG_API 0x30A1
-
-#define EGL_LUMINANCE_SIZE 0x303D
-#define EGL_ALPHA_MASK_SIZE 0x303E
-#define EGL_COLOR_BUFFER_TYPE 0x303F
-#define EGL_RENDERABLE_TYPE 0x3040
-
-#define EGL_SINGLE_BUFFER 0x3085
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_COLORSPACE 0x3087
-#define EGL_ALPHA_FORMAT 0x3088
-#define EGL_COLORSPACE_sRGB 0x3089
-#define EGL_COLORSPACE_LINEAR 0x308A
-#define EGL_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_ALPHA_FORMAT_PRE 0x308C
-#define EGL_CLIENT_APIS 0x308D
-#define EGL_RGB_BUFFER 0x308E
-#define EGL_LUMINANCE_BUFFER 0x308F
-#define EGL_HORIZONTAL_RESOLUTION 0x3090
-#define EGL_VERTICAL_RESOLUTION 0x3091
-#define EGL_PIXEL_ASPECT_RATIO 0x3092
-#define EGL_SWAP_BEHAVIOR 0x3093
-#define EGL_BUFFER_PRESERVED 0x3094
-#define EGL_BUFFER_DESTROYED 0x3095
-#define EGL_OPENVG_IMAGE 0x3096
-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
-
-GLAPI EGLBoolean APIENTRY eglBindAPI(EGLenum api);
-GLAPI EGLenum APIENTRY eglQueryAPI(void);
-GLAPI EGLBoolean APIENTRY eglWaitClient(void);
-GLAPI EGLBoolean APIENTRY eglReleaseThread(void);
-GLAPI EGLSurface APIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-
-#endif /* EGL_VERSION_1_2 */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _EGL_H */
diff --git a/include/GLES/egltypes.h b/include/GLES/egltypes.h
deleted file mode 100644
index 65cba8d5793..00000000000
--- a/include/GLES/egltypes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-** egltypes.h for Mesa
-**
-** ONLY egl.h SHOULD INCLUDE THIS FILE!
-**
-** See comments about egltypes.h in the standard egl.h file.
-*/
-
-
-#include <sys/types.h>
-
-
-/*
-** These opaque EGL types are implemented as unsigned 32-bit integers:
-*/
-typedef u_int32_t EGLDisplay;
-typedef u_int32_t EGLConfig;
-typedef u_int32_t EGLSurface;
-typedef u_int32_t EGLContext;
-
-/* EGL_MESA_screen_surface */
-typedef u_int32_t EGLModeMESA;
-typedef u_int32_t EGLScreenMESA;
-
-
-/*
-** Other basic EGL types:
-*/
-typedef u_int8_t EGLBoolean;
-typedef int32_t EGLint;
-
-typedef void * NativeDisplayType;
-typedef int NativePixmapType;
-typedef int NativeWindowType;
-
-/*
-** EGL and native handle null values:
-*/
-#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0)
-#define EGL_NO_CONTEXT ((EGLContext) 0)
-#define EGL_NO_DISPLAY ((EGLDisplay) 0)
-#define EGL_NO_SURFACE ((EGLSurface) 0)
-
-/* EGL_MESA_screen_surface */
-#define EGL_NO_MODE_MESA ((EGLModeMESA) 0)
diff --git a/progs/demos/.cvsignore b/progs/demos/.cvsignore
deleted file mode 100644
index f764b3d117e..00000000000
--- a/progs/demos/.cvsignore
+++ /dev/null
@@ -1,48 +0,0 @@
-.cvsignore
-arbfplight
-arbocclude
-bounce
-clearspd
-cubemap
-drawpix
-fire
-fplight
-gamma
-gears
-geartrain
-glinfo
-gloss
-gltestperf
-glutfx
-ipers
-isosurf
-lodbias
-morph3d
-multiarb
-occlude
-osdemo
-paltex
-pixeltex
-pointblast
-ray
-readpix
-readtex.c
-readtex.h
-reflect
-renormal
-shadowtex
-showbuffer.c
-showbuffer.h
-spectex
-stex3d
-teapot
-terrain
-tessdemo
-texcyl
-texdown
-texenv
-texobj
-trispd
-tunnel
-tunnel2
-winpos
diff --git a/progs/demos/Windows/all.dsp b/progs/demos/Windows/all.dsp
deleted file mode 100644
index b47283c5882..00000000000
--- a/progs/demos/Windows/all.dsp
+++ /dev/null
@@ -1,101 +0,0 @@
-# Microsoft Developer Studio Project File - Name="all" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=all - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "all.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "all.mak" CFG="all - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "all - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "all - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "all - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
-
-!ELSEIF "$(CFG)" == "all - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "all - Win32 Release"
-# Name "all - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/bounce.dsp b/progs/demos/Windows/bounce.dsp
deleted file mode 100644
index 0510e77d994..00000000000
--- a/progs/demos/Windows/bounce.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="bounce" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=bounce - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "bounce.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "bounce.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "bounce - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "bounce - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "bounce - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../bounce.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "bounce - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../bounce.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "bounce - Win32 Release"
-# Name "bounce - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\bounce.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/clearspd.dsp b/progs/demos/Windows/clearspd.dsp
deleted file mode 100644
index 440c7ae64e9..00000000000
--- a/progs/demos/Windows/clearspd.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="clearspd" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=clearspd - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "clearspd.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "clearspd.mak" CFG="clearspd - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "clearspd - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "clearspd - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "clearspd - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../clearspd.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "clearspd - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../clearspd.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "clearspd - Win32 Release"
-# Name "clearspd - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\clearspd.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/cubemap.dsp b/progs/demos/Windows/cubemap.dsp
deleted file mode 100644
index 220a3a0df61..00000000000
--- a/progs/demos/Windows/cubemap.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="cubemap" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=cubemap - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "cubemap.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "cubemap.mak" CFG="cubemap - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "cubemap - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "cubemap - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "cubemap - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../cubemap.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "cubemap - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../cubemap.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "cubemap - Win32 Release"
-# Name "cubemap - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\cubemap.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/demos.dsw b/progs/demos/Windows/demos.dsw
deleted file mode 100644
index 2d6f629e07a..00000000000
--- a/progs/demos/Windows/demos.dsw
+++ /dev/null
@@ -1,782 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "all"=".\all.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name bounce
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name clearspd
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name cubemap
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name drawpix
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name fire
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name gears
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name geartrain
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name glinfo
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name gloss
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name gltestperf
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name glutfx
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name ipers
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name isosurf
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name lodbias
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name morph3d
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name multiarb
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name occlude
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name osdemo
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name paltex
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name pixeltex
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name pointblast
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name rain
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name ray
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name readpix
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name reflect
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name renormal
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name shadowtex
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name spectex
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name stex3d
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name teapot
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name terrain
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name tessdemo
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name texcyl
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name texdown
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name texenv
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name texobj
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name trispd
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name tunnel
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name tunnel2
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name winpos
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name spriteblast
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "bounce"=".\bounce.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "clearspd"=".\clearspd.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "cubemap"=".\cubemap.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "drawpix"=".\drawpix.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "fire"=".\fire.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "gears"=".\gears.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "geartrain"=".\geartrain.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "glinfo"=".\glinfo.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "gloss"=".\gloss.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "gltestperf"=".\gltestperf.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "glut"="..\..\..\src\glut\glx\glut.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "glutfx"=".\glutfx.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "ipers"=".\ipers.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "isosurf"=".\isosurf.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "lodbias"=".\loadbias.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "morph3d"=".\morph3d.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "multiarb"=".\multiarb.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "occlude"=".\occlude.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "osdemo"=".\osdemo.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "paltex"=".\paltex.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "pixeltex"=".\pixeltex.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "pointblast"=".\pointblast.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "rain"=".\rain.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "ray"=".\ray.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "readpix"=".\readpix.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "reflect"=".\reflect.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "renormal"=".\renormal.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "shadowtex"=".\shadowtex.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "spectex"=".\spectex.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "spriteblast"=".\spriteblast.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "stex3d"=".\stex3d.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "teapot"=".\teapot.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "terrain"=".\terrain.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "tessdemo"=".\tessdemo.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "texcyl"=".\texcyl.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "texdown"=".\texdown.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "texenv"=".\texenv.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "texobj"=".\texobj.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "trispd"=".\trispd.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "tunnel"=".\tunnel.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "tunnel2"=".\tunnel2.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "winpos"=".\winpos.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name glut
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/progs/demos/Windows/drawpix.dsp b/progs/demos/Windows/drawpix.dsp
deleted file mode 100644
index 57003e616b4..00000000000
--- a/progs/demos/Windows/drawpix.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="drawpix" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=drawpix - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "drawpix.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "drawpix.mak" CFG="drawpix - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "drawpix - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "drawpix - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "drawpix - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../" /I "../../../include" /I "../../util" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../drawpix.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "drawpix - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../drawpix.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "drawpix - Win32 Release"
-# Name "drawpix - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\drawpix.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/fire.dsp b/progs/demos/Windows/fire.dsp
deleted file mode 100644
index f8a536d3349..00000000000
--- a/progs/demos/Windows/fire.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="fire" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=fire - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "fire.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "fire.mak" CFG="fire - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "fire - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "fire - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "fire - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../fire.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "fire - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../fire.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "fire - Win32 Release"
-# Name "fire - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\fire.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/gears.dsp b/progs/demos/Windows/gears.dsp
deleted file mode 100644
index 43a588dc68d..00000000000
--- a/progs/demos/Windows/gears.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gears" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=gears - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gears.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gears.mak" CFG="gears - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gears - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "gears - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gears - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gears.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "gears - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gears.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "gears - Win32 Release"
-# Name "gears - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\gears.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/geartrain.dsp b/progs/demos/Windows/geartrain.dsp
deleted file mode 100644
index 8dee77de4d5..00000000000
--- a/progs/demos/Windows/geartrain.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="geartrain" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=geartrain - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "geartrain.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "geartrain.mak" CFG="geartrain - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "geartrain - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "geartrain - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "geartrain - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../geartrain.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "geartrain - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../geartrain.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "geartrain - Win32 Release"
-# Name "geartrain - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\geartrain.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/glinfo.dsp b/progs/demos/Windows/glinfo.dsp
deleted file mode 100644
index d9d61eb424d..00000000000
--- a/progs/demos/Windows/glinfo.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="glinfo" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=glinfo - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "glinfo.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "glinfo.mak" CFG="glinfo - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "glinfo - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "glinfo - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "glinfo - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../glinfo.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "glinfo - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../glinfo.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "glinfo - Win32 Release"
-# Name "glinfo - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\glinfo.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/gloss.dsp b/progs/demos/Windows/gloss.dsp
deleted file mode 100644
index 402d291f4dc..00000000000
--- a/progs/demos/Windows/gloss.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gloss" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=gloss - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gloss.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gloss.mak" CFG="gloss - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gloss - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "gloss - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gloss - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gloss.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "gloss - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gloss.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "gloss - Win32 Release"
-# Name "gloss - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\gloss.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/gltestperf.dsp b/progs/demos/Windows/gltestperf.dsp
deleted file mode 100644
index e5066201522..00000000000
--- a/progs/demos/Windows/gltestperf.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="gltestperf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=gltestperf - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "gltestperf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "gltestperf.mak" CFG="gltestperf - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gltestperf - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "gltestperf - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "gltestperf - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gltestperf.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "gltestperf - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gltestperf.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "gltestperf - Win32 Release"
-# Name "gltestperf - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\gltestperf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/glutfx.dsp b/progs/demos/Windows/glutfx.dsp
deleted file mode 100644
index 90eca930d22..00000000000
--- a/progs/demos/Windows/glutfx.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="glutfx" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=glutfx - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "glutfx.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "glutfx.mak" CFG="glutfx - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "glutfx - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "glutfx - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "glutfx - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../glutfx.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "glutfx - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../glutfx.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "glutfx - Win32 Release"
-# Name "glutfx - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\glutfx.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/ipers.dsp b/progs/demos/Windows/ipers.dsp
deleted file mode 100644
index 430f1b6258d..00000000000
--- a/progs/demos/Windows/ipers.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ipers" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=ipers - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ipers.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ipers.mak" CFG="ipers - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ipers - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "ipers - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ipers - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../ipers.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "ipers - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../ipers.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "ipers - Win32 Release"
-# Name "ipers - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\ipers.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/isosurf.dsp b/progs/demos/Windows/isosurf.dsp
deleted file mode 100644
index 1c59d40081e..00000000000
--- a/progs/demos/Windows/isosurf.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="isosurf" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=isosurf - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "isosurf.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "isosurf.mak" CFG="isosurf - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "isosurf - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "isosurf - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "isosurf - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../isosurf.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "isosurf - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../isosurf.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "isosurf - Win32 Release"
-# Name "isosurf - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\isosurf.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/loadbias.dsp b/progs/demos/Windows/loadbias.dsp
deleted file mode 100644
index ed51960e493..00000000000
--- a/progs/demos/Windows/loadbias.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="lodbias" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=lodbias - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "lodbias.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "lodbias.mak" CFG="lodbias - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "lodbias - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "lodbias - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "lodbias - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../lodbias.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "lodbias - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../lodbias.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "lodbias - Win32 Release"
-# Name "lodbias - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\lodbias.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/morph3d.dsp b/progs/demos/Windows/morph3d.dsp
deleted file mode 100644
index 247dbf03d7a..00000000000
--- a/progs/demos/Windows/morph3d.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="morph3d" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=morph3d - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "morph3d.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "morph3d.mak" CFG="morph3d - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "morph3d - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "morph3d - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "morph3d - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../morph3d.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "morph3d - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../morph3d.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "morph3d - Win32 Release"
-# Name "morph3d - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\morph3d.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/multiarb.dsp b/progs/demos/Windows/multiarb.dsp
deleted file mode 100644
index 57c32deb294..00000000000
--- a/progs/demos/Windows/multiarb.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="multiarb" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=multiarb - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "multiarb.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "multiarb.mak" CFG="multiarb - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "multiarb - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "multiarb - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "multiarb - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../multiarb.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "multiarb - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../multiarb.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "multiarb - Win32 Release"
-# Name "multiarb - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\multiarb.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/occlude.dsp b/progs/demos/Windows/occlude.dsp
deleted file mode 100644
index ca4afa579e1..00000000000
--- a/progs/demos/Windows/occlude.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="occlude" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=occlude - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "occlude.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "occlude.mak" CFG="occlude - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "occlude - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "occlude - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "occlude - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../occlude.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "occlude - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../occlude.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "occlude - Win32 Release"
-# Name "occlude - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\occlude.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/osdemo.dsp b/progs/demos/Windows/osdemo.dsp
deleted file mode 100644
index ccaa6d2b42a..00000000000
--- a/progs/demos/Windows/osdemo.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="osdemo" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=osdemo - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "osdemo.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "osdemo.mak" CFG="osdemo - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "osdemo - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "osdemo - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "osdemo - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB ../../../lib/OSMESA32.LIB /nologo /subsystem:console /machine:I386 /out:"../osdemo.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "osdemo - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB ../../../lib/OSMESA32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../osdemo.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "osdemo - Win32 Release"
-# Name "osdemo - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\osdemo.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/paltex.dsp b/progs/demos/Windows/paltex.dsp
deleted file mode 100644
index efc63842115..00000000000
--- a/progs/demos/Windows/paltex.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="paltex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=paltex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "paltex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "paltex.mak" CFG="paltex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "paltex - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "paltex - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "paltex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../paltex.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "paltex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../paltex.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "paltex - Win32 Release"
-# Name "paltex - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\paltex.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/pixeltex.dsp b/progs/demos/Windows/pixeltex.dsp
deleted file mode 100644
index d09f9f312cb..00000000000
--- a/progs/demos/Windows/pixeltex.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pixeltex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=pixeltex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pixeltex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pixeltex.mak" CFG="pixeltex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pixeltex - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "pixeltex - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pixeltex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../pixeltex.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "pixeltex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../pixeltex.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "pixeltex - Win32 Release"
-# Name "pixeltex - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\pixeltex.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/pointblast.dsp b/progs/demos/Windows/pointblast.dsp
deleted file mode 100644
index 7be695839fa..00000000000
--- a/progs/demos/Windows/pointblast.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="pointblast" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=pointblast - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "pointblast.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "pointblast.mak" CFG="pointblast - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "pointblast - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "pointblast - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "pointblast - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../pointblast.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "pointblast - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../pointblast.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "pointblast - Win32 Release"
-# Name "pointblast - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\pointblast.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/rain.dsp b/progs/demos/Windows/rain.dsp
deleted file mode 100644
index 7e380e66aaf..00000000000
--- a/progs/demos/Windows/rain.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="rain" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=rain - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "rain.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "rain.mak" CFG="rain - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "rain - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "rain - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "rain - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../rain.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "rain - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../rain.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "rain - Win32 Release"
-# Name "rain - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\rain.cxx
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/ray.dsp b/progs/demos/Windows/ray.dsp
deleted file mode 100644
index dfa26e7755c..00000000000
--- a/progs/demos/Windows/ray.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="ray" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=ray - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ray.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ray.mak" CFG="ray - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ray - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "ray - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ray - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../ray.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "ray - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../ray.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "ray - Win32 Release"
-# Name "ray - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\ray.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/readpix.dsp b/progs/demos/Windows/readpix.dsp
deleted file mode 100644
index 8097d10625b..00000000000
--- a/progs/demos/Windows/readpix.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="readpix" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=readpix - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "readpix.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "readpix.mak" CFG="readpix - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "readpix - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "readpix - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "readpix - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../readpix.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "readpix - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../readpix.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "readpix - Win32 Release"
-# Name "readpix - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\readpix.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/reflect.dsp b/progs/demos/Windows/reflect.dsp
deleted file mode 100644
index fa09700afe2..00000000000
--- a/progs/demos/Windows/reflect.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="reflect" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=reflect - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "reflect.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "reflect.mak" CFG="reflect - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "reflect - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "reflect - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "reflect - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../reflect.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "reflect - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../reflect.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "reflect - Win32 Release"
-# Name "reflect - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\reflect.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/renormal.dsp b/progs/demos/Windows/renormal.dsp
deleted file mode 100644
index 4d72e88d8ed..00000000000
--- a/progs/demos/Windows/renormal.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="renormal" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=renormal - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "renormal.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "renormal.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "renormal - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "renormal - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "renormal - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../renormal.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "renormal - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../renormal.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "renormal - Win32 Release"
-# Name "renormal - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\renormal.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/shadowtex.dsp b/progs/demos/Windows/shadowtex.dsp
deleted file mode 100644
index 419ec241386..00000000000
--- a/progs/demos/Windows/shadowtex.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="shadowtex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=shadowtex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "shadowtex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "shadowtex.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "shadowtex - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "shadowtex - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "shadowtex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../shadowtex.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "shadowtex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../shadowtex.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "shadowtex - Win32 Release"
-# Name "shadowtex - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\shadowtex.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/spectex.dsp b/progs/demos/Windows/spectex.dsp
deleted file mode 100644
index d1960b3d139..00000000000
--- a/progs/demos/Windows/spectex.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="spectex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=spectex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "spectex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "spectex.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "spectex - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "spectex - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "spectex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../spectex.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "spectex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../spectex.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "spectex - Win32 Release"
-# Name "spectex - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\spectex.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/spriteblast.dsp b/progs/demos/Windows/spriteblast.dsp
deleted file mode 100644
index 8a02ed50d30..00000000000
--- a/progs/demos/Windows/spriteblast.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="spriteblast" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=spriteblast - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "spriteblast.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "spriteblast.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "spriteblast - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "spriteblast - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "spriteblast - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../spriteblast.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "spriteblast - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../spriteblast.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "spriteblast - Win32 Release"
-# Name "spriteblast - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\spriteblast.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/stex3d.dsp b/progs/demos/Windows/stex3d.dsp
deleted file mode 100644
index 7c112d62ca8..00000000000
--- a/progs/demos/Windows/stex3d.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="stex3d" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=stex3d - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "stex3d.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "stex3d.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "stex3d - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "stex3d - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "stex3d - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../stex3d.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "stex3d - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../stex3d.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "stex3d - Win32 Release"
-# Name "stex3d - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\stex3d.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/teapot.dsp b/progs/demos/Windows/teapot.dsp
deleted file mode 100644
index 3260e635a4b..00000000000
--- a/progs/demos/Windows/teapot.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="teapot" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=teapot - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "teapot.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "teapot.mak" CFG="gloss - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "teapot - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "teapot - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "teapot - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../teapot.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "teapot - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../teapot.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "teapot - Win32 Release"
-# Name "teapot - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\teapot.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/terrain.dsp b/progs/demos/Windows/terrain.dsp
deleted file mode 100644
index 9fe490db81e..00000000000
--- a/progs/demos/Windows/terrain.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="terrain" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=terrain - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "terrain.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "terrain.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "terrain - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "terrain - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "terrain - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../terrain.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "terrain - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../terrain.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "terrain - Win32 Release"
-# Name "terrain - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\terrain.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/tessdemo.dsp b/progs/demos/Windows/tessdemo.dsp
deleted file mode 100644
index 61345c79e6a..00000000000
--- a/progs/demos/Windows/tessdemo.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tessdemo" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=tessdemo - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tessdemo.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tessdemo.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tessdemo - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "tessdemo - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "tessdemo - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tessdemo.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "tessdemo - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tessdemo.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "tessdemo - Win32 Release"
-# Name "tessdemo - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\tessdemo.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/texcyl.dsp b/progs/demos/Windows/texcyl.dsp
deleted file mode 100644
index b227e02c297..00000000000
--- a/progs/demos/Windows/texcyl.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="texcyl" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=texcyl - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "texcyl.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "texcyl.mak" CFG="gloss - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "texcyl - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "texcyl - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "texcyl - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texcyl.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "texcyl - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texcyl.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "texcyl - Win32 Release"
-# Name "texcyl - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\texcyl.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/texdown.dsp b/progs/demos/Windows/texdown.dsp
deleted file mode 100644
index acea7666afc..00000000000
--- a/progs/demos/Windows/texdown.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="texdown" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=texdown - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "texdown.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "texdown.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "texdown - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "texdown - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "texdown - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texdown.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "texdown - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texdown.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "texdown - Win32 Release"
-# Name "texdown - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\texdown.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/texenv.dsp b/progs/demos/Windows/texenv.dsp
deleted file mode 100644
index 3eb7eecdb71..00000000000
--- a/progs/demos/Windows/texenv.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="texenv" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=texenv - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "texenv.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "texenv.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "texenv - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "texenv - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "texenv - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texenv.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "texenv - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texenv.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "texenv - Win32 Release"
-# Name "texenv - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\texenv.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/texobj.dsp b/progs/demos/Windows/texobj.dsp
deleted file mode 100644
index 5db5f2ee798..00000000000
--- a/progs/demos/Windows/texobj.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="texobj" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=texobj - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "texobj.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "texobj.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "texobj - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "texobj - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "texobj - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texobj.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "texobj - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texobj.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "texobj - Win32 Release"
-# Name "texobj - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\texobj.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/trispd.dsp b/progs/demos/Windows/trispd.dsp
deleted file mode 100644
index 7e27cf3d04b..00000000000
--- a/progs/demos/Windows/trispd.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="trispd" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=trispd - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "trispd.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "trispd.mak" CFG="bounce - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "trispd - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "trispd - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "trispd - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../trispd.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "trispd - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../trispd.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "trispd - Win32 Release"
-# Name "trispd - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\trispd.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/tunnel.dsp b/progs/demos/Windows/tunnel.dsp
deleted file mode 100644
index 965f109c33e..00000000000
--- a/progs/demos/Windows/tunnel.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tunnel" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=tunnel - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tunnel.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tunnel.mak" CFG="gloss - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tunnel - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "tunnel - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "tunnel - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tunnel.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "tunnel - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tunnel.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "tunnel - Win32 Release"
-# Name "tunnel - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\tunnel.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/tunnel2.dsp b/progs/demos/Windows/tunnel2.dsp
deleted file mode 100644
index 3ae2800a04d..00000000000
--- a/progs/demos/Windows/tunnel2.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="tunnel2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=tunnel2 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "tunnel2.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "tunnel2.mak" CFG="gloss - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "tunnel2 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "tunnel2 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "tunnel2 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tunnel2.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "tunnel2 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tunnel2.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "tunnel2 - Win32 Release"
-# Name "tunnel2 - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\tunnel2.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/Windows/winpos.dsp b/progs/demos/Windows/winpos.dsp
deleted file mode 100644
index b7b569e6402..00000000000
--- a/progs/demos/Windows/winpos.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="winpos" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=winpos - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "winpos.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "winpos.mak" CFG="gloss - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "winpos - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "winpos - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "winpos - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../winpos.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "winpos - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../winpos.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "winpos - Win32 Release"
-# Name "winpos - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\winpos.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/demos/occlude.c b/progs/demos/occlude.c
deleted file mode 100644
index 8f7b90984e0..00000000000
--- a/progs/demos/occlude.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * GL_HP_occlustion_test demo
- *
- * Brian Paul
- * 31 March 2000
- *
- * Copyright (C) 2000 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.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-#include <GL/glext.h>
-
-
-static GLfloat Xpos = 0;
-static GLboolean Anim = GL_TRUE;
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-
-static void Idle(void)
-{
- static int lastTime = 0;
- static int sign = +1;
- int time = glutGet(GLUT_ELAPSED_TIME);
- float step;
-
- if (lastTime == 0)
- lastTime = time;
- else if (time - lastTime < 20) /* 50Hz update */
- return;
-
- step = (time - lastTime) / 1000.0 * sign;
- lastTime = time;
-
- Xpos += step;
-
- if (Xpos > 2.5) {
- Xpos = 2.5;
- sign = -1;
- }
- else if (Xpos < -2.5) {
- Xpos = -2.5;
- sign = +1;
- }
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- GLboolean result;
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-
- /* draw the occluding polygons */
- glColor3f(0, 0.6, 0.8);
- glBegin(GL_QUADS);
- glVertex2f(-1.6, -1.5);
- glVertex2f(-0.4, -1.5);
- glVertex2f(-0.4, 1.5);
- glVertex2f(-1.6, 1.5);
-
- glVertex2f( 0.4, -1.5);
- glVertex2f( 1.6, -1.5);
- glVertex2f( 1.6, 1.5);
- glVertex2f( 0.4, 1.5);
- glEnd();
-
- /* draw the test polygon with occlusion testing */
- glPushMatrix();
- glTranslatef(Xpos, 0, -0.5);
- glScalef(0.3, 0.3, 1.0);
- glRotatef(-90.0 * Xpos, 0, 0, 1);
-
- glEnable(GL_OCCLUSION_TEST_HP); /* NOTE: enabling the occlusion test */
- /* doesn't clear the result flag! */
- glColorMask(0, 0, 0, 0);
- glDepthMask(GL_FALSE);
- /* this call clear's the result flag. Not really needed for this demo. */
- glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result);
-
- glBegin(GL_POLYGON);
- glVertex3f(-1, -1, 0);
- glVertex3f( 1, -1, 0);
- glVertex3f( 1, 1, 0);
- glVertex3f(-1, 1, 0);
- glEnd();
-
- glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP, &result);
- /* turn off occlusion testing */
- glDisable(GL_OCCLUSION_TEST_HP);
- glColorMask(1, 1, 1, 1);
- glDepthMask(GL_TRUE);
-
- /* draw the green rect, so we can see what's going on */
- glColor3f(0.8, 0.5, 0);
- glBegin(GL_POLYGON);
- glVertex3f(-1, -1, 0);
- glVertex3f( 1, -1, 0);
- glVertex3f( 1, 1, 0);
- glVertex3f(-1, 1, 0);
- glEnd();
-
- glPopMatrix();
-
-
- /* Print result message */
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- glColor3f(1, 1, 1);
- glRasterPos3f(-0.25, -0.7, 0);
-
- if (result)
- PrintString(" Visible");
- else
- PrintString("Fully Occluded");
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc( Idle );
- else
- glutIdleFunc( NULL );
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 0.1;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_LEFT:
- Xpos -= step;
- break;
- case GLUT_KEY_RIGHT:
- Xpos += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char *ext = (const char *) glGetString(GL_EXTENSIONS);
- if (!strstr(ext, "GL_HP_occlusion_test")) {
- printf("Sorry, this demo requires the GL_HP_occlusion_test extension\n");
- exit(-1);
- }
-
- glEnable(GL_DEPTH_TEST);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 400, 400 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutIdleFunc( Idle );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/egl/Makefile b/progs/egl/Makefile
deleted file mode 100644
index 41cadf97d2c..00000000000
--- a/progs/egl/Makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# progs/egl/Makefile
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = -I$(TOP)/include
-
-HEADERS = $(TOP)/include/GLES/egl.h
-
-PROGRAMS = \
- demo1 \
- demo2 \
- demo3 \
- eglinfo \
- eglgears
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: $(PROGRAMS)
-
-
-demo1: demo1.o $(LIB_DIR)/libEGL.so
- $(CC) $(CFLAGS) demo1.o -L$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@
-
-demo1.o: demo1.c $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include demo1.c
-
-
-demo2: demo2.o $(LIB_DIR)/libEGL.so
- $(CC) $(CFLAGS) demo2.o -L$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
-
-demo2.o: demo2.c $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include demo2.c
-
-
-demo3: demo3.o $(LIB_DIR)/libEGL.so
- $(CC) $(CFLAGS) demo3.o -L$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
-
-demo3.o: demo3.c $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c
-
-
-eglinfo: eglinfo.o $(LIB_DIR)/libEGL.so
- $(CC) $(CFLAGS) eglinfo.o -L$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@
-
-eglinfo.o: eglinfo.c $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c
-
-
-eglgears: eglgears.o $(LIB_DIR)/libEGL.so
- $(CC) $(CFLAGS) eglgears.o -L$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
-
-eglgears.o: eglgears.c $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c
-
-
-clean:
- rm -f *.o *~
- rm -f *.so
- rm -f $(PROGRAMS)
diff --git a/progs/egl/demo1.c b/progs/egl/demo1.c
deleted file mode 100644
index 9ef17e38b7d..00000000000
--- a/progs/egl/demo1.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Exercise EGL API functions
- */
-
-#include <GLES/egl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/**
- * Test EGL_MESA_screen_surface functions
- */
-static void
-TestScreens(EGLDisplay dpy)
-{
-#define MAX 8
- EGLScreenMESA screens[MAX];
- EGLint numScreens;
- EGLint i;
-
- eglGetScreensMESA(dpy, screens, MAX, &numScreens);
- printf("Found %d screens\n", numScreens);
- for (i = 0; i < numScreens; i++) {
- printf(" Screen %d handle: %d\n", i, (int) screens[i]);
- }
-}
-
-/**
- * Print table of all available configurations.
- */
-static void
-PrintConfigs(EGLDisplay d)
-{
- EGLConfig *configs;
- EGLint numConfigs, i;
-
- eglGetConfigs(d, NULL, 0, &numConfigs);
- configs = malloc(sizeof(*configs) *numConfigs);
- eglGetConfigs(d, configs, numConfigs, &numConfigs);
-
- printf("Configurations:\n");
- printf(" bf lv d st colorbuffer dp st supported \n");
- printf(" id sz l b ro r g b a th cl surfaces \n");
- printf("----------------------------------------------\n");
- for (i = 0; i < numConfigs; i++) {
- EGLint id, size, level;
- EGLint red, green, blue, alpha;
- EGLint depth, stencil;
- EGLint surfaces;
- EGLint doubleBuf = 1, stereo = 0;
- char surfString[100] = "";
-
- eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
- eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
- eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
-
- eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
- eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
- eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
- eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
- eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
- eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
- eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
-
- if (surfaces & EGL_WINDOW_BIT)
- strcat(surfString, "win,");
- if (surfaces & EGL_PBUFFER_BIT)
- strcat(surfString, "pb,");
- if (surfaces & EGL_PIXMAP_BIT)
- strcat(surfString, "pix,");
- if (strlen(surfString) > 0)
- surfString[strlen(surfString) - 1] = 0;
-
- printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
- id, size, level,
- doubleBuf ? 'y' : '.',
- stereo ? 'y' : '.',
- red, green, blue, alpha,
- depth, stencil, surfString);
- }
- free(configs);
-}
-
-
-
-int
-main(int argc, char *argv[])
-{
- int maj, min;
- EGLContext ctx;
- EGLSurface pbuffer;
- EGLConfig configs[10];
- EGLBoolean b;
- const EGLint pbufAttribs[] = {
- EGL_WIDTH, 500,
- EGL_HEIGHT, 500,
- EGL_NONE
- };
-
- /*
- EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- */
- EGLDisplay d = eglGetDisplay("!fb_dri");
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("demo: eglInitialize failed\n");
- exit(1);
- }
-
- printf("EGL version = %d.%d\n", maj, min);
- printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- PrintConfigs(d);
-
- ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
- if (ctx == EGL_NO_CONTEXT) {
- printf("failed to create context\n");
- return 0;
- }
-
- pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
- if (pbuffer == EGL_NO_SURFACE) {
- printf("failed to create pbuffer\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
- if (!b) {
- printf("make current failed\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
- TestScreens(d);
-
- eglDestroySurface(d, pbuffer);
- eglDestroyContext(d, ctx);
- eglTerminate(d);
-
- return 0;
-}
diff --git a/progs/egl/demo2.c b/progs/egl/demo2.c
deleted file mode 100644
index 17bbca61587..00000000000
--- a/progs/egl/demo2.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Exercise EGL API functions
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <GLES/egl.h>
-
-/*#define FRONTBUFFER*/
-
-static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
-{
- glBegin( GL_QUADS );
- glVertex2f( x1, y1 );
- glVertex2f( x2, y1 );
- glVertex2f( x2, y2 );
- glVertex2f( x1, y2 );
- glEnd();
-}
-
-
-static void redraw(EGLDisplay dpy, EGLSurface surf, int rot)
-{
- printf("Redraw event\n");
-
-#ifdef FRONTBUFFER
- glDrawBuffer( GL_FRONT );
-#else
- glDrawBuffer( GL_BACK );
-#endif
-
- glClearColor( rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX,
- 1);
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX );
- glPushMatrix();
- glRotatef(rot, 0, 0, 1);
- glScalef(.5, .5, .5);
- _subset_Rectf( -1, -1, 1, 1 );
- glPopMatrix();
-
-#ifdef FRONTBUFFER
- glFlush();
-#else
- eglSwapBuffers( dpy, surf );
-#endif
- glFinish();
-}
-
-
-/**
- * Test EGL_MESA_screen_surface functions
- */
-static void
-TestScreens(EGLDisplay dpy)
-{
-#define MAX 8
- EGLScreenMESA screens[MAX];
- EGLint numScreens;
- EGLint i;
-
- eglGetScreensMESA(dpy, screens, MAX, &numScreens);
- printf("Found %d screens\n", numScreens);
- for (i = 0; i < numScreens; i++) {
- printf(" Screen %d handle: %d\n", i, (int) screens[i]);
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int maj, min;
- EGLContext ctx;
- EGLSurface pbuffer, screen_surf;
- EGLConfig configs[10];
- EGLint numConfigs, i;
- EGLBoolean b;
- const EGLint pbufAttribs[] = {
- EGL_WIDTH, 500,
- EGL_HEIGHT, 500,
- EGL_NONE
- };
- const EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
- EGLModeMESA mode;
- EGLScreenMESA screen;
- EGLint count;
-
- /*
- EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- */
- EGLDisplay d = eglGetDisplay("!fb_dri");
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("demo: eglInitialize failed\n");
- exit(1);
- }
-
- printf("EGL version = %d.%d\n", maj, min);
- printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- eglGetConfigs(d, configs, 10, &numConfigs);
- printf("Got %d EGL configs:\n", numConfigs);
- for (i = 0; i < numConfigs; i++) {
- EGLint id, red, depth;
- eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
- eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
- eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
- printf("%2d: Red Size = %d Depth Size = %d\n", id, red, depth);
- }
-
- eglGetScreensMESA(d, &screen, 1, &count);
- eglGetModesMESA(d, screen, &mode, 1, &count);
-
- ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
- if (ctx == EGL_NO_CONTEXT) {
- printf("failed to create context\n");
- return 0;
- }
-
- pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
- if (pbuffer == EGL_NO_SURFACE) {
- printf("failed to create pbuffer\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
- if (!b) {
- printf("make current failed\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
- screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
- if (screen_surf == EGL_NO_SURFACE) {
- printf("failed to create screen surface\n");
- return 0;
- }
-
- eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
-
- b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
- if (!b) {
- printf("make current failed\n");
- return 0;
- }
-
- glViewport(0, 0, 1024, 768);
- glDrawBuffer( GL_FRONT );
-
- glClearColor( 0,
- 1.0,
- 0,
- 1);
-
- glClear( GL_COLOR_BUFFER_BIT );
-
-
- TestScreens(d);
-
- glShadeModel( GL_FLAT );
-
- for (i = 0; i < 6; i++) {
- redraw(d, screen_surf, i*10 );
-
- printf("sleep(1)\n");
- sleep(1);
- }
-
- eglDestroySurface(d, pbuffer);
- eglDestroyContext(d, ctx);
- eglTerminate(d);
-
- return 0;
-}
diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c
deleted file mode 100644
index 9edf7c952b3..00000000000
--- a/progs/egl/demo3.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * Exercise EGL API functions
- */
-
-#include <GLES/egl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-
-#define PIXEL_CENTER(x) ((long)(x) + 0.5)
-
-#define GAP 10
-#define ROWS 3
-#define COLS 4
-
-#define OPENGL_WIDTH 48
-#define OPENGL_HEIGHT 13
-
-
-GLenum rgb, doubleBuffer, windType;
-GLint windW, windH;
-
-GLenum mode1, mode2;
-GLint boxW, boxH;
-GLubyte OpenGL_bits[] = {
- 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
- 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
- 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
- 0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01,
- 0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00,
- 0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00,
- 0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00,
- 0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00,
- 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a,
- 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e,
- 0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e,
- 0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00,
-};
-
-
-static void Init(void)
-{
-
- mode1 = GL_TRUE;
- mode2 = GL_TRUE;
-}
-
-static void Reshape(int width, int height)
-{
-
- windW = (GLint)width;
- windH = (GLint)height;
-}
-
-#if 0
-static void RotateColorMask(void)
-{
- static GLint rotation = 0;
-
- rotation = (rotation + 1) & 0x3;
- switch (rotation) {
- case 0:
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glIndexMask( 0xff );
- break;
- case 1:
- glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
- glIndexMask(0xFE);
- break;
- case 2:
- glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
- glIndexMask(0xFD);
- break;
- case 3:
- glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
- glIndexMask(0xFB);
- break;
- }
-}
-#endif
-
-static void Viewport(GLint row, GLint column)
-{
- GLint x, y;
-
- boxW = (windW - (COLS + 1) * GAP) / COLS;
- boxH = (windH - (ROWS + 1) * GAP) / ROWS;
-
- x = GAP + column * (boxW + GAP);
- y = GAP + row * (boxH + GAP);
-
- glViewport(x, y, boxW, boxH);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
-
- glEnable(GL_SCISSOR_TEST);
- glScissor(x, y, boxW, boxH);
-}
-
-enum {
- COLOR_BLACK = 0,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW,
- COLOR_BLUE,
- COLOR_MAGENTA,
- COLOR_CYAN,
- COLOR_WHITE
-};
-
-static float RGBMap[9][3] = {
- {0, 0, 0},
- {1, 0, 0},
- {0, 1, 0},
- {1, 1, 0},
- {0, 0, 1},
- {1, 0, 1},
- {0, 1, 1},
- {1, 1, 1},
- {0.5, 0.5, 0.5}
-};
-
-static void SetColor(int c)
-{
- glColor3fv(RGBMap[c]);
-}
-
-static void Point(void)
-{
- GLint i;
-
- glBegin(GL_POINTS);
- SetColor(COLOR_WHITE);
- glVertex2i(0, 0);
- for (i = 1; i < 8; i++) {
- GLint j = i * 2;
- SetColor(COLOR_BLACK+i);
- glVertex2i(-j, -j);
- glVertex2i(-j, 0);
- glVertex2i(-j, j);
- glVertex2i(0, j);
- glVertex2i(j, j);
- glVertex2i(j, 0);
- glVertex2i(j, -j);
- glVertex2i(0, -j);
- }
- glEnd();
-}
-
-static void Lines(void)
-{
- GLint i;
-
- glPushMatrix();
-
- glTranslatef(-12, 0, 0);
- for (i = 1; i < 8; i++) {
- SetColor(COLOR_BLACK+i);
- glBegin(GL_LINES);
- glVertex2i(-boxW/4, -boxH/4);
- glVertex2i(boxW/4, boxH/4);
- glEnd();
- glTranslatef(4, 0, 0);
- }
-
- glPopMatrix();
-
- glBegin(GL_LINES);
- glVertex2i(0, 0);
- glEnd();
-}
-
-static void LineStrip(void)
-{
-
- glBegin(GL_LINE_STRIP);
- SetColor(COLOR_RED);
- glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
- SetColor(COLOR_GREEN);
- glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
- SetColor(COLOR_BLUE);
- glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
- SetColor(COLOR_WHITE);
- glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
- glEnd();
-
- glBegin(GL_LINE_STRIP);
- glVertex2i(0, 0);
- glEnd();
-}
-
-static void LineLoop(void)
-{
-
- glBegin(GL_LINE_LOOP);
- SetColor(COLOR_RED);
- glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
- SetColor(COLOR_GREEN);
- glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
- SetColor(COLOR_BLUE);
- glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
- SetColor(COLOR_WHITE);
- glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
- glEnd();
-
- glEnable(GL_LOGIC_OP);
- glLogicOp(GL_XOR);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
-
- SetColor(COLOR_MAGENTA);
- glBegin(GL_LINE_LOOP);
- glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8));
- glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8));
- glEnd();
- glBegin(GL_LINE_LOOP);
- glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5));
- glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5));
- glEnd();
- glDisable(GL_LOGIC_OP);
- glDisable(GL_BLEND);
-
- SetColor(COLOR_GREEN);
- glBegin(GL_POINTS);
- glVertex2i(0, 0);
- glEnd();
-
- glBegin(GL_LINE_LOOP);
- glVertex2i(0, 0);
- glEnd();
-}
-
-static void Bitmap(void)
-{
-
- glBegin(GL_LINES);
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/2, 0);
- glVertex2i(boxW/2, 0);
- glVertex2i(0, -boxH/2);
- glVertex2i(0, boxH/2);
- SetColor(COLOR_RED);
- glVertex2i(0, -3);
- glVertex2i(0, -3+OPENGL_HEIGHT);
- SetColor(COLOR_BLUE);
- glVertex2i(0, -3);
- glVertex2i(OPENGL_WIDTH, -3);
- glEnd();
-
- SetColor(COLOR_GREEN);
-
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- glRasterPos2i(0, 0);
- glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits);
-}
-
-static void Triangles(void)
-{
-
- glBegin(GL_TRIANGLES);
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/4, -boxH/4);
- SetColor(COLOR_RED);
- glVertex2i(-boxW/8, -boxH/16);
- SetColor(COLOR_BLUE);
- glVertex2i(boxW/8, -boxH/16);
-
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/4, boxH/4);
- SetColor(COLOR_RED);
- glVertex2i(-boxW/8, boxH/16);
- SetColor(COLOR_BLUE);
- glVertex2i(boxW/8, boxH/16);
- glEnd();
-
- glBegin(GL_TRIANGLES);
- glVertex2i(0, 0);
- glVertex2i(-100, 100);
- glEnd();
-}
-
-static void TriangleStrip(void)
-{
-
- glBegin(GL_TRIANGLE_STRIP);
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/4, -boxH/4);
- SetColor(COLOR_RED);
- glVertex2i(-boxW/4, boxH/4);
- SetColor(COLOR_BLUE);
- glVertex2i(0, -boxH/4);
- SetColor(COLOR_WHITE);
- glVertex2i(0, boxH/4);
- SetColor(COLOR_CYAN);
- glVertex2i(boxW/4, -boxH/4);
- SetColor(COLOR_YELLOW);
- glVertex2i(boxW/4, boxH/4);
- glEnd();
-
- glBegin(GL_TRIANGLE_STRIP);
- glVertex2i(0, 0);
- glVertex2i(-100, 100);
- glEnd();
-}
-
-static void TriangleFan(void)
-{
- GLint vx[8][2];
- GLint x0, y0, x1, y1, x2, y2, x3, y3;
- GLint i;
-
- y0 = -boxH/4;
- y1 = y0 + boxH/2/3;
- y2 = y1 + boxH/2/3;
- y3 = boxH/4;
- x0 = -boxW/4;
- x1 = x0 + boxW/2/3;
- x2 = x1 + boxW/2/3;
- x3 = boxW/4;
-
- vx[0][0] = x0; vx[0][1] = y1;
- vx[1][0] = x0; vx[1][1] = y2;
- vx[2][0] = x1; vx[2][1] = y3;
- vx[3][0] = x2; vx[3][1] = y3;
- vx[4][0] = x3; vx[4][1] = y2;
- vx[5][0] = x3; vx[5][1] = y1;
- vx[6][0] = x2; vx[6][1] = y0;
- vx[7][0] = x1; vx[7][1] = y0;
-
- glBegin(GL_TRIANGLE_FAN);
- SetColor(COLOR_WHITE);
- glVertex2i(0, 0);
- for (i = 0; i < 8; i++) {
- SetColor(COLOR_WHITE-i);
- glVertex2iv(vx[i]);
- }
- glEnd();
-
- glBegin(GL_TRIANGLE_FAN);
- glVertex2i(0, 0);
- glVertex2i(-100, 100);
- glEnd();
-}
-
-static void Rect(void)
-{
-
- SetColor(COLOR_GREEN);
- glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4);
-}
-
-static void PolygonFunc(void)
-{
- GLint vx[8][2];
- GLint x0, y0, x1, y1, x2, y2, x3, y3;
- GLint i;
-
- y0 = -boxH/4;
- y1 = y0 + boxH/2/3;
- y2 = y1 + boxH/2/3;
- y3 = boxH/4;
- x0 = -boxW/4;
- x1 = x0 + boxW/2/3;
- x2 = x1 + boxW/2/3;
- x3 = boxW/4;
-
- vx[0][0] = x0; vx[0][1] = y1;
- vx[1][0] = x0; vx[1][1] = y2;
- vx[2][0] = x1; vx[2][1] = y3;
- vx[3][0] = x2; vx[3][1] = y3;
- vx[4][0] = x3; vx[4][1] = y2;
- vx[5][0] = x3; vx[5][1] = y1;
- vx[6][0] = x2; vx[6][1] = y0;
- vx[7][0] = x1; vx[7][1] = y0;
-
- glBegin(GL_POLYGON);
- for (i = 0; i < 8; i++) {
- SetColor(COLOR_WHITE-i);
- glVertex2iv(vx[i]);
- }
- glEnd();
-
- glBegin(GL_POLYGON);
- glVertex2i(0, 0);
- glVertex2i(100, 100);
- glEnd();
-}
-
-static void Quads(void)
-{
-
- glBegin(GL_QUADS);
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/4, -boxH/4);
- SetColor(COLOR_RED);
- glVertex2i(-boxW/8, -boxH/16);
- SetColor(COLOR_BLUE);
- glVertex2i(boxW/8, -boxH/16);
- SetColor(COLOR_WHITE);
- glVertex2i(boxW/4, -boxH/4);
-
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/4, boxH/4);
- SetColor(COLOR_RED);
- glVertex2i(-boxW/8, boxH/16);
- SetColor(COLOR_BLUE);
- glVertex2i(boxW/8, boxH/16);
- SetColor(COLOR_WHITE);
- glVertex2i(boxW/4, boxH/4);
- glEnd();
-
- glBegin(GL_QUADS);
- glVertex2i(0, 0);
- glVertex2i(100, 100);
- glVertex2i(-100, 100);
- glEnd();
-}
-
-static void QuadStrip(void)
-{
-
- glBegin(GL_QUAD_STRIP);
- SetColor(COLOR_GREEN);
- glVertex2i(-boxW/4, -boxH/4);
- SetColor(COLOR_RED);
- glVertex2i(-boxW/4, boxH/4);
- SetColor(COLOR_BLUE);
- glVertex2i(0, -boxH/4);
- SetColor(COLOR_WHITE);
- glVertex2i(0, boxH/4);
- SetColor(COLOR_CYAN);
- glVertex2i(boxW/4, -boxH/4);
- SetColor(COLOR_YELLOW);
- glVertex2i(boxW/4, boxH/4);
- glEnd();
-
- glBegin(GL_QUAD_STRIP);
- glVertex2i(0, 0);
- glVertex2i(100, 100);
- glVertex2i(-100, 100);
- glEnd();
-}
-
-static void Draw(EGLDisplay dpy, EGLSurface surf)
-{
-
- glViewport(0, 0, windW, windH);
- glDisable(GL_SCISSOR_TEST);
-
- glPushAttrib(GL_COLOR_BUFFER_BIT);
-
- glColorMask(1, 1, 1, 1);
- glIndexMask(~0);
-
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glPopAttrib();
-
- if (mode1) {
- glShadeModel(GL_SMOOTH);
- } else {
- glShadeModel(GL_FLAT);
- }
-
- if (mode2) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- } else {
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- }
-
- Viewport(0, 0); Point();
- Viewport(0, 1); Lines();
- Viewport(0, 2); LineStrip();
- Viewport(0, 3); LineLoop();
-
- Viewport(1, 0); Bitmap();
-
- Viewport(1, 1); TriangleFan();
- Viewport(1, 2); Triangles();
- Viewport(1, 3); TriangleStrip();
-
- Viewport(2, 0); Rect();
- Viewport(2, 1); PolygonFunc();
- Viewport(2, 2); Quads();
- Viewport(2, 3); QuadStrip();
-
- glFlush();
-
- if (doubleBuffer) {
- eglSwapBuffers(dpy, surf);
- }
-}
-
-static void
-write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
-{
- const int binary = 0;
- FILE *f = fopen( filename, "w" );
- if (f) {
- int i, x, y;
- const GLubyte *ptr = buffer;
- if (binary) {
- fprintf(f,"P6\n");
- fprintf(f,"# ppm-file created by osdemo.c\n");
- fprintf(f,"%i %i\n", width,height);
- fprintf(f,"255\n");
- fclose(f);
- f = fopen( filename, "ab" ); /* reopen in binary append mode */
- for (y=height-1; y>=0; y--) {
- for (x=0; x<width; x++) {
- i = (y*width + x) * 4;
- fputc(ptr[i], f); /* write red */
- fputc(ptr[i+1], f); /* write green */
- fputc(ptr[i+2], f); /* write blue */
- }
- }
- }
- else {
- /*ASCII*/
- int counter = 0;
- fprintf(f,"P3\n");
- fprintf(f,"# ascii ppm file created by osdemo.c\n");
- fprintf(f,"%i %i\n", width, height);
- fprintf(f,"255\n");
- for (y=height-1; y>=0; y--) {
- for (x=0; x<width; x++) {
- i = (y*width + x) * 4;
- fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
- counter++;
- if (counter % 5 == 0)
- fprintf(f, "\n");
- }
- }
- }
- fclose(f);
- }
-}
-
-#include "../src/egl/main/egldisplay.h"
-
-typedef struct fb_display
-{
- _EGLDisplay Base; /* base class/object */
- void *pFB;
-} fbDisplay;
-
-
-int
-main(int argc, char *argv[])
-{
- int maj, min;
- EGLContext ctx;
- EGLSurface screen_surf;
- EGLConfig configs[10];
- EGLScreenMESA screen;
- EGLModeMESA mode;
- EGLint numConfigs, count;
- EGLBoolean b;
- const EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
-
- /*
- EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- */
- EGLDisplay d = eglGetDisplay(":0");
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("demo: eglInitialize failed\n");
- exit(1);
- }
-
- printf("EGL version = %d.%d\n", maj, min);
- printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- eglGetConfigs(d, configs, 10, &numConfigs);
- eglGetScreensMESA(d, &screen, 1, &count);
- eglGetModesMESA(d, screen, &mode, 1, &count);
-
- ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
- if (ctx == EGL_NO_CONTEXT) {
- printf("failed to create context\n");
- return 0;
- }
-
- screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
- if (screen_surf == EGL_NO_SURFACE) {
- printf("failed to create screen surface\n");
- return 0;
- }
-
- eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
-
- b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
- if (!b) {
- printf("make current failed\n");
- return 0;
- }
- glViewport(0, 0, 1024, 768);
-
-
- Init();
- Reshape(1024, 768);
-
- glDrawBuffer( GL_FRONT );
- glClearColor( 0, 1.0, 0, 1);
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- doubleBuffer = 1;
- glDrawBuffer( GL_BACK );
-
- Draw(d, screen_surf);
-
- write_ppm("dump.ppm", ((struct fb_display *)_eglLookupDisplay(d))->pFB, 1024, 768);
-
- eglDestroySurface(d, screen_surf);
- eglDestroyContext(d, ctx);
- eglTerminate(d);
-
- return 0;
-}
diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c
deleted file mode 100644
index 9feee20d889..00000000000
--- a/progs/egl/eglgears.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * This is a port of the infamous "glxgears" demo to straight EGL
- * Port by Dane Rushton 10 July 2005
- *
- * No command line options.
- * Program runs for 5 seconds then exits, outputing framerate to console
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <GL/gl.h>
-#include <GLES/egl.h>
-#include <assert.h>
-
-#define MAX_CONFIGS 10
-#define MAX_MODES 100
-
-#define BENCHMARK
-
-#ifdef BENCHMARK
-
-/* XXX this probably isn't very portable */
-
-#include <sys/time.h>
-#include <unistd.h>
-
-/* return current time (in seconds) */
-static double
-current_time(void)
-{
- struct timeval tv;
-#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
-#else
- struct timezone tz;
- (void) gettimeofday(&tv, &tz);
-#endif
- return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
-}
-
-#else /*BENCHMARK*/
-
-/* dummy */
-static double
-current_time(void)
-{
- /* update this function for other platforms! */
- static double t = 0.0;
- static int warn = 1;
- if (warn) {
- fprintf(stderr, "Warning: current_time() not implemented!!\n");
- warn = 0;
- }
- return t += 1.0;
-}
-
-#endif /*BENCHMARK*/
-
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-
-static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-#if 0
-static GLfloat eyesep = 5.0; /* Eye separation. */
-static GLfloat fix_point = 40.0; /* Fixation point distance. */
-static GLfloat left, right, asp; /* Stereo frustum params. */
-#endif
-
-
-/*
- *
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * Input: inner_radius - radius of hole at center
- * outer_radius - radius at center of teeth
- * width - width of gear
- * teeth - number of teeth
- * tooth_depth - depth of tooth
- */
-static void
-gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth)
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0;
- r2 = outer_radius + tooth_depth / 2.0;
-
- da = 2.0 * M_PI / teeth / 4.0;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0, 0.0, 1.0);
-
- /* draw front face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- if (i < teeth) {
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- width * 0.5);
- }
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- width * 0.5);
- }
- glEnd();
-
- glNormal3f(0.0, 0.0, -1.0);
-
- /* draw back face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- if (i < teeth) {
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- }
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- -width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- -width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- }
- glEnd();
-
- /* draw outward faces of teeth */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- u = r2 * cos(angle + da) - r1 * cos(angle);
- v = r2 * sin(angle + da) - r1 * sin(angle);
- len = sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- -width * 0.5);
- u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
- v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- }
-
- glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
- glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
-
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glNormal3f(-cos(angle), -sin(angle), 0.0);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- }
- glEnd();
-}
-
-
-static void
-draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1.0, 0.0, 0.0);
- glRotatef(view_roty, 0.0, 1.0, 0.0);
- glRotatef(view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix();
- glTranslatef(-3.0, -2.0, 0.0);
- glRotatef(angle, 0.0, 0.0, 1.0);
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(3.1, -2.0, 0.0);
- glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(-3.1, 4.2, 0.0);
- glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-}
-
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-}
-
-
-
-static void
-init(void)
-{
- static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
- static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
- static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
- static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0, 4.0, 1.0, 20, 0.7);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5, 2.0, 2.0, 10, 0.7);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3, 2.0, 0.5, 10, 0.7);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-}
-
-
-
-
-static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
-{
- double st = current_time();
- double ct = st;
- int frames = 0;
- while (ct - st < ttr)
- {
- double tt = current_time();
- double dt = tt - ct;
- ct = tt;
-
- /* advance rotation for next frame */
- angle += 70.0 * dt; /* 70 degrees per second */
- if (angle > 3600.0)
- angle -= 3600.0;
-
- draw();
-
- eglSwapBuffers(dpy, surf);
-
-
- frames++;
- }
-
- GLfloat seconds = ct - st;
- GLfloat fps = frames / seconds;
- printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
-
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int maj, min;
- EGLContext ctx;
- EGLSurface screen_surf;
- EGLConfig configs[MAX_CONFIGS];
- EGLint numConfigs, i;
- EGLBoolean b;
- EGLDisplay d;
- EGLint screenAttribs[10];
- EGLModeMESA mode[MAX_MODES];
- EGLScreenMESA screen;
- EGLint count, chosenMode;
- GLboolean printInfo = GL_FALSE;
- EGLint width = 0, height = 0;
-
- /* parse cmd line args */
- for (i = 1; i < argc; i++)
- {
- if (strcmp(argv[i], "-info") == 0)
- {
- printInfo = GL_TRUE;
- }
- else
- printf("Warning: unknown parameter: %s\n", argv[i]);
- }
-
- /* DBR : Create EGL context/surface etc */
- d = eglGetDisplay(":0");
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("eglgears: eglInitialize failed\n");
- exit(1);
- }
-
- printf("eglgears: EGL version = %d.%d\n", maj, min);
- printf("eglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- /* XXX use ChooseConfig */
- eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
- eglGetScreensMESA(d, &screen, 1, &count);
-
- if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
- printf("eglgears: eglGetModesMESA failed!\n");
- return 0;
- }
-
- /* Print list of modes, and find the one to use */
- printf("eglgears: Found %d modes:\n", count);
- for (i = 0; i < count; i++) {
- EGLint w, h;
- eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
- eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
- printf("%3d: %d x %d\n", i, w, h);
- if (w > width && h > height && w <= 1280 && h <= 1024) {
- width = w;
- height = h;
- chosenMode = i;
- }
- }
- printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
-
- ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
- if (ctx == EGL_NO_CONTEXT) {
- printf("eglgears: failed to create context\n");
- return 0;
- }
-
- /* build up screenAttribs array */
- i = 0;
- screenAttribs[i++] = EGL_WIDTH;
- screenAttribs[i++] = width;
- screenAttribs[i++] = EGL_HEIGHT;
- screenAttribs[i++] = height;
- screenAttribs[i++] = EGL_NONE;
-
- screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
- if (screen_surf == EGL_NO_SURFACE) {
- printf("eglgears: failed to create screen surface\n");
- return 0;
- }
-
- b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
- if (!b) {
- printf("eglgears: show surface failed\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
- if (!b) {
- printf("eglgears: make current failed\n");
- return 0;
- }
-
- if (printInfo)
- {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-
- init();
- reshape(width, height);
-
- glDrawBuffer( GL_BACK );
-
- run_gears(d, screen_surf, 5.0);
-
- eglDestroySurface(d, screen_surf);
- eglDestroyContext(d, ctx);
- eglTerminate(d);
-
- return 0;
-}
diff --git a/progs/egl/eglinfo.c b/progs/egl/eglinfo.c
deleted file mode 100644
index f9c24754457..00000000000
--- a/progs/egl/eglinfo.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * eglinfo - like glxinfo but for EGL
- *
- * Brian Paul
- * 11 March 2005
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <GLES/egl.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define MAX_CONFIGS 1000
-#define MAX_MODES 1000
-#define MAX_SCREENS 10
-
-
-/**
- * Print table of all available configurations.
- */
-static void
-PrintConfigs(EGLDisplay d)
-{
- EGLConfig configs[MAX_CONFIGS];
- EGLint numConfigs, i;
-
- eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
-
- printf("Configurations:\n");
- printf(" bf lv d st colorbuffer dp st supported\n");
- printf(" id sz l b ro r g b a th cl surfaces \n");
- printf("---------------------------------------------------\n");
- for (i = 0; i < numConfigs; i++) {
- EGLint id, size, level;
- EGLint red, green, blue, alpha;
- EGLint depth, stencil;
- EGLint surfaces;
- EGLint doubleBuf = 1, stereo = 0;
- char surfString[100] = "";
-
- eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
- eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
- eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
-
- eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
- eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
- eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
- eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
- eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
- eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
- eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
-
- if (surfaces & EGL_WINDOW_BIT)
- strcat(surfString, "win,");
- if (surfaces & EGL_PBUFFER_BIT)
- strcat(surfString, "pb,");
- if (surfaces & EGL_PIXMAP_BIT)
- strcat(surfString, "pix,");
-#ifdef EGL_MESA_screen_surface
- if (surfaces & EGL_SCREEN_BIT_MESA)
- strcat(surfString, "scrn,");
-#endif
- if (strlen(surfString) > 0)
- surfString[strlen(surfString) - 1] = 0;
-
- printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
- id, size, level,
- doubleBuf ? 'y' : '.',
- stereo ? 'y' : '.',
- red, green, blue, alpha,
- depth, stencil, surfString);
- }
-}
-
-
-/**
- * Print table of all available configurations.
- */
-static void
-PrintModes(EGLDisplay d)
-{
-#ifdef EGL_MESA_screen_surface
- const char *extensions = eglQueryString(d, EGL_EXTENSIONS);
- if (strstr(extensions, "EGL_MESA_screen_surface")) {
- EGLScreenMESA screens[MAX_SCREENS];
- EGLint numScreens = 1, scrn;
- EGLModeMESA modes[MAX_MODES];
-
- eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens);
- printf("Number of Screens: %d\n\n", numScreens);
-
- for (scrn = 0; scrn < numScreens; scrn++) {
- EGLint numModes, i;
-
- eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes);
-
- printf("Screen %d Modes:\n", scrn);
- printf(" id width height refresh name\n");
- printf("-----------------------------------------\n");
- for (i = 0; i < numModes; i++) {
- EGLint id, w, h, r;
- const char *str;
- eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id);
- eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w);
- eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h);
- eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r);
- str = eglQueryModeStringMESA(d, modes[i]);
- printf("0x%02x %5d %5d %.3f %s\n", id, w, h, r / 1000.0, str);
- }
- }
- }
-#endif
-}
-
-
-
-int
-main(int argc, char *argv[])
-{
- int maj, min;
- /*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/
- EGLDisplay d = eglGetDisplay(":0");
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("eglinfo: eglInitialize failed\n");
- exit(1);
- }
-
- printf("EGL API version: %d.%d\n", maj, min);
- printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR));
- printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION));
- printf("EGL extensions string:\n");
- printf(" %s\n", eglQueryString(d, EGL_EXTENSIONS));
- printf("\n");
-
- PrintConfigs(d);
-
- printf("\n");
-
- PrintModes(d);
-
- eglTerminate(d);
-
- return 0;
-}
diff --git a/progs/fbdev/Makefile b/progs/fbdev/Makefile
deleted file mode 100644
index 0a0c77906f7..00000000000
--- a/progs/fbdev/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# Makefile for miniglx demo programs
-
-TOP = ../..
-
-include $(TOP)/configs/current
-
-
-SOURCES = glfbdevtest.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-PROGS = $(SOURCES:%.c=%)
-
-INCLUDES = \
- -I. \
- -I$(TOP)/include
-
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c:
- $(CC) $(INCLUDES) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(PROGS)
-
-clean:
- rm -f $(PROGS)
- rm -f *.o
-
-
-depend: $(SOURCES)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-include depend
diff --git a/progs/fbdev/glfbdevtest.c b/progs/fbdev/glfbdevtest.c
deleted file mode 100644
index a461c55e2f8..00000000000
--- a/progs/fbdev/glfbdevtest.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Test the GLFBDev interface. Only tested with radeonfb driver!!!!
- *
- * Written by Brian Paul
- */
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <linux/fb.h>
-#include <linux/kd.h>
-#include <linux/vt.h>
-#include <GL/gl.h>
-#include <GL/glfbdev.h>
-#include <math.h>
-
-#define DEFAULT_DEPTH 8
-
-static struct fb_fix_screeninfo FixedInfo;
-static struct fb_var_screeninfo VarInfo, OrigVarInfo;
-static int DesiredDepth = 0;
-static int OriginalVT = -1;
-static int ConsoleFD = -1;
-static int FrameBufferFD = -1;
-static caddr_t FrameBuffer = (caddr_t) -1;
-static caddr_t MMIOAddress = (caddr_t) -1;
-
-
-static void
-print_fixed_info(const struct fb_fix_screeninfo *fixed, const char *s)
-{
- static const char *visuals[] = {
- "MONO01", "MONO10", "TRUECOLOR", "PSEUDOCOLOR",
- "DIRECTCOLOR", "STATIC_PSEUDOCOLOR"
- };
-
- printf("%s info -----------------------\n", s);
- printf("id = %16s\n", fixed->id);
- printf("smem_start = 0x%lx\n", fixed->smem_start);
- printf("smem_len = %d (0x%x)\n", fixed->smem_len, fixed->smem_len);
- printf("type = 0x%x\n", fixed->type);
- printf("type_aux = 0x%x\n", fixed->type_aux);
- printf("visual = 0x%x (%s)\n", fixed->visual, visuals[fixed->visual]);
- printf("xpanstep = %d\n", fixed->xpanstep);
- printf("ypanstep = %d\n", fixed->ypanstep);
- printf("ywrapstep = %d\n", fixed->ywrapstep);
- printf("line_length = %d\n", fixed->line_length);
- printf("mmio_start = 0x%lx\n", fixed->mmio_start);
- printf("mmio_len = %d (0x%x)\n", fixed->mmio_len, fixed->mmio_len);
- printf("accel = 0x%x\n", fixed->accel);
-}
-
-
-static void
-print_var_info(const struct fb_var_screeninfo *var, const char *s)
-{
- printf("%s info -----------------------\n", s);
- printf("xres = %d\n", var->xres);
- printf("yres = %d\n", var->yres);
- printf("xres_virtual = %d\n", var->xres_virtual);
- printf("yres_virtual = %d\n", var->yres_virtual);
- printf("xoffset = %d\n", var->xoffset);
- printf("yoffset = %d\n", var->yoffset);
- printf("bits_per_pixel = %d\n", var->bits_per_pixel);
- printf("grayscale = %d\n", var->grayscale);
-
- printf("red.offset = %d length = %d msb_right = %d\n",
- var->red.offset, var->red.length, var->red.msb_right);
- printf("green.offset = %d length = %d msb_right = %d\n",
- var->green.offset, var->green.length, var->green.msb_right);
- printf("blue.offset = %d length = %d msb_right = %d\n",
- var->blue.offset, var->blue.length, var->blue.msb_right);
- printf("transp.offset = %d length = %d msb_right = %d\n",
- var->transp.offset, var->transp.length, var->transp.msb_right);
-
- printf("nonstd = %d\n", var->nonstd);
- printf("activate = %d\n", var->activate);
- printf("height = %d mm\n", var->height);
- printf("width = %d mm\n", var->width);
- printf("accel_flags = 0x%x\n", var->accel_flags);
- printf("pixclock = %d\n", var->pixclock);
- printf("left_margin = %d\n", var->left_margin);
- printf("right_margin = %d\n", var->right_margin);
- printf("upper_margin = %d\n", var->upper_margin);
- printf("lower_margin = %d\n", var->lower_margin);
- printf("hsync_len = %d\n", var->hsync_len);
- printf("vsync_len = %d\n", var->vsync_len);
- printf("sync = %d\n", var->sync);
- printf("vmode = %d\n", var->vmode);
-}
-
-
-static void
-signal_handler(int signumber)
-{
- signal(signumber, SIG_IGN); /* prevent recursion! */
- fprintf(stderr, "error: got signal %d (exiting)\n", signumber);
- exit(1);
-}
-
-
-static void
-initialize_fbdev( void )
-{
- char ttystr[1000];
- int fd, vtnumber, ttyfd;
- int sz;
-
- (void) sz;
-
- if (geteuid()) {
- fprintf(stderr, "error: you need to be root\n");
- exit(1);
- }
-
-#if 1
- /* open the framebuffer device */
- FrameBufferFD = open("/dev/fb0", O_RDWR);
- if (FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- exit(1);
- }
-#endif
-
- /* open /dev/tty0 and get the vt number */
- if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
- fprintf(stderr, "error opening /dev/tty0\n");
- exit(1);
- }
- if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) {
- fprintf(stderr, "error: couldn't get a free vt\n");
- exit(1);
- }
- close(fd);
-
- /* open the console tty */
- sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */
- ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0);
- if (ConsoleFD < 0) {
- fprintf(stderr, "error couldn't open console fd\n");
- exit(1);
- }
-
- /* save current vt number */
- {
- struct vt_stat vts;
- if (ioctl(ConsoleFD, VT_GETSTATE, &vts) == 0)
- OriginalVT = vts.v_active;
- }
-
- /* disconnect from controlling tty */
- ttyfd = open("/dev/tty", O_RDWR);
- if (ttyfd >= 0) {
- ioctl(ttyfd, TIOCNOTTY, 0);
- close(ttyfd);
- }
-
- /* some magic to restore the vt when we exit */
- {
- struct vt_mode vt;
- if (ioctl(ConsoleFD, VT_ACTIVATE, vtnumber) != 0)
- printf("ioctl VT_ACTIVATE: %s\n", strerror(errno));
- if (ioctl(ConsoleFD, VT_WAITACTIVE, vtnumber) != 0)
- printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno));
-
- if (ioctl(ConsoleFD, VT_GETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno));
- exit(1);
- }
-
- vt.mode = VT_PROCESS;
- vt.relsig = SIGUSR1;
- vt.acqsig = SIGUSR1;
- if (ioctl(ConsoleFD, VT_SETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n",
- strerror(errno));
- exit(1);
- }
- }
-
- /* go into graphics mode */
- if (ioctl(ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) {
- fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
-
-#if 0
- /* open the framebuffer device */
- FrameBufferFD = open("/dev/fb0", O_RDWR);
- if (FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- exit(1);
- }
-#endif
-
- /* Get the fixed screen info */
- if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_fixed_info(&FixedInfo, "Fixed");
-
-
- /* get the variable screen info */
- if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &OrigVarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_var_info(&OrigVarInfo, "Orig Var");
-
- /* operate on a copy */
- VarInfo = OrigVarInfo;
-
- /* set the depth, resolution, etc */
- DesiredDepth = 32;
- if (DesiredDepth)
- VarInfo.bits_per_pixel = DesiredDepth;
-
- if (VarInfo.bits_per_pixel == 16) {
- VarInfo.red.offset = 11;
- VarInfo.green.offset = 5;
- VarInfo.blue.offset = 0;
- VarInfo.red.length = 5;
- VarInfo.green.length = 6;
- VarInfo.blue.length = 5;
- VarInfo.transp.offset = 0;
- VarInfo.transp.length = 0;
- }
- else if (VarInfo.bits_per_pixel == 32) {
- VarInfo.red.offset = 16;
- VarInfo.green.offset = 8;
- VarInfo.blue.offset = 0;
- VarInfo.transp.offset = 24;
- VarInfo.red.length = 8;
- VarInfo.green.length = 8;
- VarInfo.blue.length = 8;
- VarInfo.transp.length = 8;
- }
- /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
- VarInfo.xres_virtual = VarInfo.xres = 1280;
- VarInfo.yres_virtual = VarInfo.yres = 1024;
- VarInfo.pixclock = 7408;
- VarInfo.left_margin = 248;
- VarInfo.right_margin = 16;
- VarInfo.upper_margin = 38;
- VarInfo.lower_margin = 1;
- VarInfo.hsync_len = 144;
- VarInfo.vsync_len = 3;
-
- VarInfo.xoffset = 0;
- VarInfo.yoffset = 0;
- VarInfo.nonstd = 0;
- VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */
-
- /* set new variable screen info */
- if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_var_info(&VarInfo, "New Var");
-
- if (FixedInfo.visual != FB_VISUAL_TRUECOLOR &&
- FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) {
- fprintf(stderr, "non-TRUE/DIRECT-COLOR visuals (0x%x) not supported by this demo.\n", FixedInfo.visual);
- exit(1);
- }
-
- /* initialize colormap */
- if (FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
- struct fb_cmap cmap;
- unsigned short red[256], green[256], blue[256];
- int i;
-
- /* we're assuming 256 entries here */
- printf("initializing directcolor colormap\n");
- cmap.start = 0;
- cmap.len = 256;
- cmap.red = red;
- cmap.green = green;
- cmap.blue = blue;
- cmap.transp = NULL;
- for (i = 0; i < cmap.len; i++) {
- red[i] = green[i] = blue[i] = (i << 8) | i;
- }
- if (ioctl(FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) {
- fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
- }
- }
-
- /*
- * fbdev says the frame buffer is at offset zero, and the mmio region
- * is immediately after.
- */
-
- /* mmap the framebuffer into our address space */
- FrameBuffer = (caddr_t) mmap(0, /* start */
- FixedInfo.smem_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- FrameBufferFD, /* fd */
- 0 /* offset */);
- if (FrameBuffer == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
- strerror(errno));
- exit(1);
- }
- printf("FrameBuffer = %p\n", FrameBuffer);
-
-#if 1
- /* mmap the MMIO region into our address space */
- MMIOAddress = (caddr_t) mmap(0, /* start */
- FixedInfo.mmio_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- FrameBufferFD, /* fd */
- FixedInfo.smem_len /* offset */);
- if (MMIOAddress == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap mmio region: %s\n",
- strerror(errno));
- }
- printf("MMIOAddress = %p\n", MMIOAddress);
-
- /* try out some simple MMIO register reads */
- if (1)
- {
- typedef unsigned int CARD32;
- typedef unsigned char CARD8;
-#define RADEON_CONFIG_MEMSIZE 0x00f8
-#define RADEON_MEM_SDRAM_MODE_REG 0x0158
-#define MMIO_IN32(base, offset) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
-#define INREG(addr) MMIO_IN32(MMIOAddress, addr)
- int sz, type;
- const char *typeStr[] = {"SDR", "DDR", "64-bit SDR"};
- sz = INREG(RADEON_CONFIG_MEMSIZE);
- type = INREG(RADEON_MEM_SDRAM_MODE_REG);
- printf("RADEON_CONFIG_MEMSIZE = %d (%d MB)\n", sz, sz / 1024 / 1024);
- printf("RADEON_MEM_SDRAM_MODE_REG >> 30 = %d (%s)\n",
- type >> 30, typeStr[type>>30]);
- }
-#endif
-
-}
-
-
-static void
-shutdown_fbdev( void )
-{
- struct vt_mode VT;
-
- printf("cleaning up...\n");
- /* restore original variable screen info */
- if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- exit(1);
- }
-
- munmap(MMIOAddress, FixedInfo.mmio_len);
- munmap(FrameBuffer, FixedInfo.smem_len);
- close(FrameBufferFD);
-
- /* restore text mode */
- ioctl(ConsoleFD, KDSETMODE, KD_TEXT);
-
- /* set vt */
- if (ioctl(ConsoleFD, VT_GETMODE, &VT) != -1) {
- VT.mode = VT_AUTO;
- ioctl(ConsoleFD, VT_SETMODE, &VT);
- }
-
- /* restore original vt */
- if (OriginalVT >= 0) {
- ioctl(ConsoleFD, VT_ACTIVATE, OriginalVT);
- OriginalVT = -1;
- }
-
- close(ConsoleFD);
-}
-
-
-/* Borrowed from GLUT */
-static void
-doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings)
-{
- int i, j;
- GLfloat theta, phi, theta1;
- GLfloat cosTheta, sinTheta;
- GLfloat cosTheta1, sinTheta1;
- GLfloat ringDelta, sideDelta;
-
- ringDelta = 2.0 * M_PI / rings;
- sideDelta = 2.0 * M_PI / nsides;
-
- theta = 0.0;
- cosTheta = 1.0;
- sinTheta = 0.0;
- for (i = rings - 1; i >= 0; i--) {
- theta1 = theta + ringDelta;
- cosTheta1 = cos(theta1);
- sinTheta1 = sin(theta1);
- glBegin(GL_QUAD_STRIP);
- phi = 0.0;
- for (j = nsides; j >= 0; j--) {
- GLfloat cosPhi, sinPhi, dist;
-
- phi += sideDelta;
- cosPhi = cos(phi);
- sinPhi = sin(phi);
- dist = R + r * cosPhi;
-
- glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
- glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
- glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
- glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
- }
- glEnd();
- theta = theta1;
- cosTheta = cosTheta1;
- sinTheta = sinTheta1;
- }
-}
-
-
-static void
-gltest( void )
-{
- static const int attribs[] = {
- GLFBDEV_DOUBLE_BUFFER,
- GLFBDEV_DEPTH_SIZE, 16,
- GLFBDEV_NONE
- };
- GLFBDevContextPtr ctx;
- GLFBDevBufferPtr buf;
- GLFBDevVisualPtr vis;
- int bytes, r, g, b, a;
- float ang;
-
- printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
- printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
-
- /* framebuffer size */
- bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8;
-
- vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs );
- assert(vis);
-
- buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes );
- assert(buf);
-
- ctx = glFBDevCreateContext( vis, NULL );
- assert(buf);
-
- b = glFBDevMakeCurrent( ctx, buf, buf );
- assert(b);
-
- /*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
- glGetIntegerv(GL_ALPHA_BITS, &a);
- printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n",
- r, g, b, a);
-
- glClearColor(0.5, 0.5, 1.0, 0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1, 1, -1, 1, 2, 30);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0, 0, -15);
- glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- for (ang = 0; ang <= 180; ang += 15) {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glPushMatrix();
- glRotatef(ang, 1, 0, 0);
- doughnut(1, 3, 40, 20);
- glPopMatrix();
- glFBDevSwapBuffers(buf);
- }
-
- /* clean up */
- b = glFBDevMakeCurrent( NULL, NULL, NULL);
- assert(b);
-
- glFBDevDestroyContext(ctx);
- glFBDevDestroyBuffer(buf);
- glFBDevDestroyVisual(vis);
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
- signal(SIGSEGV, signal_handler); /* catch segfaults */
-
- initialize_fbdev();
- gltest();
- shutdown_fbdev();
-
- return 0;
-}
diff --git a/progs/fp/Makefile b/progs/fp/Makefile
deleted file mode 100644
index d461ebcc608..00000000000
--- a/progs/fp/Makefile
+++ /dev/null
@@ -1,127 +0,0 @@
-# progs/tests/Makefile
-
-
-# These programs aren't intended to be included with the normal distro.
-# They're not too interesting but they're good for testing.
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-LIBS = $(APP_LIB_DEPS)
-
-SOURCES = \
- tri-abs.c \
- tri-add.c \
- tri-cmp.c \
- tri-cos.c \
- tri-dp3.c \
- tri-dp4.c \
- tri-dph.c \
- tri-dst.c \
- tri-ex2.c \
- tri-flr.c \
- tri-frc.c \
- tri-kil.c \
- tri-lg2.c \
- tri-lit.c \
- tri-lrp.c \
- tri-mad.c \
- tri-max.c \
- tri-min.c \
- tri-mov.c \
- tri-mul.c \
- tri-pow.c \
- tri-param.c \
- tri-rcp.c \
- tri-rsq.c \
- tri-scs.c \
- tri-sge.c \
- tri-sge2.c \
- tri-sin.c \
- tri-slt.c \
- tri-sub.c \
- tri-swz.c \
- tri-swz2.c \
- tri-tex.c \
- tri-xpd.c \
- tri-position.c \
- tri-depth.c \
- tri-depth2.c \
- tri-depthwrite.c \
- tri-depthwrite2.c \
-
-NOTDONE=\
- tri-txb.c \
- tri-txp.c \
- tri-depthwrite.c \
- tri-fogoption.c
-
-
-PROGS = $(SOURCES:%.c=%)
-
-INCLUDES = -I. -I$(TOP)/include -I../samples
-
-UTIL_FILES = readtex.h readtex.c
-
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c:
- $(CC) $(INCLUDES) $(CFLAGS) $< $(LIBS) -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: $(UTIL_FILES) $(PROGS)
-
-clean:
- rm -f $(PROGS)
- rm -f *.o
- rm -f getproclist.h
-
-
-# auto code generation
-getprocaddress: getprocaddress.c getproclist.h
-
-getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
- python getprocaddress.py > getproclist.h
-
-
-texrect: texrect.o readtex.o
- $(CC) texrect.o readtex.o $(LIBS) -o $@
-
-texrect.o: texrect.c readtex.h
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-invert: invert.o readtex.o
- $(CC) invert.o readtex.o $(LIBS) -o $@
-
-invert.o: invert.c readtex.h
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-readtex.o: readtex.c
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-readtex.h: $(TOP)/progs/util/readtex.h
- ln -s $(TOP)/progs/util/readtex.h .
-
-readtex.c: $(TOP)/progs/util/readtex.c
- ln -s $(TOP)/progs/util/readtex.c .
-
-
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
diff --git a/progs/fp/tri-abs.c b/progs/fp/tri-abs.c
deleted file mode 100644
index 44aa2cfa3ad..00000000000
--- a/progs/fp/tri-abs.c
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "SUB R0, {0.5}.x, fragment.color; \n"
- "ABS result.color, R0; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-add.c b/progs/fp/tri-add.c
deleted file mode 100644
index b086126c867..00000000000
--- a/progs/fp/tri-add.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "ADD R0, fragment.color, fragment.color; \n"
- "ADD result.color, R0, R0; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-cmp.c b/progs/fp/tri-cmp.c
deleted file mode 100644
index 968b67f3d91..00000000000
--- a/progs/fp/tri-cmp.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "SUB R0, {0.5}.x, fragment.color; \n"
- "CMP result.color, R0, fragment.color, {0.0}.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-cos.c b/progs/fp/tri-cos.c
deleted file mode 100644
index 7ea24532189..00000000000
--- a/progs/fp/tri-cos.c
+++ /dev/null
@@ -1,113 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0; \n"
- "MUL R0, fragment.color, {3.14}.x; \n"
- "COS result.color.x, R0.x; \n"
- "COS result.color.y, R0.y; \n"
- "COS result.color.z, R0.z; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c
deleted file mode 100644
index a1f0579c8e1..00000000000
--- a/progs/fp/tri-depth.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- /* scale of 10.0 gives me a visible result on nv hardware.
- */
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MUL result.color, fragment.position.z, {10.0}.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -40.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -40.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -25.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c
deleted file mode 100644
index f3096282833..00000000000
--- a/progs/fp/tri-depth2.c
+++ /dev/null
@@ -1,116 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- /* scale of 10.0 gives me a visible result on nv hardware.
- */
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "MUL R0, fragment.position.z, {10.0}.x;\n"
- "MOV result.color, R0; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glVertex3f( 0.9, 0.9, -30.0);
- glVertex3f(-0.9, 0.0, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, -0.9, -40.0);
- glVertex3f(-0.9, 0.9, -40.0);
- glVertex3f( 0.9, 0.0, -25.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB | GLUT_DEPTH;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c
deleted file mode 100644
index fedeec4577d..00000000000
--- a/progs/fp/tri-depthwrite.c
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-static void Init(void)
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MUL result.depth.z, fragment.color.z, {.1}.x; \n"
- "MOV result.color.xy, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
-
-
- glBegin(GL_TRIANGLES);
- glColor4f(.8,0,.5,0);
- glVertex3f( 0.9, -0.9, -30.0);
- glVertex3f( 0.9, 0.9, -30.0);
- glVertex3f(-0.9, 0.0, -30.0);
-
- glColor4f(0,.8,.7,0);
- glVertex3f(-0.9, -0.9, -40.0);
- glColor4f(0,.8,.7,0);
- glVertex3f(-0.9, 0.9, -40.0);
- glColor4f(0,.8,.3,0);
- glVertex3f( 0.9, 0.0, -40.0);
- glEnd();
-
- glFlush();
-}
-
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
-
- glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE);
-
- if (glutCreateWindow("Depth Test") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c
deleted file mode 100644
index 5547092ec9b..00000000000
--- a/progs/fp/tri-depthwrite2.c
+++ /dev/null
@@ -1,107 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-static void Init(void)
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MUL result.depth.z, fragment.color.z, {.1}.x; \n"
- "MOV result.color, fragment.color.z; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
-
-
- glBegin(GL_TRIANGLES);
- glColor4f(.8,0,.5,0);
- glVertex3f( 0.9, -0.9, -30.0);
- glVertex3f( 0.9, 0.9, -30.0);
- glVertex3f(-0.9, 0.0, -30.0);
-
- glColor4f(0,.8,.7,0);
- glVertex3f(-0.9, -0.9, -40.0);
- glColor4f(0,.8,.7,0);
- glVertex3f(-0.9, 0.9, -40.0);
- glColor4f(0,.8,.3,0);
- glVertex3f( 0.9, 0.0, -40.0);
- glEnd();
-
- glFlush();
-}
-
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
-
- glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE);
-
- if (glutCreateWindow("Depth Test") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-dp3.c b/progs/fp/tri-dp3.c
deleted file mode 100644
index 0e18de2dc46..00000000000
--- a/progs/fp/tri-dp3.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "DP3 result.color, fragment.color, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-dp4.c b/progs/fp/tri-dp4.c
deleted file mode 100644
index 400bbf4da2d..00000000000
--- a/progs/fp/tri-dp4.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "DP4 result.color, fragment.color.xxxx, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-dph.c b/progs/fp/tri-dph.c
deleted file mode 100644
index 958073c4131..00000000000
--- a/progs/fp/tri-dph.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "DPH result.color, fragment.color, fragment.color.xyzx; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-dst.c b/progs/fp/tri-dst.c
deleted file mode 100644
index 3d85e85643c..00000000000
--- a/progs/fp/tri-dst.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "DST result.color, fragment.color, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-ex2.c b/progs/fp/tri-ex2.c
deleted file mode 100644
index f09b1d78469..00000000000
--- a/progs/fp/tri-ex2.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "EX2 R0, fragment.color.x; \n"
- "SUB result.color, R0, {1.0}.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-flr.c b/progs/fp/tri-flr.c
deleted file mode 100644
index 059f6b67541..00000000000
--- a/progs/fp/tri-flr.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "ADD R0, fragment.color, {0.5}.x; \n"
- "FLR result.color, R0; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-fp.c b/progs/fp/tri-fp.c
deleted file mode 100644
index 4148a8def34..00000000000
--- a/progs/fp/tri-fp.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "SLT result.color, {0.5}.x, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-frc.c b/progs/fp/tri-frc.c
deleted file mode 100644
index 8d60c9dc201..00000000000
--- a/progs/fp/tri-frc.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0; \n"
- "MUL R0, fragment.color, {3.0}.x; \n"
- "FRC result.color, R0; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-inv.c b/progs/fp/tri-inv.c
deleted file mode 100644
index e9023323862..00000000000
--- a/progs/fp/tri-inv.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "INV result.color, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-kil.c b/progs/fp/tri-kil.c
deleted file mode 100644
index 47dbd049644..00000000000
--- a/progs/fp/tri-kil.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "SUB R0, fragment.color, {0.5,0,0,0}; \n"
- "KIL R0;"
- "MOV result.color, R0;"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-lg2.c b/progs/fp/tri-lg2.c
deleted file mode 100644
index c7eec469741..00000000000
--- a/progs/fp/tri-lg2.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "MUL R0, fragment.color, {4.0}.x; \n"
- "LG2 result.color, R0.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-lit.c b/progs/fp/tri-lit.c
deleted file mode 100644
index 21e3b6f2169..00000000000
--- a/progs/fp/tri-lit.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "SUB R0, {0.5}.x, fragment.color; \n"
- "LIT result.color, R0; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-lrp.c b/progs/fp/tri-lrp.c
deleted file mode 100644
index a5659eed60d..00000000000
--- a/progs/fp/tri-lrp.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0, R1;\n"
- "LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-mad.c b/progs/fp/tri-mad.c
deleted file mode 100644
index b46d139fb3c..00000000000
--- a/progs/fp/tri-mad.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0, R1;\n"
- "MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-max.c b/progs/fp/tri-max.c
deleted file mode 100644
index 481a0679165..00000000000
--- a/progs/fp/tri-max.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MAX result.color, {0.5}.x, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-min.c b/progs/fp/tri-min.c
deleted file mode 100644
index 7bb722f85ff..00000000000
--- a/progs/fp/tri-min.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MIN result.color, {0.5}.x, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-mov.c b/progs/fp/tri-mov.c
deleted file mode 100644
index 40b5b66f5cc..00000000000
--- a/progs/fp/tri-mov.c
+++ /dev/null
@@ -1,102 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MOV result.color, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB | GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-mul.c b/progs/fp/tri-mul.c
deleted file mode 100644
index 61dd3e0458c..00000000000
--- a/progs/fp/tri-mul.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MUL result.color, fragment.color, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c
deleted file mode 100644
index f3e55af3f1b..00000000000
--- a/progs/fp/tri-param.c
+++ /dev/null
@@ -1,114 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MOV result.color, program.local[32]; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
- glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, .5, 0.25, 1);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.0, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 32, 0.25, 0, 0.25, 1);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, 0.0, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB | GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-position.c b/progs/fp/tri-position.c
deleted file mode 100644
index 18e8182a684..00000000000
--- a/progs/fp/tri-position.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "MUL result.color, fragment.position, {.005}.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-pow.c b/progs/fp/tri-pow.c
deleted file mode 100644
index ef91e43e997..00000000000
--- a/progs/fp/tri-pow.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "POW result.color, fragment.color.x, fragment.color.y; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-rcp.c b/progs/fp/tri-rcp.c
deleted file mode 100644
index e2a27049343..00000000000
--- a/progs/fp/tri-rcp.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "ADD R0, fragment.color.x, fragment.color.x; \n"
- "RCP result.color, R0.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-rsq.c b/progs/fp/tri-rsq.c
deleted file mode 100644
index c5b2c1b32e8..00000000000
--- a/progs/fp/tri-rsq.c
+++ /dev/null
@@ -1,110 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "MUL R0, fragment.color, {3.0}.x; \n"
- "RSQ result.color, R0.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-scs.c b/progs/fp/tri-scs.c
deleted file mode 100644
index ce7c0062c33..00000000000
--- a/progs/fp/tri-scs.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0; \n"
- "MUL R0, fragment.color, {3.14}.x; \n"
- "SCS result.color, R0.x; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-sge.c b/progs/fp/tri-sge.c
deleted file mode 100644
index 6a360ca9328..00000000000
--- a/progs/fp/tri-sge.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "SGE result.color, {0.5}.x, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-sge2.c b/progs/fp/tri-sge2.c
deleted file mode 100644
index c4330098ed4..00000000000
--- a/progs/fp/tri-sge2.c
+++ /dev/null
@@ -1,114 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "TEMP R1;\n"
- "SGE R0, fragment.color, fragment.color.yzxw; \n"
- "SGE R1, fragment.color, fragment.color.zxyw; \n"
- "MUL R0, R0, R1; \n"
- "MUL result.color, R0, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-sin.c b/progs/fp/tri-sin.c
deleted file mode 100644
index 772903e4b23..00000000000
--- a/progs/fp/tri-sin.c
+++ /dev/null
@@ -1,114 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0; \n"
- "MUL R0, fragment.color, {3.14}.x; \n"
- "MOV result.color, {0.0}.x; \n"
- "SIN result.color.x, R0.x; \n"
- "SIN result.color.y, R0.y; \n"
- "SIN result.color.z, R0.z; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-slt.c b/progs/fp/tri-slt.c
deleted file mode 100644
index 4148a8def34..00000000000
--- a/progs/fp/tri-slt.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "SLT result.color, {0.5}.x, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-sub.c b/progs/fp/tri-sub.c
deleted file mode 100644
index 6faa4145501..00000000000
--- a/progs/fp/tri-sub.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "SUB result.color, fragment.color.yzxw, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-swz.c b/progs/fp/tri-swz.c
deleted file mode 100644
index 5f34f7a3222..00000000000
--- a/progs/fp/tri-swz.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "SWZ result.color, fragment.color, 1,x,y,z; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-swz2.c b/progs/fp/tri-swz2.c
deleted file mode 100644
index fd76b58f539..00000000000
--- a/progs/fp/tri-swz2.c
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0, R1;\n"
- "SWZ result.color, fragment.color, 1, 0, 0, 1; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c
deleted file mode 100644
index 87f63894ce9..00000000000
--- a/progs/fp/tri-tex.c
+++ /dev/null
@@ -1,130 +0,0 @@
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "readtex.c"
-
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEX result.color, fragment.color, texture[0], 2D; \n"
- "END"
- ;
- GLuint modulateProg;
- GLuint Texture;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- assert(glIsProgramARB(modulateProg));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- /* Load texture */
- glGenTextures(1, &Texture);
- glBindTexture(GL_TEXTURE_2D, Texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE);
- exit(1);
- }
- /* XXX this enable shouldn't really be needed!!! */
- glEnable(GL_TEXTURE_2D);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
-/* glTexCoord2f(1, 0); */
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
-/* glTexCoord2f(1, 1); */
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
-/* glTexCoord2f(0, .5); */
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/fp/tri-xpd.c b/progs/fp/tri-xpd.c
deleted file mode 100644
index 9aca46b2faa..00000000000
--- a/progs/fp/tri-xpd.c
+++ /dev/null
@@ -1,108 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include "GL/gl.h"
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "XPD result.color, fragment.color, {2,2,2,0}; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- return;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/ggi/blah b/progs/ggi/blah
deleted file mode 100644
index 2c1664d7d05..00000000000
--- a/progs/ggi/blah
+++ /dev/null
@@ -1,2 +0,0 @@
-Terminating on signal 11
-
diff --git a/progs/ggi/blat b/progs/ggi/blat
deleted file mode 100644
index 7ff64a9d10d..00000000000
--- a/progs/ggi/blat
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-function foobar() {
- echo "foo!"
-}
-
-foobar
diff --git a/progs/ggi/box.asc b/progs/ggi/box.asc
deleted file mode 100644
index f8b23fd85af..00000000000
--- a/progs/ggi/box.asc
+++ /dev/null
@@ -1,66 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 8 Faces: 12
-Vertex list:
-Vertex 0: X: -20 Y: -19.999998 Z: 20.000002
-Vertex 1: X: 20 Y: -19.999998 Z: 20.000002
-Vertex 2: X: 20 Y: 20.000002 Z: 19.999998
-Vertex 3: X: -20 Y: 20.000002 Z: 19.999998
-Vertex 4: X: -20 Y: -20.000002 Z: -19.999998
-Vertex 5: X: 20 Y: -20.000002 Z: -19.999998
-Vertex 6: X: 20 Y: 19.999998 Z: -20.000002
-Vertex 7: X: -20 Y: 19.999998 Z: -20.000002
-Face list:
-Face 0: A:0 B:1 C:2 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 1: A:0 B:2 C:3 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 2: A:0 B:4 C:5 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 3: A:0 B:5 C:1 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 4: A:1 B:5 C:6 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 5: A:1 B:6 C:2 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 6: A:2 B:6 C:7 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 7: A:2 B:7 C:3 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 8: A:3 B:7 C:4 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 9: A:3 B:4 C:0 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 10: A:4 B:7 C:6 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 11: A:4 B:6 C:5 AB:0 BC:1 CA:1
-Smoothing: 6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 1
-
-
-
diff --git a/progs/ggi/cone.asc b/progs/ggi/cone.asc
deleted file mode 100644
index 5c522859963..00000000000
--- a/progs/ggi/cone.asc
+++ /dev/null
@@ -1,198 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 34 Faces: 64
-Vertex list:
-Vertex 0: X: 60.167416 Y: -87.419525 Z: -53.3088
-Vertex 1: X: 76.70787 Y: -87.419518 Z: -29.84565
-Vertex 2: X: 83.0103 Y: -87.419518 Z: -1.838764
-Vertex 3: X: 78.115204 Y: -87.419518 Z: 26.448057
-Vertex 4: X: 62.767834 Y: -87.41951 Z: 50.708401
-Vertex 5: X: 39.304672 Y: -87.41951 Z: 67.248848
-Vertex 6: X: 11.297782 Y: -87.41951 Z: 73.551254
-Vertex 7: X: -16.989004 Y: -87.41951 Z: 68.656158
-Vertex 8: X: -41.249344 Y: -87.41951 Z: 53.308777
-Vertex 9: X: -57.789783 Y: -87.419518 Z: 29.845612
-Vertex 10: X: -64.092194 Y: -87.419518 Z: 1.838721
-Vertex 11: X: -59.197079 Y: -87.419518 Z: -26.448097
-Vertex 12: X: -43.849678 Y: -87.419525 Z: -50.708427
-Vertex 13: X: -20.386503 Y: -87.419525 Z: -67.248856
-Vertex 14: X: 7.62039 Y: -87.419525 Z: -73.551239
-Vertex 15: X: 35.907204 Y: -87.419525 Z: -68.656105
-Vertex 16: X: 101.684875 Y: 94.590591 Z: -96.955391
-Vertex 17: X: 131.767838 Y: 94.590591 Z: -54.281792
-Vertex 18: X: 143.230377 Y: 94.590599 Z: -3.344275
-Vertex 19: X: 134.327423 Y: 94.590607 Z: 48.102379
-Vertex 20: X: 106.414383 Y: 94.590607 Z: 92.225876
-Vertex 21: X: 63.740765 Y: 94.590607 Z: 122.3088
-Vertex 22: X: 12.803238 Y: 94.590614 Z: 133.771301
-Vertex 23: X: -38.643349 Y: 94.590607 Z: 124.868355
-Vertex 24: X: -82.766846 Y: 94.590607 Z: 96.955307
-Vertex 25: X: -112.849762 Y: 94.590607 Z: 54.281677
-Vertex 26: X: -124.312256 Y: 94.590599 Z: 3.344152
-Vertex 27: X: -115.409271 Y: 94.590591 Z: -48.102493
-Vertex 28: X: -87.496201 Y: 94.590591 Z: -92.225967
-Vertex 29: X: -44.822552 Y: 94.590591 Z: -122.308861
-Vertex 30: X: 6.114983 Y: 94.590584 Z: -133.771332
-Vertex 31: X: 57.561623 Y: 94.590591 Z: -124.868301
-Vertex 32: X: 9.459057 Y: -87.419518 Z: 0.000008
-Vertex 33: X: 9.459057 Y: 94.590599 Z: -0.000008
-Face list:
-Face 0: A:0 B:1 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 1: A:1 B:2 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 2: A:2 B:3 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 3: A:3 B:4 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 4: A:4 B:5 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 5: A:5 B:6 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 6: A:6 B:7 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 7: A:7 B:8 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 8: A:8 B:9 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 9: A:9 B:10 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 10: A:10 B:11 C:32 AB:1 BC:0 CA:0
-
- Page 1
-
-
-
-Smoothing: 1
-Face 11: A:11 B:12 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 12: A:12 B:13 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 13: A:13 B:14 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 14: A:14 B:15 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 15: A:15 B:0 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 16: A:0 B:16 C:17 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 17: A:0 B:17 C:1 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 18: A:1 B:17 C:18 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 19: A:1 B:18 C:2 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 20: A:2 B:18 C:19 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 21: A:2 B:19 C:3 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 22: A:3 B:19 C:20 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 23: A:3 B:20 C:4 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 24: A:4 B:20 C:21 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 25: A:4 B:21 C:5 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 26: A:5 B:21 C:22 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 27: A:5 B:22 C:6 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 28: A:6 B:22 C:23 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 29: A:6 B:23 C:7 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 30: A:7 B:23 C:24 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 31: A:7 B:24 C:8 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 32: A:8 B:24 C:25 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 33: A:8 B:25 C:9 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 34: A:9 B:25 C:26 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 35: A:9 B:26 C:10 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 36: A:10 B:26 C:27 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 37: A:10 B:27 C:11 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 38: A:11 B:27 C:28 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 39: A:11 B:28 C:12 AB:0 BC:1 CA:1
-Smoothing: 13
-Face 40: A:12 B:28 C:29 AB:1 BC:1 CA:0
-Smoothing: 14
-
- Page 2
-
-
-
-Face 41: A:12 B:29 C:13 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 42: A:13 B:29 C:30 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 43: A:13 B:30 C:14 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 44: A:14 B:30 C:31 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 45: A:14 B:31 C:15 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 46: A:15 B:31 C:16 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 47: A:15 B:16 C:0 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 48: A:16 B:33 C:17 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 49: A:17 B:33 C:18 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 50: A:18 B:33 C:19 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 51: A:19 B:33 C:20 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 52: A:20 B:33 C:21 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 53: A:21 B:33 C:22 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 54: A:22 B:33 C:23 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 55: A:23 B:33 C:24 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 56: A:24 B:33 C:25 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 57: A:25 B:33 C:26 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 58: A:26 B:33 C:27 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 59: A:27 B:33 C:28 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 60: A:28 B:33 C:29 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 61: A:29 B:33 C:30 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 62: A:30 B:33 C:31 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 63: A:31 B:33 C:16 AB:0 BC:0 CA:1
-Smoothing: 18
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3
-
-
-
diff --git a/progs/ggi/sphere.asc b/progs/ggi/sphere.asc
deleted file mode 100644
index 1424a740d7b..00000000000
--- a/progs/ggi/sphere.asc
+++ /dev/null
@@ -1,132 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 20 Faces: 36
-Vertex list:
-Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
-Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
-Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
-Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
-Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
-Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
-Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
-Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
-Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
-Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
-Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
-Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
-Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
-Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
-Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
-Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
-Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
-Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
-Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
-Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
-Face list:
-Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
-Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
-Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
-Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
-Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
-Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
-Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
-Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
-Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
-Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
-Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
-Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
-Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
-Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
-Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
-Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
-Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
-Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
-Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
-Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
-Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
-Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
-Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
-Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
-Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
-Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
-Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
-Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
-Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
-Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
-Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
-Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
-Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
-Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
-Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
-
- Page 1
-
-
-
-Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 2
-
-
-
diff --git a/progs/ggi/torus.asc b/progs/ggi/torus.asc
deleted file mode 100644
index 6bd41f40337..00000000000
--- a/progs/ggi/torus.asc
+++ /dev/null
@@ -1,264 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 40 Faces: 80
-Vertex list:
-Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
-Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
-Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
-Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
-Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
-Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
-Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
-Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
-Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
-Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
-Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
-Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
-Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
-Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
-Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
-Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
-Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
-Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
-Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
-Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
-Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
-Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
-Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
-Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
-Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
-Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
-Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
-Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
-Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
-Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
-Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
-Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
-Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
-Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
-Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
-Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
-Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
-Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
-Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
-Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
-Face list:
-Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
-
- Page 1
-
-
-
-Smoothing: 4
-Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
-Smoothing: 13
-Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
-Smoothing: 14
-Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
-Smoothing: 18
-Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
-Smoothing: 18
-Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
-Smoothing: 19
-Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
-Smoothing: 19
-
- Page 2
-
-
-
-Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
-Smoothing: 20
-Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
-Smoothing: 20
-Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
-Smoothing: 21
-Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
-Smoothing: 21
-Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
-Smoothing: 22
-Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
-Smoothing: 22
-Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
-Smoothing: 23
-Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
-Smoothing: 23
-Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
-Smoothing: 24
-Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
-Smoothing: 24
-Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
-Smoothing: 25
-Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
-Smoothing: 25
-Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
-Smoothing: 26
-Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
-Smoothing: 26
-Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
-Smoothing: 27
-Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
-Smoothing: 27
-Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
-Smoothing: 28
-Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
-Smoothing: 28
-Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
-Smoothing: 29
-Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
-Smoothing: 29
-Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
-Smoothing: 30
-Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
-Smoothing: 30
-Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
-Smoothing: 31
-Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
-Smoothing: 31
-Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
-Smoothing: 32
-Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
-Smoothing: 32
-Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
-
- Page 3
-
-
-
-Smoothing: 3
-Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
-Smoothing: 8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 4
-
-
-
diff --git a/progs/ggi/tube.asc b/progs/ggi/tube.asc
deleted file mode 100644
index 0b5dd0d810b..00000000000
--- a/progs/ggi/tube.asc
+++ /dev/null
@@ -1,396 +0,0 @@
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 64 Faces: 128
-Vertex list:
-Vertex 0: X: 61.483898 Y: 37.836231 Z: -70.94294
-Vertex 1: X: 82.867447 Y: 37.836235 Z: -41.288902
-Vertex 2: X: 91.275154 Y: 37.836239 Z: -5.70901
-Vertex 3: X: 85.427025 Y: 37.836243 Z: 30.380013
-Vertex 4: X: 66.213379 Y: 37.836243 Z: 61.483936
-Vertex 5: X: 36.559322 Y: 37.836246 Z: 82.86747
-Vertex 6: X: 0.979424 Y: 37.836246 Z: 91.275154
-Vertex 7: X: -35.109554 Y: 37.836246 Z: 85.42701
-Vertex 8: X: -66.213478 Y: 37.836246 Z: 66.213356
-Vertex 9: X: -87.597 Y: 37.836243 Z: 36.559303
-Vertex 10: X: -96.004677 Y: 37.836239 Z: 0.979406
-Vertex 11: X: -90.156517 Y: 37.836235 Z: -35.109615
-Vertex 12: X: -70.942848 Y: 37.836235 Z: -66.213516
-Vertex 13: X: -41.288776 Y: 37.836231 Z: -87.597023
-Vertex 14: X: -5.708872 Y: 37.836231 Z: -96.004692
-Vertex 15: X: 30.380142 Y: 37.836231 Z: -90.156502
-Vertex 16: X: 61.483898 Y: -38.14529 Z: -70.942932
-Vertex 17: X: 82.867447 Y: -38.145287 Z: -41.288895
-Vertex 18: X: 91.275154 Y: -38.145283 Z: -5.709003
-Vertex 19: X: 85.427025 Y: -38.145279 Z: 30.38002
-Vertex 20: X: 66.213379 Y: -38.145279 Z: 61.483944
-Vertex 21: X: 36.559322 Y: -38.145275 Z: 82.867477
-Vertex 22: X: 0.979424 Y: -38.145275 Z: 91.275162
-Vertex 23: X: -35.109554 Y: -38.145275 Z: 85.427017
-Vertex 24: X: -66.213478 Y: -38.145275 Z: 66.213364
-Vertex 25: X: -87.597 Y: -38.145279 Z: 36.559311
-Vertex 26: X: -96.004677 Y: -38.145283 Z: 0.979412
-Vertex 27: X: -90.156517 Y: -38.145287 Z: -35.109608
-Vertex 28: X: -70.942848 Y: -38.145287 Z: -66.213516
-Vertex 29: X: -41.288776 Y: -38.14529 Z: -87.597015
-Vertex 30: X: -5.708872 Y: -38.14529 Z: -96.004684
-Vertex 31: X: 30.380142 Y: -38.14529 Z: -90.156494
-Vertex 32: X: 29.53923 Y: 37.836235 Z: -36.632011
-Vertex 33: X: 40.224194 Y: 37.836239 Z: -21.814436
-Vertex 34: X: 44.425369 Y: 37.836239 Z: -4.035822
-Vertex 35: X: 41.503166 Y: 37.836239 Z: 13.997195
-Vertex 36: X: 31.902466 Y: 37.836243 Z: 29.539249
-Vertex 37: X: 17.084883 Y: 37.836243 Z: 40.224201
-Vertex 38: X: -0.693734 Y: 37.836243 Z: 44.425365
-Vertex 39: X: -18.726728 Y: 37.836243 Z: 41.503159
-Vertex 40: X: -34.26878 Y: 37.836243 Z: 31.902454
-Vertex 41: X: -44.953732 Y: 37.836239 Z: 17.084871
-Vertex 42: X: -49.154892 Y: 37.836239 Z: -0.693745
-Vertex 43: X: -46.232677 Y: 37.836239 Z: -18.726759
-Vertex 44: X: -36.631962 Y: 37.836235 Z: -34.268806
-Vertex 45: X: -21.814371 Y: 37.836235 Z: -44.953747
-Vertex 46: X: -4.035751 Y: 37.836235 Z: -49.1549
-Vertex 47: X: 13.997261 Y: 37.836235 Z: -46.23267
-Vertex 48: X: 29.53923 Y: -38.145287 Z: -36.632004
-Vertex 49: X: 40.224194 Y: -38.145283 Z: -21.814428
-Vertex 50: X: 44.425369 Y: -38.145283 Z: -4.035816
-Vertex 51: X: 41.503166 Y: -38.145283 Z: 13.997201
-Vertex 52: X: 31.902466 Y: -38.145279 Z: 29.539257
-Vertex 53: X: 17.084883 Y: -38.145279 Z: 40.224209
-Vertex 54: X: -0.693734 Y: -38.145279 Z: 44.425373
-Vertex 55: X: -18.726728 Y: -38.145279 Z: 41.503166
-
- Page 1
-
-
-
-Vertex 56: X: -34.26878 Y: -38.145279 Z: 31.902462
-Vertex 57: X: -44.953732 Y: -38.145283 Z: 17.084879
-Vertex 58: X: -49.154892 Y: -38.145283 Z: -0.693738
-Vertex 59: X: -46.232677 Y: -38.145283 Z: -18.726751
-Vertex 60: X: -36.631962 Y: -38.145287 Z: -34.268799
-Vertex 61: X: -21.814371 Y: -38.145287 Z: -44.953739
-Vertex 62: X: -4.035751 Y: -38.145287 Z: -49.154892
-Vertex 63: X: 13.997261 Y: -38.145287 Z: -46.232662
-Face list:
-Face 0: A:0 B:1 C:17 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 1: A:0 B:17 C:16 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 2: A:1 B:2 C:18 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 3: A:1 B:18 C:17 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 4: A:2 B:3 C:19 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 5: A:2 B:19 C:18 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 6: A:3 B:4 C:20 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 7: A:3 B:20 C:19 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 8: A:4 B:5 C:21 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 9: A:4 B:21 C:20 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 10: A:5 B:6 C:22 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 11: A:5 B:22 C:21 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 12: A:6 B:7 C:23 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 13: A:6 B:23 C:22 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 14: A:7 B:8 C:24 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 15: A:7 B:24 C:23 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 16: A:8 B:9 C:25 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 17: A:8 B:25 C:24 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 18: A:9 B:10 C:26 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 19: A:9 B:26 C:25 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 20: A:10 B:11 C:27 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 21: A:10 B:27 C:26 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 22: A:11 B:12 C:28 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 23: A:11 B:28 C:27 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 24: A:12 B:13 C:29 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 25: A:12 B:29 C:28 AB:0 BC:1 CA:1
-Smoothing: 13
-
- Page 2
-
-
-
-Face 26: A:13 B:14 C:30 AB:1 BC:1 CA:0
-Smoothing: 14
-Face 27: A:13 B:30 C:29 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 28: A:14 B:15 C:31 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 29: A:14 B:31 C:30 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 30: A:15 B:0 C:16 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 31: A:15 B:16 C:31 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 32: A:32 B:49 C:33 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 33: A:32 B:48 C:49 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 34: A:33 B:50 C:34 AB:0 BC:1 CA:1
-Smoothing: 18
-Face 35: A:33 B:49 C:50 AB:1 BC:1 CA:0
-Smoothing: 18
-Face 36: A:34 B:51 C:35 AB:0 BC:1 CA:1
-Smoothing: 19
-Face 37: A:34 B:50 C:51 AB:1 BC:1 CA:0
-Smoothing: 19
-Face 38: A:35 B:52 C:36 AB:0 BC:1 CA:1
-Smoothing: 20
-Face 39: A:35 B:51 C:52 AB:1 BC:1 CA:0
-Smoothing: 20
-Face 40: A:36 B:53 C:37 AB:0 BC:1 CA:1
-Smoothing: 21
-Face 41: A:36 B:52 C:53 AB:1 BC:1 CA:0
-Smoothing: 21
-Face 42: A:37 B:54 C:38 AB:0 BC:1 CA:1
-Smoothing: 22
-Face 43: A:37 B:53 C:54 AB:1 BC:1 CA:0
-Smoothing: 22
-Face 44: A:38 B:55 C:39 AB:0 BC:1 CA:1
-Smoothing: 23
-Face 45: A:38 B:54 C:55 AB:1 BC:1 CA:0
-Smoothing: 23
-Face 46: A:39 B:56 C:40 AB:0 BC:1 CA:1
-Smoothing: 24
-Face 47: A:39 B:55 C:56 AB:1 BC:1 CA:0
-Smoothing: 24
-Face 48: A:40 B:57 C:41 AB:0 BC:1 CA:1
-Smoothing: 25
-Face 49: A:40 B:56 C:57 AB:1 BC:1 CA:0
-Smoothing: 25
-Face 50: A:41 B:58 C:42 AB:0 BC:1 CA:1
-Smoothing: 26
-Face 51: A:41 B:57 C:58 AB:1 BC:1 CA:0
-Smoothing: 26
-Face 52: A:42 B:59 C:43 AB:0 BC:1 CA:1
-Smoothing: 27
-Face 53: A:42 B:58 C:59 AB:1 BC:1 CA:0
-Smoothing: 27
-Face 54: A:43 B:60 C:44 AB:0 BC:1 CA:1
-Smoothing: 28
-Face 55: A:43 B:59 C:60 AB:1 BC:1 CA:0
-Smoothing: 28
-Face 56: A:44 B:61 C:45 AB:0 BC:1 CA:1
-
- Page 3
-
-
-
-Smoothing: 29
-Face 57: A:44 B:60 C:61 AB:1 BC:1 CA:0
-Smoothing: 29
-Face 58: A:45 B:62 C:46 AB:0 BC:1 CA:1
-Smoothing: 30
-Face 59: A:45 B:61 C:62 AB:1 BC:1 CA:0
-Smoothing: 30
-Face 60: A:46 B:63 C:47 AB:0 BC:1 CA:1
-Smoothing: 31
-Face 61: A:46 B:62 C:63 AB:1 BC:1 CA:0
-Smoothing: 31
-Face 62: A:47 B:48 C:32 AB:0 BC:1 CA:1
-Smoothing: 32
-Face 63: A:47 B:63 C:48 AB:1 BC:1 CA:0
-Smoothing: 32
-Face 64: A:0 B:32 C:33 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 65: A:0 B:33 C:1 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 66: A:1 B:33 C:34 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 67: A:1 B:34 C:2 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 68: A:2 B:34 C:35 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 69: A:2 B:35 C:3 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 70: A:3 B:35 C:36 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 71: A:3 B:36 C:4 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 72: A:4 B:36 C:37 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 73: A:4 B:37 C:5 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 74: A:5 B:37 C:38 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 75: A:5 B:38 C:6 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 76: A:6 B:38 C:39 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 77: A:6 B:39 C:7 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 78: A:7 B:39 C:40 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 79: A:7 B:40 C:8 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 80: A:8 B:40 C:41 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 81: A:8 B:41 C:9 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 82: A:9 B:41 C:42 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 83: A:9 B:42 C:10 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 84: A:10 B:42 C:43 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 85: A:10 B:43 C:11 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 86: A:11 B:43 C:44 AB:0 BC:1 CA:0
-Smoothing: 1
-
- Page 4
-
-
-
-Face 87: A:11 B:44 C:12 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 88: A:12 B:44 C:45 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 89: A:12 B:45 C:13 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 90: A:13 B:45 C:46 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 91: A:13 B:46 C:14 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 92: A:14 B:46 C:47 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 93: A:14 B:47 C:15 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 94: A:15 B:47 C:32 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 95: A:15 B:32 C:0 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 96: A:16 B:17 C:49 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 97: A:16 B:49 C:48 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 98: A:17 B:18 C:50 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 99: A:17 B:50 C:49 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 100: A:18 B:19 C:51 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 101: A:18 B:51 C:50 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 102: A:19 B:20 C:52 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 103: A:19 B:52 C:51 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 104: A:20 B:21 C:53 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 105: A:20 B:53 C:52 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 106: A:21 B:22 C:54 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 107: A:21 B:54 C:53 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 108: A:22 B:23 C:55 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 109: A:22 B:55 C:54 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 110: A:23 B:24 C:56 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 111: A:23 B:56 C:55 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 112: A:24 B:25 C:57 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 113: A:24 B:57 C:56 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 114: A:25 B:26 C:58 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 115: A:25 B:58 C:57 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 116: A:26 B:27 C:59 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 117: A:26 B:59 C:58 AB:0 BC:1 CA:0
-
- Page 5
-
-
-
-Smoothing: 2
-Face 118: A:27 B:28 C:60 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 119: A:27 B:60 C:59 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 120: A:28 B:29 C:61 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 121: A:28 B:61 C:60 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 122: A:29 B:30 C:62 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 123: A:29 B:62 C:61 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 124: A:30 B:31 C:63 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 125: A:30 B:63 C:62 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 126: A:31 B:16 C:48 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 127: A:31 B:48 C:63 AB:0 BC:1 CA:0
-Smoothing: 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 6
-
-
-
diff --git a/progs/miniglx/Makefile b/progs/miniglx/Makefile
deleted file mode 100644
index 7f1e162186f..00000000000
--- a/progs/miniglx/Makefile
+++ /dev/null
@@ -1,58 +0,0 @@
-# Makefile for miniglx demo programs
-
-TOP = ../..
-
-include $(TOP)/configs/current
-
-
-SOURCES = miniglxtest.c \
- miniglxsample.c \
- sample_server.c \
- sample_server2.c \
- manytex.c \
- texline.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-PROGS = $(SOURCES:%.c=%)
-
-INCLUDES = \
- -I. \
- -I$(TOP)/include
-
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c:
- $(CC) $(INCLUDES) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(PROGS)
-
-clean:
- rm -f $(PROGS)
- rm -f *.o
-
-
-depend: $(SOURCES)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-include depend
diff --git a/progs/miniglx/glfbdevtest.c b/progs/miniglx/glfbdevtest.c
deleted file mode 100644
index 8dbf0df461b..00000000000
--- a/progs/miniglx/glfbdevtest.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* $Id: glfbdevtest.c,v 1.1 2003-08-06 17:47:15 keithw Exp $ */
-
-/*
- * Test the GLFBDev interface. Only tested with radeonfb driver!!!!
- */
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <linux/fb.h>
-#include <linux/kd.h>
-#include <linux/vt.h>
-#include <GL/glut.h>
-#include "GL/glfbdev.h"
-
-#define DEFAULT_DEPTH 8
-
-static struct fb_fix_screeninfo FixedInfo;
-static struct fb_var_screeninfo VarInfo, OrigVarInfo;
-static int DesiredDepth = 0;
-static int OriginalVT = -1;
-static int ConsoleFD = -1;
-static int FrameBufferFD = -1;
-static caddr_t FrameBuffer = (caddr_t) -1;
-static caddr_t MMIOAddress = (caddr_t) -1;
-
-
-static void
-print_fixed_info(const struct fb_fix_screeninfo *fixed, const char *s)
-{
- static const char *visuals[] = {
- "MONO01", "MONO10", "TRUECOLOR", "PSEUDOCOLOR",
- "DIRECTCOLOR", "STATIC_PSEUDOCOLOR"
- };
-
- printf("%s info -----------------------\n", s);
- printf("id = %16s\n", fixed->id);
- printf("smem_start = 0x%x\n", fixed->smem_start);
- printf("smem_len = %d (0x%x)\n", fixed->smem_len, fixed->smem_len);
- printf("type = 0x%x\n", fixed->type);
- printf("type_aux = 0x%x\n", fixed->type_aux);
- printf("visual = 0x%x (%s)\n", fixed->visual, visuals[fixed->visual]);
- printf("xpanstep = %d\n", fixed->xpanstep);
- printf("ypanstep = %d\n", fixed->ypanstep);
- printf("ywrapstep = %d\n", fixed->ywrapstep);
- printf("line_length = %d\n", fixed->line_length);
- printf("mmio_start = 0x%x\n", fixed->mmio_start);
- printf("mmio_len = %d (0x%x)\n", fixed->mmio_len, fixed->mmio_len);
- printf("accel = 0x%x\n", fixed->accel);
-}
-
-
-static void
-print_var_info(const struct fb_var_screeninfo *var, const char *s)
-{
- printf("%s info -----------------------\n", s);
- printf("xres = %d\n", var->xres);
- printf("yres = %d\n", var->yres);
- printf("xres_virtual = %d\n", var->xres_virtual);
- printf("yres_virtual = %d\n", var->yres_virtual);
- printf("xoffset = %d\n", var->xoffset);
- printf("yoffset = %d\n", var->yoffset);
- printf("bits_per_pixel = %d\n", var->bits_per_pixel);
- printf("grayscale = %d\n", var->grayscale);
-
- printf("red.offset = %d length = %d msb_right = %d\n",
- var->red.offset, var->red.length, var->red.msb_right);
- printf("green.offset = %d length = %d msb_right = %d\n",
- var->green.offset, var->green.length, var->green.msb_right);
- printf("blue.offset = %d length = %d msb_right = %d\n",
- var->blue.offset, var->blue.length, var->blue.msb_right);
- printf("transp.offset = %d length = %d msb_right = %d\n",
- var->transp.offset, var->transp.length, var->transp.msb_right);
-
- printf("nonstd = %d\n", var->nonstd);
- printf("activate = %d\n", var->activate);
- printf("height = %d mm\n", var->height);
- printf("width = %d mm\n", var->width);
- printf("accel_flags = 0x%x\n", var->accel_flags);
- printf("pixclock = %d\n", var->pixclock);
- printf("left_margin = %d\n", var->left_margin);
- printf("right_margin = %d\n", var->right_margin);
- printf("upper_margin = %d\n", var->upper_margin);
- printf("lower_margin = %d\n", var->lower_margin);
- printf("hsync_len = %d\n", var->hsync_len);
- printf("vsync_len = %d\n", var->vsync_len);
- printf("sync = %d\n", var->sync);
- printf("vmode = %d\n", var->vmode);
-}
-
-
-static void
-signal_handler(int signumber)
-{
- signal(signumber, SIG_IGN); /* prevent recursion! */
- fprintf(stderr, "error: got signal %d (exiting)\n", signumber);
- exit(1);
-}
-
-
-static void
-initialize_fbdev( void )
-{
- char ttystr[1000];
- int fd, vtnumber, ttyfd;
- int sz;
-
- if (geteuid()) {
- fprintf(stderr, "error: you need to be root\n");
- exit(1);
- }
-
-#if 1
- /* open the framebuffer device */
- FrameBufferFD = open("/dev/fb0", O_RDWR);
- if (FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- exit(1);
- }
-#endif
-
- /* open /dev/tty0 and get the vt number */
- if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
- fprintf(stderr, "error opening /dev/tty0\n");
- exit(1);
- }
- if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) {
- fprintf(stderr, "error: couldn't get a free vt\n");
- exit(1);
- }
- close(fd);
-
- /* open the console tty */
- sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */
- ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0);
- if (ConsoleFD < 0) {
- fprintf(stderr, "error couldn't open console fd\n");
- exit(1);
- }
-
- /* save current vt number */
- {
- struct vt_stat vts;
- if (ioctl(ConsoleFD, VT_GETSTATE, &vts) == 0)
- OriginalVT = vts.v_active;
- }
-
- /* disconnect from controlling tty */
- ttyfd = open("/dev/tty", O_RDWR);
- if (ttyfd >= 0) {
- ioctl(ttyfd, TIOCNOTTY, 0);
- close(ttyfd);
- }
-
- /* some magic to restore the vt when we exit */
- {
- struct vt_mode vt;
- if (ioctl(ConsoleFD, VT_ACTIVATE, vtnumber) != 0)
- printf("ioctl VT_ACTIVATE: %s\n", strerror(errno));
- if (ioctl(ConsoleFD, VT_WAITACTIVE, vtnumber) != 0)
- printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno));
-
- if (ioctl(ConsoleFD, VT_GETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno));
- exit(1);
- }
-
- vt.mode = VT_PROCESS;
- vt.relsig = SIGUSR1;
- vt.acqsig = SIGUSR1;
- if (ioctl(ConsoleFD, VT_SETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n",
- strerror(errno));
- exit(1);
- }
- }
-
- /* go into graphics mode */
- if (ioctl(ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) {
- fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
-
-#if 0
- /* open the framebuffer device */
- FrameBufferFD = open("/dev/fb0", O_RDWR);
- if (FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- exit(1);
- }
-#endif
-
- /* Get the fixed screen info */
- if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_fixed_info(&FixedInfo, "Fixed");
-
-
- /* get the variable screen info */
- if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &OrigVarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_var_info(&OrigVarInfo, "Orig Var");
-
- /* operate on a copy */
- VarInfo = OrigVarInfo;
-
- /* set the depth, resolution, etc */
- DesiredDepth = 32;
- if (DesiredDepth)
- VarInfo.bits_per_pixel = DesiredDepth;
-
- if (VarInfo.bits_per_pixel == 16) {
- VarInfo.red.offset = 11;
- VarInfo.green.offset = 5;
- VarInfo.blue.offset = 0;
- VarInfo.red.length = 5;
- VarInfo.green.length = 6;
- VarInfo.blue.length = 5;
- VarInfo.transp.offset = 0;
- VarInfo.transp.length = 0;
- }
- else if (VarInfo.bits_per_pixel == 32) {
- VarInfo.red.offset = 16;
- VarInfo.green.offset = 8;
- VarInfo.blue.offset = 0;
- VarInfo.transp.offset = 24;
- VarInfo.red.length = 8;
- VarInfo.green.length = 8;
- VarInfo.blue.length = 8;
- VarInfo.transp.length = 8;
- }
- /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
- VarInfo.xres_virtual = VarInfo.xres = 1280;
- VarInfo.yres_virtual = VarInfo.yres = 1024;
- VarInfo.pixclock = 7408;
- VarInfo.left_margin = 248;
- VarInfo.right_margin = 16;
- VarInfo.upper_margin = 38;
- VarInfo.lower_margin = 1;
- VarInfo.hsync_len = 144;
- VarInfo.vsync_len = 3;
-
- VarInfo.xoffset = 0;
- VarInfo.yoffset = 0;
- VarInfo.nonstd = 0;
- VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */
-
- /* set new variable screen info */
- if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- exit(1);
- }
-
- print_var_info(&VarInfo, "New Var");
-
- if (FixedInfo.visual != FB_VISUAL_TRUECOLOR &&
- FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) {
- fprintf(stderr, "non-TRUE/DIRECT-COLOR visuals (0x%x) not supported by this demo.\n", FixedInfo.visual);
- exit(1);
- }
-
- /* initialize colormap */
- if (FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
- struct fb_cmap cmap;
- unsigned short red[256], green[256], blue[256];
- int i;
-
- /* we're assuming 256 entries here */
- printf("initializing directcolor colormap\n");
- cmap.start = 0;
- cmap.len = 256;
- cmap.red = red;
- cmap.green = green;
- cmap.blue = blue;
- cmap.transp = NULL;
- for (i = 0; i < cmap.len; i++) {
- red[i] = green[i] = blue[i] = (i << 8) | i;
- }
- if (ioctl(FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) {
- fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
- }
- }
-
- /*
- * fbdev says the frame buffer is at offset zero, and the mmio region
- * is immediately after.
- */
-
- /* mmap the framebuffer into our address space */
- FrameBuffer = (caddr_t) mmap(0, /* start */
- FixedInfo.smem_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- FrameBufferFD, /* fd */
- 0 /* offset */);
- if (FrameBuffer == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
- strerror(errno));
- exit(1);
- }
- printf("FrameBuffer = %p\n", FrameBuffer);
-
-#if 1
- /* mmap the MMIO region into our address space */
- MMIOAddress = (caddr_t) mmap(0, /* start */
- FixedInfo.mmio_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- FrameBufferFD, /* fd */
- FixedInfo.smem_len /* offset */);
- if (MMIOAddress == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap mmio region: %s\n",
- strerror(errno));
- }
- printf("MMIOAddress = %p\n", MMIOAddress);
-
- /* try out some simple MMIO register reads */
- if (1)
- {
- typedef unsigned int CARD32;
- typedef unsigned char CARD8;
-#define RADEON_CONFIG_MEMSIZE 0x00f8
-#define RADEON_MEM_SDRAM_MODE_REG 0x0158
-#define MMIO_IN32(base, offset) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
-#define INREG(addr) MMIO_IN32(MMIOAddress, addr)
- int sz, type;
- const char *typeStr[] = {"SDR", "DDR", "64-bit SDR"};
- sz = INREG(RADEON_CONFIG_MEMSIZE);
- type = INREG(RADEON_MEM_SDRAM_MODE_REG);
- printf("RADEON_CONFIG_MEMSIZE = %d (%d MB)\n", sz, sz / 1024 / 1024);
- printf("RADEON_MEM_SDRAM_MODE_REG >> 30 = %d (%s)\n",
- type >> 30, typeStr[type>>30]);
- }
-#endif
-
-}
-
-
-static void
-shutdown_fbdev( void )
-{
- struct vt_mode VT;
-
- printf("cleaning up...\n");
- /* restore original variable screen info */
- if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- exit(1);
- }
-
- munmap(MMIOAddress, FixedInfo.mmio_len);
- munmap(FrameBuffer, FixedInfo.smem_len);
- close(FrameBufferFD);
-
- /* restore text mode */
- ioctl(ConsoleFD, KDSETMODE, KD_TEXT);
-
- /* set vt */
- if (ioctl(ConsoleFD, VT_GETMODE, &VT) != -1) {
- VT.mode = VT_AUTO;
- ioctl(ConsoleFD, VT_SETMODE, &VT);
- }
-
- /* restore original vt */
- if (OriginalVT >= 0) {
- ioctl(ConsoleFD, VT_ACTIVATE, OriginalVT);
- OriginalVT = -1;
- }
-
- close(ConsoleFD);
-}
-
-
-static void
-gltest( void )
-{
- static const int attribs[] = {
- GLFBDEV_DOUBLE_BUFFER,
- GLFBDEV_DEPTH_SIZE, 16,
- GLFBDEV_NONE
- };
- GLFBDevContextPtr ctx;
- GLFBDevBufferPtr buf;
- GLFBDevVisualPtr vis;
- int bytes, r, g, b, a;
- float ang;
-
- printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
- printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
-
- /* framebuffer size */
- bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8;
-
- vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs );
- assert(vis);
-
- buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes );
- assert(buf);
-
- ctx = glFBDevCreateContext( vis, NULL );
- assert(buf);
-
- b = glFBDevMakeCurrent( ctx, buf, buf );
- assert(b);
-
- /*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
- glGetIntegerv(GL_ALPHA_BITS, &a);
- printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n",
- r, g, b, a);
-
- glClearColor(0.5, 0.5, 1.0, 0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1, 1, -1, 1, 2, 30);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0, 0, -15);
- glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- for (ang = 0; ang <= 180; ang += 15) {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glPushMatrix();
- glRotatef(ang, 1, 0, 0);
- glutSolidTorus(1, 3, 40, 20);
- glPopMatrix();
- glFBDevSwapBuffers(buf);
- }
-
- /* clean up */
- b = glFBDevMakeCurrent( NULL, NULL, NULL);
- assert(b);
-
- glFBDevDestroyContext(ctx);
- glFBDevDestroyBuffer(buf);
- glFBDevDestroyVisual(vis);
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
- signal(SIGSEGV, signal_handler); /* catch segfaults */
-
- initialize_fbdev();
- gltest();
- shutdown_fbdev();
-
- return 0;
-}
diff --git a/progs/miniglx/manytex.c b/progs/miniglx/manytex.c
deleted file mode 100644
index 3ba89d499e4..00000000000
--- a/progs/miniglx/manytex.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* $Id: manytex.c,v 1.2 2003-08-23 01:28:59 jonsmirl Exp $ */
-
-/*
- * test handling of many texture maps
- * Also tests texture priority and residency.
- *
- * Brian Paul
- * August 2, 2000
- */
-
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-static GLint NumTextures = 20;
-static GLuint *TextureID = NULL;
-static GLint *TextureWidth = NULL, *TextureHeight = NULL;
-static GLboolean *TextureResidency = NULL;
-static GLint TexWidth = 128, TexHeight = 128;
-static GLfloat Zrot = 0;
-static GLboolean Anim = GL_TRUE;
-static GLint WinWidth = 500, WinHeight = 400;
-static GLboolean MipMap = GL_FALSE;
-static GLboolean LinearFilter = GL_FALSE;
-static GLboolean RandomSize = GL_FALSE;
-static GLint Rows, Columns;
-static GLint LowPriorityCount = 0;
-
-
-static void Idle( void )
-{
- Zrot += 1.0;
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- GLfloat spacing = WinWidth / Columns;
- GLfloat size = spacing * 0.4;
- GLint i;
-
- /* test residency */
- if (0)
- {
- GLboolean b;
- GLint i, resident;
- b = glAreTexturesResident(NumTextures, TextureID, TextureResidency);
- if (b) {
- printf("all resident\n");
- }
- else {
- resident = 0;
- for (i = 0; i < NumTextures; i++) {
- if (TextureResidency[i]) {
- resident++;
- }
- }
- printf("%d of %d texture resident\n", resident, NumTextures);
- }
- }
-
- /* render the textured quads */
- glClear( GL_COLOR_BUFFER_BIT );
- for (i = 0; i < NumTextures; i++) {
- GLint row = i / Columns;
- GLint col = i % Columns;
- GLfloat x = col * spacing + spacing * 0.5;
- GLfloat y = row * spacing + spacing * 0.5;
-
- GLfloat maxDim = (TextureWidth[i] > TextureHeight[i])
- ? TextureWidth[i] : TextureHeight[i];
- GLfloat w = TextureWidth[i] / maxDim;
- GLfloat h = TextureHeight[i] / maxDim;
-
- glPushMatrix();
- glTranslatef(x, y, 0.0);
- glRotatef(Zrot, 0, 0, 1);
- glScalef(size, size, 1);
-
- glBindTexture(GL_TEXTURE_2D, TextureID[i]);
- glBegin(GL_POLYGON);
-#if 0
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glTexCoord2f(0, 1); glVertex2f(-1, 1);
-#else
- glTexCoord2f(0, 0); glVertex2f(-w, -h);
- glTexCoord2f(1, 0); glVertex2f( w, -h);
- glTexCoord2f(1, 1); glVertex2f( w, h);
- glTexCoord2f(0, 1); glVertex2f(-w, h);
-#endif
- glEnd();
- glPopMatrix();
- }
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- WinWidth = width;
- WinHeight = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-/*
- * Return a random int in [min, max].
- */
-static int RandomInt(int min, int max)
-{
- int i = rand();
- int j = i % (max - min + 1);
- return min + j;
-}
-
-
-
-static void Init( void )
-{
- GLint i;
-
- if (RandomSize) {
- printf("Creating %d %s random-size textures, ", NumTextures,
- MipMap ? "Mipmapped" : "non-Mipmapped");
- }
- else {
- printf("Creating %d %s %d x %d textures, ", NumTextures,
- MipMap ? "Mipmapped" : "non-Mipmapped",
- TexWidth, TexHeight);
- }
-
- if (LinearFilter) {
- printf("bilinear filtering\n");
- }
- else {
- printf("nearest filtering\n");
- }
-
-
- /* compute number of rows and columns of rects */
- {
- GLfloat area = (GLfloat) (WinWidth * WinHeight) / (GLfloat) NumTextures;
- GLfloat edgeLen = sqrt(area);
-
- Columns = WinWidth / edgeLen;
- Rows = (NumTextures + Columns - 1) / Columns;
- printf("Rows: %d Cols: %d\n", Rows, Columns);
- }
-
-
- if (!TextureID) {
- TextureID = (GLuint *) malloc(sizeof(GLuint) * NumTextures);
- assert(TextureID);
- glGenTextures(NumTextures, TextureID);
- }
-
- if (!TextureResidency) {
- TextureResidency = (GLboolean *) malloc(sizeof(GLboolean) * NumTextures);
- assert(TextureResidency);
- }
-
- if (!TextureWidth) {
- TextureWidth = (GLint *) malloc(sizeof(GLint) * NumTextures);
- assert(TextureWidth);
- }
- if (!TextureHeight) {
- TextureHeight = (GLint *) malloc(sizeof(GLint) * NumTextures);
- assert(TextureHeight);
- }
-
- for (i = 0; i < NumTextures; i++) {
- GLubyte color[4];
- GLubyte *texImage;
- GLint j, row, col;
-
- row = i / Columns;
- col = i % Columns;
-
- glBindTexture(GL_TEXTURE_2D, TextureID[i]);
-
- if (i < LowPriorityCount)
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 0.5F);
-
- if (RandomSize) {
-#if 0
- int k = (glutGet(GLUT_ELAPSED_TIME) % 7) + 2;
- TexWidth = 1 << k;
- TexHeight = 1 << k;
-#else
- TexWidth = 1 << RandomInt(2, 7);
- TexHeight = 1 << RandomInt(2, 7);
- printf("Random size of %3d: %d x %d\n", i, TexWidth, TexHeight);
-#endif
- }
-
- TextureWidth[i] = TexWidth;
- TextureHeight[i] = TexHeight;
-
- texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte));
- assert(texImage);
-
- /* determine texture color */
- color[0] = (GLint) (255.0 * ((float) col / (Columns - 1)));
- color[1] = 127;
- color[2] = (GLint) (255.0 * ((float) row / (Rows - 1)));
- color[3] = 255;
-
- /* fill in solid-colored teximage */
- for (j = 0; j < TexWidth * TexHeight; j++) {
- texImage[j*4+0] = color[0];
- texImage[j*4+1] = color[1];
- texImage[j*4+2] = color[2];
- texImage[j*4+3] = color[3];
- }
-
- if (MipMap) {
- GLint level = 0;
- GLint w = TexWidth, h = TexHeight;
- while (1) {
- glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage);
- if (w == 1 && h == 1)
- break;
- if (w > 1)
- w /= 2;
- if (h > 1)
- h /= 2;
- level++;
- /*printf("%d: %d x %d\n", level, w, h);*/
- }
- if (LinearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST_MIPMAP_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
- else {
- /* Set corners to white */
- int k = 0;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth - 1) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth * TexHeight - TexWidth) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth * TexHeight - 1) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage);
- if (LinearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
-
- free(texImage);
- }
-
- glEnable(GL_TEXTURE_2D);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 's':
- Idle();
- break;
- case 'z':
- Zrot -= step;
- break;
- case 'Z':
- Zrot += step;
- break;
- case ' ':
- Init();
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-int main( int argc, char *argv[] )
-{
- GLint i;
-
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( WinWidth, WinHeight );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-n") == 0) {
- NumTextures = atoi(argv[i+1]);
- if (NumTextures <= 0) {
- printf("Error, bad number of textures\n");
- return 1;
- }
- i++;
- }
- else if (strcmp(argv[i], "-mipmap") == 0) {
- MipMap = GL_TRUE;
- }
- else if (strcmp(argv[i], "-linear") == 0) {
- LinearFilter = GL_TRUE;
- }
- else if (strcmp(argv[i], "-size") == 0) {
- TexWidth = atoi(argv[i+1]);
- TexHeight = atoi(argv[i+2]);
- assert(TexWidth >= 1);
- assert(TexHeight >= 1);
- i += 2;
- }
- else if (strcmp(argv[i], "-randomsize") == 0) {
- RandomSize = GL_TRUE;
- }
- else if (strcmp(argv[i], "-lowpri") == 0) {
- LowPriorityCount = atoi(argv[i+1]);
- i++;
- }
- else {
- printf("Usage:\n");
- printf(" manytex [options]\n");
- printf("Options:\n");
- printf(" -n <number of texture objects>\n");
- printf(" -size <width> <height> - specify texture size\n");
- printf(" -randomsize - use random size textures\n");
- printf(" -mipmap - generate mipmaps\n");
- printf(" -linear - use linear filtering instead of nearest\n");
- printf(" -lowpri <n> - Set lower priority on <n> textures\n");
- return 0;
- }
- }
-
- Init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/miniglx/miniglxsample.c b/progs/miniglx/miniglxsample.c
deleted file mode 100644
index d4d6729f932..00000000000
--- a/progs/miniglx/miniglxsample.c
+++ /dev/null
@@ -1,128 +0,0 @@
-
-#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <GL/gl.h>
-
-#if USE_MINIGLX
-#include <GL/miniglx.h>
-#else
-#include <GL/glx.h>
-#include <X11/Xlib.h>
-#endif
-
-static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
-{
- glBegin( GL_QUADS );
- glVertex2f( x1, y1 );
- glVertex2f( x2, y1 );
- glVertex2f( x2, y2 );
- glVertex2f( x1, y2 );
- glEnd();
-}
-
-
-/*
- * Create a simple double-buffered RGBA window.
- */
-static Window
-MakeWindow(Display * dpy, unsigned int width, unsigned int height)
-{
- int visAttributes[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- None
- };
- XSetWindowAttributes attr;
- unsigned long attrMask;
- Window root;
- Window win;
- GLXContext ctx;
- XVisualInfo *visinfo;
-
- root = RootWindow(dpy, 0);
-
- /* Choose GLX visual / pixel format */
- visinfo = glXChooseVisual(dpy, 0, visAttributes);
- if (!visinfo) {
- printf("Error: couldn't get an RGB, Double-buffered visual\n");
- exit(1);
- }
-
- /* Create the window */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attrMask = CWBackPixel | CWBorderPixel | CWColormap;
- win = XCreateWindow(dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, attrMask, &attr);
- if (!win) {
- printf("Error: XCreateWindow failed\n");
- exit(1);
- }
-
- /* Display the window */
- XMapWindow(dpy, win);
-
- /* Create GLX rendering context */
- ctx = glXCreateContext(dpy, visinfo, NULL, True);
- if (!ctx) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
- }
-
- /* Bind the rendering context and window */
- glXMakeCurrent(dpy, win, ctx);
-
- glViewport(0, 0, width, height);
-
- return win;
-}
-
-
-/*
- * Draw a few frames of a rotating square.
- */
-static void
-DrawFrames(Display * dpy, Window win)
-{
- int angle;
- glShadeModel(GL_FLAT);
- glClearColor(0.5, 0.5, 0.5, 1.0);
- for (angle = 0; angle < 360; angle += 10) {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1.0, 1.0, 0.0);
- glPushMatrix();
- glRotatef(angle, 0, 0, 1);
- _subset_Rectf(-0.8, -0.8, 0.8, 0.8);
- glPopMatrix();
- glXSwapBuffers(dpy, win);
- sleep(1);
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- Display *dpy;
- Window win;
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Error: XOpenDisplay failed\n");
- return 1;
- }
-
- win = MakeWindow(dpy, 300, 300);
-
- DrawFrames(dpy, win);
-
- return 0;
-}
diff --git a/progs/miniglx/miniglxtest.c b/progs/miniglx/miniglxtest.c
deleted file mode 100644
index 25e4c59104d..00000000000
--- a/progs/miniglx/miniglxtest.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $Id: miniglxtest.c,v 1.3 2004-03-25 14:58:39 brianp Exp $ */
-
-/*
- * Test the mini GLX interface.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <GL/gl.h>
-#define USE_MINI_GLX 1
-#if USE_MINI_GLX
-#include <GL/miniglx.h>
-#else
-#include <GL/glx.h>
-#endif
-
-#define FRONTBUFFER 1
-#define NR 6
-#define DO_SLEEPS 1
-#define NR_DISPLAYS 2
-
-GLXContext ctx;
-
-
-static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
-{
- glBegin( GL_QUADS );
- glVertex2f( x1, y1 );
- glVertex2f( x2, y1 );
- glVertex2f( x2, y2 );
- glVertex2f( x1, y2 );
- glEnd();
-}
-
-
-
-static void redraw( Display *dpy, Window w, int rot )
-{
- printf("Redraw event\n");
-
-#if FRONTBUFFER
- glDrawBuffer( GL_FRONT );
-#else
-/* glDrawBuffer( GL_BACK ); */
-#endif
-
- glClearColor( rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX,
- 1);
-
- glClear( GL_COLOR_BUFFER_BIT );
-
-#if 1
- glColor3f( rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX,
- rand()/(float)RAND_MAX );
- glPushMatrix();
- glRotatef(rot, 0, 0, 1);
- glScalef(.5, .5, .5);
- _subset_Rectf( -1, -1, 1, 1 );
- glPopMatrix();
-#endif
-
-#if FRONTBUFFER
- glFlush();
-#else
- glXSwapBuffers( dpy, w );
-#endif
- glFinish();
-}
-
-
-static Window make_rgb_db_window( Display *dpy,
- unsigned int width, unsigned int height )
-{
- int attrib[] = { GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
-#if !FRONTBUFFER
- GLX_DOUBLEBUFFER,
-#endif
- None };
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visinfo;
-
- scrnum = 0;
- root = RootWindow( dpy, scrnum );
-
- if (!(visinfo = glXChooseVisual( dpy, scrnum, attrib ))) {
- printf("Error: couldn't get an RGB, Double-buffered visual\n");
- exit(1);
- }
-
- if(!(ctx = glXCreateContext( dpy, visinfo, NULL, True ))) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
- if (!win) {
- printf("Error: XCreateWindow failed\n");
- exit(1);
- }
-
- glXMakeCurrent( dpy, win, ctx );
-
- glViewport(0, 0, width, height);
-
- return win;
-}
-
-
-static void event_loop( Display *dpy, Window win )
-{
- int i;
-
- printf("Hang on... drawing %d frames\n", NR);
- for (i = 0; i < NR; i++) {
- redraw( dpy, win, i*10 );
- if (DO_SLEEPS) {
- printf("sleep(1)\n");
- sleep(1);
- }
- }
-}
-
-
-static int foo( void )
-{
- Display *dpy;
- Window win;
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Error: XOpenDisplay failed\n");
- return 1;
- }
-
- win = make_rgb_db_window( dpy, 800, 600);
-
- srand(getpid());
-
- glShadeModel( GL_FLAT );
- glClearColor( 0.5, 0.5, 0.5, 1.0 );
-
- XMapWindow( dpy, win );
-
- {
- XEvent e;
- while (1) {
- XNextEvent( dpy, &e );
- if (e.type == MapNotify && e.xmap.window == win) {
- break;
- }
- }
- }
-
- event_loop( dpy, win );
-
- glXDestroyContext( dpy, ctx );
- XDestroyWindow( dpy, win );
-
- XCloseDisplay( dpy );
-
- return 0;
-}
-
-
-int main()
-{
- int i;
- for (i = 0 ; i < NR_DISPLAYS ; i++) {
- if (foo() != 0)
- break;
- }
-
- return 0;
-}
diff --git a/progs/miniglx/sample_server.c b/progs/miniglx/sample_server.c
deleted file mode 100644
index cac6e3b8345..00000000000
--- a/progs/miniglx/sample_server.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $Id: sample_server.c,v 1.1 2003-08-06 17:47:15 keithw Exp $ */
-
-/*
- * Sample server that just keeps first available window mapped.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <GL/gl.h>
-#include <GL/miniglx.h>
-
-struct client {
- struct client *next;
- Window windowid;
- int mappable;
-};
-
-struct client *clients = 0, *mapped_client = 0;
-
-
-static struct client *find_client( Window id )
-{
- struct client *c;
-
- for (c = clients ; c ; c = c->next)
- if (c->windowid == id)
- return c;
-
- return 0;
-}
-
-int main( int argc, char *argv[] )
-{
- Display *dpy;
- XEvent ev;
-
- dpy = __miniglx_StartServer(NULL);
- if (!dpy) {
- fprintf(stderr, "Error: __miniglx_StartServer failed\n");
- return 1;
- }
-
- while (XNextEvent( dpy, &ev )) {
- struct client *c;
-
- switch (ev.type) {
- case MapRequest:
- fprintf(stderr, "MapRequest\n");
- c = find_client(ev.xmaprequest.window);
- if (!c) break;
- c->mappable = True;
- break;
-
- case UnmapNotify:
- fprintf(stderr, "UnmapNotify\n");
- c = find_client(ev.xunmap.window);
- if (!c) break;
- c->mappable = False;
- if (c == mapped_client)
- mapped_client = 0;
- break;
-
- case CreateNotify:
- fprintf(stderr, "CreateNotify\n");
- c = malloc(sizeof(*c));
- c->next = clients;
- c->windowid = ev.xcreatewindow.window;
- c->mappable = False;
- clients = c;
- break;
-
- case DestroyNotify:
- fprintf(stderr, "DestroyNotify\n");
- c = find_client(ev.xdestroywindow.window);
- if (!c) break;
- if (c == clients)
- clients = c->next;
- else {
- struct client *t;
- for (t = clients ; t->next != c ; t = t->next)
- ;
- t->next = c->next;
- }
-
- if (c == mapped_client)
- mapped_client = 0;
-
- free(c);
- break;
-
- default:
- break;
- }
-
- /* Search for first mappable client if none already mapped.
- */
- if (!mapped_client) {
- for (c = clients ; c ; c = c->next) {
- if (c->mappable) {
- XMapWindow( dpy, c->windowid );
- mapped_client = c;
- break;
- }
- }
- }
- }
-
- XCloseDisplay( dpy );
-
- return 0;
-}
diff --git a/progs/miniglx/sample_server2.c b/progs/miniglx/sample_server2.c
deleted file mode 100644
index 109677ba969..00000000000
--- a/progs/miniglx/sample_server2.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $Id: sample_server2.c,v 1.2 2003-08-23 01:28:59 jonsmirl Exp $ */
-
-/*
- * Sample server that just keeps first available window mapped.
- *
- * It also reads and echos anything that happens on stdin as an
- * example of tracking events from sources other than miniglx clients.
- *
- * It reads & writes without blocking, so that eg. piping a lot of
- * text to stdin and then hitting 'ctrl-S' on the output stream won't
- * cause it to stop handling miniglx events.
- *
- * See select_tut in the linux manual pages for a good overview of the
- * select(2) system call.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <GL/gl.h>
-#include <GL/miniglx.h>
-#include <errno.h>
-#include <assert.h>
-
-struct client {
- struct client *next;
- Window windowid;
- int mappable;
-};
-
-struct client *clients = 0, *mapped_client = 0;
-
-#define BUFSZ 4096
-char rbuf[BUFSZ];
-int rbuf_count;
-
-
-static struct client *find_client( Window id )
-{
- struct client *c;
-
- for (c = clients ; c ; c = c->next)
- if (c->windowid == id)
- return c;
-
- return 0;
-}
-
-int main( int argc, char *argv[] )
-{
- Display *dpy;
- XEvent ev;
- int autostart = 0;
-
- if (argc == 2 && strcmp(argv[1], "-autostart") == 0)
- autostart = 1;
-
- dpy = __miniglx_StartServer(NULL);
- if (!dpy) {
- fprintf(stderr, "Error: __miniglx_StartServer failed\n");
- return 1;
- }
-
- /* How is vt switching communicated through the XNextEvent interface?
- */
- while (1) {
- int r, n;
- struct timeval tv;
- fd_set rfds, wfds;
- int bored = 0;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
- tv.tv_sec = 1;
- tv.tv_usec = 0;
-
- if (rbuf_count) {
- FD_SET( 1, &wfds ); /* notify when we can write out buffer */
- n = 1;
- }
- else {
- FD_SET( 0, &rfds ); /* else notify when new data to read */
- n = 0;
- }
-
- /* __miniglx_Select waits until any of these file groups becomes
- * readable/writable/etc (like regular select), until timeout
- * expires (like regular select), until a signal is received
- * (like regular select) or until an event is available for
- * XCheckMaskEvent().
- */
- r = __miniglx_Select( dpy, n+1, &rfds, &wfds, 0, &tv );
-
- /* This can happen if select() is interrupted by a signal:
- */
- if (r < 0 && errno != EINTR && errno != EAGAIN) {
- perror ("select()");
- exit (1);
- }
-
- if (tv.tv_sec == 0 && tv.tv_usec == 0)
- bored = 1;
-
- /* Check and handle events on our local file descriptors
- */
- if (FD_ISSET( 0, &rfds )) {
- /* Something on stdin */
- assert(rbuf_count == 0);
- r = read(0, rbuf, BUFSZ);
- if (r < 1) {
- perror("read");
- abort();
- }
- rbuf_count = r;
- }
-
- if (FD_ISSET( 1, &wfds )) {
- /* Can write to stdout */
- assert(rbuf_count > 0);
- r = write(1, rbuf, rbuf_count);
- if (r < 1) {
- perror("write");
- abort();
- }
- rbuf_count -= r;
- if (rbuf_count)
- memmove(rbuf + r, rbuf, rbuf_count);
- }
-
-
- /* Check and handle events generated by miniglx:
- */
- while (XCheckMaskEvent( dpy, ~0, &ev )) {
- struct client *c;
- bored = 0;
-
- fprintf(stderr, "Received event %d\n", ev.type);
-
- switch (ev.type) {
- case CreateNotify:
- fprintf(stderr, "CreateNotify -- new client\n");
- c = malloc(sizeof(*c));
- c->next = clients;
- c->windowid = ev.xcreatewindow.window;
- c->mappable = False;
- clients = c;
- break;
-
- case DestroyNotify:
- fprintf(stderr, "DestroyNotify\n");
- c = find_client(ev.xdestroywindow.window);
- if (!c) break;
- if (c == clients)
- clients = c->next;
- else {
- struct client *t;
- for (t = clients ; t->next != c ; t = t->next)
- ;
- t->next = c->next;
- }
-
- if (c == mapped_client)
- mapped_client = 0;
-
- free(c);
- break;
-
- case MapRequest:
- fprintf(stderr, "MapRequest\n");
- c = find_client(ev.xmaprequest.window);
- if (!c) break;
- c->mappable = True;
- break;
-
- case UnmapNotify:
- fprintf(stderr, "UnmapNotify\n");
- c = find_client(ev.xunmap.window);
- if (!c) break;
- c->mappable = False;
- if (c == mapped_client)
- mapped_client = 0;
- break;
-
- default:
- break;
- }
- }
-
-
- /* Search for first mappable client if none already mapped.
- */
- if (!mapped_client) {
- struct client *c;
- for (c = clients ; c ; c = c->next) {
- if (c->mappable) {
- XMapWindow( dpy, c->windowid );
- mapped_client = c;
- break;
- }
- }
- if (!clients && autostart) {
- system("nohup ./texline &");
- system("nohup ./manytex &");
- }
- }
- else if (bored) {
- struct client *c;
- /* bored of mapped client now, let's try & find another one */
- for (c = mapped_client->next ; c && !c->mappable ; c = c->next)
- ;
- if (!c)
- for (c = clients ; c && !c->mappable ; c = c->next)
- ;
- if (c && c != mapped_client) {
- XUnmapWindow( dpy, mapped_client->windowid );
- XMapWindow( dpy, c->windowid );
- mapped_client = c;
- }
- else
- fprintf(stderr, "I'm bored!\n");
- }
- }
-
- XCloseDisplay( dpy );
-
- return 0;
-}
diff --git a/progs/miniglx/texline.c b/progs/miniglx/texline.c
deleted file mode 100644
index 3cc22fdf3f4..00000000000
--- a/progs/miniglx/texline.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* $Id: texline.c,v 1.1 2003-08-06 17:47:15 keithw Exp $ */
-
-/*
- * Test textured lines.
- *
- * Brian Paul
- * September 2000
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLboolean Antialias = GL_FALSE;
-static GLboolean Animate = GL_FALSE;
-static GLint Texture = 1;
-static GLboolean Stipple = GL_FALSE;
-static GLfloat LineWidth = 1.0;
-
-static GLfloat Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
-static GLfloat DYrot = 1.0;
-static GLboolean Points = GL_FALSE;
-static GLfloat Scale = 1.0;
-
-static void Idle( void )
-{
- if (Animate) {
- Zrot += DYrot;
- glutPostRedisplay();
- }
-}
-
-
-static void Display( void )
-{
- GLfloat x, y, s, t;
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(Scale, Scale, Scale);
-
- if (Texture)
- glColor3f(1, 1, 1);
-
- if (Points) {
- glBegin(GL_POINTS);
- for (t = 0.0; t <= 1.0; t += 0.025) {
- for (s = 0.0; s <= 1.0; s += 0.025) {
- x = s * 2.0 - 1.0;
- y = t * 2.0 - 1.0;
- if (!Texture)
- glColor3f(1, 0, 1);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s);
- glTexCoord2f(s, t);
- glVertex2f(x, y);
- }
- }
- glEnd();
- }
- else {
- glBegin(GL_LINES);
- for (t = 0.0; t <= 1.0; t += 0.025) {
- x = t * 2.0 - 1.0;
- if (!Texture)
- glColor3f(1, 0, 1);
- glTexCoord2f(t, 0.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t);
- glVertex2f(x, -1.0);
- if (!Texture)
- glColor3f(0, 1, 0);
- glTexCoord2f(t, 1.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t);
- glVertex2f(x, 1.0);
- }
- glEnd();
- }
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Antialias = !Antialias;
- if (Antialias) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- else {
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_POINT_SMOOTH);
- glDisable(GL_BLEND);
- }
- break;
- case 't':
- Texture++;
- if (Texture > 2)
- Texture = 0;
- if (Texture == 0) {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glDisable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glDisable(GL_TEXTURE_2D);
- }
- else if (Texture == 1) {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glDisable(GL_TEXTURE_2D);
- }
- else {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glEnable(GL_TEXTURE_2D);
- }
- break;
- case 'w':
- LineWidth -= 0.25;
- if (LineWidth < 0.25)
- LineWidth = 0.25;
- glLineWidth(LineWidth);
- glPointSize(LineWidth);
- break;
- case 'W':
- LineWidth += 0.25;
- if (LineWidth > 8.0)
- LineWidth = 8.0;
- glLineWidth(LineWidth);
- glPointSize(LineWidth);
- break;
- case 'p':
- Points = !Points;
- break;
- case 's':
- Stipple = !Stipple;
- if (Stipple)
- glEnable(GL_LINE_STIPPLE);
- else
- glDisable(GL_LINE_STIPPLE);
- break;
- case ' ':
- Animate = !Animate;
- if (Animate)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 27:
- exit(0);
- break;
- }
- printf("LineWidth, PointSize = %f\n", LineWidth);
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- GLuint u;
- for (u = 0; u < 2; u++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + u);
- glBindTexture(GL_TEXTURE_2D, 10+u);
- if (u == 0)
- glEnable(GL_TEXTURE_2D);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- if (u == 0)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- else
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- }
-
- glLineStipple(1, 0xff);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 400, 300 );
-
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
-
- glutCreateWindow(argv[0] );
-
- Init(argc, argv);
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Animate)
- glutIdleFunc( Idle );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/redbook/.cvsignore b/progs/redbook/.cvsignore
deleted file mode 100644
index 8ed3efe3e23..00000000000
--- a/progs/redbook/.cvsignore
+++ /dev/null
@@ -1,64 +0,0 @@
-.cvsignore
-aaindex
-aapoly
-aargb
-accanti
-accpersp
-alpha
-alpha3D
-anti
-bezcurve
-bezmesh
-checker
-clip
-colormat
-cube
-depthcue
-dof
-double
-drawf
-feedback
-fog
-fogindex
-font
-hello
-image
-light
-lines
-list
-material
-mipmap
-model
-movelight
-nurbs
-pickdepth
-picksquare
-plane
-planet
-polyoff
-polys
-quadric
-robot
-sccolorlight
-scene
-scenebamb
-sceneflat
-select
-smooth
-stencil
-stroke
-surface
-teaambient
-teapots
-tess
-tesswind
-texbind
-texgen
-texprox
-texsub
-texturesurf
-torus
-trim
-unproject
-varray
-wrap
diff --git a/progs/redbook/Imakefile b/progs/redbook/Imakefile
deleted file mode 100644
index ab3b6d7f793..00000000000
--- a/progs/redbook/Imakefile
+++ /dev/null
@@ -1,221 +0,0 @@
-LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\Mesaaux.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
-
-INCLUDES = -I$(TOP)\include
-
-SRCS = accanti.c \
- accnot.c \
- accpersp.c \
- accum.c \
- aim.c \
- alpha.c \
- alpha3D.c \
- anti.c \
- antiindex.c \
- antipindex.c \
- antipoint.c \
- antipoly.c \
- bezcurve.c \
- bezmesh.c \
- bezsurf.c \
- checker.c \
- checker2.c \
- chess.c \
- clip.c \
- colormat.c \
- cone.c \
- cube.c \
- curve.c \
- depthcue.c \
- disk.c \
- dof.c \
- dofnot.c \
- double.c \
- drawf.c \
- feedback.c \
- fog.c \
- fogindex.c \
- font.c \
- light.c \
- linelist.c \
- lines.c \
- list.c \
- list2.c \
- maplight.c \
- material.c \
- mipmap.c \
- model.c \
- movelight.c \
- nurbs.c \
- pickdepth.c \
- pickline.c \
- picksquare.c \
- plane.c \
- planet.c \
- planetup.c \
- polys.c \
- robot.c \
- sccolorlight.c \
- scene.c \
- scenebamb.c \
- sceneflat.c \
- select.c \
- simple.c \
- smooth.c \
- sphere.c \
- stencil.c \
- stroke.c \
- surface.c \
- tea.c \
- teaambient.c \
- teapots.c \
- texgen.c \
- texturesurf.c \
- trim.c \
- xfont.c
-
-PROGRAMS = ProgramTargetName(accanti) \
- ProgramTargetName(accnot) \
- ProgramTargetName(accpersp) \
- ProgramTargetName(accum) \
- ProgramTargetName(aim) \
- ProgramTargetName(alpha) \
- ProgramTargetName(alpha3D) \
- ProgramTargetName(anti) \
- ProgramTargetName(antiindex) \
- ProgramTargetName(antipindex) \
- ProgramTargetName(antipoint) \
- ProgramTargetName(antipoly) \
- ProgramTargetName(bezcurve) \
- ProgramTargetName(bezmesh) \
- ProgramTargetName(bezsurf) \
- ProgramTargetName(checker) \
- ProgramTargetName(checker2) \
- ProgramTargetName(chess) \
- ProgramTargetName(clip) \
- ProgramTargetName(colormat) \
- ProgramTargetName(cone) \
- ProgramTargetName(cube) \
- ProgramTargetName(curve) \
- ProgramTargetName(depthcue) \
- ProgramTargetName(disk) \
- ProgramTargetName(dof) \
- ProgramTargetName(dofnot) \
- ProgramTargetName(double) \
- ProgramTargetName(drawf) \
- ProgramTargetName(feedback) \
- ProgramTargetName(fog) \
- ProgramTargetName(fogindex) \
- ProgramTargetName(font) \
- ProgramTargetName(light) \
- ProgramTargetName(linelist) \
- ProgramTargetName(lines) \
- ProgramTargetName(list) \
- ProgramTargetName(list2) \
- ProgramTargetName(maplight) \
- ProgramTargetName(material) \
- ProgramTargetName(mipmap) \
- ProgramTargetName(model) \
- ProgramTargetName(movelight) \
- ProgramTargetName(nurbs) \
- ProgramTargetName(pickdepth) \
- ProgramTargetName(pickline) \
- ProgramTargetName(picksquare) \
- ProgramTargetName(plane) \
- ProgramTargetName(planet) \
- ProgramTargetName(planetup) \
- ProgramTargetName(polys) \
- ProgramTargetName(robot) \
- ProgramTargetName(sccolorlight) \
- ProgramTargetName(scene) \
- ProgramTargetName(scenebamb) \
- ProgramTargetName(sceneflat) \
- ProgramTargetName(select) \
- ProgramTargetName(simple) \
- ProgramTargetName(smooth) \
- ProgramTargetName(sphere) \
- ProgramTargetName(stencil) \
- ProgramTargetName(stroke) \
- ProgramTargetName(surface) \
- ProgramTargetName(tea) \
- ProgramTargetName(teaambient) \
- ProgramTargetName(teapots) \
- ProgramTargetName(texgen) \
- ProgramTargetName(texturesurf) \
- ProgramTargetName(trim) \
- ProgramTargetName(xfont)
-
-AllTarget($(PROGRAMS))
-
-NormalProgramTarget(accanti,accanti.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(accnot,accnot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(accpersp,accpersp.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(aim,aim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(alpha,alpha.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(alpha3D,alpha3D.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(anti,anti.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(antiindex,antiindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(antipindex,antipindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(antipoint,antipoint.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(antipoly,antipoly.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(bezcurve,bezcurve.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(bezmesh,bezmesh.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(bezsurf,bezsurf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(checker,checker.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(checker2,checker2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(chess,chess.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(clip,clip.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(colormat,colormat.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(cone,cone.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(cube,cube.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(curve,curve.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(depthcue,depthcue.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(disk,disk.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(dof,dof.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(dofnot,dofnot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(double,double.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(drawf,drawf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(feedback,feedback.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(fogindex,fogindex.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(light,light.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(linelist,linelist.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(lines,lines.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(list,list.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(list2,list2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(maplight,maplight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(material,material.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(mipmap,mipmap.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(model,model.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(movelight,movelight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(nurbs,nurbs.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(pickdepth,pickdepth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(pickline,pickline.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(picksquare,picksquare.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(plane,plane.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(planet,planet.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(planetup,planetup.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(polys,polys.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(robot,robot.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(sccolorlight,sccolorlight.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(scene,scene.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(scenebamb,scenebamb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(sceneflat,sceneflat.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(simple,simple.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(smooth,smooth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(stroke,stroke.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(surface,surface.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(tea,tea.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(teaambient,teaambient.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(teapots,teapots.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(texgen,texgen.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(texturesurf,texturesurf.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(trim,trim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(xfont,xfont.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-
-DependTarget()
-
diff --git a/progs/redbook/Windows/redbook.dsw b/progs/redbook/Windows/redbook.dsw
deleted file mode 100644
index 71ba7e89e3e..00000000000
--- a/progs/redbook/Windows/redbook.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "teapots"=".\teapots.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/progs/redbook/Windows/teapots.dsp b/progs/redbook/Windows/teapots.dsp
deleted file mode 100644
index 4d39865810c..00000000000
--- a/progs/redbook/Windows/teapots.dsp
+++ /dev/null
@@ -1,112 +0,0 @@
-# Microsoft Developer Studio Project File - Name="teapots" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=teapots - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "teapots.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "teapots.mak" CFG="teapots - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "teapots - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "teapots - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "teapots - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../teapots.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "teapots - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../teapots.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy DLLs
-PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "teapots - Win32 Release"
-# Name "teapots - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\teapots.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/progs/samples/.cvsignore b/progs/samples/.cvsignore
deleted file mode 100644
index 12b0650567b..00000000000
--- a/progs/samples/.cvsignore
+++ /dev/null
@@ -1,45 +0,0 @@
-.cvsignore
-accum
-bitmap1
-bitmap2
-blendeq
-blendxor
-copy
-cursor
-depth
-eval
-fog
-font
-line
-logo
-nurb
-oglinfo
-olympic
-overlay
-point
-prim
-quad
-select
-shape
-sphere
-star
-stencil
-stretch
-texture
-tri
-wave
-bugger
-pend
-lthreads
-lxdemo
-lxgears
-lxheads
-lxinfo
-lxpixmap
-anywin
-ffset
-bdemo
-binfo
-incopy
-demo
-font
diff --git a/progs/samples/Imakefile b/progs/samples/Imakefile
deleted file mode 100644
index 948a9783597..00000000000
--- a/progs/samples/Imakefile
+++ /dev/null
@@ -1,101 +0,0 @@
-LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\glut.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
-
-INCLUDES = -I$(TOP)\include
-
-SRCS = accum.c \
- bitmap1.c \
- bitmap2.c \
- blendeq.c \
- blendxor.c \
- copy.c \
- cursor.c \
- depth.c \
- eval.c \
- fog.c \
- font.c \
- line.c \
- logo.c \
- nurb.c \
- oglinfo.c \
- olympic.c \
- overlay.c \
- point.c \
- prim.c \
- quad.c \
- select.c \
- shape.c \
- speed.c \
- sphere.c \
- star.c \
- stencil.c \
- stretch.c \
- texture.c \
- tri.c \
- wave.c
-
-PROGRAMS = ProgramTargetName(accum) \
- ProgramTargetName(bitmap1) \
- ProgramTargetName(bitmap2) \
- ProgramTargetName(blendeq) \
- ProgramTargetName(blendxor) \
- ProgramTargetName(copy) \
- ProgramTargetName(cursor) \
- ProgramTargetName(depth) \
- ProgramTargetName(eval) \
- ProgramTargetName(fog) \
- ProgramTargetName(font) \
- ProgramTargetName(line) \
- ProgramTargetName(logo) \
- ProgramTargetName(nurb) \
- ProgramTargetName(oglinfo) \
- ProgramTargetName(olympic) \
- ProgramTargetName(overlay) \
- ProgramTargetName(point) \
- ProgramTargetName(prim) \
- ProgramTargetName(quad) \
- ProgramTargetName(select) \
- ProgramTargetName(shape) \
- ProgramTargetName(speed) \
- ProgramTargetName(sphere) \
- ProgramTargetName(star) \
- ProgramTargetName(stencil) \
- ProgramTargetName(stretch) \
- ProgramTargetName(texture) \
- ProgramTargetName(tri) \
- ProgramTargetName(wave)
-
-AllTarget($(PROGRAMS))
-
-NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(bitmap1,bitmap1.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(bitmap2,bitmap2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(blendeq,blendeq.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(blendxor,blendxor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(copy,copy.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(cursor,cursor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(depth,depth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(eval,eval.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(line,line.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(logo,logo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(nurb,nurb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(oglinfo,oglinfo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(olympic,olympic.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(overlay,overlay.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(point,point.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(prim,prim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(quad,quad.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(shape,shape.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(speed,speed.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(star,star.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(stretch,stretch.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(texture,texture.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(tri,tri.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-NormalProgramTarget(wave,wave.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
-
-DependTarget()
-
diff --git a/progs/tests/.cvsignore b/progs/tests/.cvsignore
deleted file mode 100644
index 2c0e16c35ec..00000000000
--- a/progs/tests/.cvsignore
+++ /dev/null
@@ -1,54 +0,0 @@
-.cvsignore
-getproclist.h
-antialias
-arbfpspec
-arbfptest1
-arbfptexture
-arbfptrig
-arbvptest1
-arbvptest3
-arbvptorus
-arbvpwarpmesh
-blendminmax
-blendsquare
-bufferobj
-bug_3101
-bug_3195
-crossbar
-cva
-dinoshade
-fbotest1
-fbotexture
-floattex
-fog
-fogcoord
-fptest1
-fptexture
-getprocaddress
-invert
-manytex
-multipal
-no_s3tc
-packedpixels
-pbo
-projtex
-seccolor
-sharedtex
-stencil_wrap
-stencilwrap
-tex1d
-texcmp
-texgenmix
-texline
-texobjshare
-texrect
-texwrap
-vparray
-vptest1
-vptest2
-vptest3
-vptorus
-vpwarpmesh
-yuvrect
-yuvsquare
-zreaddraw
diff --git a/progs/tests/Makefile b/progs/tests/Makefile
deleted file mode 100644
index 7f6655dd54b..00000000000
--- a/progs/tests/Makefile
+++ /dev/null
@@ -1,154 +0,0 @@
-# progs/tests/Makefile
-
-
-# These programs aren't intended to be included with the normal distro.
-# They're not too interesting but they're good for testing.
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-LIBS = $(APP_LIB_DEPS)
-
-SOURCES = \
- afsmultiarb.c \
- antialias.c \
- arbfpspec.c \
- arbfptest1.c \
- arbfptexture.c \
- arbfptrig.c \
- arbnpot.c \
- arbvptest1.c \
- arbvptest3.c \
- arbvptorus.c \
- arbvpwarpmesh.c \
- blendminmax.c \
- blendsquare.c \
- bufferobj.c \
- bug_3050.c \
- bug_3101.c \
- bug_3195.c \
- copypixrate.c \
- crossbar.c \
- cva.c \
- dinoshade.c \
- floattex.c \
- fbotest1.c \
- fbotest2.c \
- fbotexture.c \
- fog.c \
- fogcoord.c \
- fptest1.c \
- fptexture.c \
- getprocaddress.c \
- interleave.c \
- invert.c \
- jkrahntest.c \
- manytex.c \
- mipmap_limits.c \
- multipal.c \
- no_s3tc.c \
- packedpixels.c \
- pbo.c \
- projtex.c \
- readrate.c \
- seccolor.c \
- sharedtex.c \
- stencilwrap.c \
- stencil_wrap.c \
- subtexrate.c \
- tex1d.c \
- texcompress2.c \
- texfilt.c \
- texline.c \
- texobjshare.c \
- texrect.c \
- texwrap.c \
- vparray.c \
- vptest1.c \
- vptest2.c \
- vptest3.c \
- vptorus.c \
- vpwarpmesh.c \
- yuvrect.c \
- yuvsquare.c \
- zreaddraw.c
-
-PROGS = $(SOURCES:%.c=%)
-
-INCLUDES = -I. -I$(TOP)/include
-
-UTIL_FILES = readtex.h readtex.c
-
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c:
- $(CC) $(INCLUDES) $(CFLAGS) $< $(LIBS) -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: $(UTIL_FILES) $(PROGS)
-
-clean:
- rm -f $(PROGS)
- rm -f *.o
- rm -f getproclist.h
-
-
-# auto code generation
-getprocaddress: getprocaddress.c getproclist.h
-
-getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
- python getprocaddress.py > getproclist.h
-
-afsmultiarb: afsmultiarb.o readtex.o
- $(CC) $(CFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@
-
-afsmultiarb.o: afsmultiarb.c readtex.h
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-texrect: texrect.o readtex.o
- $(CC) $(CFLAGS) texrect.o readtex.o $(LIBS) -o $@
-
-texrect.o: texrect.c readtex.h
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-bug_3195: bug_3195.o readtex.o
- $(CC) $(CFLAGS) bug_3195.o readtex.o $(LIBS) -o $@
-
-bug_3195.o: bug_3195.c readtex.h
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-invert: invert.o readtex.o
- $(CC) $(CFLAGS) invert.o readtex.o $(LIBS) -o $@
-
-invert.o: invert.c readtex.h
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-readtex.o: readtex.c
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-readtex.h: $(TOP)/progs/util/readtex.h
- ln -s $(TOP)/progs/util/readtex.h .
-
-readtex.c: $(TOP)/progs/util/readtex.c
- ln -s $(TOP)/progs/util/readtex.c .
-
-
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
diff --git a/progs/tests/Makefile.win b/progs/tests/Makefile.win
deleted file mode 100644
index ff5b1e626e8..00000000000
--- a/progs/tests/Makefile.win
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Id: Makefile.win,v 1.1 2002-01-16 01:03:25 kschultz Exp $
-
-# Mesa 3-D graphics library
-# Version: 3.5
-# Copyright (C) 1995-2001 Brian Paul
-
-# Makefile for GLUT-based demo programs for Windows
-
-!include <win32.mak>
-
-##### MACROS #####
-
-TOP = ..
-INCDIR = ..\include
-LIBDIR = ..\lib
-
-SRCS = cva.c \
- dinoshade.c \
- fogcoord.c \
- manytex.c \
- multipal.c \
- projtex.c \
- seccolor.c \
-# sharedtex.c \
- texline.c \
- texwrap.c \
- vptest1.c \
- vptest2.c \
- vptest3.c \
- vptorus.c \
- vpwarpmesh.c
-
-!include "../mesawin32.mak"
-
-##### TARGETS #####
-
-clean::
-
-clobber::
- @del readtex.c readtex.h
-
-$(EXES) :$*.obj
- @echo $@
- $(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS)
diff --git a/progs/tests/afsmultiarb.c b/progs/tests/afsmultiarb.c
deleted file mode 100644
index c026ecd4ce2..00000000000
--- a/progs/tests/afsmultiarb.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * GL_ATI_fragment_shader test
- * Roland Scheidegger
- *
- * Command line options:
- * -info print GL implementation information
- */
-
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "readtex.h"
-
-#define TEXTURE_1_FILE "../images/girl.rgb"
-#define TEXTURE_2_FILE "../images/reflect.rgb"
-
-#define TEX0 1
-#define TEX7 8
-#define ANIMATE 10
-#define SHADER 20
-#define QUIT 100
-
-static GLboolean Animate = GL_TRUE;
-static GLint NumUnits = 6;
-static GLboolean TexEnabled[8];
-static GLuint boringshaderID = 0;
-static GLuint boring2passID = 0;
-static GLboolean Shader = GL_FALSE;
-
-static GLfloat Drift = 0.0;
-static GLfloat drift_increment = 0.005;
-static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0;
-static GLfloat shaderconstant[4] = {0.5, 0.0, 0.0, 0.0};
-
-static void Idle( void )
-{
- if (Animate) {
- GLint i;
-
- Drift += drift_increment;
- if (Drift >= 1.0)
- Drift = 0.0;
-
- for (i = 0; i < NumUnits; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- if (i == 0) {
- glTranslatef(Drift, 0.0, 0.0);
- glScalef(2, 2, 1);
- }
- else if (i == 1) {
- glTranslatef(0.0, Drift, 0.0);
- }
- else {
- glTranslatef(0.5, 0.5, 0.0);
- glRotatef(180.0 * Drift, 0, 0, 1);
- glScalef(1.0/i, 1.0/i, 1.0/i);
- glTranslatef(-0.5, -0.5, 0.0);
- }
- }
- glMatrixMode(GL_MODELVIEW);
-
- glutPostRedisplay();
- }
-}
-
-
-static void DrawObject(void)
-{
- GLint i;
- GLint j;
- static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
- static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
-
- if (!TexEnabled[0] && !TexEnabled[1])
- glColor3f(0.1, 0.1, 0.1); /* add onto this */
- else
- glColor3f(1, 1, 1); /* modulate this */
-
- glBegin(GL_QUADS);
-
- /* Toggle between the vector and scalar entry points. This is done purely
- * to hit multiple paths in the driver.
- */
- if ( Drift > 0.49 ) {
- for (j = 0; j < 4; j++ ) {
- for (i = 0; i < NumUnits; i++)
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i,
- tex_coords[j], tex_coords[j+1]);
- glVertex2f( vtx_coords[j], vtx_coords[j+1] );
- }
- }
- else {
- for (j = 0; j < 4; j++ ) {
- for (i = 0; i < NumUnits; i++)
- glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + i, & tex_coords[j]);
- glVertex2fv( & vtx_coords[j] );
- }
- }
-
- glEnd();
-}
-
-
-
-static void Display( void )
-{
- static GLint T0 = 0;
- static GLint Frames = 0;
- GLint t;
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(5.0, 5.0, 5.0);
- DrawObject();
- glPopMatrix();
-
- glutSwapBuffers();
-
- Frames++;
-
- t = glutGet(GLUT_ELAPSED_TIME);
- if (t - T0 >= 2500) {
- GLfloat seconds = (t - T0) / 1000.0;
- GLfloat fps = Frames / seconds;
- drift_increment = 2.2 * seconds / Frames;
- printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
- T0 = t;
- Frames = 0;
- }
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
- /*glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );*/
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -70.0 );
-}
-
-
-static void ModeMenu(int entry)
-{
- if (entry >= TEX0 && entry <= TEX7) {
- /* toggle */
- GLint i = entry - TEX0;
- TexEnabled[i] = !TexEnabled[i];
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- if (TexEnabled[i])
- glEnable(GL_TEXTURE_2D);
- else
- glDisable(GL_TEXTURE_2D);
- printf("Enabled: ");
- for (i = 0; i < NumUnits; i++)
- printf("%d ", (int) TexEnabled[i]);
- printf("\n");
- }
- else if (entry==ANIMATE) {
- Animate = !Animate;
- }
- else if (entry==SHADER) {
- Shader = !Shader;
- if (Shader) {
- fprintf(stderr, "using 2-pass shader\n");
- glBindFragmentShaderATI(boring2passID);
- }
- else {
- fprintf(stderr, "using 1-pass shader\n");
- glBindFragmentShaderATI(boringshaderID);
- }
- }
- else if (entry==QUIT) {
- exit(0);
- }
-
- glutPostRedisplay();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- GLuint texObj[8];
- GLint size, i;
-
- const char *exten = (const char *) glGetString(GL_EXTENSIONS);
- if (!strstr(exten, "GL_ATI_fragment_shader")) {
- printf("Sorry, GL_ATI_fragment_shader not supported by this renderer.\n");
- exit(1);
- }
-
-
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);
- printf("%d x %d max texture size\n", size, size);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- for (i = 0; i < NumUnits; i++) {
- if (i < 6)
- TexEnabled[i] = GL_TRUE;
- else
- TexEnabled[i] = GL_FALSE;
- }
-
- /* allocate two texture objects */
- glGenTextures(NumUnits, texObj);
-
- /* setup the texture objects */
- for (i = 0; i < NumUnits; i++) {
-
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glBindTexture(GL_TEXTURE_2D, texObj[i]);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- if (i == 0) {
- if (!LoadRGBMipmaps(TEXTURE_1_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- }
- else if (i == 1) {
- if (!LoadRGBMipmaps(TEXTURE_2_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- }
- else {
- /* checker */
- GLubyte image[8][8][3];
- GLint i, j;
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- if ((i + j) & 1) {
- image[i][j][0] = 50;
- image[i][j][1] = 50;
- image[i][j][2] = 50;
- }
- else {
- image[i][j][0] = 25;
- image[i][j][1] = 25;
- image[i][j][2] = 25;
- }
- }
- }
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0,
- GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *) image);
- }
-
- /* Bind texObj[i] to ith texture unit */
-/* if (i < 2)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- else
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);*/
-
- if (TexEnabled[i])
- glEnable(GL_TEXTURE_2D);
- }
-
- boringshaderID = glGenFragmentShadersATI(1);
- boring2passID = glGenFragmentShadersATI(1);
- if (boring2passID == 0)
- {
- fprintf(stderr, "couldn't get frag shader id\n");
- exit(1);
- }
- glBindFragmentShaderATI(boringshaderID);
-/* maybe not the most creative shader but at least I know how it should look like! */
- glBeginFragmentShaderATI();
- glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_3_ATI, GL_TEXTURE3_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_4_ATI, GL_TEXTURE4_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_5_ATI, GL_TEXTURE5_ARB, GL_SWIZZLE_STR_ATI);
- glColorFragmentOp2ATI(GL_MUL_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_PRIMARY_COLOR, GL_NONE, GL_NONE);
- glAlphaFragmentOp1ATI(GL_MOV_ATI,
- GL_REG_0_ATI, GL_NONE,
- GL_PRIMARY_COLOR, GL_NONE, GL_NONE);
- glColorFragmentOp3ATI(GL_MAD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_1_ATI, GL_NONE, GL_NONE,
- GL_REG_2_ATI, GL_NONE, GL_NONE);
- glColorFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_3_ATI, GL_NONE, GL_NONE);
- glColorFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_4_ATI, GL_NONE, GL_NONE);
- glColorFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_5_ATI, GL_NONE, GL_NONE);
- glEndFragmentShaderATI();
-
-/* mathematically equivalent to first shader but using 2 passes together with
- some tex coord rerouting */
- glBindFragmentShaderATI(boring2passID);
- glBeginFragmentShaderATI();
- glPassTexCoordATI(GL_REG_1_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_3_ATI, GL_TEXTURE3_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_4_ATI, GL_TEXTURE4_ARB, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_5_ATI, GL_TEXTURE5_ARB, GL_SWIZZLE_STR_ATI);
- glColorFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_2_ATI, GL_NONE, GL_NONE,
- GL_REG_3_ATI, GL_NONE, GL_NONE);
- glColorFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_4_ATI, GL_NONE, GL_NONE);
- glColorFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_5_ATI, GL_NONE, GL_NONE);
- /* not really a dependant read */
- glSampleMapATI(GL_REG_0_ATI, GL_REG_1_ATI, GL_SWIZZLE_STR_ATI);
- glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI);
- glPassTexCoordATI(GL_REG_5_ATI, GL_REG_0_ATI, GL_SWIZZLE_STR_ATI);
- glColorFragmentOp2ATI(GL_MUL_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_PRIMARY_COLOR, GL_NONE, GL_NONE);
- glAlphaFragmentOp1ATI(GL_MOV_ATI,
- GL_REG_0_ATI, GL_NONE,
- GL_PRIMARY_COLOR, GL_NONE, GL_NONE);
- glColorFragmentOp3ATI(GL_MAD_ATI,
- GL_REG_0_ATI, GL_NONE, GL_SATURATE_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_1_ATI, GL_NONE, GL_NONE,
- GL_REG_5_ATI, GL_NONE, GL_NONE);
- /* in principle we're finished here, but to test a bit more
- we do some fun with dot ops, replication et al. */
- glSetFragmentShaderConstantATI(GL_CON_3_ATI, shaderconstant);
- glColorFragmentOp2ATI(GL_DOT4_ATI,
- GL_REG_3_ATI, GL_GREEN_BIT_ATI, GL_EIGHTH_BIT_ATI,
- GL_ZERO, GL_NONE, GL_COMP_BIT_ATI | GL_NEGATE_BIT_ATI,
- GL_CON_3_ATI, GL_RED, GL_2X_BIT_ATI);
- /* those args must get ignored, except dstReg */
- glAlphaFragmentOp2ATI(GL_DOT4_ATI,
- GL_REG_4_ATI, GL_NONE,
- GL_ZERO, GL_NONE, GL_NONE,
- GL_ZERO, GL_NONE, GL_NONE);
- /* -> reg3 g = reg4 alpha = -0.5 */
- glAlphaFragmentOp2ATI(GL_ADD_ATI,
- GL_REG_5_ATI, GL_NONE,
- GL_REG_3_ATI, GL_GREEN, GL_NONE,
- GL_REG_4_ATI, GL_NONE, GL_NONE);
- /* -> reg5 a = -1 */
- glColorFragmentOp3ATI(GL_DOT2_ADD_ATI,
- GL_REG_4_ATI, GL_BLUE_BIT_ATI, GL_HALF_BIT_ATI,
- GL_REG_5_ATI, GL_ALPHA, GL_NEGATE_BIT_ATI,
- GL_ONE, GL_NONE, GL_BIAS_BIT_ATI,
- GL_ONE, GL_ALPHA, GL_2X_BIT_ATI | GL_NEGATE_BIT_ATI);
- /* -> reg 4 b = -0.5 */
- glColorFragmentOp2ATI(GL_MUL_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE,
- GL_REG_4_ATI, GL_BLUE, GL_NEGATE_BIT_ATI | GL_2X_BIT_ATI,
- GL_REG_0_ATI, GL_NONE, GL_NONE);
- glEndFragmentShaderATI();
-
- glBindFragmentShaderATI(boringshaderID);
- glEnable(GL_FRAGMENT_SHADER_ATI);
-
- glShadeModel(GL_FLAT);
- glClearColor(0.3, 0.3, 0.4, 1.0);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
- printf("output should be identical with both shaders to multiarb demo when 6 textures are enabled\n");
-}
-
-
-int main( int argc, char *argv[] )
-{
-/* GLint i;*/
-
- glutInit( &argc, argv );
- glutInitWindowSize( 300, 300 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
-
- Init( argc, argv );
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- glutIdleFunc( Idle );
-
- glutCreateMenu(ModeMenu);
-
-/* for (i = 0; i < NumUnits; i++) {
- char s[100];
- sprintf(s, "Toggle Texture %d", i);
- glutAddMenuEntry(s, TEX0 + i);
- }*/
- glutAddMenuEntry("Toggle 1/2 Pass Shader", SHADER);
- glutAddMenuEntry("Toggle Animation", ANIMATE);
- glutAddMenuEntry("Quit", QUIT);
- glutAttachMenu(GLUT_RIGHT_BUTTON);
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/antialias.c b/progs/tests/antialias.c
deleted file mode 100644
index d8269a3ee12..00000000000
--- a/progs/tests/antialias.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $Id: antialias.c,v 1.2 2003-03-29 16:42:57 brianp Exp $ */
-
-/*
- * Test multisampling and polygon smoothing.
- *
- * Brian Paul
- * 4 November 2002
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-static GLfloat Zrot = 0;
-static GLboolean Anim = GL_TRUE;
-static GLboolean HaveMultisample = GL_TRUE;
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-static void
-Polygon( GLint verts, GLfloat radius, GLfloat z )
-{
- int i;
- for (i = 0; i < verts; i++) {
- float a = (i * 2.0 * 3.14159) / verts;
- float x = radius * cos(a);
- float y = radius * sin(a);
- glVertex3f(x, y, z);
- }
-}
-
-
-static void
-DrawObject( void )
-{
- glLineWidth(3.0);
- glColor3f(1, 1, 1);
- glBegin(GL_LINE_LOOP);
- Polygon(12, 1.2, 0);
- glEnd();
-
- glLineWidth(1.0);
- glColor3f(1, 1, 1);
- glBegin(GL_LINE_LOOP);
- Polygon(12, 1.1, 0);
- glEnd();
-
- glColor3f(1, 0, 0);
- glBegin(GL_POLYGON);
- Polygon(12, 0.4, 0.3);
- glEnd();
-
- glColor3f(0, 1, 0);
- glBegin(GL_POLYGON);
- Polygon(12, 0.6, 0.2);
- glEnd();
-
- glColor3f(0, 0, 1);
- glBegin(GL_POLYGON);
- Polygon(12, 0.8, 0.1);
- glEnd();
-
- glColor3f(1, 1, 1);
- glBegin(GL_POLYGON);
- Polygon(12, 1.0, 0);
- glEnd();
-}
-
-
-static void
-Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glColor3f(1, 1, 1);
- if (HaveMultisample) {
- glRasterPos2f(-3.1, -1.6);
- PrintString("MULTISAMPLE");
- }
- glRasterPos2f(-0.8, -1.6);
- PrintString("No antialiasing");
- glRasterPos2f(1.6, -1.6);
- PrintString("GL_POLYGON_SMOOTH");
-
- /* multisample */
- if (HaveMultisample) {
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_MULTISAMPLE_ARB);
- glPushMatrix();
- glTranslatef(-2.5, 0, 0);
- glPushMatrix();
- glRotatef(Zrot, 0, 0, 1);
- DrawObject();
- glPopMatrix();
- glPopMatrix();
- glDisable(GL_MULTISAMPLE_ARB);
- glDisable(GL_DEPTH_TEST);
- }
-
- /* non-aa */
- glEnable(GL_DEPTH_TEST);
- glPushMatrix();
- glTranslatef(0, 0, 0);
- glPushMatrix();
- glRotatef(Zrot, 0, 0, 1);
- DrawObject();
- glPopMatrix();
- glPopMatrix();
- glDisable(GL_DEPTH_TEST);
-
- /* polygon smooth */
- glEnable(GL_POLYGON_SMOOTH);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glPushMatrix();
- glTranslatef(2.5, 0, 0);
- glPushMatrix();
- glRotatef(Zrot, 0, 0, 1);
- DrawObject();
- glPopMatrix();
- glPopMatrix();
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_POLYGON_SMOOTH);
- glDisable(GL_BLEND);
-
- glutSwapBuffers();
-}
-
-
-static void
-Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(-2.0*ar, 2.0*ar, -2.0, 2.0, -1.0, 1.0);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void
-Idle( void )
-{
- Zrot = 0.01 * glutGet(GLUT_ELAPSED_TIME);
- glutPostRedisplay();
-}
-
-
-static void
-Key( unsigned char key, int x, int y )
-{
- const GLfloat step = 1.0;
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'z':
- Zrot = (int) (Zrot - step);
- break;
- case 'Z':
- Zrot = (int) (Zrot + step);
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init( void )
-{
- /* GLUT imposes the four samples/pixel requirement */
- int s;
- glGetIntegerv(GL_SAMPLES_ARB, &s);
- if (!glutExtensionSupported("GL_ARB_multisample") || s < 1) {
- printf("Warning: multisample antialiasing not supported.\n");
- HaveMultisample = GL_FALSE;
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_SAMPLES_ARB = %d\n", s);
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
-
- glGetIntegerv(GL_MULTISAMPLE_ARB, &s);
- printf("GL_MULTISAMPLE_ARB = %d\n", s);
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 600, 300 );
- glutInitDisplayMode( GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE |
- GLUT_DEPTH | GLUT_MULTISAMPLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc( Idle );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/api_speed.c b/progs/tests/api_speed.c
deleted file mode 100644
index aed65b35fe3..00000000000
--- a/progs/tests/api_speed.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2002
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file api_speed.c
- * Simple test to measure the overhead of making GL calls.
- *
- * The main purpose of this test is to measure the difference in calling
- * overhead of different dispatch methods. Since it uses asm/timex.h to
- * access the Pentium's cycle counters, it will probably only compile on
- * Linux (though most architectures have a get_cycles function in timex.h).
- * That is why it isn't in the default Makefile.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-#include <GL/glut.h>
-
-#define inline __inline__
-#include <asm/timex.h>
-
-static float Width = 400;
-static float Height = 400;
-static unsigned count = 1000000;
-
-
-static void Idle( void )
-{
- glutPostRedisplay();
-}
-
-#define DO_FUNC(f,p) \
- do { \
- t0 = get_cycles(); \
- for ( i = 0 ; i < count ; i++ ) { \
- f p ; \
- } \
- t1 = get_cycles(); \
- printf("%u calls to % 20s required %llu cycles.\n", count, # f, t1 - t0); \
- } while( 0 )
-
-/**
- * Main display function. This is the place to add more API calls.
- */
-static void Display( void )
-{
- int i;
- const float v[3] = { 1.0, 0.0, 0.0 };
- cycles_t t0;
- cycles_t t1;
-
- glBegin(GL_TRIANGLE_STRIP);
-
- DO_FUNC( glColor3fv, (v) );
- DO_FUNC( glNormal3fv, (v) );
- DO_FUNC( glTexCoord2fv, (v) );
- DO_FUNC( glTexCoord3fv, (v) );
- DO_FUNC( glMultiTexCoord2fv, (GL_TEXTURE0, v) );
- DO_FUNC( glMultiTexCoord2f, (GL_TEXTURE0, 0.0, 0.0) );
- DO_FUNC( glFogCoordfvEXT, (v) );
- DO_FUNC( glFogCoordfEXT, (0.5) );
-
- glEnd();
-
- exit(0);
-}
-
-
-static void Reshape( int width, int height )
-{
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( (int) Width, (int) Height );
- glutInitWindowPosition( 0, 0 );
-
- glutInitDisplayMode( GLUT_RGB );
-
- glutCreateWindow( argv[0] );
-
- if ( argc > 1 ) {
- count = strtoul( argv[1], NULL, 0 );
- if ( count == 0 ) {
- fprintf( stderr, "Usage: %s [iterations]\n", argv[0] );
- exit(1);
- }
- }
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- glutIdleFunc( Idle );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/api_speed.py b/progs/tests/api_speed.py
deleted file mode 100755
index 0ddaf5836c9..00000000000
--- a/progs/tests/api_speed.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/env python2
-
-# (C) Copyright IBM Corporation 2004
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-
-# This script is used to run api_speed against several different libGL
-# libraries and compare the results. See the show_usage function for more
-# details on how to use it.
-
-
-import re, os, sys, getopt
-
-class results:
- def process_file(self, f):
- self.cycles = {}
- self.iterations = -1
-
- for line in f.readlines():
- m = re.match("(\d+) calls to (.{20}) required (\d+) cycles.", line)
-
- if self.iterations != -1 and int(m.group(1)) != self.iterations:
- raise
-
- # This could be done with lstrip, but the version of
- # the Python library on my system doesn't have it.
- # The installed version of Python is quite old. :(
-
- temp = m.group(2)
- function_name = None
- for i in range(len(temp)):
- if temp[i] != ' ':
- function_name = temp[i:]
- break
-
- if function_name == None:
- raise
-
- self.cycles[ function_name ] = int(m.group(3))
- self.iterations = int(m.group(1))
-
-
- def show_results(self):
- for name in self.cycles:
- print "%s -> %f" % (name, float(self.cycles[name]) / self.iterations)
-
-
- def compare_results(self, other):
- for name in self.cycles:
- if other.cycles.has_key(name):
- a = float(self.cycles[name]) / float(self.iterations)
- b = float(other.cycles[name]) / float(other.iterations)
- if abs( a ) < 0.000001:
- print "a = %f, b = %f" % (a, b)
- else:
- p = (100.0 * b / a) - 100.0
- print "%- 20s %7.2f - %7.2f = % -6.2f (%+.1f%%)" % (name, a, b, a - b, p)
- return
-
-
-def make_execution_string(lib, iterations):
- if lib == None:
- return "./api_speed %u" % (iterations)
- else:
- return "LD_PRELOAD=%s ./api_speed %u" % (lib, iterations)
-
-
-def show_usage():
- print """Usage: %s [-i iterations] {library ...}
-
-The full path to one or more libGL libraries (including the full name of the
-library) can be included on the command-line. Each library will be tested,
-and the results compared. The first library listed will be used as the
-"base line" for all comparisons.""" % (sys.argv[0])
- sys.exit(1)
-
-
-if __name__ == '__main__':
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "i:")
- except Exception,e:
- show_usage()
-
- iterations = 1000000
- try:
- for (arg,val) in args:
- if arg == "-i":
- iterations = int(val)
- except Exception,e:
- show_usage()
-
-
- # If no libraries were specifically named, just run the test against
- # the default system libGL.
-
- if len(trail) == 0:
- trail.append(None)
-
-
- result_array = []
- names = []
-
- for lib in trail:
- s = make_execution_string( lib, iterations )
- r = results()
- r.process_file( os.popen(s) )
- names.append(lib)
- result_array.append(r)
-
-
- # If the test was only run against one library, just show the results
- # of the test run. Otherwise, compare each successive run against
- # the first run.
-
- if len( result_array ) == 1:
- result_array[0].show_results()
- else:
- for i in range(1, len( result_array )):
- print "%s vs. %s" % (names[0], names[i])
- result_array[0].compare_results( result_array[i] )
- print ""
diff --git a/progs/tests/arbfpspec.c b/progs/tests/arbfpspec.c
deleted file mode 100644
index eac2a9100f5..00000000000
--- a/progs/tests/arbfpspec.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * To demo that specular color gets lost someplace after vertex
- * program completion and fragment program startup
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-static GLboolean Anim = GL_TRUE;
-
-
-static void Idle( void )
-{
- Xrot += .3;
- Yrot += .4;
- Zrot += .2;
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
- glutSolidTorus(0.75, 2.0, 10, 20);
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case ' ':
- Xrot = Yrot = Zrot = 0;
- break;
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLint errno;
- GLuint prognum, fprognum;
-
- static const char prog[] =
- "!!ARBvp1.0\n"
- "DP4 result.position.x, state.matrix.mvp.row[0], vertex.position ;\n"
- "DP4 result.position.y, state.matrix.mvp.row[1], vertex.position ;\n"
- "DP4 result.position.z, state.matrix.mvp.row[2], vertex.position ;\n"
- "DP4 result.position.w, state.matrix.mvp.row[3], vertex.position ;\n"
- "MOV result.color.front.primary, {.5, .5, .5, 1};\n"
- "MOV result.color.front.secondary, {1, 1, 1, 1};\n"
- "END";
-
- static const char fprog[] =
- "!!ARBfp1.0\n"
- "MOV result.color, fragment.color.secondary;\n"
- "END";
-
- if (!glutExtensionSupported("GL_ARB_vertex_program")) {
- printf("Sorry, this program requires GL_ARB_vertex_program");
- exit(1);
- }
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Sorry, this program requires GL_ARB_fragment_program");
- exit(1);
- }
-
- glGenProgramsARB(1, &prognum);
- glGenProgramsARB(1, &fprognum);
-
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(prog), (const GLubyte *) prog);
-
- assert(glIsProgramARB(prognum));
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- GLint errorpos;
-
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- }
-
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, fprognum);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(fprog), (const GLubyte *) fprog);
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- GLint errorpos;
-
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- }
-
- glEnable(GL_VERTEX_PROGRAM_ARB);
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
- glEnable(GL_DEPTH_TEST);
- glClearColor(0.3, 0.3, 0.3, 1);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbfptest1.c b/progs/tests/arbfptest1.c
deleted file mode 100644
index 45d05125b26..00000000000
--- a/progs/tests/arbfptest1.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Test GL_ARB_fragment_program */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
-
- glColor4f(0, 0.5, 0, 1);
- glColor4f(0, 1, 0, 1);
- glBegin(GL_POLYGON);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 0, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-static void load_program(const char *prog, GLuint prognum)
-{
- int a;
- GLint errorpos, errno;
-
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(prog), (const GLubyte *) prog);
-
- assert(glIsProgramARB(prognum));
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- for (a=-10; a<10; a++)
- {
- if ((errorpos+a < 0) || (errorpos+a >= strlen(prog))) continue;
- printf("%c", prog[errorpos+a]);
- }
- printf("\n");
- exit(1);
- }
-}
-
-static void Init( void )
-{
- static const char *prog0 =
- "!!ARBfp1.0\n"
- "TEMP R0, RC, HC, H0, H1, H2, H3, H30 ;\n"
- "MUL result.color, R0, fragment.position; \n"
- "ADD result.color, H3, fragment.texcoord; \n"
- "ADD_SAT result.color, H3, fragment.texcoord; \n"
- "MUL result.color.xy, R0.wzyx, fragment.position; \n"
- "MUL result.color, H0, fragment.position; \n"
- "MUL result.color, -H0, fragment.position; \n"
- "MOV RC, H1; \n"
- "MOV HC, H2; \n"
- "END \n"
- ;
- /* masked updates, defines, declarations */
- static const char *prog1 =
- "!!ARBfp1.0\n"
- "PARAM foo = {1., 2., 3., 4.}; \n"
- "PARAM foo2 = 5.; \n"
- "PARAM foo3 = {5., 6., 7., 8.}; \n"
- "PARAM bar = 3.; \n"
- "TEMP R0, R1, RC, EQ, NE, bar2; \n"
- "ALIAS bar3 = bar; \n"
- "MOV result.color.xy, R0; \n"
- "MOV result.color, R0; \n"
- "MOV result.color.xyzw, R0; \n"
- "MOV result.color.xy, R0; \n"
- "MOV RC.x, R1.x; \n"
- "KIL NE; \n"
- "KIL EQ.xyxy; \n"
- "END \n"
- ;
-
- /* texture instructions */
- static const char *prog2 =
- "!!ARBfp1.0\n"
- "TEMP R0, R1, R2, R3;\n"
- "TEX R0, fragment.texcoord, texture[1], 2D; \n"
- "TEX R1, fragment.texcoord[1], texture[1], CUBE; \n"
- "TEX R2, fragment.texcoord[2], texture[2], 3D; \n"
- "TXP R3, fragment.texcoord[3], texture[3], RECT; \n"
- "MUL result.color, R0, fragment.color; \n"
- "END \n"
- ;
-
- /* test negation, absolute value */
- static const char *prog3 =
- "!!ARBfp1.0\n"
- "TEMP R0, R1;\n"
- "MOV R0, R1; \n"
- "MOV R0, -R1; \n"
- "MOV result.color, R0; \n"
- "END \n"
- ;
-
- /* literal constant sources */
- static const char *prog4 =
- "!!ARBfp1.0\n"
- "TEMP R0, R1;\n"
- "PARAM Pi = 3.14159; \n"
- "MOV R0, {1., -2., +3., 4.}; \n"
- "MOV R0, 5.; \n"
- "MOV R0, -5.; \n"
- "MOV R0, 5.; \n"
- "MOV R0, Pi; \n"
- "MOV result.color, R0; \n"
- "END \n"
- ;
-
- /* change the fragment color in a simple way */
- static const char *prog10 =
- "!!ARBfp1.0\n"
- "PARAM blue = {0., 0., 1., 0.};\n"
- "PARAM color = {1., 0., 0., 1.};\n"
- "TEMP R0; \n"
- "MOV R0, fragment.color; \n"
- "#ADD result.color, R0, fragment.color; \n"
- "#ADD result.color, blue, fragment.color; \n"
- "#ADD result.color, {1., 0., 0., 0.}, fragment.color; \n"
- "ADD result.color, color, fragment.color; \n"
- "END \n"
- ;
-
- GLuint progs[20];
-
- glGenProgramsARB(20, progs);
- assert(progs[0]);
- assert(progs[1]);
- assert(progs[0] != progs[1]);
-
-
- printf("program 0:\n");
- load_program(prog0, progs[0]);
- printf("program 1:\n");
- load_program(prog1, progs[1]);
- printf("program 2:\n");
- load_program(prog2, progs[2]);
- printf("program 3:\n");
- load_program(prog3, progs[3]);
- printf("program 4:\n");
- load_program(prog4, progs[4]);
- printf("program 10:\n");
- load_program(prog10, progs[5]);
-
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
- glEnable(GL_ALPHA_TEST);
- glAlphaFunc(GL_ALWAYS, 0.0);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbfptexture.c b/progs/tests/arbfptexture.c
deleted file mode 100644
index a854908c311..00000000000
--- a/progs/tests/arbfptexture.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* GL_ARB_fragment_program texture test */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "readtex.c"
-
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
-
- glBegin(GL_POLYGON);
-#define Q 2
- glColor4f(1.0, 1.0, 1.0, 1); glTexCoord4f(0, 0, 0, Q); glVertex2f(-1, -1);
- glColor4f(0.2, 0.2, 1.0, 1); glTexCoord4f(1, 0, 0, Q); glVertex2f( 1, -1);
- glColor4f(0.2, 1.0, 0.2, 1); glTexCoord4f(1, 1, 0, Q); glVertex2f( 1, 1);
- glColor4f(1.0, 0.2, 0.2, 1); glTexCoord4f(0, 1, 0, Q); glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "TEX R0, fragment.texcoord[0], texture[0], 2D; \n"
- "MUL result.color, R0, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
- GLuint Texture;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- assert(glIsProgramARB(modulateProg));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- /* Load texture */
- glGenTextures(1, &Texture);
- glBindTexture(GL_TEXTURE_2D, Texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE);
- exit(1);
- }
- /* XXX this enable shouldn't really be needed!!! */
- glEnable(GL_TEXTURE_2D);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbfptrig.c b/progs/tests/arbfptrig.c
deleted file mode 100644
index 26b68c6b412..00000000000
--- a/progs/tests/arbfptrig.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* GL_ARB_fragment_program texture test */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "readtex.c"
-
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-
-#define PI 3.141592
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
-
- glBegin(GL_POLYGON);
- glTexCoord2f(-PI, 0); glVertex2f(-1, -1);
- glTexCoord2f(PI, 0); glVertex2f( 1, -1);
- glTexCoord2f(PI, 1); glVertex2f( 1, 1);
- glTexCoord2f(-PI, 1); glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "MOV R0, {0,0,0,1};\n"
- "SCS R0, fragment.texcoord[0].x; \n"
- "ADD R0, R0, {1.0}.x;\n"
- "MUL R0, R0, {0.5}.x;\n"
- "MOV result.color, R0; \n"
- "END"
- ;
- GLuint modulateProg;
- GLuint Texture;
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- assert(glIsProgramARB(modulateProg));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- /* Load texture */
- glGenTextures(1, &Texture);
- glBindTexture(GL_TEXTURE_2D, Texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE);
- exit(1);
- }
- /* XXX this enable shouldn't really be needed!!! */
- glEnable(GL_TEXTURE_2D);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbnpot.c b/progs/tests/arbnpot.c
deleted file mode 100644
index 8107717e271..00000000000
--- a/progs/tests/arbnpot.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Test NPOT textures with the GL_ARB_texture_non_power_of_two extension.
- * Brian Paul
- * 2 July 2003
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-#include "../util/readtex.c"
-
-#define IMAGE_FILE "../images/girl.rgb"
-
-static GLfloat Zrot = 0;
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Zrot, 0, 0, 1);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0);
- glVertex2f(-1, -1);
- glTexCoord2f(1, 0);
- glVertex2f(1, -1);
- glTexCoord2f(1, 1);
- glVertex2f(1, 1);
- glTexCoord2f(0, 1);
- glVertex2f(-1, 1);
- glEnd();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -7.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'z':
- Zrot -= 1.0;
- break;
- case 'Z':
- Zrot += 1.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLubyte *image;
- int imgWidth, imgHeight, minDim, w;
- GLenum imgFormat;
-
- if (!glutExtensionSupported("GL_ARB_texture_non_power_of_two")) {
- printf("Sorry, this program requires GL_ARB_texture_non_power_of_two\n");
- exit(1);
- }
-
-#if 1
- image = LoadRGBImage( IMAGE_FILE, &imgWidth, &imgHeight, &imgFormat );
- if (!image) {
- printf("Couldn't read %s\n", IMAGE_FILE);
- exit(0);
- }
-#else
- int i, j;
- imgFormat = GL_RGB;
- imgWidth = 3;
- imgHeight = 3;
- image = malloc(imgWidth * imgHeight * 3);
- for (i = 0; i < imgHeight; i++) {
- for (j = 0; j < imgWidth; j++) {
- int k = (i * imgWidth + j) * 3;
- if ((i + j) & 1) {
- image[k+0] = 255;
- image[k+1] = 0;
- image[k+2] = 0;
- }
- else {
- image[k+0] = 0;
- image[k+1] = 255;
- image[k+2] = 0;
- }
- }
- }
-#endif
-
- printf("Read %d x %d\n", imgWidth, imgHeight);
-
- minDim = imgWidth < imgHeight ? imgWidth : imgHeight;
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, imgWidth, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- assert(glGetError() == GL_NO_ERROR);
-
- glTexImage1D(GL_PROXY_TEXTURE_1D, 0, GL_RGB, imgWidth, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- glGetTexLevelParameteriv(GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &w);
- assert(w == imgWidth);
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- assert(glGetError() == GL_NO_ERROR);
-
- glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
- assert(w == imgWidth);
-
- glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- assert(glGetError() == GL_NO_ERROR);
-
- glTexImage3D(GL_PROXY_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_WIDTH, &w);
- assert(w == imgWidth);
-
- glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB,
- minDim, minDim, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- assert(glGetError() == GL_NO_ERROR);
-
- glTexImage2D(GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_RGB,
- minDim, minDim, 0,
- imgFormat, GL_UNSIGNED_BYTE, image);
- glGetTexLevelParameteriv(GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_TEXTURE_WIDTH, &w);
- assert(w == minDim);
-
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glEnable(GL_TEXTURE_2D);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 400, 400 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbvptest1.c b/progs/tests/arbvptest1.c
deleted file mode 100644
index 0ebd3987f58..00000000000
--- a/progs/tests/arbvptest1.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Test glGenProgramsARB(), glIsProgramARB(), glLoadProgramARB() */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
-
- glBegin(GL_POLYGON);
- glVertexAttrib2fARB(0, -1, -1);
- glVertexAttrib2fARB(0, 1, -1);
- glVertexAttrib2fARB(0, 0, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-static void load_program(const char *prog, GLuint prognum)
-{
- int a;
- GLint errorpos, errno;
-
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(prog), (const GLubyte *) prog);
-
- assert(glIsProgramARB(prognum));
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- for (a=-10; a<10; a++)
- {
- if ((errorpos+a < 0) || (errorpos+a >= strlen(prog))) continue;
- printf("%c", prog[errorpos+a]);
- }
- printf("\n");
- exit(1);
- }
-}
-
-static void Init( void )
-{
- GLuint prognum[4];
-
- static const char *prog1 =
- "!!ARBvp1.0\n"
- "TEMP R0;\n"
- "MUL result.color.primary.xyz, R0, program.local[35]; \n"
- "END\n";
- static const char *prog2 =
- "!!ARBvp1.0\n"
- "#\n"
- "# c[0-3] = modelview projection (composite) matrix\n"
- "# c[32] = normalized light direction in object-space\n"
- "# c[35] = yellow diffuse material, (1.0, 1.0, 0.0, 1.0)\n"
- "# c[64].x = 0.0\n"
- "# c[64].z = 0.125, a scaling factor\n"
- "TEMP R0, R1;\n"
- "#\n"
- "# outputs diffuse illumination for color and perturbed position\n"
- "#\n"
- "DP3 R0, program.local[32], vertex.normal; # light direction DOT normal\n"
- "MUL result.color.primary.xyz, R0, program.local[35]; \n"
- "MAX R0, program.local[64].x, R0; \n"
- "MUL R0, R0, vertex.normal; \n"
- "MUL R0, R0, program.local[64].z; \n"
- "ADD R1, vertex.position, -R0; # perturb object space position\n"
- "DP4 result.position.x, state.matrix.mvp.row[3], R1; \n"
- "DP4 result.position.y, state.matrix.mvp.row[1], R1; \n"
- "DP4 result.position.z, state.matrix.mvp.row[2], R1; \n"
- "DP4 result.position.w, state.matrix.mvp.row[3], R1; \n"
- "END\n";
- static const char *prog3 =
- "!!ARBvp1.0\n"
- "TEMP R0, R1, R2, R3;\n"
- "DP4 result.position.x, state.matrix.mvp.row[0], vertex.position;\n"
- "DP4 result.position.y, state.matrix.mvp.row[1], vertex.position;\n"
- "DP4 result.position.z, state.matrix.mvp.row[2], vertex.position;\n"
- "DP4 result.position.w, state.matrix.mvp.row[3], vertex.position;\n"
- "DP3 R0.x, state.matrix.modelview.inverse.row[0], vertex.normal;\n"
- "DP3 R0.y, state.matrix.modelview.inverse.row[1], vertex.normal;\n"
- "DP3 R0.z, state.matrix.modelview.inverse.row[2], vertex.normal;\n"
- "DP3 R1.x, program.env[32], R0; # R1.x = Lpos DOT n'\n"
- "DP3 R1.y, program.env[33], R0; # R1.y = hHat DOT n'\n"
- "MOV R1.w, program.local[38].x; # R1.w = specular power\n"
- "LIT R2, R1; # Compute lighting values\n"
- "MAD R3, program.env[35].x, R2.y, program.env[35].y; # diffuse + emissive\n"
- "MAD result.color.primary.xyz, program.env[36], R2.z, R3; # + specular\n"
- "END\n";
- static const char *prog4 =
- "!!ARBvp1.0\n"
- "TEMP R2, R3;\n"
- "PARAM foo = {0., 0., 0., 1.};\n"
- "PARAM blah[] = { program.local[0..8] };\n"
- "ADDRESS A0;\n"
- "ARL A0.x, foo.x;\n"
- "DP4 R2, R3, blah[A0.x].x;\n"
- "DP4 R2, R3, blah[A0.x + 5];\n"
- "DP4 result.position, R3, blah[A0.x - 4];\n"
- "END\n";
-
- glGenProgramsARB(4, prognum);
-
- load_program(prog1, prognum[0]);
- load_program(prog2, prognum[1]);
- load_program(prog3, prognum[2]);
- load_program(prog4, prognum[3]);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbvptest3.c b/progs/tests/arbvptest3.c
deleted file mode 100644
index 6437062900e..00000000000
--- a/progs/tests/arbvptest3.c
+++ /dev/null
@@ -1,127 +0,0 @@
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Zrot = 0.0;
-
-
-static void Display( void )
-{
- glClearColor(0.3, 0.3, 0.3, 1);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glEnable(GL_VERTEX_PROGRAM_ARB);
-
- glLoadIdentity();
- glRotatef(Zrot, 0, 0, 1);
-
- glPushMatrix();
-
- glVertexAttrib3fARB(3, 1, 0.5, 0.25);
- glBegin(GL_TRIANGLES);
-#if 1
- glVertexAttrib3fARB(3, 1.0, 0.0, 0.0);
- glVertexAttrib2fARB(0, -0.5, -0.5);
- glVertexAttrib3fARB(3, 0.0, 1.0, 0.0);
- glVertexAttrib2fARB(0, 0.5, -0.5);
- glVertexAttrib3fARB(3, 0.0, 0.0, 1.0);
- glVertexAttrib2fARB(0, 0, 0.5);
-#else
- glVertex2f( -1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 0, 1);
-#endif
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- /* glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/
- glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- /*glTranslatef( 0.0, 0.0, -15.0 );*/
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLint errno;
- GLuint prognum;
-
- static const char *prog1 =
- "!!ARBvp1.0\n"
- "MOV result.color, vertex.attrib[3];\n"
-
- "DP4 result.position.x, vertex.position, state.matrix.modelview.row[0];\n"
- "DP4 result.position.y, vertex.position, state.matrix.modelview.row[1];\n"
- "DP4 result.position.z, vertex.position, state.matrix.modelview.row[2];\n"
- "DP4 result.position.w, vertex.position, state.matrix.modelview.row[3];\n"
- "END\n";
-
- glGenProgramsARB(1, &prognum);
-
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(prog1), (const GLubyte *) prog1);
-
- assert(glIsProgramARB(prognum));
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- GLint errorpos;
-
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbvptorus.c b/progs/tests/arbvptorus.c
deleted file mode 100644
index c1e2d0b76a8..00000000000
--- a/progs/tests/arbvptorus.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * A lit, rotating torus via vertex program
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-static GLboolean Anim = GL_TRUE;
-
-
-static void Idle( void )
-{
- Xrot += .3;
- Yrot += .4;
- Zrot += .2;
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
- glutSolidTorus(0.75, 2.0, 10, 20);
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case ' ':
- Xrot = Yrot = Zrot = 0;
- break;
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLint errno;
- GLuint prognum;
-
- /* borrowed from an nvidia demo:
- * c[0..3] = modelview matrix
- * c[4..7] = invtrans modelview matrix
- * c[32] = light pos
- * c[35] = diffuse color
- */
- static const char prog[] =
- "!!ARBvp1.0\n"
- "TEMP R0, R1; \n"
- "#Simple transform and diffuse lighting\n"
- "# object x MVP -> clip\n"
- "DP4 result.position.x, state.matrix.mvp.row[0], vertex.position ;\n"
- "DP4 result.position.y, state.matrix.mvp.row[1], vertex.position ;\n"
- "DP4 result.position.z, state.matrix.mvp.row[2], vertex.position ;\n"
- "DP4 result.position.w, state.matrix.mvp.row[3], vertex.position ;\n"
-
- "# normal x MV-1T -> lighting normal\n"
- "DP3 R1.x, state.matrix.modelview.invtrans.row[0], vertex.normal ;\n"
- "DP3 R1.y, state.matrix.modelview.invtrans.row[1], vertex.normal;\n"
- "DP3 R1.z, state.matrix.modelview.invtrans.row[2], vertex.normal;\n"
-
- "DP3 R0, program.local[32], R1; # L.N\n"
-#if 0
- "MUL result.color.xyz, R0, program.local[35] ; # col = L.N * diffuse\n"
-#else
- "MUL result.color.primary.xyz, R0, program.local[35] ; # col = L.N * diffuse\n"
-#endif
- "MOV result.texcoord, vertex.texcoord;\n"
- "END";
-
- if (!glutExtensionSupported("GL_ARB_vertex_program")) {
- printf("Sorry, this program requires GL_ARB_vertex_program");
- exit(1);
- }
-
-
- glGenProgramsARB(1, &prognum);
-
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(prog), (const GLubyte *) prog);
-
- assert(glIsProgramARB(prognum));
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- GLint errorpos;
-
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- }
-
- /* Light position */
- glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 32, 2, 2, 4, 1);
- /* Diffuse material color */
- glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 35, 0.25, 0, 0.25, 1);
-
- glEnable(GL_VERTEX_PROGRAM_ARB);
- glEnable(GL_DEPTH_TEST);
- glClearColor(0.3, 0.3, 0.3, 1);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/arbvpwarpmesh.c b/progs/tests/arbvpwarpmesh.c
deleted file mode 100644
index 3dfe94f7596..00000000000
--- a/progs/tests/arbvpwarpmesh.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Warp a triangle mesh with a vertex program.
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
-static GLboolean Anim = GL_TRUE;
-static GLfloat Phi = 0.0;
-
-
-static void Idle( void )
-{
- Phi += 0.01;
- glutPostRedisplay();
-}
-
-
-static void DrawMesh( int rows, int cols )
-{
- static const GLfloat colorA[3] = { 0, 1, 0 };
- static const GLfloat colorB[3] = { 0, 0, 1 };
- const float dx = 2.0 / (cols - 1);
- const float dy = 2.0 / (rows - 1);
- float x, y;
- int i, j;
-
-#if 1
-#define COLOR3FV(c) glVertexAttrib3fvARB(3, c)
-#define VERTEX2F(x, y) glVertexAttrib2fARB(0, x, y)
-#else
-#define COLOR3FV(c) glColor3fv(c)
-#define VERTEX2F(x, y) glVertex2f(x, y)
-#endif
-
- y = -1.0;
- for (i = 0; i < rows - 1; i++) {
- glBegin(GL_QUAD_STRIP);
- x = -1.0;
- for (j = 0; j < cols; j++) {
- if ((i + j) & 1)
- COLOR3FV(colorA);
- else
- COLOR3FV(colorB);
- VERTEX2F(x, y);
- VERTEX2F(x, y + dy);
- x += dx;
- }
- glEnd();
- y += dy;
- }
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
-
- /* Position the gravity source */
- {
- GLfloat x, y, z, r = 0.5;
- x = r * cos(Phi);
- y = r * sin(Phi);
- z = 1.0;
- glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 30, x, y, z, 1);
- glDisable(GL_VERTEX_PROGRAM_ARB);
- glBegin(GL_POINTS);
- glColor3f(1,1,1);
- glVertex3f(x, y, z);
- glEnd();
- }
-
- glEnable(GL_VERTEX_PROGRAM_ARB);
- DrawMesh(8, 8);
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- float ar = (float) width / (float) height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0 * ar, 1.0 * ar, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
- glScalef(2, 2, 2);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'p':
- Phi += 0.2;
- break;
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLuint prognum;
- GLint errno;
-
- /*
- * c[0..3] = modelview matrix
- * c[4..7] = inverse modelview matrix
- * c[30] = gravity source location
- * c[31] = gravity source strength
- * c[32] = light pos
- * c[35] = diffuse color
- */
- static const char prog[] =
- "!!ARBvp1.0\n"
- "TEMP R1, R2, R3; "
-
- "# Compute distance from vertex to gravity source\n"
- "ADD R1, program.local[30], -vertex.position; # vector from vertex to gravity\n"
- "DP3 R2, R1, R1; # dot product\n"
- "RSQ R2, R2.x; # square root = distance\n"
- "MUL R2, R2, program.local[31].xxxx; # scale by the gravity factor\n"
-
- "# Displace vertex by gravity factor along R1 vector\n"
- "MAD R3, R1, R2, vertex.position;\n"
-
- "# Continue with typical modelview/projection\n"
- "DP4 result.position.x, state.matrix.mvp.row[0], R3 ; # object x MVP -> clip\n"
- "DP4 result.position.y, state.matrix.mvp.row[1], R3 ;\n"
- "DP4 result.position.z, state.matrix.mvp.row[2], R3 ;\n"
- "DP4 result.position.w, state.matrix.mvp.row[3], R3 ;\n"
-
- "MOV result.color, vertex.attrib[3];\n # copy input color to output color\n"
-
- "END";
-
- if (!glutExtensionSupported("GL_ARB_vertex_program")) {
- printf("Sorry, this program requires GL_ARB_vertex_program\n");
- exit(1);
- }
-
- glGenProgramsARB(1, &prognum);
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(prog), (const GLubyte *)prog);
- errno = glGetError();
- printf("glGetError = %d\n", errno);
-
- if (errno != GL_NO_ERROR)
- {
- GLint errorpos;
-
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- }
-
- /* Light position */
- glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 32, 2, 2, 4, 1);
- /* Diffuse material color */
- glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 35, 0.25, 0, 0.25, 1);
-
- /* Gravity strength */
- glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 31, .5, 0, 0, 0);
-
- glEnable(GL_DEPTH_TEST);
- glClearColor(0.3, 0.3, 0.3, 1);
- glShadeModel(GL_FLAT);
- glPointSize(3);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/auxbuffer.c b/progs/tests/auxbuffer.c
deleted file mode 100644
index 70f0b73910d..00000000000
--- a/progs/tests/auxbuffer.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Test AUX buffer rendering
- * Use GLX since GLUT doesn't support AUX buffers
- */
-
-
-/*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
- * Port by Brian Paul 23 March 2001
- *
- * Command line options:
- * -info print GL implementation information
- *
- */
-
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/keysym.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-
-
-static int
-current_time(void)
-{
- return 0;
-}
-
-
-
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-static int WinWidth = 300, WinHeight = 300;
-static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-
-/*
- *
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * Input: inner_radius - radius of hole at center
- * outer_radius - radius at center of teeth
- * width - width of gear
- * teeth - number of teeth
- * tooth_depth - depth of tooth
- */
-static void
-gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth)
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0;
- r2 = outer_radius + tooth_depth / 2.0;
-
- da = 2.0 * M_PI / teeth / 4.0;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0, 0.0, 1.0);
-
- /* draw front face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- if (i < teeth) {
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- width * 0.5);
- }
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- width * 0.5);
- }
- glEnd();
-
- glNormal3f(0.0, 0.0, -1.0);
-
- /* draw back face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- if (i < teeth) {
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- }
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- -width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- -width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- }
- glEnd();
-
- /* draw outward faces of teeth */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- u = r2 * cos(angle + da) - r1 * cos(angle);
- v = r2 * sin(angle + da) - r1 * sin(angle);
- len = sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
- -width * 0.5);
- u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
- v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
- -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- }
-
- glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
- glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
-
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glNormal3f(-cos(angle), -sin(angle), 0.0);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- }
- glEnd();
-}
-
-
-static void
-draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1.0, 0.0, 0.0);
- glRotatef(view_roty, 0.0, 1.0, 0.0);
- glRotatef(view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix();
- glTranslatef(-3.0, -2.0, 0.0);
- glRotatef(angle, 0.0, 0.0, 1.0);
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(3.1, -2.0, 0.0);
- glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(-3.1, 4.2, 0.0);
- glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-}
-
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- WinWidth = width;
- WinHeight = height;
- glViewport(0, 0, (GLint) width, (GLint) height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-}
-
-
-static void
-init(void)
-{
- static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
- static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
- static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
- static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
- int i;
-
- glGetIntegerv(GL_AUX_BUFFERS, &i);
- printf("AUX BUFFERS: %d\n", i);
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0, 4.0, 1.0, 20, 0.7);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5, 2.0, 2.0, 10, 0.7);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3, 2.0, 0.5, 10, 0.7);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-}
-
-
-/*
- * Create an RGB, double-buffered window.
- * Return the window and context handles.
- */
-static void
-make_window( Display *dpy, const char *name,
- int x, int y, int width, int height,
- Window *winRet, GLXContext *ctxRet)
-{
- int attrib[] = { GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- GLX_DEPTH_SIZE, 1,
- GLX_AUX_BUFFERS, 1,
- None };
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- GLXContext ctx;
- XVisualInfo *visinfo;
-
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
-
- visinfo = glXChooseVisual( dpy, scrnum, attrib );
- if (!visinfo) {
- printf("Error: couldn't get an RGB, Double-buffered visual\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
-
- /* set hints and properties */
- {
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(dpy, win, &sizehints);
- XSetStandardProperties(dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
- if (!ctx) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
- }
-
- XFree(visinfo);
-
- *winRet = win;
- *ctxRet = ctx;
-}
-
-
-static void
-event_loop(Display *dpy, Window win)
-{
- while (1) {
- while (XPending(dpy) > 0) {
- XEvent event;
- XNextEvent(dpy, &event);
- switch (event.type) {
- case Expose:
- /* we'll redraw below */
- break;
- case ConfigureNotify:
- reshape(event.xconfigure.width, event.xconfigure.height);
- break;
- case KeyPress:
- {
- char buffer[10];
- int r, code;
- code = XLookupKeysym(&event.xkey, 0);
- if (code == XK_Left) {
- view_roty += 5.0;
- }
- else if (code == XK_Right) {
- view_roty -= 5.0;
- }
- else if (code == XK_Up) {
- view_rotx += 5.0;
- }
- else if (code == XK_Down) {
- view_rotx -= 5.0;
- }
- else {
- r = XLookupString(&event.xkey, buffer, sizeof(buffer),
- NULL, NULL);
- if (buffer[0] == 27) {
- /* escape */
- return;
- }
- }
- }
- }
- }
-
- /* next frame */
- angle += 2.0;
-
- /* draw to aux buffer */
- glDrawBuffer(GL_AUX0);
-
- draw();
-
- /* Copy aux buffer image to back color buffer */
- glReadBuffer(GL_AUX0);
- glDrawBuffer(GL_BACK);
- glWindowPos2iARB(0, 0);
- glDisable(GL_DEPTH_TEST);
- glCopyPixels(0, 0, WinWidth, WinHeight, GL_COLOR);
- glEnable(GL_DEPTH_TEST);
-
- glXSwapBuffers(dpy, win);
-
- /* calc framerate */
- {
- static int t0 = -1;
- static int frames = 0;
- int t = current_time();
-
- if (t0 < 0)
- t0 = t;
-
- frames++;
-
- if (t - t0 >= 5.0) {
- GLfloat seconds = t - t0;
- GLfloat fps = frames / seconds;
- printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
- fps);
- t0 = t;
- frames = 0;
- }
- }
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- Display *dpy;
- Window win;
- GLXContext ctx;
- char *dpyName = ":0";
- GLboolean printInfo = GL_FALSE;
- int i;
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
- i++;
- }
- else if (strcmp(argv[i], "-info") == 0) {
- printInfo = GL_TRUE;
- }
- }
-
- dpy = XOpenDisplay(dpyName);
- if (!dpy) {
- printf("Error: couldn't open display %s\n", dpyName);
- return -1;
- }
-
- make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win, &ctx);
- XMapWindow(dpy, win);
- glXMakeCurrent(dpy, win, ctx);
-
- if (printInfo) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-
- init();
-
- event_loop(dpy, win);
-
- glXDestroyContext(dpy, ctx);
- XDestroyWindow(dpy, win);
- XCloseDisplay(dpy);
-
- return 0;
-}
diff --git a/progs/tests/blendminmax.c b/progs/tests/blendminmax.c
deleted file mode 100644
index 2aab1a39d29..00000000000
--- a/progs/tests/blendminmax.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file blendminmax.c
- *
- * Simple test of GL_EXT_blend_minmax functionality. Four squares are drawn
- * with different blending modes, but all should be rendered with the same
- * final color.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <GL/glut.h>
-
-static int Width = 400;
-static int Height = 200;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
-
- /* This is the "reference" square.
- */
-
- glTranslatef(-4.5, 0, 0);
- glBlendEquation( GL_FUNC_ADD );
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- /* GL_MIN and GL_MAX are supposed to ignore the blend function setting.
- * To test that, we set the blend function to GL_ZERO for both color and
- * alpha each time GL_MIN or GL_MAX is used.
- *
- * Apple ships an extension called GL_ATI_blend_weighted_minmax (supported
- * on Mac OS X 10.2 and later). I believe the difference with that
- * extension is that it uses the blend function. However, I have no idea
- * what the enums are for it. The extension is listed at Apple's developer
- * site, but there is no documentation.
- *
- * http://developer.apple.com/opengl/extensions.html
- */
-
- glTranslatef(3.0, 0, 0);
- glBlendEquation( GL_FUNC_ADD );
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glBlendEquation( GL_MAX );
- glBlendFunc( GL_ZERO, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.2, 0.2, 0.2 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glTranslatef(3.0, 0, 0);
- glBlendEquation( GL_FUNC_ADD );
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glBlendEquation( GL_MIN );
- glBlendFunc( GL_ZERO, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.8, 0.8, 0.8 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glTranslatef(3.0, 0, 0);
- glBlendEquation( GL_FUNC_ADD );
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.8, 0.8, 0.8 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glBlendEquation( GL_MIN );
- glBlendFunc( GL_ZERO, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- if ( !glutExtensionSupported("GL_ARB_imaging") && !glutExtensionSupported("GL_EXT_blend_minmax")) {
- printf("Sorry, this program requires either GL_ARB_imaging or GL_EXT_blend_minmax.\n");
- exit(1);
- }
-
- printf("\nAll 4 squares should be the same color.\n");
- glEnable( GL_BLEND );
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "GL_EXT_blend_minmax test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/blendsquare.c b/progs/tests/blendsquare.c
deleted file mode 100644
index 1694866a557..00000000000
--- a/progs/tests/blendsquare.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file blendsquare.c
- *
- * Simple test of GL_NV_blend_square functionality. Four squares are drawn
- * with different blending modes, but all should be rendered with the same
- * final color.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <GL/glut.h>
-
-static int Width = 400;
-static int Height = 200;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
-
- glTranslatef(-4.5, 0, 0);
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5 * 0.5, 0.5 * 0.5, 0.5 * 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glTranslatef(3.0, 0, 0);
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glBlendFunc( GL_DST_COLOR, GL_ZERO );
- glBegin(GL_QUADS);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glTranslatef(3.0, 0, 0);
- glBlendFunc( GL_SRC_COLOR, GL_ZERO );
- glBegin(GL_QUADS);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glTranslatef(3.0, 0, 0);
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glBlendFunc( GL_ZERO, GL_DST_COLOR );
- glBegin(GL_QUADS);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
- const double version = strtod( ver_string, NULL );
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- if ( (version < 1.4) && !glutExtensionSupported("GL_NV_blend_square")) {
- printf("Sorry, this program requires either OpenGL 1.4 or GL_NV_blend_square\n");
- exit(1);
- }
-
- printf("\nAll 4 squares should be the same color. The two on the left are drawn\n"
- "without NV_blend_square functionality, and the two on the right are drawn\n"
- "with NV_blend_square functionality. If the two on the left are dark, but\n"
- "the two on the right are not, then NV_blend_square is broken.\n");
- glEnable( GL_BLEND );
- glBlendEquation( GL_FUNC_ADD );
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "GL_NV_blend_square test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/bufferobj.c b/progs/tests/bufferobj.c
deleted file mode 100644
index c765d2516ba..00000000000
--- a/progs/tests/bufferobj.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Test GL_ARB_vertex_buffer_object
- *
- * Brian Paul
- * 16 Sep 2003
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-#define NUM_OBJECTS 10
-
-struct object
-{
- GLuint BufferID;
- GLuint ElementsBufferID;
- GLuint NumVerts;
- GLuint VertexOffset;
- GLuint ColorOffset;
- GLuint NumElements;
-};
-
-static struct object Objects[NUM_OBJECTS];
-static GLuint NumObjects;
-
-static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
-static GLboolean Anim = GL_TRUE;
-
-
-static void CheckError(int line)
-{
- GLenum err = glGetError();
- if (err) {
- printf("GL Error 0x%x at line %d\n", (int) err, line);
- }
-}
-
-
-static void DrawObject( const struct object *obj )
-{
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
- glVertexPointer(3, GL_FLOAT, 0, (void *) obj->VertexOffset);
- glEnable(GL_VERTEX_ARRAY);
-
- /* test push/pop attrib */
- /* XXX this leads to a segfault with NVIDIA's 53.36 driver */
-#if 0
- if (1)
- {
- glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
- /*glVertexPointer(3, GL_FLOAT, 0, (void *) (obj->VertexOffset + 10000));*/
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 999999);
- glPopClientAttrib();
- }
-#endif
- glColorPointer(3, GL_FLOAT, 0, (void *) obj->ColorOffset);
- glEnable(GL_COLOR_ARRAY);
-
- if (obj->NumElements > 0) {
- /* indexed arrays */
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID);
- glDrawElements(GL_LINE_LOOP, obj->NumElements, GL_UNSIGNED_INT, NULL);
- }
- else {
- /* non-indexed arrays */
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
- glDrawArrays(GL_LINE_LOOP, 0, obj->NumVerts);
- }
-}
-
-
-static void Idle( void )
-{
- Zrot = 0.05 * glutGet(GLUT_ELAPSED_TIME);
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- int i;
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- for (i = 0; i < NumObjects; i++) {
- float x = 5.0 * ((float) i / (NumObjects-1) - 0.5);
- glPushMatrix();
- glTranslatef(x, 0, 0);
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
-
- DrawObject(Objects + i);
-
- glPopMatrix();
- }
-
- CheckError(__LINE__);
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- float ar = (float) width / (float) height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'z':
- Zrot -= step;
- break;
- case 'Z':
- Zrot += step;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-static void MakeObject1(struct object *obj)
-{
- GLfloat *v, *c;
- void *p;
- int i;
- GLubyte buffer[500];
-
- for (i = 0; i < 500; i++)
- buffer[i] = i & 0xff;
-
- obj->BufferID = 0;
- glGenBuffersARB(1, &obj->BufferID);
- assert(obj->BufferID != 0);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, 500, buffer, GL_STATIC_DRAW_ARB);
-
- for (i = 0; i < 500; i++)
- buffer[i] = 0;
-
- glGetBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 500, buffer);
-
- for (i = 0; i < 500; i++)
- assert(buffer[i] == (i & 0xff));
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i);
- assert(!i);
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i);
-
- v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
-
- /* do some sanity tests */
- glGetBufferPointervARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAP_POINTER_ARB, &p);
- assert(p == v);
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &i);
- assert(i == 500);
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_USAGE_ARB, &i);
- assert(i == GL_STATIC_DRAW_ARB);
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_ACCESS_ARB, &i);
- assert(i == GL_WRITE_ONLY_ARB);
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i);
- assert(i);
-
- /* Make rectangle */
- v[0] = -1; v[1] = -1; v[2] = 0;
- v[3] = 1; v[4] = -1; v[5] = 0;
- v[6] = 1; v[7] = 1; v[8] = 0;
- v[9] = -1; v[10] = 1; v[11] = 0;
- c = v + 12;
- c[0] = 1; c[1] = 0; c[2] = 0;
- c[3] = 1; c[4] = 0; c[5] = 0;
- c[6] = 1; c[7] = 0; c[8] = 1;
- c[9] = 1; c[10] = 0; c[11] = 1;
- obj->NumVerts = 4;
- obj->VertexOffset = 0;
- obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts;
- obj->NumElements = 0;
-
- glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
-
- glGetBufferPointervARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAP_POINTER_ARB, &p);
- assert(!p);
-
- glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_MAPPED_ARB, &i);
- assert(!i);
-}
-
-
-static void MakeObject2(struct object *obj)
-{
- GLfloat *v, *c;
-
- glGenBuffersARB(1, &obj->BufferID);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, NULL, GL_STATIC_DRAW_ARB);
- v = (GLfloat *) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
-
- /* Make triangle */
- v[0] = -1; v[1] = -1; v[2] = 0;
- v[3] = 1; v[4] = -1; v[5] = 0;
- v[6] = 0; v[7] = 1; v[8] = 0;
- c = v + 9;
- c[0] = 0; c[1] = 1; c[2] = 0;
- c[3] = 0; c[4] = 1; c[5] = 0;
- c[6] = 1; c[7] = 1; c[8] = 0;
- obj->NumVerts = 3;
- obj->VertexOffset = 0;
- obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts;
- obj->NumElements = 0;
-
- glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
-}
-
-
-static void MakeObject3(struct object *obj)
-{
- GLfloat vertexData[1000];
- GLfloat *v, *c;
- GLuint *i;
- int bytes;
-
- /* Make rectangle */
- v = vertexData;
- v[0] = -1; v[1] = -0.5; v[2] = 0;
- v[3] = 1; v[4] = -0.5; v[5] = 0;
- v[6] = 1; v[7] = 0.5; v[8] = 0;
- v[9] = -1; v[10] = 0.5; v[11] = 0;
- c = vertexData + 12;
- c[0] = 0; c[1] = 0; c[2] = 1;
- c[3] = 0; c[4] = 0; c[5] = 1;
- c[6] = 0; c[7] = 1; c[8] = 1;
- c[9] = 0; c[10] = 1; c[11] = 1;
- obj->NumVerts = 4;
- obj->VertexOffset = 0;
- obj->ColorOffset = 3 * sizeof(GLfloat) * obj->NumVerts;
-
- bytes = obj->NumVerts * (3 + 3) * sizeof(GLfloat);
-
- /* Don't use glMap/UnmapBuffer for this object */
- glGenBuffersARB(1, &obj->BufferID);
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, obj->BufferID);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, bytes, vertexData, GL_STATIC_DRAW_ARB);
-
- /* Setup a buffer of indices to test the ELEMENTS path */
- glGenBuffersARB(1, &obj->ElementsBufferID);
- glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, obj->ElementsBufferID);
- glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 100, NULL, GL_STATIC_DRAW_ARB);
- i = (GLuint *) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_READ_WRITE_ARB);
- i[0] = 0;
- i[1] = 1;
- i[2] = 2;
- i[3] = 3;
- glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
- obj->NumElements = 4;
-}
-
-
-
-static void Init( void )
-{
- if (!glutExtensionSupported("GL_ARB_vertex_buffer_object")) {
- printf("GL_ARB_vertex_buffer_object not found!\n");
- exit(0);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Test buffer object deletion */
- if (1) {
- static GLubyte data[1000];
- GLuint id = 999;
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, id);
- glBufferDataARB(GL_ARRAY_BUFFER_ARB, 1000, data, GL_STATIC_DRAW_ARB);
- glVertexPointer(3, GL_FLOAT, 0, (void *) 0);
- glDeleteBuffersARB(1, &id);
- assert(!glIsBufferARB(id));
- glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
- glVertexPointer(3, GL_FLOAT, 0, (void *) 0);
- assert(!glIsBufferARB(id));
- }
-
- MakeObject1(Objects + 0);
- MakeObject2(Objects + 1);
- MakeObject3(Objects + 2);
- NumObjects = 3;
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 600, 300 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/bug_3050.c b/progs/tests/bug_3050.c
deleted file mode 100644
index 4ea7b80f231..00000000000
--- a/progs/tests/bug_3050.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2006
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file bug_3050.c
- *
- * Simple regression test for bug #3050. Create a texture and make a few
- * calls to \c glGetTexLevelParameteriv. If the bug still exists, trying
- * to get \c GL_TEXTURE_WITDH will cause a protocol error.
- *
- * This test \b only applies to indirect-rendering. This may mean that the
- * test needs to be run with the environment variable \c LIBGL_ALWAYS_INDIRECT
- * set to a non-zero value.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GL/glut.h>
-
-static int Width = 400;
-static int Height = 200;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
-}
-
-
-static void Reshape( int width, int height )
-{
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- unsigned i;
- static const GLenum pnames[] = {
- GL_TEXTURE_RED_SIZE,
- GL_TEXTURE_GREEN_SIZE,
- GL_TEXTURE_BLUE_SIZE,
- GL_TEXTURE_ALPHA_SIZE,
- GL_TEXTURE_LUMINANCE_SIZE,
- GL_TEXTURE_INTENSITY_SIZE,
- GL_TEXTURE_BORDER,
- GL_TEXTURE_INTERNAL_FORMAT,
- GL_TEXTURE_WIDTH,
- GL_TEXTURE_HEIGHT,
- GL_TEXTURE_DEPTH,
- ~0
- };
-
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
-
- printf("\nThis program should log some data about a texture and exit.\n");
- printf("This is a regression test for bug #3050. If the bug still\n");
- printf("exists, a GLX protocol error will be generated.\n");
- printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n");
-
-
- if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" )
- && ! glutExtensionSupported( "GL_EXT_texture_rectangle" )
- && ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) {
- printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n"
- "or GL_NV_texture_rectangle be supported\n." );
- exit( 1 );
- }
-
-
- glBindTexture( GL_TEXTURE_RECTANGLE_NV, 1 );
- glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL );
-
- for ( i = 0 ; pnames[i] != ~0 ; i++ ) {
- GLint param_i;
- GLfloat param_f;
- GLenum err;
-
- glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_i );
- err = glGetError();
-
- if ( err ) {
- printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
- "error of 0x%04x!",
- pnames[i], err );
- exit( 1 );
- }
- else {
- printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n",
- pnames[i], param_i );
- }
-
-
- glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_f );
- err = glGetError();
-
- if ( err ) {
- printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
- "error of 0x%04x!\n",
- pnames[i], err );
- exit( 1 );
- }
- else {
- printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n",
- pnames[i], param_f, (GLint) param_f );
- }
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "Bug #3050 Test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- return 0;
-}
diff --git a/progs/tests/bug_3101.c b/progs/tests/bug_3101.c
deleted file mode 100644
index 761dcbb9513..00000000000
--- a/progs/tests/bug_3101.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file bug_3101.c
- *
- * Simple regression test for bug #3101. Attempt to draw a single square.
- * After emiting the first vertex, call \c glEdgeFlag to change the vertex
- * format. If the bug still exists, this will cause a segfault.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <GL/glut.h>
-
-static int Width = 400;
-static int Height = 200;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
-
- /* This is the "reference" square.
- */
-
- glTranslatef(-4.5, 0, 0);
- glBlendEquation( GL_FUNC_ADD );
- glBlendFunc( GL_ONE, GL_ZERO );
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glEdgeFlag(GL_TRUE);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- printf("\nThis program should draw a single square, but not crash.\n");
- printf("This is a regression test for bug #3101.\n");
- printf("https://bugs.freedesktop.org/show_bug.cgi?id=3101\n");
- glEnable( GL_BLEND );
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "Bug #3101 Test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/bug_3195.c b/progs/tests/bug_3195.c
deleted file mode 100644
index 4aceae04abe..00000000000
--- a/progs/tests/bug_3195.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (C) 2000 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 bug_3195.c
- *
- * Simple regression test for bug #3195. A bug in the i180 driver caused
- * a segfault (inside the driver) when the LOD bias is adjusted and no texture
- * is enabled. This test, which is based on progs/demos/lodbias.c, sets up
- * all the texturing, disables all textures, adjusts the LOD bias, then
- * re-enables \c GL_TEXTURE_2D.
- *
- * \author Brian Paul
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <GL/glut.h>
-#include <GL/glext.h>
-
-#include "readtex.h"
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
-static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */
-static GLint BiasMin = -400, BiasMax = 400;
-
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-static void Idle( void )
-{
- static int lastTime = 0;
- int time = glutGet(GLUT_ELAPSED_TIME);
- int step;
-
- if (lastTime == 0)
- lastTime = time;
- else if (time - lastTime < 10)
- return;
-
- step = (time - lastTime) / 10 * BiasStepSign;
- lastTime = time;
-
- Bias += step;
- if (Bias < BiasMin) {
- exit(0);
- }
- else if (Bias > BiasMax) {
- Bias = BiasMax;
- BiasStepSign = -1;
- }
-
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- char str[100];
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(-1, 1, -1, 1, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- glDisable(GL_TEXTURE_2D);
- glColor3f(1,1,1);
- glRasterPos3f(-0.9, -0.9, 0.0);
- sprintf(str, "Texture LOD Bias = %4.1f", Bias * 0.01);
- PrintString(str);
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
-
- glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.01 * Bias);
- glEnable(GL_TEXTURE_2D);
-
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(2, 0); glVertex2f( 1, -1);
- glTexCoord2f(2, 2); glVertex2f( 1, 1);
- glTexCoord2f(0, 2); glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLfloat maxBias;
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- printf("\nThis program should function nearly identically to Mesa's lodbias demo.\n"
- "It should cycle through the complet LOD bias range once and exit. If bug\n"
- "#3195 still exists, the demo should crash almost immediatly.\n");
- printf("This is a regression test for bug #3195.\n");
- printf("https://bugs.freedesktop.org/show_bug.cgi?id=3195\n");
-
- if (!glutExtensionSupported("GL_EXT_texture_lod_bias")) {
- printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");
- exit(1);
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- if (glutExtensionSupported("GL_SGIS_generate_mipmap")) {
- /* test auto mipmap generation */
- GLint width, height, i;
- GLenum format;
- GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
- if (!image) {
- printf("Error: could not load texture image %s\n", TEXTURE_FILE);
- exit(1);
- }
- /* resize to 256 x 256 */
- if (width != 256 || height != 256) {
- GLubyte *newImage = malloc(256 * 256 * 4);
- gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
- 256, 256, GL_UNSIGNED_BYTE, newImage);
- free(image);
- image = newImage;
- }
- printf("Using GL_SGIS_generate_mipmap\n");
- glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
- glTexImage2D(GL_TEXTURE_2D, 0, format, 256, 256, 0,
- format, GL_UNSIGNED_BYTE, image);
- free(image);
-
- /* make sure mipmap was really generated correctly */
- width = height = 256;
- for (i = 0; i < 9; i++) {
- GLint w, h;
- glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
- printf("Level %d size: %d x %d\n", i, w, h);
- assert(w == width);
- assert(h == height);
- width /= 2;
- height /= 2;
- }
-
- }
- else if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: could not load texture image %s\n", TEXTURE_FILE);
- exit(1);
- }
-
- /* mipmapping required for this extension */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &maxBias);
- printf("LOD bias range: [%g, %g]\n", -maxBias, maxBias);
- BiasMin = -100 * maxBias;
- BiasMax = 100 * maxBias;
-
- /* Since we have (about) 8 mipmap levels, no need to bias beyond
- * the range [-1, +8].
- */
- if (BiasMin < -100)
- BiasMin = -100;
- if (BiasMax > 800)
- BiasMax = 800;
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 350, 350 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "Bug #3195 Test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/copypixrate.c b/progs/tests/copypixrate.c
deleted file mode 100644
index e9a42a1c8c9..00000000000
--- a/progs/tests/copypixrate.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Measure glCopyPixels speed
- *
- * Brian Paul
- * 26 Jan 2006
- */
-
-#define GL_GLEXT_PROTOTYPES
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static GLint WinWidth = 1000, WinHeight = 800;
-static GLint ImgWidth, ImgHeight;
-
-static GLenum Buffer = GL_FRONT;
-static GLenum AlphaTest = GL_FALSE;
-static GLboolean UseBlit = GL_FALSE;
-
-static PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT_func = NULL;
-
-
-/**
- * draw teapot in lower-left corner of window
- */
-static void
-DrawTestImage(void)
-{
- GLfloat ar;
-
- ImgWidth = WinWidth / 3;
- ImgHeight = WinHeight / 3;
-
- glViewport(0, 0, ImgWidth, ImgHeight);
- glScissor(0, 0, ImgWidth, ImgHeight);
- glEnable(GL_SCISSOR_TEST);
-
- glClearColor(0.5, 0.5, 0.5, 0.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- ar = (float) WinWidth / WinHeight;
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
-
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
- glFrontFace(GL_CW);
- glPushMatrix();
- glRotatef(45, 1, 0, 0);
- glutSolidTeapot(2.0);
- glPopMatrix();
- glFrontFace(GL_CCW);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
-
- glDisable(GL_SCISSOR_TEST);
-
- glViewport(0, 0, WinWidth, WinHeight);
- glFinish();
-}
-
-
-static int
-Rand(int max)
-{
- return ((int) random()) % max;
-}
-
-
-/**
- * Measure glCopyPixels rate
- */
-static void
-RunTest(void)
-{
- double t1, t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
- int iters = 0;
- float copyRate, mbRate;
- int r, g, b, a, bpp;
-
- if (AlphaTest) {
- glEnable(GL_ALPHA_TEST);
- glAlphaFunc(GL_GREATER, 0.0);
- }
-
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
- glGetIntegerv(GL_ALPHA_BITS, &a);
- bpp = (r + g + b + a) / 8;
-
- do {
- int x, y;
- x = Rand(WinWidth);
- y = Rand(WinHeight);
-
- if (x > ImgWidth || y > ImgHeight) {
-#ifdef GL_EXT_framebuffer_blit
- if (UseBlit)
- {
- glBlitFramebufferEXT_func(0, 0, ImgWidth, ImgHeight,
- x, y, x + ImgWidth, y + ImgHeight,
- GL_COLOR_BUFFER_BIT, GL_LINEAR);
- }
- else
-#endif
- {
- glWindowPos2iARB(x, y);
- glCopyPixels(0, 0, ImgWidth, ImgHeight, GL_COLOR);
- }
- glFinish(); /* XXX OK? */
-
- iters++;
-
- t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
- }
- } while (t1 - t0 < 5.0);
-
- glDisable(GL_ALPHA_TEST);
-
- copyRate = iters / (t1 - t0);
- mbRate = ImgWidth * ImgHeight * bpp * copyRate / (1024 * 1024);
-
- printf("Image size: %d x %d, %d Bpp\n", ImgWidth, ImgHeight, bpp);
- printf("%d copies in %.2f = %.2f copies/sec, %.2f MB/s\n",
- iters, t1-t0, copyRate, mbRate);
-}
-
-
-static void
-Draw(void)
-{
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClearColor(0.2, 0.2, 0.8, 0);
- glReadBuffer(Buffer);
- glDrawBuffer(Buffer);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- DrawTestImage();
-
- RunTest();
-
- if (Buffer == GL_FRONT)
- glFinish();
- else
- glutSwapBuffers();
-
- printf("exiting\n");
- exit(0);
-}
-
-
-static void
-Reshape(int width, int height)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -15.0);
-}
-
-
-static void
-Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-SpecialKey(int key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- break;
- case GLUT_KEY_DOWN:
- break;
- case GLUT_KEY_LEFT:
- break;
- case GLUT_KEY_RIGHT:
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-ParseArgs(int argc, char *argv[])
-{
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-back") == 0)
- Buffer = GL_BACK;
- else if (strcmp(argv[i], "-alpha") == 0)
- AlphaTest = GL_TRUE;
- else if (strcmp(argv[i], "-blit") == 0)
- UseBlit = GL_TRUE;
- }
-}
-
-
-static void
-Init(void)
-{
- if (glutExtensionSupported("GL_EXT_framebuffer_blit")) {
- glBlitFramebufferEXT_func = (PFNGLBLITFRAMEBUFFEREXTPROC)
- glutGetProcAddress("glBlitFramebufferEXT");
- }
- else if (UseBlit) {
- printf("Warning: GL_EXT_framebuffer_blit not supported.\n");
- UseBlit = GL_FALSE;
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
- glutInit(&argc, argv);
-
- ParseArgs(argc, argv);
- if (AlphaTest)
- mode |= GLUT_ALPHA;
-
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(WinWidth, WinHeight);
- glutInitDisplayMode(mode);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutSpecialFunc(SpecialKey);
- glutDisplayFunc(Draw);
-
- printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
- printf("Draw Buffer: %s\n", (Buffer == GL_BACK) ? "Back" : "Front");
- Init();
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/crossbar.c b/progs/tests/crossbar.c
deleted file mode 100644
index 12aabb1c9ad..00000000000
--- a/progs/tests/crossbar.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file crossbar.c
- *
- * Simple test of GL_ARB_texture_env_crossbar functionality. Several squares
- * are drawn with different texture combine modes, but all should be rendered
- * with the same final color.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GL/glut.h>
-
-static const GLint tests[][8] = {
- { 1, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
- 2, GL_REPLACE, GL_TEXTURE, GL_PRIMARY_COLOR },
- { 3, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
- 2, GL_SUBTRACT, GL_TEXTURE0, GL_TEXTURE1 },
- { 2, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
- 2, GL_REPLACE, GL_TEXTURE0, GL_TEXTURE0 },
- { 2, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
- 1, GL_SUBTRACT, GL_TEXTURE0, GL_TEXTURE1 },
- { 3, GL_ADD, GL_TEXTURE1, GL_TEXTURE1,
- 2, GL_MODULATE, GL_TEXTURE1, GL_PREVIOUS },
- { 3, GL_ADD, GL_TEXTURE1, GL_TEXTURE1,
- 4, GL_MODULATE, GL_TEXTURE0, GL_PREVIOUS },
-};
-
-#define NUM_TESTS (sizeof(tests) / sizeof(tests[0]))
-
-static int Width = 100 * (NUM_TESTS + 1);
-static int Height = 200;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- unsigned i;
-
-
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
-
- /* This is the "reference" square.
- */
-
- glActiveTexture( GL_TEXTURE0 );
- glDisable( GL_TEXTURE_2D );
- glActiveTexture( GL_TEXTURE1 );
- glDisable( GL_TEXTURE_2D );
-
- glTranslatef(-(NUM_TESTS * 1.5), 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
- for ( i = 0 ; i < NUM_TESTS ; i++ ) {
- glActiveTexture( GL_TEXTURE0 );
- glEnable( GL_TEXTURE_2D );
- glBindTexture( GL_TEXTURE_2D, tests[i][0] );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
- glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, tests[i][1] );
- glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, tests[i][2] );
- glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, tests[i][3] );
-
- glActiveTexture( GL_TEXTURE1 );
- glEnable( GL_TEXTURE_2D );
- glBindTexture( GL_TEXTURE_2D, tests[i][4] );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
- glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, tests[i][5] );
- glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, tests[i][6] );
- glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, tests[i][7] );
-
- glCallList(1);
- }
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
- float ver = strtof( ver_string, NULL );
- GLint tex_units;
- GLint temp[ 256 ];
-
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- if ( (!glutExtensionSupported("GL_ARB_multitexture")
- && (ver < 1.3))
- || (!glutExtensionSupported("GL_ARB_texture_env_combine")
- && !glutExtensionSupported("GL_EXT_texture_env_combine")
- && (ver < 1.3))
- || (!glutExtensionSupported("GL_ARB_texture_env_crossbar")
- && !glutExtensionSupported("GL_NV_texture_env_combine4")
- && (ver < 1.4)) ) {
- printf("\nSorry, this program requires GL_ARB_multitexture and either\n"
- "GL_ARB_texture_env_combine or GL_EXT_texture_env_combine (or OpenGL 1.3).\n"
- "Either GL_ARB_texture_env_crossbar or GL_NV_texture_env_combine4 (or\n"
- "OpenGL 1.4) are also required.\n");
- exit(1);
- }
-
- glGetIntegerv( GL_MAX_TEXTURE_UNITS, & tex_units );
- if ( tex_units < 2 ) {
- printf("\nSorry, this program requires at least 2 texture units.\n");
- exit(1);
- }
-
- printf("\nAll %u squares should be the same color.\n", NUM_TESTS + 1);
-
- (void) memset( temp, 0x00, sizeof( temp ) );
- glBindTexture( GL_TEXTURE_2D, 1 );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, temp );
-
- (void) memset( temp, 0x7f, sizeof( temp ) );
- glBindTexture( GL_TEXTURE_2D, 2 );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, temp );
-
- (void) memset( temp, 0xff, sizeof( temp ) );
- glBindTexture( GL_TEXTURE_2D, 3 );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, temp );
-
- (void) memset( temp, 0x3f, sizeof( temp ) );
- glBindTexture( GL_TEXTURE_2D, 4 );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, temp );
-
-
- glNewList( 1, GL_COMPILE );
- glTranslatef(3.0, 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.9, 0.0, 0.0 );
- glMultiTexCoord2f( GL_TEXTURE0, 0.5, 0.5 );
- glMultiTexCoord2f( GL_TEXTURE1, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
- glEndList();
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "GL_ARB_texture_env_crossbar test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/cva.c b/progs/tests/cva.c
deleted file mode 100644
index 8514be6226e..00000000000
--- a/progs/tests/cva.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $Id: cva.c,v 1.7 2003-12-08 09:03:35 joukj Exp $ */
-
-/*
- * Trivial CVA test, good for testing driver fastpaths (especially
- * indexed vertex buffers if they are supported).
- *
- * Gareth Hughes
- * November 2000
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef __VMS
-# include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
-#else
-# include <malloc.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
-#endif
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#define GL_GLEXT_LEGACY
-#include <GL/glut.h>
-
-
-GLfloat verts[][4] = {
- { -0.5, -0.5, -2.0, 0.0 },
- { 0.5, -0.5, -2.0, 0.0 },
- { -0.5, 0.5, -2.0, 0.0 },
- { 0.5, 0.5, -2.0, 0.0 },
-};
-
-GLubyte color[][4] = {
- { 0xff, 0x00, 0x00, 0x00 },
- { 0x00, 0xff, 0x00, 0x00 },
- { 0x00, 0x00, 0xff, 0x00 },
- { 0xff, 0xff, 0xff, 0x00 },
-};
-
-GLuint indices[] = { 0, 1, 2, 3 };
-
-GLboolean compiled = GL_TRUE;
-GLboolean doubleBuffer = GL_TRUE;
-
-
-void init( void )
-{
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glShadeModel( GL_SMOOTH );
-
- glFrontFace( GL_CCW );
- glCullFace( GL_BACK );
- glEnable( GL_CULL_FACE );
-
- glEnable( GL_DEPTH_TEST );
-
- glEnableClientState( GL_VERTEX_ARRAY );
- glEnableClientState( GL_COLOR_ARRAY );
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 2.0, 10.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-
- glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts );
- glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color );
-
-#ifdef GL_EXT_compiled_vertex_array
- if ( compiled ) {
- glLockArraysEXT( 0, 4 );
- }
-#endif
-}
-
-void display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices );
-
- glFlush();
- if ( doubleBuffer ) {
- glutSwapBuffers();
- }
-}
-
-void keyboard( unsigned char key, int x, int y )
-{
- switch ( key ) {
- case 27:
- exit( 0 );
- break;
- }
-
- glutPostRedisplay();
-}
-
-GLboolean args( int argc, char **argv )
-{
- GLint i;
-
- doubleBuffer = GL_TRUE;
-
- for ( i = 1 ; i < argc ; i++ ) {
- if ( strcmp( argv[i], "-sb" ) == 0 ) {
- doubleBuffer = GL_FALSE;
- } else if ( strcmp( argv[i], "-db" ) == 0 ) {
- doubleBuffer = GL_TRUE;
- } else {
- fprintf( stderr, "%s (Bad option).\n", argv[i] );
- return GL_FALSE;
- }
- }
- return GL_TRUE;
-}
-
-int main( int argc, char **argv )
-{
- GLenum type;
- char *string;
-
- glutInit( &argc, argv );
-
- if ( args( argc, argv ) == GL_FALSE ) {
- exit( 1 );
- }
-
- type = GLUT_RGB | GLUT_DEPTH;
- type |= ( doubleBuffer ) ? GLUT_DOUBLE : GLUT_SINGLE;
-
- glutInitDisplayMode( type );
- glutInitWindowSize( 250, 250 );
- glutInitWindowPosition( 100, 100 );
- glutCreateWindow( "CVA Test" );
-
- /* Make sure the server supports GL 1.2 vertex arrays.
- */
- string = (char *) glGetString( GL_VERSION );
-
- if ( !strstr(string, "1.2") &&
- !strstr(string, "1.3") &&
- !strstr(string, "1.4")) {
- fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" );
- exit( -1 );
- }
-
- /* See if the server supports compiled vertex arrays.
- */
- string = (char *) glGetString( GL_EXTENSIONS );
-
- if ( !strstr( string, "GL_EXT_compiled_vertex_array" ) ) {
- fprintf( stderr, "Compiled vertex arrays not supported by this renderer.\n" );
- compiled = GL_FALSE;
- }
-
- init();
-
- glutDisplayFunc( display );
- glutKeyboardFunc( keyboard );
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/tests/debugger.c b/progs/tests/debugger.c
deleted file mode 100644
index 4c6955bcfc6..00000000000
--- a/progs/tests/debugger.c
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * Test the GL_MESA_program_debug extension
- */
-
-
-#include <assert.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-/*
- * Print the string with line numbers
- */
-static void list_program(const GLubyte *string, GLsizei len)
-{
- const char *c = (const char *) string;
- int i, line = 1, printNumber = 1;
-
- for (i = 0; i < len; i++) {
- if (printNumber) {
- printf("%3d ", line);
- printNumber = 0;
- }
- if (*c == '\n') {
- line++;
- printNumber = 1;
- }
- putchar(*c);
- c++;
- }
- putchar('\n');
-}
-
-
-/*
- * Return the line number and column number that corresponds to the
- * given program position. Also return a null-terminated copy of that
- * line of the program string.
- */
-static const GLubyte *
-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;
-}
-
-
-#define ARB_VERTEX_PROGRAM 1
-#define ARB_FRAGMENT_PROGRAM 2
-#define NV_VERTEX_PROGRAM 3
-#define NV_FRAGMENT_PROGRAM 4
-
-
-struct breakpoint {
- enum {PIXEL, LINE} type;
- int x, y;
- int line;
- GLboolean enabled;
-};
-
-#define MAX_BREAKPOINTS 100
-static struct breakpoint Breakpoints[MAX_BREAKPOINTS];
-static int NumBreakpoints = 0;
-
-
-
-/*
- * Interactive debugger
- */
-static void Debugger2(GLenum target, GLvoid *data)
-{
- static GLuint skipCount = 0;
- const GLubyte *ln;
- GLint pos, line, column;
- GLint id;
- int progType;
- GLint len;
- GLubyte *program;
- GLboolean stop;
- int i;
-
- /* Sigh, GL_VERTEX_PROGRAM_ARB == GL_VERTEX_PROGRAM_NV so it's a bit
- * hard to distinguish between them.
- */
- if (target == GL_FRAGMENT_PROGRAM_ARB)
- progType = ARB_FRAGMENT_PROGRAM;
- else if (target == GL_FRAGMENT_PROGRAM_NV)
- progType = NV_FRAGMENT_PROGRAM;
- else
- progType = NV_VERTEX_PROGRAM;
-
- /* Until we hit zero, continue rendering */
- if (skipCount > 0) {
- skipCount--;
- return;
- }
-
- /* Get id of the program and current position */
- switch (progType) {
- case ARB_FRAGMENT_PROGRAM:
- glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &id);
- glGetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos);
- break;
- case NV_FRAGMENT_PROGRAM:
- glGetIntegerv(GL_FRAGMENT_PROGRAM_BINDING_NV, &id);
- glGetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos);
- break;
- case ARB_VERTEX_PROGRAM:
- glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, &id);
- glGetIntegerv(GL_VERTEX_PROGRAM_POSITION_MESA, &pos);
- break;
- case NV_VERTEX_PROGRAM:
- glGetIntegerv(GL_VERTEX_PROGRAM_BINDING_NV, &id);
- glGetIntegerv(GL_VERTEX_PROGRAM_POSITION_MESA, &pos);
- break;
- default:
- abort();
- }
-
- /* get program string */
- if (progType == ARB_VERTEX_PROGRAM ||
- progType == ARB_FRAGMENT_PROGRAM)
- glGetProgramivARB(target, GL_PROGRAM_LENGTH_ARB, &len);
- else
- glGetProgramivNV(id, GL_PROGRAM_LENGTH_NV, &len);
- program = malloc(len + 1);
- if (progType == ARB_VERTEX_PROGRAM ||
- progType == ARB_FRAGMENT_PROGRAM)
- glGetProgramStringARB(target, GL_PROGRAM_STRING_ARB, program);
- else
- glGetProgramStringNV(id, GL_PROGRAM_STRING_NV, program);
-
-
- /* Get current line number, column, line string */
- ln = find_line_column(program, program + pos, &line, &column);
-
- /* test breakpoints */
- if (NumBreakpoints > 0)
- stop = GL_FALSE;
- else
- stop = GL_TRUE;
- for (i = 0; i < NumBreakpoints; i++) {
- if (Breakpoints[i].enabled) {
- switch (Breakpoints[i].type) {
- case PIXEL:
- if (progType == ARB_FRAGMENT_PROGRAM) {
-
- }
- else if (progType == NV_FRAGMENT_PROGRAM) {
- GLfloat pos[4];
- int px, py;
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- 6, (GLubyte *) "f[WPOS]", pos);
- px = (int) pos[0];
- py = (int) pos[1];
- printf("%d, %d\n", px, py);
- if (px == Breakpoints[i].x &&
- py == Breakpoints[i].y) {
- printf("Break at pixel (%d, %d)\n", px, py);
- stop = GL_TRUE;
- }
- }
- break;
- case LINE:
- if (line == Breakpoints[i].line) {
- /* hit a breakpoint! */
- printf("Break at line %d\n", line);
- stop = GL_TRUE;
- }
- break;
- }
- }
- }
- if (!stop) {
- free(program);
- return;
- }
-
- printf("%d: %s\n", line, ln);
-
- /* get commands from stdin */
- while (1) {
- char command[1000], *cmd;
-
- /* print prompt and get command */
- printf("(%s %d) ", (target == GL_VERTEX_PROGRAM_ARB ? "vert" : "frag"),
- line);
- fgets(command, 999, stdin);
-
- /* skip leading whitespace */
- for (cmd = command; cmd[0] == ' '; cmd++)
- ;
-
- if (!cmd[0])
- /* nothing (repeat the previous cmd?) */
- continue;
-
- switch (cmd[0]) {
- case 's':
- /* skip N instructions */
- i = atoi(cmd + 2);
- skipCount = i;
- printf("Skipping %d instructions\n", i);
- return;
- case 'n':
- /* next */
- return;
- case 'c':
- return;
- case 'd':
- /* dump machine state */
- if (progType == NV_FRAGMENT_PROGRAM) {
- static const char *inRegs[] = {
- "f[WPOS]", "f[COL0]", "f[COL1]", "f[FOGC]",
- "f[TEX0]", "f[TEX1]", "f[TEX2]", "f[TEX3]",
- NULL
- };
- static const char *outRegs[] = {
- "o[COLR]", "o[COLH]", "o[DEPR]", NULL
- };
- GLfloat v[4];
- int i;
- printf("Fragment input attributes:\n");
- for (i = 0; inRegs[i]; i++) {
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- strlen(inRegs[i]),
- (const GLubyte *) inRegs[i], v);
- printf(" %s: %g, %g, %g, %g\n", inRegs[i],
- v[0], v[1], v[2], v[3]);
- }
- printf("Fragment output attributes:\n");
- for (i = 0; outRegs[i]; i++) {
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- strlen(outRegs[i]),
- (const GLubyte *) outRegs[i], v);
- printf(" %s: %g, %g, %g, %g\n", outRegs[i],
- v[0], v[1], v[2], v[3]);
- }
- printf("Temporaries:\n");
- for (i = 0; i < 4; i++) {
- char temp[100];
- GLfloat v[4];
- sprintf(temp, "R%d", i);
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- strlen(temp),
- (const GLubyte *) temp, v);
- printf(" %s: %g, %g, %g, %g\n", temp, v[0],v[1],v[2],v[3]);
- }
- }
- else if (progType == NV_VERTEX_PROGRAM) {
- GLfloat v[4];
- int i;
- static const char *inRegs[] = {
- "v[OPOS]", "v[WGHT]", "v[NRML]", "v[COL0]",
- "v[COL1]", "v[FOGC]", "v[6]", "v[7]",
- "v[TEX0]", "v[TEX1]", "v[TEX2]", "v[TEX3]",
- "v[TEX4]", "v[TEX5]", "v[TEX6]", "v[TEX7]",
- NULL
- };
- static const char *outRegs[] = {
- "o[HPOS]", "o[COL0]", "o[COL1]", "o[BFC0]",
- "o[BFC1]", "o[FOGC]", "o[PSIZ]",
- "o[TEX0]", "o[TEX1]", "o[TEX2]", "o[TEX3]",
- "o[TEX4]", "o[TEX5]", "o[TEX6]", "o[TEX7]",
- NULL
- };
- printf("Vertex input attributes:\n");
- for (i = 0; inRegs[i]; i++) {
- glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_NV,
- strlen(inRegs[i]),
- (const GLubyte *) inRegs[i], v);
- printf(" %s: %g, %g, %g, %g\n", inRegs[i],
- v[0], v[1], v[2], v[3]);
- }
- printf("Vertex output attributes:\n");
- for (i = 0; outRegs[i]; i++) {
- glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_NV,
- strlen(outRegs[i]),
- (const GLubyte *) outRegs[i], v);
- printf(" %s: %g, %g, %g, %g\n", outRegs[i],
- v[0], v[1], v[2], v[3]);
- }
- printf("Temporaries:\n");
- for (i = 0; i < 4; i++) {
- char temp[100];
- GLfloat v[4];
- sprintf(temp, "R%d", i);
- glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_NV,
- strlen(temp),
- (const GLubyte *) temp, v);
- printf(" %s: %g, %g, %g, %g\n", temp, v[0],v[1],v[2],v[3]);
- }
- }
- break;
- case 'l':
- /* list */
- list_program(program, len);
- break;
- case 'p':
- /* print */
- {
- GLfloat v[4];
- char *c;
- cmd++;
- while (*cmd == ' ')
- cmd++;
- c = cmd;
- while (*c) {
- if (*c == '\n' || *c == '\r')
- *c = 0;
- else
- c++;
- }
- glGetProgramRegisterfvMESA(target, strlen(cmd),
- (const GLubyte *) cmd, v);
- if (glGetError() == GL_NO_ERROR)
- printf("%s = %g, %g, %g, %g\n", cmd, v[0], v[1], v[2], v[3]);
- else
- printf("Invalid expression\n");
- }
- break;
- case 'b':
- if (cmd[1] == ' ' && isdigit(cmd[2])) {
- char *comma = strchr(cmd, ',');
- if (comma) {
- /* break at pixel */
- int x = atoi(cmd + 2);
- int y = atoi(comma + 1);
- if (NumBreakpoints < MAX_BREAKPOINTS) {
- Breakpoints[NumBreakpoints].type = PIXEL;
- Breakpoints[NumBreakpoints].x = x;
- Breakpoints[NumBreakpoints].y = y;
- Breakpoints[NumBreakpoints].enabled = GL_TRUE;
- NumBreakpoints++;
- printf("Breakpoint %d: break at pixel (%d, %d)\n",
- NumBreakpoints, x, y);
- }
- }
- else {
- /* break at line */
- int l = atoi(cmd + 2);
- if (l && NumBreakpoints < MAX_BREAKPOINTS) {
- Breakpoints[NumBreakpoints].type = LINE;
- Breakpoints[NumBreakpoints].line = l;
- Breakpoints[NumBreakpoints].enabled = GL_TRUE;
- NumBreakpoints++;
- printf("Breakpoint %d: break at line %d\n",
- NumBreakpoints, l);
- }
- }
- }
- else {
- /* list breakpoints */
- printf("Breakpoints:\n");
- for (i = 0; i < NumBreakpoints; i++) {
- switch (Breakpoints[i].type) {
- case LINE:
- printf(" %d: break at line %d\n",
- i + 1, Breakpoints[i].line);
- break;
- case PIXEL:
- printf(" %d: break at pixel (%d, %d)\n",
- i + 1, Breakpoints[i].x, Breakpoints[i].y);
- break;
- }
- }
- }
- break;
- case 'h':
- /* help */
- printf("Debugger commands:\n");
- printf(" b list breakpoints\n");
- printf(" b N break at line N\n");
- printf(" b x,y break at pixel x,y\n");
- printf(" c continue execution\n");
- printf(" d display register values\n");
- printf(" h help\n");
- printf(" l list program\n");
- printf(" n next instruction\n");
- printf(" p V print value V\n");
- printf(" s N skip N instructions\n");
- break;
- default:
- printf("Unknown command: %c\n", cmd[0]);
- }
- }
-}
-
-
-/*
- * Print current line, some registers, and continue.
- */
-static void Debugger(GLenum target, GLvoid *data)
-{
- GLint pos;
- const GLubyte *ln;
- GLint line, column;
- GLfloat v[4];
-
- assert(target == GL_FRAGMENT_PROGRAM_NV);
-
- glGetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos);
-
- ln = find_line_column((const GLubyte *) data, (const GLubyte *) data + pos,
- &line, &column);
- printf("%d:%d: %s\n", line, column, (char *) ln);
-
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- 2, (const GLubyte *) "R0", v);
- printf(" R0 = %g, %g, %g, %g\n", v[0], v[1], v[2], v[3]);
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- 7, (const GLubyte *) "f[WPOS]", v);
- printf(" o[WPOS] = %g, %g, %g, %g\n", v[0], v[1], v[2], v[3]);
- glGetProgramRegisterfvMESA(GL_FRAGMENT_PROGRAM_NV,
- 7, (const GLubyte *) "o[COLR]", v);
- printf(" o[COLR] = %g, %g, %g, %g\n", v[0], v[1], v[2], v[3]);
-
- free((void *) ln);
-}
-
-
-
-
-/**********************************************************************/
-
-static GLfloat Diffuse[4] = { 0.5, 0.5, 1.0, 1.0 };
-static GLfloat Specular[4] = { 0.8, 0.8, 0.8, 1.0 };
-static GLfloat LightPos[4] = { 0.0, 10.0, 20.0, 1.0 };
-static GLfloat Delta = 1.0;
-
-static GLuint FragProg;
-static GLuint VertProg;
-static GLboolean Anim = GL_TRUE;
-static GLboolean Wire = GL_FALSE;
-static GLboolean PixelLight = GL_TRUE;
-
-static GLfloat Xrot = 0, Yrot = 0;
-
-
-#define NAMED_PARAMETER4FV(prog, name, v) \
- glProgramNamedParameter4fvNV(prog, strlen(name), (const GLubyte *) name, v)
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- if (PixelLight) {
- NAMED_PARAMETER4FV(FragProg, "LightPos", LightPos);
- glEnable(GL_FRAGMENT_PROGRAM_NV);
- glEnable(GL_VERTEX_PROGRAM_NV);
- glDisable(GL_LIGHTING);
- }
- else {
- glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
- glDisable(GL_FRAGMENT_PROGRAM_NV);
- glDisable(GL_VERTEX_PROGRAM_NV);
- glEnable(GL_LIGHTING);
- }
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
-
-#if 1
- glutSolidSphere(2.0, 10, 5);
-#else
- {
- GLUquadricObj *q = gluNewQuadric();
- gluQuadricNormals(q, GL_SMOOTH);
- gluQuadricTexture(q, GL_TRUE);
- glRotatef(90, 1, 0, 0);
- glTranslatef(0, 0, -1);
- gluCylinder(q, 1.0, 1.0, 2.0, 24, 1);
- gluDeleteQuadric(q);
- }
-#endif
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Idle(void)
-{
- LightPos[0] += Delta;
- if (LightPos[0] > 25.0)
- Delta = -1.0;
- else if (LightPos[0] <- 25.0)
- Delta = 1.0;
- glutPostRedisplay();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- /*glOrtho( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case ' ':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'x':
- LightPos[0] -= 1.0;
- break;
- case 'X':
- LightPos[0] += 1.0;
- break;
- case 'w':
- Wire = !Wire;
- if (Wire)
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- else
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- break;
- case 'p':
- PixelLight = !PixelLight;
- if (PixelLight) {
- printf("Per-pixel lighting\n");
- }
- else {
- printf("Conventional lighting\n");
- }
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- static const char *fragProgramText =
- "!!FP1.0\n"
- "DECLARE Diffuse; \n"
- "DECLARE Specular; \n"
- "DECLARE LightPos; \n"
-
- "# Compute normalized LightPos, put it in R0\n"
- "DP3 R0.x, LightPos, LightPos;\n"
- "RSQ R0.y, R0.x;\n"
- "MUL R0, LightPos, R0.y;\n"
-
- "# Compute normalized normal, put it in R1\n"
- "DP3 R1, f[TEX0], f[TEX0]; \n"
- "RSQ R1.y, R1.x;\n"
- "MUL R1, f[TEX0], R1.y;\n"
-
- "# Compute dot product of light direction and normal vector\n"
- "DP3 R2, R0, R1;\n"
-
- "MUL R3, Diffuse, R2; # diffuse attenuation\n"
-
- "POW R4, R2.x, {20.0}.x; # specular exponent\n"
-
- "MUL R5, Specular, R4; # specular attenuation\n"
-
- "ADD o[COLR], R3, R5; # add diffuse and specular colors\n"
- "END \n"
- ;
-
- static const char *vertProgramText =
- "!!VP1.0\n"
- "# typical modelview/projection transform\n"
- "DP4 o[HPOS].x, c[0], v[OPOS] ;\n"
- "DP4 o[HPOS].y, c[1], v[OPOS] ;\n"
- "DP4 o[HPOS].z, c[2], v[OPOS] ;\n"
- "DP4 o[HPOS].w, c[3], v[OPOS] ;\n"
- "# transform normal by inv transpose of modelview, put in tex0\n"
- "DP4 o[TEX0].x, c[4], v[NRML] ;\n"
- "DP4 o[TEX0].y, c[5], v[NRML] ;\n"
- "DP4 o[TEX0].z, c[6], v[NRML] ;\n"
- "DP4 o[TEX0].w, c[7], v[NRML] ;\n"
- "END\n";
- ;
-
- if (!glutExtensionSupported("GL_NV_vertex_program")) {
- printf("Sorry, this demo requires GL_NV_vertex_program\n");
- exit(1);
- }
- if (!glutExtensionSupported("GL_NV_fragment_program")) {
- printf("Sorry, this demo requires GL_NV_fragment_program\n");
- exit(1);
- }
-
- glGenProgramsNV(1, &FragProg);
- assert(FragProg > 0);
- glGenProgramsNV(1, &VertProg);
- assert(VertProg > 0);
-
- /*
- * Fragment program
- */
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, FragProg,
- strlen(fragProgramText),
- (const GLubyte *) fragProgramText);
- assert(glIsProgramNV(FragProg));
- glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, FragProg);
-
- NAMED_PARAMETER4FV(FragProg, "Diffuse", Diffuse);
- NAMED_PARAMETER4FV(FragProg, "Specular", Specular);
-
- /*
- * Vertex program
- */
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, VertProg,
- strlen(vertProgramText),
- (const GLubyte *) vertProgramText);
- assert(glIsProgramNV(VertProg));
- glBindProgramNV(GL_VERTEX_PROGRAM_NV, VertProg);
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV);
-
- /*
- * Misc init
- */
- glClearColor(0.3, 0.3, 0.3, 0.0);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHTING);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0);
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("Press p to toggle between per-pixel and per-vertex lighting\n");
-
-#ifdef GL_MESA_program_debug
- if (argc > 1 && strcmp(argv[1], "fragment") == 0) {
- printf(">> Debugging fragment program\n");
- glProgramCallbackMESA(GL_FRAGMENT_PROGRAM_ARB, Debugger2,
- (GLvoid *) fragProgramText);
- glEnable(GL_FRAGMENT_PROGRAM_CALLBACK_MESA);
- }
- else {
- printf(">> Debugging vertex program\n");
- glProgramCallbackMESA(GL_VERTEX_PROGRAM_ARB, Debugger2,
- (GLvoid *) fragProgramText);
- glEnable(GL_VERTEX_PROGRAM_CALLBACK_MESA);
- }
-#endif
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 200, 200 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init(argc, argv);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/descrip.mms b/progs/tests/descrip.mms
deleted file mode 100644
index b6ba3e1aebb..00000000000
--- a/progs/tests/descrip.mms
+++ /dev/null
@@ -1,84 +0,0 @@
-# Makefile for GLUT-based demo programs for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-
-
-.first
- define gl [--.include.gl]
-
-.include [--]mms-config.
-
-##### MACROS #####
-
-INCDIR = ([--.include],[-.util])
-CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm
-
-.ifdef SHARE
-GL_LIBS = $(XLIBS)
-.else
-GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS)
-.endif
-
-LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
-
-PROGS = cva.exe,\
- dinoshade.exe,\
- fogcoord.exe,\
- manytex.exe,\
- multipal.exe,\
- projtex.exe,\
- seccolor.exe,\
- sharedtex.exe,\
- texline.exe,\
- texwrap.exe,\
- vptest1.exe,\
- vptest2.exe,\
- vptest3.exe,\
- vptorus.exe,\
- vpwarpmesh.exe
-
-##### RULES #####
-.obj.exe :
- cxxlink $(MMS$TARGET_NAME),$(GL_LIBS)
-
-##### TARGETS #####
-default :
- $(MMS)$(MMSQUALIFIERS) $(PROGS)
-
-clean :
- delete *.obj;*
-
-realclean :
- delete $(PROGS)
- delete *.obj;*
-
-cva.exe : cva.obj $(LIB_DEP)
-dinoshade.exe : dinoshade.obj $(LIB_DEP)
-fogcoord.exe : fogcoord.obj $(LIB_DEP)
-manytex.exe : manytex.obj $(LIB_DEP)
-multipal.exe : multipal.obj $(LIB_DEP)
-projtex.exe : projtex.obj $(LIB_DEP)
-seccolor.exe : seccolor.obj $(LIB_DEP)
-sharedtex.exe : sharedtex.obj $(LIB_DEP)
-texline.exe : texline.obj $(LIB_DEP)
-texwrap.exe : texwrap.obj $(LIB_DEP)
-vptest1.exe : vptest1.obj $(LIB_DEP)
-vptest2.exe : vptest2.obj $(LIB_DEP)
-vptest3.exe : vptest3.obj $(LIB_DEP)
-vptorus.exe : vptorus.obj $(LIB_DEP)
-vpwarpmesh.exe : vpwarpmesh.obj $(LIB_DEP)
-
-cva.obj : cva.c
-dinoshade.obj : dinoshade.c
-fogcoord.obj : fogcoord.c
-manytex.obj : manytex.c
-multipal.obj : multipal.c
-projtex.obj : projtex.c
-seccolor.obj : seccolor.c
-sharedtex.obj : sharedtex.c
-texline.obj : texline.c
-texwrap.obj : texwrap.c
-vptest1.obj : vptest1.c
-vptest2.obj : vptest2.c
-vptest3.obj : vptest3.c
-vptorus.obj : vptorus.c
-vpwarpmesh.obj : vpwarpmesh.c
diff --git a/progs/tests/dinoshade.c b/progs/tests/dinoshade.c
deleted file mode 100644
index ed7b879bc71..00000000000
--- a/progs/tests/dinoshade.c
+++ /dev/null
@@ -1,914 +0,0 @@
-
-/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
-
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-/* Example for PC game developers to show how to *combine* texturing,
- reflections, and projected shadows all in real-time with OpenGL.
- Robust reflections use stenciling. Robust projected shadows
- use both stenciling and polygon offset. PC game programmers
- should realize that neither stenciling nor polygon offset are
- supported by Direct3D, so these real-time rendering algorithms
- are only really viable with OpenGL.
-
- The program has modes for disabling the stenciling and polygon
- offset uses. It is worth running this example with these features
- toggled off so you can see the sort of artifacts that result.
-
- Notice that the floor texturing, reflections, and shadowing
- all co-exist properly. */
-
-/* When you run this program: Left mouse button controls the
- view. Middle mouse button controls light position (left &
- right rotates light around dino; up & down moves light
- position up and down). Right mouse button pops up menu. */
-
-/* Check out the comments in the "redraw" routine to see how the
- reflection blending and surface stenciling is done. You can
- also see in "redraw" how the projected shadows are rendered,
- including the use of stenciling and polygon offset. */
-
-/* This program is derived from glutdino.c */
-
-/* Compile: cc -o dinoshade dinoshade.c -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h> /* for cos(), sin(), and sqrt() */
-#ifdef __VMS
-# include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
-#else
-# include <malloc.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
-#endif
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#define GL_GLEXT_LEGACY
-#include <GL/glut.h> /* OpenGL Utility Toolkit header */
-
-/* Some <math.h> files do not define M_PI... */
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-/* Variable controlling various rendering modes. */
-static int stencilReflection = 1, stencilShadow = 1, offsetShadow = 1;
-static int renderShadow = 1, renderDinosaur = 1, renderReflection = 1;
-static int linearFiltering = 0, useMipmaps = 0, useTexture = 1;
-static int reportSpeed = 0;
-static int animation = 1;
-static GLboolean lightSwitch = GL_TRUE;
-static int directionalLight = 1;
-static int forceExtension = 0;
-
-/* Time varying or user-controled variables. */
-static float jump = 0.0;
-static float lightAngle = 0.0, lightHeight = 20;
-GLfloat angle = -150; /* in degrees */
-GLfloat angle2 = 30; /* in degrees */
-
-int moving, startx, starty;
-int lightMoving = 0, lightStartX, lightStartY;
-
-enum {
- MISSING, EXTENSION, ONE_DOT_ONE
-};
-int polygonOffsetVersion;
-
-static GLdouble bodyWidth = 3.0;
-/* *INDENT-OFF* */
-static GLfloat body[][2] = { {0, 3}, {1, 1}, {5, 1}, {8, 4}, {10, 4}, {11, 5},
- {11, 11.5}, {13, 12}, {13, 13}, {10, 13.5}, {13, 14}, {13, 15}, {11, 16},
- {8, 16}, {7, 15}, {7, 13}, {8, 12}, {7, 11}, {6, 6}, {4, 3}, {3, 2},
- {1, 2} };
-static GLfloat arm[][2] = { {8, 10}, {9, 9}, {10, 9}, {13, 8}, {14, 9}, {16, 9},
- {15, 9.5}, {16, 10}, {15, 10}, {15.5, 11}, {14.5, 10}, {14, 11}, {14, 10},
- {13, 9}, {11, 11}, {9, 11} };
-static GLfloat leg[][2] = { {8, 6}, {8, 4}, {9, 3}, {9, 2}, {8, 1}, {8, 0.5}, {9, 0},
- {12, 0}, {10, 1}, {10, 2}, {12, 4}, {11, 6}, {10, 7}, {9, 7} };
-static GLfloat eye[][2] = { {8.75, 15}, {9, 14.7}, {9.6, 14.7}, {10.1, 15},
- {9.6, 15.25}, {9, 15.25} };
-static GLfloat lightPosition[4];
-static GLfloat lightColor[] = {0.8, 1.0, 0.8, 1.0}; /* green-tinted */
-static GLfloat skinColor[] = {0.1, 1.0, 0.1, 1.0}, eyeColor[] = {1.0, 0.2, 0.2, 1.0};
-/* *INDENT-ON* */
-
-/* Nice floor texture tiling pattern. */
-static char *circles[] = {
- "....xxxx........",
- "..xxxxxxxx......",
- ".xxxxxxxxxx.....",
- ".xxx....xxx.....",
- "xxx......xxx....",
- "xxx......xxx....",
- "xxx......xxx....",
- "xxx......xxx....",
- ".xxx....xxx.....",
- ".xxxxxxxxxx.....",
- "..xxxxxxxx......",
- "....xxxx........",
- "................",
- "................",
- "................",
- "................",
-};
-
-static void
-makeFloorTexture(void)
-{
- GLubyte floorTexture[16][16][3];
- GLubyte *loc;
- int s, t;
-
- /* Setup RGB image for the texture. */
- loc = (GLubyte*) floorTexture;
- for (t = 0; t < 16; t++) {
- for (s = 0; s < 16; s++) {
- if (circles[t][s] == 'x') {
- /* Nice green. */
- loc[0] = 0x1f;
- loc[1] = 0x8f;
- loc[2] = 0x1f;
- } else {
- /* Light gray. */
- loc[0] = 0xaa;
- loc[1] = 0xaa;
- loc[2] = 0xaa;
- }
- loc += 3;
- }
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- if (useMipmaps) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
- gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16,
- GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
- } else {
- if (linearFiltering) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- } else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- }
- glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0,
- GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
- }
-}
-
-enum {
- X, Y, Z, W
-};
-enum {
- A, B, C, D
-};
-
-/* Create a matrix that will project the desired shadow. */
-void
-shadowMatrix(GLfloat shadowMat[4][4],
- GLfloat groundplane[4],
- GLfloat lightpos[4])
-{
- GLfloat dot;
-
- /* Find dot product between light position vector and ground plane normal. */
- dot = groundplane[X] * lightpos[X] +
- groundplane[Y] * lightpos[Y] +
- groundplane[Z] * lightpos[Z] +
- groundplane[W] * lightpos[W];
-
- shadowMat[0][0] = dot - lightpos[X] * groundplane[X];
- shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y];
- shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z];
- shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W];
-
- shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X];
- shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y];
- shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z];
- shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W];
-
- shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X];
- shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y];
- shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z];
- shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W];
-
- shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X];
- shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y];
- shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z];
- shadowMat[3][3] = dot - lightpos[W] * groundplane[W];
-
-}
-
-/* Find the plane equation given 3 points. */
-void
-findPlane(GLfloat plane[4],
- GLfloat v0[3], GLfloat v1[3], GLfloat v2[3])
-{
- GLfloat vec0[3], vec1[3];
-
- /* Need 2 vectors to find cross product. */
- vec0[X] = v1[X] - v0[X];
- vec0[Y] = v1[Y] - v0[Y];
- vec0[Z] = v1[Z] - v0[Z];
-
- vec1[X] = v2[X] - v0[X];
- vec1[Y] = v2[Y] - v0[Y];
- vec1[Z] = v2[Z] - v0[Z];
-
- /* find cross product to get A, B, and C of plane equation */
- plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y];
- plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]);
- plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X];
-
- plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]);
-}
-
-void
-extrudeSolidFromPolygon(GLfloat data[][2], unsigned int dataSize,
- GLdouble thickness, GLuint side, GLuint edge, GLuint whole)
-{
- static GLUtriangulatorObj *tobj = NULL;
- GLdouble vertex[3], dx, dy, len;
- int i;
- int count = (int) (dataSize / (2 * sizeof(GLfloat)));
-
- if (tobj == NULL) {
- tobj = gluNewTess(); /* create and initialize a GLU
- polygon tesselation object */
- gluTessCallback(tobj, GLU_BEGIN, glBegin);
- gluTessCallback(tobj, GLU_VERTEX, glVertex2fv); /* semi-tricky */
- gluTessCallback(tobj, GLU_END, glEnd);
- }
- glNewList(side, GL_COMPILE);
- glShadeModel(GL_SMOOTH); /* smooth minimizes seeing
- tessellation */
- gluBeginPolygon(tobj);
- for (i = 0; i < count; i++) {
- vertex[0] = data[i][0];
- vertex[1] = data[i][1];
- vertex[2] = 0;
- gluTessVertex(tobj, vertex, data[i]);
- }
- gluEndPolygon(tobj);
- glEndList();
- glNewList(edge, GL_COMPILE);
- glShadeModel(GL_FLAT); /* flat shade keeps angular hands
- from being "smoothed" */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= count; i++) {
-#if 1 /* weird, but seems to be legal */
- /* mod function handles closing the edge */
- glVertex3f(data[i % count][0], data[i % count][1], 0.0);
- glVertex3f(data[i % count][0], data[i % count][1], thickness);
- /* Calculate a unit normal by dividing by Euclidean
- distance. We * could be lazy and use
- glEnable(GL_NORMALIZE) so we could pass in * arbitrary
- normals for a very slight performance hit. */
- dx = data[(i + 1) % count][1] - data[i % count][1];
- dy = data[i % count][0] - data[(i + 1) % count][0];
- len = sqrt(dx * dx + dy * dy);
- glNormal3f(dx / len, dy / len, 0.0);
-#else /* the nice way of doing it */
- /* Calculate a unit normal by dividing by Euclidean
- distance. We * could be lazy and use
- glEnable(GL_NORMALIZE) so we could pass in * arbitrary
- normals for a very slight performance hit. */
- dx = data[i % count][1] - data[(i - 1 + count) % count][1];
- dy = data[(i - 1 + count) % count][0] - data[i % count][0];
- len = sqrt(dx * dx + dy * dy);
- glNormal3f(dx / len, dy / len, 0.0);
- /* mod function handles closing the edge */
- glVertex3f(data[i % count][0], data[i % count][1], 0.0);
- glVertex3f(data[i % count][0], data[i % count][1], thickness);
-#endif
- }
- glEnd();
- glEndList();
- glNewList(whole, GL_COMPILE);
- glFrontFace(GL_CW);
- glCallList(edge);
- glNormal3f(0.0, 0.0, -1.0); /* constant normal for side */
- glCallList(side);
- glPushMatrix();
- glTranslatef(0.0, 0.0, thickness);
- glFrontFace(GL_CCW);
- glNormal3f(0.0, 0.0, 1.0); /* opposite normal for other side */
- glCallList(side);
- glPopMatrix();
- glEndList();
-}
-
-/* Enumerants for refering to display lists. */
-typedef enum {
- RESERVED, BODY_SIDE, BODY_EDGE, BODY_WHOLE, ARM_SIDE, ARM_EDGE, ARM_WHOLE,
- LEG_SIDE, LEG_EDGE, LEG_WHOLE, EYE_SIDE, EYE_EDGE, EYE_WHOLE
-} displayLists;
-
-static void
-makeDinosaur(void)
-{
- extrudeSolidFromPolygon(body, sizeof(body), bodyWidth,
- BODY_SIDE, BODY_EDGE, BODY_WHOLE);
- extrudeSolidFromPolygon(arm, sizeof(arm), bodyWidth / 4,
- ARM_SIDE, ARM_EDGE, ARM_WHOLE);
- extrudeSolidFromPolygon(leg, sizeof(leg), bodyWidth / 2,
- LEG_SIDE, LEG_EDGE, LEG_WHOLE);
- extrudeSolidFromPolygon(eye, sizeof(eye), bodyWidth + 0.2,
- EYE_SIDE, EYE_EDGE, EYE_WHOLE);
-}
-
-static void
-drawDinosaur(void)
-
-{
- glPushMatrix();
- /* Translate the dinosaur to be at (0,8,0). */
- glTranslatef(-8, 0, -bodyWidth / 2);
- glTranslatef(0.0, jump, 0.0);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor);
- glCallList(BODY_WHOLE);
- glTranslatef(0.0, 0.0, bodyWidth);
- glCallList(ARM_WHOLE);
- glCallList(LEG_WHOLE);
- glTranslatef(0.0, 0.0, -bodyWidth - bodyWidth / 4);
- glCallList(ARM_WHOLE);
- glTranslatef(0.0, 0.0, -bodyWidth / 4);
- glCallList(LEG_WHOLE);
- glTranslatef(0.0, 0.0, bodyWidth / 2 - 0.1);
- glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor);
- glCallList(EYE_WHOLE);
- glPopMatrix();
-}
-
-static GLfloat floorVertices[4][3] = {
- { -20.0, 0.0, 20.0 },
- { 20.0, 0.0, 20.0 },
- { 20.0, 0.0, -20.0 },
- { -20.0, 0.0, -20.0 },
-};
-
-/* Draw a floor (possibly textured). */
-static void
-drawFloor(void)
-{
- glDisable(GL_LIGHTING);
-
- if (useTexture) {
- glEnable(GL_TEXTURE_2D);
- }
-
- glBegin(GL_QUADS);
- glTexCoord2f(0.0, 0.0);
- glVertex3fv(floorVertices[0]);
- glTexCoord2f(0.0, 16.0);
- glVertex3fv(floorVertices[1]);
- glTexCoord2f(16.0, 16.0);
- glVertex3fv(floorVertices[2]);
- glTexCoord2f(16.0, 0.0);
- glVertex3fv(floorVertices[3]);
- glEnd();
-
- if (useTexture) {
- glDisable(GL_TEXTURE_2D);
- }
-
- glEnable(GL_LIGHTING);
-}
-
-static GLfloat floorPlane[4];
-static GLfloat floorShadow[4][4];
-
-static void
-redraw(void)
-{
- int start, end;
-
- if (reportSpeed) {
- start = glutGet(GLUT_ELAPSED_TIME);
- }
-
- /* Clear; default stencil clears to zero. */
- if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow)) {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- } else {
- /* Avoid clearing stencil when not using it. */
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
-
- /* Reposition the light source. */
- lightPosition[0] = 12*cos(lightAngle);
- lightPosition[1] = lightHeight;
- lightPosition[2] = 12*sin(lightAngle);
- if (directionalLight) {
- lightPosition[3] = 0.0;
- } else {
- lightPosition[3] = 1.0;
- }
-
- shadowMatrix(floorShadow, floorPlane, lightPosition);
-
- glPushMatrix();
- /* Perform scene rotations based on user mouse input. */
- glRotatef(angle2, 1.0, 0.0, 0.0);
- glRotatef(angle, 0.0, 1.0, 0.0);
-
- /* Tell GL new light source position. */
- glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-
- if (renderReflection) {
- if (stencilReflection) {
- /* We can eliminate the visual "artifact" of seeing the "flipped"
- dinosaur underneath the floor by using stencil. The idea is
- draw the floor without color or depth update but so that
- a stencil value of one is where the floor will be. Later when
- rendering the dinosaur reflection, we will only update pixels
- with a stencil value of 1 to make sure the reflection only
- lives on the floor, not below the floor. */
-
- /* Don't update color or depth. */
- glDisable(GL_DEPTH_TEST);
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-
- /* Draw 1 into the stencil buffer. */
- glEnable(GL_STENCIL_TEST);
- glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
- glStencilFunc(GL_ALWAYS, 1, 0xffffffff);
-
- /* Now render floor; floor pixels just get their stencil set to 1. */
- drawFloor();
-
- /* Re-enable update of color and depth. */
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glEnable(GL_DEPTH_TEST);
-
- /* Now, only render where stencil is set to 1. */
- glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- }
-
- glPushMatrix();
-
- /* The critical reflection step: Reflect dinosaur through the floor
- (the Y=0 plane) to make a relection. */
- glScalef(1.0, -1.0, 1.0);
-
- /* Reflect the light position. */
- glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-
- /* To avoid our normals getting reversed and hence botched lighting
- on the reflection, turn on normalize. */
- glEnable(GL_NORMALIZE);
- glCullFace(GL_FRONT);
-
- /* Draw the reflected dinosaur. */
- drawDinosaur();
-
- /* Disable noramlize again and re-enable back face culling. */
- glDisable(GL_NORMALIZE);
- glCullFace(GL_BACK);
-
- glPopMatrix();
-
- /* Switch back to the unreflected light position. */
- glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
-
- if (stencilReflection) {
- glDisable(GL_STENCIL_TEST);
- }
- }
-
- /* Back face culling will get used to only draw either the top or the
- bottom floor. This let's us get a floor with two distinct
- appearances. The top floor surface is reflective and kind of red.
- The bottom floor surface is not reflective and blue. */
-
- /* Draw "bottom" of floor in blue. */
- glFrontFace(GL_CW); /* Switch face orientation. */
- glColor4f(0.1, 0.1, 0.7, 1.0);
- drawFloor();
- glFrontFace(GL_CCW);
-
- if (renderShadow) {
- if (stencilShadow) {
- /* Draw the floor with stencil value 3. This helps us only
- draw the shadow once per floor pixel (and only on the
- floor pixels). */
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_ALWAYS, 3, 0xffffffff);
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
- }
- }
-
- /* Draw "top" of floor. Use blending to blend in reflection. */
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glColor4f(0.7, 0.0, 0.0, 0.3);
- glColor4f(1.0, 1.0, 1.0, 0.3);
- drawFloor();
- glDisable(GL_BLEND);
-
- if (renderDinosaur) {
- /* Draw "actual" dinosaur, not its reflection. */
- drawDinosaur();
- }
-
- if (renderShadow) {
-
- /* Render the projected shadow. */
-
- if (stencilShadow) {
-
- /* Now, only render where stencil is set above 2 (ie, 3 where
- the top floor is). Update stencil with 2 where the shadow
- gets drawn so we don't redraw (and accidently reblend) the
- shadow). */
- glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */
- glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
- }
-
- /* To eliminate depth buffer artifacts, we use polygon offset
- to raise the depth of the projected shadow slightly so
- that it does not depth buffer alias with the floor. */
- if (offsetShadow) {
- switch (polygonOffsetVersion) {
- case EXTENSION:
-#ifdef GL_EXT_polygon_offset
- glEnable(GL_POLYGON_OFFSET_EXT);
- break;
-#endif
-#ifdef GL_VERSION_1_1
- case ONE_DOT_ONE:
- glEnable(GL_POLYGON_OFFSET_FILL);
- break;
-#endif
- case MISSING:
- /* Oh well. */
- break;
- }
- }
-
- /* Render 50% black shadow color on top of whatever the
- floor appareance is. */
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_LIGHTING); /* Force the 50% black. */
- glColor4f(0.0, 0.0, 0.0, 0.5);
-
- glPushMatrix();
- /* Project the shadow. */
- glMultMatrixf((GLfloat *) floorShadow);
- drawDinosaur();
- glPopMatrix();
-
- glDisable(GL_BLEND);
- glEnable(GL_LIGHTING);
-
- if (offsetShadow) {
- switch (polygonOffsetVersion) {
-#ifdef GL_EXT_polygon_offset
- case EXTENSION:
- glDisable(GL_POLYGON_OFFSET_EXT);
- break;
-#endif
-#ifdef GL_VERSION_1_1
- case ONE_DOT_ONE:
- glDisable(GL_POLYGON_OFFSET_FILL);
- break;
-#endif
- case MISSING:
- /* Oh well. */
- break;
- }
- }
- if (stencilShadow) {
- glDisable(GL_STENCIL_TEST);
- }
- }
-
- glPushMatrix();
- glDisable(GL_LIGHTING);
- glColor3f(1.0, 1.0, 0.0);
- if (directionalLight) {
- /* Draw an arrowhead. */
- glDisable(GL_CULL_FACE);
- glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
- glRotatef(lightAngle * -180.0 / M_PI, 0, 1, 0);
- glRotatef(atan(lightHeight/12) * 180.0 / M_PI, 0, 0, 1);
- glBegin(GL_TRIANGLE_FAN);
- glVertex3f(0, 0, 0);
- glVertex3f(2, 1, 1);
- glVertex3f(2, -1, 1);
- glVertex3f(2, -1, -1);
- glVertex3f(2, 1, -1);
- glVertex3f(2, 1, 1);
- glEnd();
- /* Draw a white line from light direction. */
- glColor3f(1.0, 1.0, 1.0);
- glBegin(GL_LINES);
- glVertex3f(0, 0, 0);
- glVertex3f(5, 0, 0);
- glEnd();
- glEnable(GL_CULL_FACE);
- } else {
- /* Draw a yellow ball at the light source. */
- glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
- glutSolidSphere(1.0, 5, 5);
- }
- glEnable(GL_LIGHTING);
- glPopMatrix();
-
- glPopMatrix();
-
- if (reportSpeed) {
- glFinish();
- end = glutGet(GLUT_ELAPSED_TIME);
- printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start);
- }
-
- glutSwapBuffers();
-}
-
-/* ARGSUSED2 */
-static void
-mouse(int button, int state, int x, int y)
-{
- if (button == GLUT_LEFT_BUTTON) {
- if (state == GLUT_DOWN) {
- moving = 1;
- startx = x;
- starty = y;
- }
- if (state == GLUT_UP) {
- moving = 0;
- }
- }
- if (button == GLUT_MIDDLE_BUTTON) {
- if (state == GLUT_DOWN) {
- lightMoving = 1;
- lightStartX = x;
- lightStartY = y;
- }
- if (state == GLUT_UP) {
- lightMoving = 0;
- }
- }
-}
-
-/* ARGSUSED1 */
-static void
-motion(int x, int y)
-{
- if (moving) {
- angle = angle + (x - startx);
- angle2 = angle2 + (y - starty);
- startx = x;
- starty = y;
- glutPostRedisplay();
- }
- if (lightMoving) {
- lightAngle += (x - lightStartX)/40.0;
- lightHeight += (lightStartY - y)/20.0;
- lightStartX = x;
- lightStartY = y;
- glutPostRedisplay();
- }
-}
-
-/* Advance time varying state when idle callback registered. */
-static void
-idle(void)
-{
- static float time = 0.0;
-
- time = glutGet(GLUT_ELAPSED_TIME) / 500.0;
-
- jump = 4.0 * fabs(sin(time)*0.5);
- if (!lightMoving) {
- lightAngle += 0.03;
- }
- glutPostRedisplay();
-}
-
-enum {
- M_NONE, M_MOTION, M_LIGHT, M_TEXTURE, M_SHADOWS, M_REFLECTION, M_DINOSAUR,
- M_STENCIL_REFLECTION, M_STENCIL_SHADOW, M_OFFSET_SHADOW,
- M_POSITIONAL, M_DIRECTIONAL, M_PERFORMANCE
-};
-
-static void
-controlLights(int value)
-{
- switch (value) {
- case M_NONE:
- return;
- case M_MOTION:
- animation = 1 - animation;
- if (animation) {
- glutIdleFunc(idle);
- } else {
- glutIdleFunc(NULL);
- }
- break;
- case M_LIGHT:
- lightSwitch = !lightSwitch;
- if (lightSwitch) {
- glEnable(GL_LIGHT0);
- } else {
- glDisable(GL_LIGHT0);
- }
- break;
- case M_TEXTURE:
- useTexture = !useTexture;
- break;
- case M_SHADOWS:
- renderShadow = 1 - renderShadow;
- break;
- case M_REFLECTION:
- renderReflection = 1 - renderReflection;
- break;
- case M_DINOSAUR:
- renderDinosaur = 1 - renderDinosaur;
- break;
- case M_STENCIL_REFLECTION:
- stencilReflection = 1 - stencilReflection;
- break;
- case M_STENCIL_SHADOW:
- stencilShadow = 1 - stencilShadow;
- break;
- case M_OFFSET_SHADOW:
- offsetShadow = 1 - offsetShadow;
- break;
- case M_POSITIONAL:
- directionalLight = 0;
- break;
- case M_DIRECTIONAL:
- directionalLight = 1;
- break;
- case M_PERFORMANCE:
- reportSpeed = 1 - reportSpeed;
- break;
- }
- glutPostRedisplay();
-}
-
-/* When not visible, stop animating. Restart when visible again. */
-static void
-visible(int vis)
-{
- if (vis == GLUT_VISIBLE) {
- if (animation)
- glutIdleFunc(idle);
- } else {
- if (!animation)
- glutIdleFunc(NULL);
- }
-}
-
-/* Press any key to redraw; good when motion stopped and
- performance reporting on. */
-/* ARGSUSED */
-static void
-key(unsigned char c, int x, int y)
-{
- if (c == 27) {
- exit(0); /* IRIS GLism, Escape quits. */
- }
- glutPostRedisplay();
-}
-
-/* Press any key to redraw; good when motion stopped and
- performance reporting on. */
-/* ARGSUSED */
-static void
-special(int k, int x, int y)
-{
- glutPostRedisplay();
-}
-
-static int
-supportsOneDotOne(void)
-{
- const char *version;
- int major, minor;
-
- version = (char *) glGetString(GL_VERSION);
- if (sscanf(version, "%d.%d", &major, &minor) == 2)
- return major >= 1 && minor >= 1;
- return 0; /* OpenGL version string malformed! */
-}
-
-int
-main(int argc, char **argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for (i=1; i<argc; i++) {
- if (!strcmp("-linear", argv[i])) {
- linearFiltering = 1;
- } else if (!strcmp("-mipmap", argv[i])) {
- useMipmaps = 1;
- } else if (!strcmp("-ext", argv[i])) {
- forceExtension = 1;
- }
- }
-
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
-
-#if 0
- /* In GLUT 4.0, you'll be able to do this an be sure to
- get 2 bits of stencil if the machine has it for you. */
- glutInitDisplayString("samples stencil>=2 rgb double depth");
-#endif
-
- glutCreateWindow("Shadowy Leapin' Lizards");
-
- if (glutGet(GLUT_WINDOW_STENCIL_SIZE) <= 1) {
- printf("dinoshade: Sorry, I need at least 2 bits of stencil.\n");
- exit(1);
- }
-
- /* Register GLUT callbacks. */
- glutDisplayFunc(redraw);
- glutMouseFunc(mouse);
- glutMotionFunc(motion);
- glutVisibilityFunc(visible);
- glutKeyboardFunc(key);
- glutSpecialFunc(special);
-
- glutCreateMenu(controlLights);
-
- glutAddMenuEntry("Toggle motion", M_MOTION);
- glutAddMenuEntry("-----------------------", M_NONE);
- glutAddMenuEntry("Toggle light", M_LIGHT);
- glutAddMenuEntry("Toggle texture", M_TEXTURE);
- glutAddMenuEntry("Toggle shadows", M_SHADOWS);
- glutAddMenuEntry("Toggle reflection", M_REFLECTION);
- glutAddMenuEntry("Toggle dinosaur", M_DINOSAUR);
- glutAddMenuEntry("-----------------------", M_NONE);
- glutAddMenuEntry("Toggle reflection stenciling", M_STENCIL_REFLECTION);
- glutAddMenuEntry("Toggle shadow stenciling", M_STENCIL_SHADOW);
- glutAddMenuEntry("Toggle shadow offset", M_OFFSET_SHADOW);
- glutAddMenuEntry("----------------------", M_NONE);
- glutAddMenuEntry("Positional light", M_POSITIONAL);
- glutAddMenuEntry("Directional light", M_DIRECTIONAL);
- glutAddMenuEntry("-----------------------", M_NONE);
- glutAddMenuEntry("Toggle performance", M_PERFORMANCE);
- glutAttachMenu(GLUT_RIGHT_BUTTON);
- makeDinosaur();
-
-#ifdef GL_VERSION_1_1
- if (supportsOneDotOne() && !forceExtension) {
- polygonOffsetVersion = ONE_DOT_ONE;
- glPolygonOffset(-2.0, -9.0);
- } else
-#endif
- {
-#ifdef GL_EXT_polygon_offset
- /* check for the polygon offset extension */
- if (glutExtensionSupported("GL_EXT_polygon_offset")) {
- polygonOffsetVersion = EXTENSION;
- glPolygonOffsetEXT(-2.0, -0.002);
- } else
-#endif
- {
- polygonOffsetVersion = MISSING;
- printf("\ndinoshine: Missing polygon offset.\n");
- printf(" Expect shadow depth aliasing artifacts.\n\n");
- }
- }
-
- glEnable(GL_CULL_FACE);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_TEXTURE_2D);
- glLineWidth(3.0);
-
- glMatrixMode(GL_PROJECTION);
- gluPerspective( /* field of view in degree */ 40.0,
- /* aspect ratio */ 1.0,
- /* Z near */ 20.0, /* Z far */ 100.0);
- glMatrixMode(GL_MODELVIEW);
- gluLookAt(0.0, 8.0, 60.0, /* eye is at (0,8,60) */
- 0.0, 8.0, 0.0, /* center is at (0,8,0) */
- 0.0, 1.0, 0.); /* up is in postivie Y direction */
-
- glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
- glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1);
- glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHTING);
-
- makeFloorTexture();
-
- /* Setup floor plane for projected shadow calculations. */
- findPlane(floorPlane, floorVertices[1], floorVertices[2], floorVertices[3]);
-
- glutMainLoop();
- return 0; /* ANSI C requires main to return int. */
-}
diff --git a/progs/tests/ext422square.c b/progs/tests/ext422square.c
deleted file mode 100644
index 6533514d697..00000000000
--- a/progs/tests/ext422square.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Exercise the EXT_422_pixels extension, a less convenient
- * alternative to MESA_ycbcr_texture. Requires ARB_fragment_program
- * to perform the final YUV->RGB conversion.
- *
- * Brian Paul 13 September 2002
- * Keith Whitwell 30 November 2004
- */
-
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include <assert.h>
-
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_FILE "../images/tile.rgb"
-
-static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
-static GLint ImgWidth, ImgHeight;
-static GLushort *ImageYUV = NULL;
-static const GLuint yuvObj = 100;
-static const GLuint rgbObj = 101;
-
-static void Init( int argc, char *argv[] );
-
-static void DrawObject(void)
-{
- glBegin(GL_QUADS);
-
- glTexCoord2f(0, 0);
- glVertex2f(-1.0, -1.0);
-
- glTexCoord2f(1, 0);
- glVertex2f(1.0, -1.0);
-
- glTexCoord2f(1, 1);
- glVertex2f(1.0, 1.0);
-
- glTexCoord2f(0, 1);
- glVertex2f(-1.0, 1.0);
-
- glEnd();
-}
-
-static void Display( void )
-{
- static int firsttime = 1;
-
- if (firsttime) {
- firsttime = 0;
- Init( 0, 0 ); /* don't ask */
- }
-
- glClear( GL_COLOR_BUFFER_BIT );
- glBindTexture(GL_TEXTURE_2D, yuvObj);
-
- glPushMatrix();
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
- glTranslatef( -1.1, 0.0, -15.0 );
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glBindTexture(GL_TEXTURE_2D, yuvObj);
- DrawObject();
- glPopMatrix();
-
- glPushMatrix();
- glDisable(GL_FRAGMENT_PROGRAM_ARB);
- glTranslatef( 1.1, 0.0, -15.0 );
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glBindTexture(GL_TEXTURE_2D, rgbObj);
- DrawObject();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.1, 1.1, -1.1, 1.1, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-
-/* #define LINEAR_FILTER */
-
-static void Init( int argc, char *argv[] )
-{
- const char *file;
- const GLfloat yuvtorgb[16] = {
- 1.164, 1.164, 1.164, 0,
- 0, -.391, 2.018, 0,
- 1.596, -.813, 0.0, 0,
- (-.0625*1.164 + -.5*1.596), (-.0625*1.164 + -.5*-.813 + -.5*-.391), (-.0625*1.164 + -.5*2.018), 1
- };
-
- if (!glutExtensionSupported("GL_ARB_fragment_program")) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
-
- if (!glutExtensionSupported("GL_EXT_422_pixels")) {
- printf("Error: GL_EXT_422_pixels not supported!\n");
- exit(1);
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- file = TEXTURE_FILE;
-
- /* Load the texture as YCbCr.
- */
- glBindTexture(GL_TEXTURE_2D, yuvObj);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight );
- if (!ImageYUV) {
- printf("Couldn't read %s\n", TEXTURE_FILE);
- exit(0);
- }
-
- glTexImage2D(GL_TEXTURE_2D, 0,
- GL_RGB,
- ImgWidth, ImgHeight, 0,
- GL_422_EXT,
- GL_UNSIGNED_BYTE, ImageYUV);
-
- glEnable(GL_TEXTURE_2D);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- {
- static const char *modulateYUV =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "TEX R0, fragment.texcoord[0], texture[0], 2D; \n"
-
- "ADD R0, R0, {-0.0625, -0.5, -0.5, 0.0}; \n"
- "DP3 result.color.x, R0, {1.164, 1.596, 0.0}; \n"
- "DP3 result.color.y, R0, {1.164, -0.813, -0.391}; \n"
- "DP3 result.color.z, R0, {1.164, 0.0, 2.018}; \n"
- "MOV result.color.w, R0.w; \n"
-
- "END"
- ;
-
- GLuint modulateProg;
-
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulateYUV), (const GLubyte *)modulateYUV);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- assert(glIsProgramARB(modulateProg));
-
- }
-
- /* Now the same, but use a color matrix to do the conversion at
- * upload time:
- */
- glBindTexture(GL_TEXTURE_2D, rgbObj);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glMatrixMode( GL_COLOR_MATRIX );
- glLoadMatrixf( yuvtorgb );
-
- glTexImage2D(GL_TEXTURE_2D, 0,
- GL_RGB,
- ImgWidth, ImgHeight, 0,
- GL_422_EXT,
- GL_UNSIGNED_BYTE, ImageYUV);
-
- glLoadIdentity();
- glMatrixMode( GL_MODELVIEW );
-
- glEnable(GL_TEXTURE_2D);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-
- glShadeModel(GL_FLAT);
- glClearColor(0.3, 0.3, 0.4, 1.0);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 300, 300 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fbotest1.c b/progs/tests/fbotest1.c
deleted file mode 100644
index ed72ab16dd8..00000000000
--- a/progs/tests/fbotest1.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Test GL_EXT_framebuffer_object
- *
- * Brian Paul
- * 7 Feb 2005
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static int Width = 400, Height = 400;
-static GLuint MyFB, MyRB;
-
-
-static void
-CheckError(int line)
-{
- GLenum err = glGetError();
- if (err) {
- printf("GL Error 0x%x at line %d\n", (int) err, line);
- }
-}
-
-
-static void
-Display( void )
-{
- GLubyte *buffer = malloc(Width * Height * 4);
- GLenum status;
-
- /* draw to user framebuffer */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
-
- status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- printf("Framebuffer incomplete!!!\n");
- }
-
- glClearColor(0.5, 0.5, 1.0, 0.0);
- glClear( GL_COLOR_BUFFER_BIT );
-
- glBegin(GL_POLYGON);
- glColor3f(1, 0, 0);
- glVertex2f(-1, -1);
- glColor3f(0, 1, 0);
- glVertex2f(1, -1);
- glColor3f(0, 0, 1);
- glVertex2f(0, 1);
- glEnd();
-
- /* read from user framebuffer */
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
-
- /* draw to window */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- glWindowPos2iARB(0, 0);
- glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
-
- free(buffer);
- glutSwapBuffers();
- CheckError(__LINE__);
-}
-
-
-static void
-Reshape( int width, int height )
-{
-#if 0
- float ar = (float) width / (float) height;
-#endif
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
-#if 0
- glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
-#else
- glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
-#endif
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
- Width = width;
- Height = height;
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
-}
-
-
-static void
-CleanUp(void)
-{
- glDeleteFramebuffersEXT(1, &MyFB);
- glDeleteRenderbuffersEXT(1, &MyRB);
- assert(!glIsFramebufferEXT(MyFB));
- assert(!glIsRenderbufferEXT(MyRB));
- exit(0);
-}
-
-
-static void
-Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- CleanUp();
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init( void )
-{
- GLint i;
-
- if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
- printf("GL_EXT_framebuffer_object not found!\n");
- /*exit(0);*/
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- glGenFramebuffersEXT(1, &MyFB);
- assert(MyFB);
- assert(!glIsFramebufferEXT(MyFB));
- glDeleteFramebuffersEXT(1, &MyFB);
- assert(!glIsFramebufferEXT(MyFB));
- /* Note, continue to use MyFB below */
-
- glGenRenderbuffersEXT(1, &MyRB);
- assert(MyRB);
- assert(!glIsRenderbufferEXT(MyRB));
- glDeleteRenderbuffersEXT(1, &MyRB);
- assert(!glIsRenderbufferEXT(MyRB));
- MyRB = 42; /* an arbitrary ID */
-
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- assert(glIsFramebufferEXT(MyFB));
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB);
- assert(glIsRenderbufferEXT(MyRB));
-
- glGetIntegerv(GL_RENDERBUFFER_BINDING_EXT, &i);
- assert(i == MyRB);
-
- glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i);
- assert(i == MyFB);
-
- CheckError(__LINE__);
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
- GL_RENDERBUFFER_EXT, MyRB);
-
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
-
- CheckError(__LINE__);
-
- {
- GLint r, g, b, a;
- glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_RED_SIZE_EXT, &r);
- glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_GREEN_SIZE_EXT, &g);
- glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_BLUE_SIZE_EXT, &b);
- glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_ALPHA_SIZE_EXT, &a);
- CheckError(__LINE__);
- printf("renderbuffer RGBA sizes = %d %d %d %d\n", r, g, b, a);
-
- glGetIntegerv(GL_RED_BITS, &r);
- glGetIntegerv(GL_GREEN_BITS, &g);
- glGetIntegerv(GL_BLUE_BITS, &b);
- glGetIntegerv(GL_ALPHA_BITS, &a);
- printf("Visual RGBA sizes = %d %d %d %d\n", r, g, b, a);
- }
-
- /* restore to default */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- CheckError(__LINE__);
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c
deleted file mode 100644
index c3117b0f767..00000000000
--- a/progs/tests/fbotest2.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Test GL_EXT_framebuffer_object
- *
- * Brian Paul
- * 19 Mar 2006
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static int Width = 400, Height = 400;
-static GLuint MyFB, ColorRb, DepthRb;
-static GLboolean Animate = GL_TRUE;
-static GLfloat Rotation = 0.0;
-
-
-static void
-CheckError(int line)
-{
- GLenum err = glGetError();
- if (err) {
- printf("fbotest2: GL Error 0x%x at line %d\n", (int) err, line);
- }
-}
-
-
-static void
-Display( void )
-{
- GLubyte *buffer = malloc(Width * Height * 4);
- GLenum status;
-
- CheckError(__LINE__);
-
- /* draw to user framebuffer */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
-
- status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- printf("fbotest2: Error: Framebuffer is incomplete!!!\n");
- }
-
- CheckError(__LINE__);
-
- glClearColor(0.5, 0.5, 1.0, 0.0);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
-
- glPushMatrix();
- glRotatef(30.0, 1, 0, 0);
- glRotatef(Rotation, 0, 1, 0);
- glutSolidTeapot(2.0);
- glPopMatrix();
-
- /* read from user framebuffer */
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
-
- /* draw to window */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- glWindowPos2iARB(0, 0);
- glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
-
- free(buffer);
- glutSwapBuffers();
- CheckError(__LINE__);
-}
-
-
-static void
-Reshape( int width, int height )
-{
- float ar = (float) width / (float) height;
-
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, width, height);
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRb);
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
- width, height);
-
- Width = width;
- Height = height;
-}
-
-
-static void
-CleanUp(void)
-{
- glDeleteFramebuffersEXT(1, &MyFB);
- glDeleteRenderbuffersEXT(1, &ColorRb);
- glDeleteRenderbuffersEXT(1, &DepthRb);
- assert(!glIsFramebufferEXT(MyFB));
- assert(!glIsRenderbufferEXT(ColorRb));
- assert(!glIsRenderbufferEXT(DepthRb));
- exit(0);
-}
-
-
-static void
-Idle(void)
-{
- Rotation = glutGet(GLUT_ELAPSED_TIME) * 0.1;
- glutPostRedisplay();
-}
-
-
-static void
-Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Animate = !Animate;
- if (Animate)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 27:
- CleanUp();
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init( void )
-{
- if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
- printf("fbotest2: GL_EXT_framebuffer_object not found!\n");
- exit(0);
- }
- printf("fbotest2: GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- glGenFramebuffersEXT(1, &MyFB);
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- assert(glIsFramebufferEXT(MyFB));
-
- /* set color buffer */
- glGenRenderbuffersEXT(1, &ColorRb);
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
- assert(glIsRenderbufferEXT(ColorRb));
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
- GL_RENDERBUFFER_EXT, ColorRb);
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
-
- /* setup depth buffer */
- glGenRenderbuffersEXT(1, &DepthRb);
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRb);
- assert(glIsRenderbufferEXT(DepthRb));
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, DepthRb);
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, Width, Height);
-
- CheckError(__LINE__);
-
- /* restore to default */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- CheckError(__LINE__);
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- if (Animate)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fbotexture.c b/progs/tests/fbotexture.c
deleted file mode 100644
index 13a29db3f35..00000000000
--- a/progs/tests/fbotexture.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Test GL_EXT_framebuffer_object render-to-texture
- *
- * Draw a teapot into a texture image with stenciling.
- * Then draw a textured quad using that texture.
- *
- * Brian Paul
- * 18 Apr 2005
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-/* For debug */
-#define DEPTH 1
-#define STENCIL 1
-#define DRAW 1
-
-
-static int Width = 400, Height = 400;
-
-static GLenum TexTarget = GL_TEXTURE_2D; /*GL_TEXTURE_RECTANGLE_ARB;*/
-static int TexWidth = 512, TexHeight = 512;
-/*static int TexWidth = 600, TexHeight = 600;*/
-
-static GLuint MyFB;
-static GLuint TexObj;
-static GLuint DepthRB, StencilRB;
-static GLboolean Anim = GL_FALSE;
-static GLfloat Rot = 0.0;
-static GLboolean UsePackedDepthStencil = GL_FALSE;
-static GLuint TextureLevel = 1; /* which texture level to render to */
-static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
-
-
-static void
-CheckError(int line)
-{
- GLenum err = glGetError();
- if (err) {
- printf("GL Error 0x%x at line %d\n", (int) err, line);
- }
-}
-
-
-static void
-Idle(void)
-{
- Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
- glutPostRedisplay();
-}
-
-
-static void
-RenderTexture(void)
-{
- GLenum status;
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -15.0);
-
- /* draw to texture image */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
-
- status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
- if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- printf("Framebuffer incomplete!!!\n");
- }
-
- glViewport(0, 0, TexWidth, TexHeight);
-
- glClearColor(0.5, 0.5, 1.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- CheckError(__LINE__);
-
-#if DEPTH
- glEnable(GL_DEPTH_TEST);
-#endif
-
-#if STENCIL
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_NEVER, 1, ~0);
- glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE);
-#endif
-
- CheckError(__LINE__);
-
-#if DEPTH || STENCIL
- /* draw diamond-shaped stencil pattern */
- glColor3f(0, 1, 0);
- glBegin(GL_POLYGON);
- glVertex2f(-0.2, 0.0);
- glVertex2f( 0.0, -0.2);
- glVertex2f( 0.2, 0.0);
- glVertex2f( 0.0, 0.2);
- glEnd();
-#endif
-
- /* draw teapot where stencil != 1 */
-#if STENCIL
- glStencilFunc(GL_NOTEQUAL, 1, ~0);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-#endif
-
- CheckError(__LINE__);
-
-#if 0
- glBegin(GL_POLYGON);
- glColor3f(1, 0, 0);
- glVertex2f(-1, -1);
- glColor3f(0, 1, 0);
- glVertex2f(1, -1);
- glColor3f(0, 0, 1);
- glVertex2f(0, 1);
- glEnd();
-#else
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glPushMatrix();
- glRotatef(0.5 * Rot, 1.0, 0.0, 0.0);
- glutSolidTeapot(0.5);
- glPopMatrix();
- glDisable(GL_LIGHTING);
- /*
- PrintStencilHistogram(TexWidth, TexHeight);
- */
-#endif
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_STENCIL_TEST);
-
-#if DRAW
- /* Bind normal framebuffer */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-#endif
-
- CheckError(__LINE__);
-}
-
-
-
-static void
-Display(void)
-{
- float ar = (float) Width / (float) Height;
-
- RenderTexture();
-
- /* draw textured quad in the window */
-#if DRAW
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -7.0);
-
- glViewport(0, 0, Width, Height);
-
- glClearColor(0.25, 0.25, 0.25, 0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(Rot, 0, 1, 0);
- glEnable(TexTarget);
- glBindTexture(TexTarget, TexObj);
- glBegin(GL_POLYGON);
- glColor3f(0.25, 0.25, 0.25);
- if (TexTarget == GL_TEXTURE_2D) {
- glTexCoord2f(0, 0);
- glVertex2f(-1, -1);
- glTexCoord2f(1, 0);
- glVertex2f(1, -1);
- glColor3f(1.0, 1.0, 1.0);
- glTexCoord2f(1, 1);
- glVertex2f(1, 1);
- glTexCoord2f(0, 1);
- glVertex2f(-1, 1);
- }
- else {
- assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB);
- glTexCoord2f(0, 0);
- glVertex2f(-1, -1);
- glTexCoord2f(TexWidth, 0);
- glVertex2f(1, -1);
- glColor3f(1.0, 1.0, 1.0);
- glTexCoord2f(TexWidth, TexHeight);
- glVertex2f(1, 1);
- glTexCoord2f(0, TexHeight);
- glVertex2f(-1, 1);
- }
- glEnd();
- glPopMatrix();
- glDisable(TexTarget);
-#endif
-
- glutSwapBuffers();
- CheckError(__LINE__);
-}
-
-
-static void
-Reshape(int width, int height)
-{
- glViewport(0, 0, width, height);
- Width = width;
- Height = height;
-}
-
-
-static void
-CleanUp(void)
-{
-#if DEPTH
- glDeleteRenderbuffersEXT(1, &DepthRB);
-#endif
-#if STENCIL
- if (!UsePackedDepthStencil)
- glDeleteRenderbuffersEXT(1, &StencilRB);
-#endif
- glDeleteFramebuffersEXT(1, &MyFB);
-
- glDeleteTextures(1, &TexObj);
-
- exit(0);
-}
-
-
-static void
-Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 's':
- Rot += 2.0;
- break;
- case 27:
- CleanUp();
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init(int argc, char *argv[])
-{
- static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
- GLint i;
-
- if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
- printf("GL_EXT_framebuffer_object not found!\n");
- exit(0);
- }
-
- if (argc > 1 && strcmp(argv[1], "-ds") == 0) {
- if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) {
- printf("GL_EXT_packed_depth_stencil not found!\n");
- exit(0);
- }
- UsePackedDepthStencil = GL_TRUE;
- printf("Using GL_EXT_packed_depth_stencil\n");
- }
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* gen framebuffer id, delete it, do some assertions, just for testing */
- glGenFramebuffersEXT(1, &MyFB);
- assert(MyFB);
- assert(!glIsFramebufferEXT(MyFB));
- glDeleteFramebuffersEXT(1, &MyFB);
- assert(!glIsFramebufferEXT(MyFB));
- /* Note, continue to use MyFB below */
-
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- assert(glIsFramebufferEXT(MyFB));
- glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i);
- assert(i == MyFB);
-
- /* Make texture object/image */
- glGenTextures(1, &TexObj);
- glBindTexture(TexTarget, TexObj);
- /* make two image levels */
- glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- TexWidth = TexWidth >> TextureLevel;
- TexHeight = TexHeight >> TextureLevel;
-
- glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
- glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
-
- CheckError(__LINE__);
-
- /* Render color to texture */
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- TexTarget, TexObj, TextureLevel);
-
-
-#if DEPTH
- /* make depth renderbuffer */
- glGenRenderbuffersEXT(1, &DepthRB);
- assert(DepthRB);
- assert(!glIsRenderbufferEXT(DepthRB));
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
- assert(glIsRenderbufferEXT(DepthRB));
- if (UsePackedDepthStencil)
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT,
- TexWidth, TexHeight);
- else
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
- TexWidth, TexHeight);
- CheckError(__LINE__);
- glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_DEPTH_SIZE_EXT, &i);
- CheckError(__LINE__);
- printf("Depth renderbuffer size = %d bits\n", i);
- assert(i > 0);
-
- /* attach DepthRB to MyFB */
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, DepthRB);
-#endif
-
- CheckError(__LINE__);
-
-#if STENCIL
- if (UsePackedDepthStencil) {
- /* DepthRb is a combined depth/stencil renderbuffer */
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
- GL_STENCIL_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, DepthRB);
- }
- else {
- /* make stencil renderbuffer */
- glGenRenderbuffersEXT(1, &StencilRB);
- assert(StencilRB);
- assert(!glIsRenderbufferEXT(StencilRB));
- glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB);
- assert(glIsRenderbufferEXT(StencilRB));
- glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX,
- TexWidth, TexHeight);
- /* attach StencilRB to MyFB */
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
- GL_STENCIL_ATTACHMENT_EXT,
- GL_RENDERBUFFER_EXT, StencilRB);
- }
- glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
- GL_RENDERBUFFER_STENCIL_SIZE_EXT, &i);
- CheckError(__LINE__);
- printf("Stencil renderbuffer size = %d bits\n", i);
- assert(i > 0);
-#endif
-
- CheckError(__LINE__);
-
- /* bind regular framebuffer */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-
-
- /* lighting */
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
-}
-
-
-int
-main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Display);
- if (Anim)
- glutIdleFunc(Idle);
- Init(argc, argv);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/floattex.c b/progs/tests/floattex.c
deleted file mode 100644
index 2345a49b270..00000000000
--- a/progs/tests/floattex.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Test floating point textures.
- * No actual rendering, yet.
- */
-
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-/* XXX - temporary */
-#ifndef GL_ARB_texture_float
-#define GL_ARB_texture_float 1
-#define GL_TEXTURE_RED_TYPE_ARB 0x9000
-#define GL_TEXTURE_GREEN_TYPE_ARB 0x9001
-#define GL_TEXTURE_BLUE_TYPE_ARB 0x9002
-#define GL_TEXTURE_ALPHA_TYPE_ARB 0x9003
-#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x9004
-#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x9005
-#define GL_TEXTURE_DEPTH_TYPE_ARB 0x9006
-#define GL_UNSIGNED_NORMALIZED_ARB 0x9007
-#define GL_RGBA32F_ARB 0x8814
-#define GL_RGB32F_ARB 0x8815
-#define GL_ALPHA32F_ARB 0x8816
-#define GL_INTENSITY32F_ARB 0x8817
-#define GL_LUMINANCE32F_ARB 0x8818
-#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
-#define GL_RGBA16F_ARB 0x881A
-#define GL_RGB16F_ARB 0x881B
-#define GL_ALPHA16F_ARB 0x881C
-#define GL_INTENSITY16F_ARB 0x881D
-#define GL_LUMINANCE16F_ARB 0x881E
-#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
-#endif
-
-
-static GLboolean
-CheckError( int line )
-{
- GLenum error = glGetError();
- if (error) {
- char *err = (char *) gluErrorString( error );
- fprintf( stderr, "GL Error: %s at line %d\n", err, line );
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-static void
-Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
-
- glutSolidCube(2.0);
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void
-Reshape(int width, int height)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -15.0);
-}
-
-
-static void
-Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-static void
-Init(void)
-{
- GLfloat tex[16][16][4];
- GLfloat tex2[16][16][4];
- GLint i, j, t;
-
- if (!glutExtensionSupported("GL_MESAX_texture_float")) {
- printf("Sorry, this test requires GL_MESAX_texture_float\n");
- exit(1);
- }
-
- for (i = 0; i < 16; i++) {
- for (j = 0; j < 16; j++) {
- GLfloat s = i / 15.0;
- tex[i][j][0] = s;
- tex[i][j][1] = 2.0 * s;
- tex[i][j][2] = -3.0 * s;
- tex[i][j][3] = 4.0 * s;
- }
- }
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, 16, 16, 0, GL_RGBA,
- GL_FLOAT, tex);
- CheckError(__LINE__);
-
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_TYPE_ARB, &t);
- assert(t == GL_FLOAT);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_TYPE_ARB, &t);
- assert(t == GL_FLOAT);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_TYPE_ARB, &t);
- assert(t == GL_FLOAT);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_TYPE_ARB, &t);
- assert(t == GL_FLOAT);
-
- CheckError(__LINE__);
-
- /* read back the texture and make sure values are correct */
- glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, tex2);
- CheckError(__LINE__);
- for (i = 0; i < 16; i++) {
- for (j = 0; j < 16; j++) {
- if (tex[i][j][0] != tex2[i][j][0] ||
- tex[i][j][1] != tex2[i][j][1] ||
- tex[i][j][2] != tex2[i][j][2] ||
- tex[i][j][3] != tex2[i][j][3]) {
- printf("tex[%d][%d] %g %g %g %g != tex2[%d][%d] %g %g %g %g\n",
- i, j,
- tex[i][j][0], tex[i][j][1], tex[i][j][2], tex[i][j][3],
- i, j,
- tex2[i][j][0], tex2[i][j][1], tex2[i][j][2], tex2[i][j][3]);
- }
- }
- }
-
-
-}
-
-
-int
-main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(400, 400);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fog.c b/progs/tests/fog.c
deleted file mode 100644
index ecd9f533f99..00000000000
--- a/progs/tests/fog.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright 2005 Eric Anholt
- * 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 (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.
- *
- * Authors:
- * Eric Anholt <anholt@FreeBSD.org>
- * Brian Paul (fogcoord.c used as a skeleton)
- */
-
-/*
- * Test to exercise fog modes and for comparison with GL_EXT_fog_coord.
- */
-
-#define GL_GLEXT_PROTOTYPES
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static int Width = 600;
-static int Height = 600;
-static GLfloat Near = 0.0, Far = 1.0;
-GLboolean has_fogcoord;
-
-static void drawString( const char *string )
-{
- glRasterPos2f(0, .5);
- while ( *string ) {
- glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string );
- string++;
- }
-}
-
-static void Display( void )
-{
- GLint i, depthi;
- GLfloat fogcolor[4] = {1, 1, 1, 1};
-
- glEnable(GL_FOG);
- glFogfv(GL_FOG_COLOR, fogcolor);
-
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- for (i = 0; i < 6; i++) {
- if (i >= 3 && !has_fogcoord)
- break;
-
- glPushMatrix();
- for (depthi = 0; depthi < 5; depthi++) {
- GLfloat depth = Near + (Far - Near) * depthi / 4;
-
- switch (i % 3) {
- case 0:
- glFogi(GL_FOG_MODE, GL_LINEAR);
- glFogf(GL_FOG_START, Near);
- glFogf(GL_FOG_END, Far);
- break;
- case 1:
- glFogi(GL_FOG_MODE, GL_EXP);
- glFogf(GL_FOG_DENSITY, 2);
- break;
- case 2:
- glFogi(GL_FOG_MODE, GL_EXP2);
- glFogf(GL_FOG_DENSITY, 2);
- break;
- }
-
- glColor4f(0, 0, 0, 0);
- if (i < 3) {
- if (has_fogcoord)
- glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
-
- glBegin(GL_POLYGON);
- glVertex3f(0, 0, depth);
- glVertex3f(1, 0, depth);
- glVertex3f(1, 1, depth);
- glVertex3f(0, 1, depth);
- glEnd();
- } else {
- glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
- glFogCoordfEXT(depth);
-
- glBegin(GL_POLYGON);
- glVertex3f(0, 0, (Near + Far) / 2);
- glVertex3f(1, 0, (Near + Far) / 2);
- glVertex3f(1, 1, (Near + Far) / 2);
- glVertex3f(0, 1, (Near + Far) / 2);
- glEnd();
- }
- glTranslatef(1.5, 0, 0);
- }
-
- glTranslatef(.1, 0, 0);
- switch (i) {
- case 0:
- drawString("GL_LINEAR");
- break;
- case 1:
- drawString("GL_EXP");
- break;
- case 2:
- drawString("GL_EXP2");
- break;
- case 3:
- drawString("GL_FOGCOORD GL_LINEAR");
- break;
- case 4:
- drawString("GL_FOGCOORD GL_EXP");
- break;
- case 5:
- drawString("GL_FOGCOORD GL_EXP2");
- break;
- }
-
- glPopMatrix();
- glTranslatef(0, 1.5, 0);
- }
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
-
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( 0, 11, 9, 0, -Near, -Far );
-
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef(.25, .25, 0);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- /* setup lighting, etc */
- has_fogcoord = glutExtensionSupported("GL_EXT_fog_coord");
- if (!has_fogcoord) {
- printf("Some output of this program requires GL_EXT_fog_coord\n");
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fogcoord.c b/progs/tests/fogcoord.c
deleted file mode 100644
index 89355742aad..00000000000
--- a/progs/tests/fogcoord.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Exercise GL_EXT_fog_coord
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static int Width = 600;
-static int Height = 200;
-static GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- GLfloat t;
-
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- for (t = 0.0; t <= 1.0; t += 0.25) {
- GLfloat f = Near + t * (Far - Near);
- printf("glFogCoord(%4.1f)\n", f);
- glFogCoordfEXT(f);
-
- glPushMatrix();
- glTranslatef(t * 10.0 - 5.0, 0, 0);
- glBegin(GL_POLYGON);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
- glPopMatrix();
- }
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- /* setup lighting, etc */
- if (!glutExtensionSupported("GL_EXT_fog_coord")) {
- printf("Sorry, this program requires GL_EXT_fog_coord\n");
- exit(1);
- }
- glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
- glFogi(GL_FOG_MODE, GL_LINEAR);
- glFogf(GL_FOG_START, Near);
- glFogf(GL_FOG_END, Far);
- glEnable(GL_FOG);
- printf("Squares should be colored from white -> gray -> black.\n");
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fptest1.c b/progs/tests/fptest1.c
deleted file mode 100644
index 095190a8aef..00000000000
--- a/progs/tests/fptest1.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* Test GL_NV_fragment_program */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
-
- glColor4f(0, 0.5, 0, 1);
- glColor4f(0, 1, 0, 1);
- glBegin(GL_POLYGON);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 0, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const char *prog0 =
- "!!FP1.0\n"
- "MUL o[COLR], R0, f[WPOS]; \n"
- "ADD o[COLH], H3, f[TEX0]; \n"
- "ADD_SAT o[COLH], H3, f[TEX0]; \n"
- "ADDX o[COLH], H3, f[TEX0]; \n"
- "ADDHC o[COLH], H3, f[TEX0]; \n"
- "ADDXC o[COLH], H3, f[TEX0]; \n"
- "ADDXC_SAT o[COLH], H30, f[TEX0]; \n"
- "MUL o[COLR].xy, R0.wzyx, f[WPOS]; \n"
- "MUL o[COLR], H0, f[WPOS]; \n"
- "MUL o[COLR], -H0, f[WPOS]; \n"
- "MOV RC, H1; \n"
- "MOV HC, H2; \n"
- "END \n"
- ;
-
- /* masked updates, defines, declarations */
- static const char *prog1 =
- "!!FP1.0\n"
- "DEFINE foo = {1, 2, 3, 4}; \n"
- "DEFINE foo2 = 5; \n"
- "DECLARE foo3 = {5, 6, 7, 8}; \n"
- "DECLARE bar = 3; \n"
- "DECLARE bar2; \n"
- "DECLARE bar3 = bar; \n"
- "#DECLARE bar4 = { a, b, c, d }; \n"
- "MOV o[COLR].xy, R0; \n"
- "MOV o[COLR] (NE), R0; \n"
- "MOV o[COLR] (NE.wzyx), R0; \n"
- "MOV o[COLR].xy (NE.wzyx), R0; \n"
- "MOV RC.x (EQ), R1.x; \n"
- "KIL NE; \n"
- "KIL EQ.xyxy; \n"
- "END \n"
- ;
-
- /* texture instructions */
- static const char *prog2 =
- "!!FP1.0\n"
- "TEX R0, f[TEX0], TEX0, 2D; \n"
- "TEX R1, f[TEX1], TEX1, CUBE; \n"
- "TEX R2, f[TEX2], TEX2, 3D; \n"
- "TXP R3, f[TEX3], TEX3, RECT; \n"
- "TXD R3, R2, R1, f[TEX3], TEX3, RECT; \n"
- "MUL o[COLR], R0, f[COL0]; \n"
- "END \n"
- ;
-
- /* test negation, absolute value */
- static const char *prog3 =
- "!!FP1.0\n"
- "MOV R0, -R1; \n"
- "MOV R0, +R1; \n"
- "MOV R0, |-R1|; \n"
- "MOV R0, |+R1|; \n"
- "MOV R0, -|R1|; \n"
- "MOV R0, +|R1|; \n"
- "MOV R0, -|-R1|; \n"
- "MOV R0, -|+R1|; \n"
- "MOV o[COLR], R0; \n"
- "END \n"
- ;
-
- /* literal constant sources */
- static const char *prog4 =
- "!!FP1.0\n"
- "DEFINE Pi = 3.14159; \n"
- "MOV R0, {1, -2, +3, 4}; \n"
- "MOV R0, 5; \n"
- "MOV R0, -5; \n"
- "MOV R0, +5; \n"
- "MOV R0, Pi; \n"
- "MOV o[COLR], R0; \n"
- "END \n"
- ;
-
- /* change the fragment color in a simple way */
- static const char *prog10 =
- "!!FP1.0\n"
- "DEFINE blue = {0, 0, 1, 0};\n"
- "DECLARE color; \n"
- "MOV R0, f[COL0]; \n"
- "#ADD o[COLR], R0, f[COL0]; \n"
- "#ADD o[COLR], blue, f[COL0]; \n"
- "#ADD o[COLR], {1, 0, 0, 0}, f[COL0]; \n"
- "ADD o[COLR], color, f[COL0]; \n"
- "END \n"
- ;
-
- GLuint progs[20];
-
- if (!glutExtensionSupported ("GL_NV_fragment_program")) {
- printf("Sorry, this program requires GL_NV_fragment_program\n");
- exit(1);
- }
-
- glGenProgramsNV(20, progs);
- assert(progs[0]);
- assert(progs[1]);
- assert(progs[0] != progs[1]);
-
-#if 0
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[0],
- strlen(prog0),
- (const GLubyte *) prog0);
- assert(glIsProgramNV(progs[0]));
-#endif
-
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[1],
- strlen(prog1),
- (const GLubyte *) prog1);
- assert(glIsProgramNV(progs[1]));
-
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[2],
- strlen(prog2),
- (const GLubyte *) prog2);
- assert(glIsProgramNV(progs[2]));
- glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[2]);
-
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[3],
- strlen(prog3),
- (const GLubyte *) prog3);
- assert(glIsProgramNV(progs[3]));
- glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[3]);
-
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[4],
- strlen(prog4),
- (const GLubyte *) prog4);
- assert(glIsProgramNV(progs[4]));
- glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[4]);
-
-
- /* a real program */
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[10],
- strlen(prog10),
- (const GLubyte *) prog10);
- assert(glIsProgramNV(progs[10]));
- glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, progs[10]);
-
- glProgramNamedParameter4fNV(progs[10],
- strlen("color"), (const GLubyte *) "color",
- 1, 0, 0, 1);
-
- glEnable(GL_FRAGMENT_PROGRAM_NV);
- glEnable(GL_ALPHA_TEST);
- glAlphaFunc(GL_ALWAYS, 0.0);
-
- printf("glGetError = %d\n", (int) glGetError());
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/fptexture.c b/progs/tests/fptexture.c
deleted file mode 100644
index f57ad628282..00000000000
--- a/progs/tests/fptexture.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* GL_NV_fragment_program texture test */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "../util/readtex.c"
-
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLfloat Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
-
- glBegin(GL_POLYGON);
- glColor4f(1.0, 1.0, 1.0, 1); glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glColor4f(0.2, 0.2, 1.0, 1); glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glColor4f(0.2, 1.0, 0.2, 1); glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glColor4f(1.0, 0.2, 0.2, 1); glTexCoord2f(0, 1); glVertex2f(-1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!FP1.0\n"
- "TEX R0, f[TEX0], TEX0, 2D; \n"
- "MUL o[COLR], R0, f[COL0]; \n"
- "END"
- ;
- GLuint modulateProg;
- GLuint Texture;
-
- if (!glutExtensionSupported("GL_NV_fragment_program")) {
- printf("Error: GL_NV_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsNV(1, &modulateProg);
- glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, modulateProg,
- strlen(modulate2D),
- (const GLubyte *) modulate2D);
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_NV) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_NV));
- assert(glIsProgramNV(modulateProg));
-
- glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, modulateProg);
- glEnable(GL_FRAGMENT_PROGRAM_NV);
-
- /* Load texture */
- glGenTextures(1, &Texture);
- glBindTexture(GL_TEXTURE_2D, Texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE);
- exit(1);
- }
- /* XXX this enable shouldn't really be needed!!! */
- glEnable(GL_TEXTURE_2D);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/getprocaddress.c b/progs/tests/getprocaddress.c
deleted file mode 100644
index 2480ed44cc7..00000000000
--- a/progs/tests/getprocaddress.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (C) 1999-2002 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.
- */
-
-/*
- * Test that glXGetProcAddress works.
- */
-
-#define GLX_GLXEXT_PROTOTYPES
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-
-typedef void (*generic_func)();
-
-#define EQUAL(X, Y) (fabs((X) - (Y)) < 0.001)
-
-static GLboolean
-test_ActiveTextureARB(generic_func func)
-{
- PFNGLACTIVETEXTUREARBPROC activeTexture = (PFNGLACTIVETEXTUREARBPROC) func;
- GLint t;
- GLboolean pass;
- (*activeTexture)(GL_TEXTURE1_ARB);
- glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &t);
- pass = (t == GL_TEXTURE1_ARB);
- (*activeTexture)(GL_TEXTURE0_ARB); /* restore default */
- return pass;
-}
-
-
-static GLboolean
-test_SecondaryColor3fEXT(generic_func func)
-{
- PFNGLSECONDARYCOLOR3FEXTPROC secColor3f = (PFNGLSECONDARYCOLOR3FEXTPROC) func;
- GLfloat color[4];
- GLboolean pass;
- (*secColor3f)(1.0, 1.0, 0.0);
- glGetFloatv(GL_CURRENT_SECONDARY_COLOR_EXT, color);
- pass = (color[0] == 1.0 && color[1] == 1.0 && color[2] == 0.0);
- (*secColor3f)(0.0, 0.0, 0.0); /* restore default */
- return pass;
-}
-
-
-static GLboolean
-test_ActiveStencilFaceEXT(generic_func func)
-{
- PFNGLACTIVESTENCILFACEEXTPROC activeFace = (PFNGLACTIVESTENCILFACEEXTPROC) func;
- GLint face;
- GLboolean pass;
- (*activeFace)(GL_BACK);
- glGetIntegerv(GL_ACTIVE_STENCIL_FACE_EXT, &face);
- pass = (face == GL_BACK);
- (*activeFace)(GL_FRONT); /* restore default */
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib1fvARB(generic_func func)
-{
- PFNGLVERTEXATTRIB1FVARBPROC vertexAttrib1fvARB = (PFNGLVERTEXATTRIB1FVARBPROC) func;
- PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
-
- const GLfloat v[1] = {25.0};
- const GLfloat def[1] = {0};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib1fvARB)(6, v);
- (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
- pass = (res[0] == 25.0 && res[1] == 0.0 && res[2] == 0.0 && res[3] == 1.0);
- (*vertexAttrib1fvARB)(6, def);
- return pass;
-}
-
-static GLboolean
-test_VertexAttrib4NubvARB(generic_func func)
-{
- PFNGLVERTEXATTRIB4NUBVARBPROC vertexAttrib4NubvARB = (PFNGLVERTEXATTRIB4NUBVARBPROC) func;
- PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
-
- const GLubyte v[4] = {255, 0, 255, 0};
- const GLubyte def[4] = {0, 0, 0, 255};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4NubvARB)(6, v);
- (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
- pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0);
- (*vertexAttrib4NubvARB)(6, def);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib4NuivARB(generic_func func)
-{
- PFNGLVERTEXATTRIB4NUIVARBPROC vertexAttrib4NuivARB = (PFNGLVERTEXATTRIB4NUIVARBPROC) func;
- PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
-
- const GLuint v[4] = {0xffffffff, 0, 0xffffffff, 0};
- const GLuint def[4] = {0, 0, 0, 0xffffffff};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4NuivARB)(6, v);
- (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
- pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0));
- (*vertexAttrib4NuivARB)(6, def);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib4ivARB(generic_func func)
-{
- PFNGLVERTEXATTRIB4IVARBPROC vertexAttrib4ivARB = (PFNGLVERTEXATTRIB4IVARBPROC) func;
- PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
-
- const GLint v[4] = {1, 2, -3, 4};
- const GLint def[4] = {0, 0, 0, 1};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4ivARB)(6, v);
- (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
- pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 2.0) && EQUAL(res[2], -3.0) && EQUAL(res[3], 4.0));
- (*vertexAttrib4ivARB)(6, def);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib4NsvARB(generic_func func)
-{
- PFNGLVERTEXATTRIB4NSVARBPROC vertexAttrib4NsvARB = (PFNGLVERTEXATTRIB4NSVARBPROC) func;
- PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
-
- const GLshort v[4] = {0, 32767, 32767, 0};
- const GLshort def[4] = {0, 0, 0, 32767};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4NsvARB)(6, v);
- (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
- pass = (EQUAL(res[0], 0.0) && EQUAL(res[1], 1.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0));
- (*vertexAttrib4NsvARB)(6, def);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib4NusvARB(generic_func func)
-{
- PFNGLVERTEXATTRIB4NUSVARBPROC vertexAttrib4NusvARB = (PFNGLVERTEXATTRIB4NUSVARBPROC) func;
- PFNGLGETVERTEXATTRIBFVARBPROC getVertexAttribfvARB = (PFNGLGETVERTEXATTRIBFVARBPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvARB");
-
- const GLushort v[4] = {0xffff, 0, 0xffff, 0};
- const GLushort def[4] = {0, 0, 0, 0xffff};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4NusvARB)(6, v);
- (*getVertexAttribfvARB)(6, GL_CURRENT_VERTEX_ATTRIB_ARB, res);
- pass = (EQUAL(res[0], 1.0) && EQUAL(res[1], 0.0) && EQUAL(res[2], 1.0) && EQUAL(res[3], 0.0));
- (*vertexAttrib4NusvARB)(6, def);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib4ubNV(generic_func func)
-{
- PFNGLVERTEXATTRIB4UBNVPROC vertexAttrib4ubNV = (PFNGLVERTEXATTRIB4UBNVPROC) func;
- PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
-
- const GLubyte v[4] = {255, 0, 255, 0};
- const GLubyte def[4] = {0, 0, 0, 255};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4ubNV)(6, v[0], v[1], v[2], v[3]);
- (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
- pass = (res[0] == 1.0 && res[1] == 0.0 && res[2] == 1.0 && res[3] == 0.0);
- (*vertexAttrib4ubNV)(6, def[0], def[1], def[2], def[3]);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib2sNV(generic_func func)
-{
- PFNGLVERTEXATTRIB2SNVPROC vertexAttrib2sNV = (PFNGLVERTEXATTRIB2SNVPROC) func;
- PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
-
- const GLshort v[2] = {2, -4,};
- const GLshort def[2] = {0, 0};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib2sNV)(6, v[0], v[1]);
- (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
- pass = (EQUAL(res[0], 2) && EQUAL(res[1], -4) && EQUAL(res[2], 0) && res[3] == 1.0);
- (*vertexAttrib2sNV)(6, def[0], def[1]);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib3fNV(generic_func func)
-{
- PFNGLVERTEXATTRIB3FNVPROC vertexAttrib3fNV = (PFNGLVERTEXATTRIB3FNVPROC) func;
- PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
-
- const GLfloat v[3] = {0.2, 0.4, 0.8};
- const GLfloat def[3] = {0, 0, 0};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib3fNV)(6, v[0], v[1], v[2]);
- (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
- pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && res[3] == 1.0);
- (*vertexAttrib3fNV)(6, def[0], def[1], def[2]);
- return pass;
-}
-
-
-static GLboolean
-test_VertexAttrib4dvNV(generic_func func)
-{
- PFNGLVERTEXATTRIB4DVNVPROC vertexAttrib4dvNV = (PFNGLVERTEXATTRIB4DVNVPROC) func;
- PFNGLGETVERTEXATTRIBFVNVPROC getVertexAttribfvNV = (PFNGLGETVERTEXATTRIBFVNVPROC) glXGetProcAddressARB((const GLubyte *) "glGetVertexAttribfvNV");
-
- const GLdouble v[4] = {0.2, 0.4, 0.8, 1.2};
- const GLdouble def[4] = {0, 0, 0, 1};
- GLfloat res[4];
- GLboolean pass;
- (*vertexAttrib4dvNV)(6, v);
- (*getVertexAttribfvNV)(6, GL_CURRENT_ATTRIB_NV, res);
- pass = (EQUAL(res[0], 0.2) && EQUAL(res[1], 0.4) && EQUAL(res[2], 0.8) && EQUAL(res[3], 1.2));
- (*vertexAttrib4dvNV)(6, def);
- return pass;
-}
-
-
-/*
- * The following header file is auto-generated with Python. The Python
- * script looks in this file for functions named "test_*" as seen above.
- */
-#include "getproclist.h"
-
-
-
-static int
-extension_supported(const char *haystack, const char *needle)
-{
- if (strstr(haystack, needle))
- return 1;
- else
- return 0;
-}
-
-
-static void
-check_functions( const char *extensions )
-{
- struct name_test_pair *entry;
- int failures = 0, passes = 0;
- int totalFail = 0, totalPass = 0;
- int doTests;
-
- for (entry = functions; entry->name; entry++) {
- if (entry->name[0] == '-') {
- /* XXX update for OpenGL 2.0 */
- if (entry->name[1] == '1') {
- /* check GL version X.Y */
- const char *version = (const char *) glGetString(GL_VERSION);
- if (version[0] == entry->name[1] &&
- version[1] == entry->name[2] &&
- version[2] >= entry->name[3])
- doTests = 1;
- else
- doTests = 0;
- }
- else {
- /* check if the named extension is available */
- doTests = extension_supported(extensions, entry->name+1);
- }
- if (doTests)
- printf("Testing %s functions\n", entry->name + 1);
- totalFail += failures;
- totalPass += passes;
- failures = 0;
- passes = 0;
- }
- else if (doTests) {
- generic_func funcPtr = (generic_func) glXGetProcAddressARB((const GLubyte *) entry->name);
- if (funcPtr) {
- if (entry->test) {
- GLboolean b;
- printf(" Validating %s:", entry->name);
- b = (*entry->test)(funcPtr);
- if (b) {
- printf(" Pass\n");
- passes++;
- }
- else {
- printf(" FAIL!!!\n");
- failures++;
- }
- }
- else {
- passes++;
- }
- }
- else {
- printf(" glXGetProcAddress(%s) failed!\n", entry->name);
- failures++;
- }
- }
-
- if (doTests && (!(entry+1)->name || (entry+1)->name[0] == '-')) {
- if (failures > 0) {
- printf(" %d failed.\n", failures);
- }
- if (passes > 0) {
- printf(" %d passed.\n", passes);
- }
- }
- }
- totalFail += failures;
- totalPass += passes;
-
- printf("-----------------------------\n");
- printf("Total: %d pass %d fail\n", totalPass, totalFail);
-}
-
-
-
-static void
-print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
-{
- Window win;
- int attribSingle[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- None };
- int attribDouble[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- None };
-
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- GLXContext ctx;
- XVisualInfo *visinfo;
- int width = 100, height = 100;
-
- root = RootWindow(dpy, scrnum);
-
- visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
- if (!visinfo) {
- visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
- if (!visinfo) {
- fprintf(stderr, "Error: couldn't find RGB GLX visual\n");
- return;
- }
- }
-
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow(dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr);
-
- ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect );
- if (!ctx) {
- fprintf(stderr, "Error: glXCreateContext failed\n");
- XDestroyWindow(dpy, win);
- return;
- }
-
- if (glXMakeCurrent(dpy, win, ctx)) {
- check_functions( (const char *) glGetString(GL_EXTENSIONS) );
- }
- else {
- fprintf(stderr, "Error: glXMakeCurrent failed\n");
- }
-
- glXDestroyContext(dpy, ctx);
- XDestroyWindow(dpy, win);
-}
-
-
-int
-main(int argc, char *argv[])
-{
- char *displayName = NULL;
- Display *dpy;
-
- dpy = XOpenDisplay(displayName);
- if (!dpy) {
- fprintf(stderr, "Error: unable to open display %s\n", displayName);
- return -1;
- }
-
- print_screen_info(dpy, 0, GL_TRUE);
-
- XCloseDisplay(dpy);
-
- return 0;
-}
diff --git a/progs/tests/getprocaddress.py b/progs/tests/getprocaddress.py
deleted file mode 100644
index f3ed3192e1f..00000000000
--- a/progs/tests/getprocaddress.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-
-# $Id: getprocaddress.py,v 1.7 2005-06-21 23:42:43 idr Exp $
-
-# Helper for the getprocaddress.c test.
-
-import sys, getopt, re
-sys.path.append("../../src/mesa/glapi/" )
-import gl_XML
-import license
-
-
-def FindTestFunctions():
- """Scan getprocaddress.c for lines that start with "test_" to find
- extension function tests. Return a list of names found."""
- functions = []
- f = open("getprocaddress.c")
- if not f:
- return functions
- for line in f.readlines():
- v = re.search("^test_([a-zA-Z0-9]+)", line)
- if v:
- func = v.group(1)
- functions.append(func)
- f.close
- return functions
-
-
-class PrintExports(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "getprocaddress.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
-
- self.tests = FindTestFunctions()
- self.prevCategory = ""
- return
-
-
- def printRealHeader(self):
- print """
-struct name_test_pair {
- const char *name;
- GLboolean (*test)(generic_func);
-};
-
-static struct name_test_pair functions[] = {"""
-
- def printBody(self, api):
- prev_category = None
-
-
- for f in api.functionIterateByOffset():
- [category, num] = api.get_category_for_name( f.name )
- if category != prev_category:
- print ' { "-%s", NULL},' % category
- prev_category = category
-
- test = "NULL"
- for name in f.entry_points:
- if name in self.tests:
- test = "test_%s" % name
- break
-
- print ' { "gl%s", %s },' % (f.name, test)
-
- print ''
- print ' { NULL, NULL }'
- print '};'
- print ''
- return
-
-
-if __name__ == '__main__':
- file_name = "../../src/mesa/glapi/gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
-
- printer = PrintExports()
-
- api = gl_XML.parse_GL_API( file_name, gl_XML.gl_item_factory() )
-
- printer.Print( api )
diff --git a/progs/tests/interleave.c b/progs/tests/interleave.c
deleted file mode 100644
index e98b3ed0469..00000000000
--- a/progs/tests/interleave.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file interleave.c
- *
- * Simple test of glInterleavedArrays functionality. For each mode, two
- * meshes are drawn. One is drawn using interleaved arrays and the othe is
- * drawn using immediate mode. Both should look identical.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <GL/glut.h>
-
-static int Width = 400;
-static int Height = 300;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-static const GLfloat t[][4] = {
- { 0.5, 0.0, 0.0, 1.0 },
-
- { 0.25, 0.5, 0.0, 1.0 },
- { 0.75, 0.5, 0.0, 1.0 },
-
- { 0.0, 1.0, 0.0, 1.0 },
- { 0.5, 1.0, 0.0, 1.0 },
- { 1.0, 1.0, 0.0, 1.0 },
-};
-
-static const GLfloat c_f[][4] = {
- { 1.0, 0.0, 0.0, 1.0 },
-
- { 0.0, 1.0, 0.0, 1.0 },
- { 0.0, 1.0, 0.0, 1.0 },
-
- { 0.0, 0.0, 1.0, 1.0 },
- { 1.0, 0.0, 1.0, 1.0 },
- { 0.0, 0.0, 1.0, 1.0 },
-};
-
-static const GLubyte c_ub[][4] = {
- { 0xff, 0x00, 0x00, 0xff },
-
- { 0x00, 0xff, 0x00, 0xff },
- { 0x00, 0xff, 0x00, 0xff },
-
- { 0x00, 0x00, 0xff, 0xff },
- { 0xff, 0x00, 0xff, 0xff },
- { 0x00, 0x00, 0xff, 0xff },
-};
-
-static const GLfloat n[][3] = {
- { 0.0, 0.0, -1.0 },
-
- { 0.0, 0.0, -1.0 },
- { 0.0, 0.0, -1.0 },
-
- { 0.0, 0.0, -1.0 },
- { 0.0, 0.0, -1.0 },
- { 0.0, 0.0, -1.0 },
-};
-
-static const GLfloat v[][4] = {
- { 0.0, 1.0, 0.0, 1.0, },
-
- { -0.5, 0.0, 0.0, 1.0, },
- { 0.5, 0.0, 0.0, 1.0, },
-
- { -1.0, -1.0, 0.0, 1.0, },
- { 0.0, -1.0, 0.0, 1.0, },
- { 1.0, -1.0, 0.0, 1.0, },
-};
-
-static const unsigned indicies[12] = {
- 0, 1, 2,
- 1, 3, 4,
- 2, 4, 5,
- 1, 4, 2
-};
-
-#define NONE { NULL, 0, 0, 0 }
-#define V2F { v, 2, 2 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) }
-#define V3F { v, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) }
-#define V4F { v, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( v[0] ) }
-
-#define C4UB { c_ub, 4, 4 * sizeof( GLubyte ), GL_UNSIGNED_BYTE, sizeof( c_ub[0] ) }
-#define C3F { c_f, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( c_f[0] ) }
-#define C4F { c_f, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( c_f[0] ) }
-
-#define T2F { t, 2, 2 * sizeof( GLfloat ), GL_FLOAT, sizeof( t[0] ) }
-#define T4F { t, 4, 4 * sizeof( GLfloat ), GL_FLOAT, sizeof( t[0] ) }
-
-#define N3F { n, 3, 3 * sizeof( GLfloat ), GL_FLOAT, sizeof( n[0] ) }
-
-struct interleave_info {
- const void * data;
- unsigned count;
- unsigned size;
- GLenum type;
- unsigned stride;
-};
-
-#define NUM_MODES 14
-#define INVALID_MODE 14
-#define INVALID_STRIDE 15
-
-struct interleave_info info[ NUM_MODES ][4] = {
- { NONE, NONE, NONE, V2F },
- { NONE, NONE, NONE, V3F },
- { NONE, C4UB, NONE, V2F },
- { NONE, C4UB, NONE, V3F },
- { NONE, C3F, NONE, V3F },
-
- { NONE, NONE, N3F, V3F },
- { NONE, C4F, N3F, V3F },
-
- { T2F, NONE, NONE, V3F },
- { T4F, NONE, NONE, V4F },
-
- { T2F, C4UB, NONE, V3F },
- { T2F, C3F, NONE, V3F },
- { T2F, NONE, N3F, V3F },
- { T2F, C4F, N3F, V3F },
- { T4F, C4F, N3F, V4F },
-};
-
-const char * const mode_names[ NUM_MODES ] = {
- "GL_V2F",
- "GL_V3F",
- "GL_C4UB_V2F",
- "GL_C4UB_V3F",
- "GL_C3F_V3F",
- "GL_N3F_V3F",
- "GL_C4F_N3F_V3F",
- "GL_T2F_V3F",
- "GL_T4F_V4F",
- "GL_T2F_C4UB_V3F",
- "GL_T2F_C3F_V3F",
- "GL_T2F_N3F_V3F",
- "GL_T2F_C4F_N3F_V3F",
- "GL_T4F_C4F_N3F_V4F",
-};
-
-static unsigned interleave_mode = 0;
-static GLboolean use_invalid_mode = GL_FALSE;
-static GLboolean use_invalid_stride = GL_FALSE;
-
-#define DEREF(item,idx) (void *) & ((char *)curr_info[item].data)[idx * curr_info[item].stride]
-
-static void Display( void )
-{
- const struct interleave_info * const curr_info = info[ interleave_mode ];
-
- /* 4 floats for 12 verticies for 4 data elements.
- */
- char data[ (sizeof( GLfloat ) * 4) * 12 * 4 ];
-
- unsigned i;
- unsigned offset;
- GLenum err;
- GLenum format;
- GLsizei stride;
-
-
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
-
- glTranslatef(-1.5, 0, 0);
-
- glColor3fv( c_f[0] );
-
- if ( curr_info[0].data != NULL ) {
- glEnable( GL_TEXTURE_2D );
- }
- else {
- glDisable( GL_TEXTURE_2D );
- }
-
-
- offset = 0;
- glBegin(GL_TRIANGLES);
- for ( i = 0 ; i < 12 ; i++ ) {
- const unsigned index = indicies[i];
-
-
- /* Handle the vertex texture coordinate.
- */
- if ( curr_info[0].data != NULL ) {
- if ( curr_info[0].count == 2 ) {
- glTexCoord2fv( DEREF(0, index) );
- }
- else {
- glTexCoord4fv( DEREF(0, index) );
- }
-
- (void) memcpy( & data[ offset ], DEREF(0, index),
- curr_info[0].size );
- offset += curr_info[0].size;
- }
-
-
- /* Handle the vertex color.
- */
- if ( curr_info[1].data != NULL ) {
- if ( curr_info[1].type == GL_FLOAT ) {
- if ( curr_info[1].count == 3 ) {
- glColor3fv( DEREF(1, index) );
- }
- else {
- glColor4fv( DEREF(1, index) );
- }
- }
- else {
- glColor4ubv( DEREF(1, index) );
- }
-
- (void) memcpy( & data[ offset ], DEREF(1, index),
- curr_info[1].size );
- offset += curr_info[1].size;
- }
-
-
- /* Handle the vertex normal.
- */
- if ( curr_info[2].data != NULL ) {
- glNormal3fv( DEREF(2, index) );
-
- (void) memcpy( & data[ offset ], DEREF(2, index),
- curr_info[2].size );
- offset += curr_info[2].size;
- }
-
-
- switch( curr_info[3].count ) {
- case 2:
- glVertex2fv( DEREF(3, index) );
- break;
- case 3:
- glVertex3fv( DEREF(3, index) );
- break;
- case 4:
- glVertex4fv( DEREF(3, index) );
- break;
- }
-
- (void) memcpy( & data[ offset ], DEREF(3, index),
- curr_info[3].size );
- offset += curr_info[3].size;
- }
- glEnd();
-
-
- glTranslatef(3.0, 0, 0);
-
- /* The masking with ~0x2A00 is a bit of a hack to make sure that format
- * ends up with an invalid value no matter what rand() returns.
- */
- format = (use_invalid_mode)
- ? (rand() & ~0x2A00) : GL_V2F + interleave_mode;
- stride = (use_invalid_stride) ? -abs(rand()) : 0;
-
- (void) glGetError();
- glInterleavedArrays( format, stride, data );
- err = glGetError();
- if ( err ) {
- printf("glInterleavedArrays(0x%04x, %d, %p) generated the error 0x%04x\n",
- format, stride, data, err );
- }
- else {
- glDrawArrays( GL_TRIANGLES, 0, 12 );
- }
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void ModeMenu( int entry )
-{
- if ( entry == INVALID_MODE ) {
- use_invalid_mode = GL_TRUE;
- use_invalid_stride = GL_FALSE;
- }
- else if ( entry == INVALID_STRIDE ) {
- use_invalid_mode = GL_FALSE;
- use_invalid_stride = GL_TRUE;
- }
- else {
- use_invalid_mode = GL_FALSE;
- use_invalid_stride = GL_FALSE;
- interleave_mode = entry;
- }
-}
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
- const GLubyte tex[16] = {
- 0xff, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0xff,
- 0xff, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0xff,
- };
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0,
- GL_LUMINANCE, GL_UNSIGNED_BYTE, tex );
-
- printf("Use the context menu (right click) to select the interleaved array mode.\n");
- printf("Press ESCAPE to exit.\n\n");
- printf("NOTE: This is *NOT* a very good test of the modes that use normals.\n");
-}
-
-
-int main( int argc, char *argv[] )
-{
- unsigned i;
-
- srand( time( NULL ) );
-
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "glInterleavedArrays test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
-
- glutCreateMenu( ModeMenu );
- for ( i = 0 ; i < NUM_MODES ; i++ ) {
- glutAddMenuEntry( mode_names[i], i);
- }
-
- glutAddMenuEntry( "Random invalid mode", INVALID_MODE);
- glutAddMenuEntry( "Random invalid stride", INVALID_STRIDE);
-
- glutAttachMenu(GLUT_RIGHT_BUTTON);
-
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/invert.c b/progs/tests/invert.c
deleted file mode 100644
index 750592ed79f..00000000000
--- a/progs/tests/invert.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file invert.c
- *
- * Simple test of GL_MESA_pack_invert functionality. Three squares are
- * drawn. The first two should look the same, and the third one should
- * look inverted.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GL/glut.h>
-
-#include "readtex.h"
-
-#define IMAGE_FILE "../images/tree3.rgb"
-
-static int Width = 420;
-static int Height = 150;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-static GLubyte * image = NULL;
-static GLubyte * temp_image = NULL;
-static GLuint img_width = 0;
-static GLuint img_height = 0;
-static GLuint img_format = 0;
-
-PFNGLWINDOWPOS2IPROC win_pos_2i = NULL;
-
-
-static void Display( void )
-{
- GLint err;
-
-
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT );
-
-
- /* This is the "reference" square.
- */
-
- (*win_pos_2i)( 5, 5 );
- glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, image );
-
- glPixelStorei( GL_PACK_INVERT_MESA, GL_FALSE );
- err = glGetError();
- if ( err != GL_NO_ERROR ) {
- printf( "Setting PACK_INVERT_MESA to false generated an error (0x%04x).\n",
- err );
- }
-
- glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
- (*win_pos_2i)( 5 + 1 * (10 + img_width), 5 );
- glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
-
- glPixelStorei( GL_PACK_INVERT_MESA, GL_TRUE );
- err = glGetError();
- if ( err != GL_NO_ERROR ) {
- printf( "Setting PACK_INVERT_MESA to true generated an error (0x%04x).\n",
- err );
- }
-
- glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
- (*win_pos_2i)( 5 + 2 * (10 + img_width), 5 );
- glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
- const float ver = strtof( ver_string, NULL );
-
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- if ( !glutExtensionSupported("GL_MESA_pack_invert") ) {
- printf("\nSorry, this program requires GL_MESA_pack_invert.\n");
- exit(1);
- }
-
- if ( ver >= 1.4 ) {
- win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2i" );
- }
- else if ( glutExtensionSupported("GL_ARB_window_pos") ) {
- win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2iARB" );
- }
- else if ( glutExtensionSupported("GL_MESA_window_pos") ) {
- win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2iMESA" );
- }
-
-
- /* Do this check as a separate if-statement instead of as an else in case
- * one of the required extensions is supported but glutGetProcAddress
- * returns NULL.
- */
-
- if ( win_pos_2i == NULL ) {
- printf("\nSorry, this program requires either GL 1.4 (or higher),\n"
- "GL_ARB_window_pos, or GL_MESA_window_pos.\n");
- exit(1);
- }
-
- printf("\nThe left 2 squares should be the same color, and the right\n"
- "square should look upside-down.\n");
-
-
- image = LoadRGBImage( IMAGE_FILE, & img_width, & img_height,
- & img_format );
- if ( image == NULL ) {
- printf( "Could not open image file \"%s\".\n", IMAGE_FILE );
- exit(1);
- }
-
- temp_image = malloc( 3 * img_height * img_width );
- if ( temp_image == NULL ) {
- printf( "Could not allocate memory for temporary image.\n" );
- exit(1);
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "GL_MESA_pack_invert test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/jkrahntest.c b/progs/tests/jkrahntest.c
deleted file mode 100644
index 9392e1ab2b9..00000000000
--- a/progs/tests/jkrahntest.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $Id: jkrahntest.c,v 1.2 2006-01-30 17:12:10 brianp Exp $ */
-
-/* This is a good test for glXSwapBuffers on non-current windows,
- * and the glXCopyContext function. Fixed several Mesa/DRI bugs with
- * this program on 15 June 2002.
- *
- * Joe's comments follow:
- *
- * I have tried some different approaches for being able to
- * draw to multiple windows using one context, or a copied
- * context. Mesa/indirect rendering works to use one context
- * for multiple windows, but crashes with glXCopyContext.
- * DRI is badly broken, at least for ATI.
- *
- * I also noticed that glXMakeCurrent allows a window and context
- * from different visuals to be attached (haven't tested recently).
- *
- * Joe Krahn <jkrahn@nc.rr.com>
- */
-
-#include <GL/glx.h>
-#include <GL/gl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159
-#endif
-
-#define DEGTOR (M_PI/180.0)
-
-static int AttributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
-
-int main(int argc, char **argv)
-{
- Window win1, win2;
- XVisualInfo *vi;
- XSetWindowAttributes swa;
- Display *dpy;
- GLXContext ctx1, ctx2;
- float angle;
- int test;
-
- if (argc < 2) {
- fprintf(stderr, "This program tests GLX context switching.\n");
- fprintf(stderr, "Usage: cxbug <n>\n");
- fprintf(stderr, "Where n is:\n");
- fprintf(stderr, "\t1) Use two contexts and swap only when the context is current (typical case).\n");
- fprintf(stderr, "\t2) Use two contexts and swap at the same time.\n");
- fprintf(stderr, "\t\t Used to crash Mesa & nVidia, and DRI artifacts. Seems OK now.\n");
- fprintf(stderr, "\t3) Use one context, but only swap when a context is current.\n");
- fprintf(stderr, "\t\t Serious artifacts for DRI at least with ATI.\n");
- fprintf(stderr, "\t4) Use one context, swap both windows at the same time, so the left\n");
- fprintf(stderr, "\t\t window has no context at swap time. Severe artifacts for DRI.\n");
- fprintf(stderr, "\t5) Use two contexts, copying one to the other when switching windows.\n");
- fprintf(stderr, "\t\t DRI gives an error, indirect rendering crashes server.\n");
-
- exit(1);
- }
- test = atoi(argv[1]);
-
- /* get a connection */
- dpy = XOpenDisplay(NULL);
-
- /* Get an appropriate visual */
- vi = glXChooseVisual(dpy, DefaultScreen(dpy), AttributeList);
- if (vi == 0) {
- fprintf(stderr, "No matching visuals found.\n");
- exit(-1);
- }
-
- /* Create two GLX contexts, with list sharing */
- ctx1 = glXCreateContext(dpy, vi, 0, True);
- ctx2 = glXCreateContext(dpy, vi, ctx1, True);
-
- /* create a colormap */
- swa.colormap = XCreateColormap(dpy, RootWindow(dpy, vi->screen),
- vi->visual, AllocNone);
- swa.border_pixel = 0;
-
- /* Create two windows */
- win1 = XCreateWindow(dpy, RootWindow(dpy, vi->screen),
- 10, 10, 200, 200,
- 0, vi->depth, InputOutput, vi->visual,
- CWBorderPixel | CWColormap, &swa);
- XStoreName(dpy, win1, "Test [L]");
- XMapWindow(dpy, win1);
- XMoveWindow(dpy, win1, 10, 10); /* Initial requested x,y may not be honored */
- {
- XSizeHints sizehints;
- static const char *name = "window";
- sizehints.x = 10;
- sizehints.y = 10;
- sizehints.width = 200;
- sizehints.height = 200;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(dpy, win1, &sizehints);
- XSetStandardProperties(dpy, win1, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
-
- win2 = XCreateWindow(dpy, RootWindow(dpy, vi->screen),
- 250, 10, 200, 200,
- 0, vi->depth, InputOutput, vi->visual,
- CWBorderPixel | CWColormap, &swa);
- XStoreName(dpy, win1, "Test [R]");
- XMapWindow(dpy, win2);
- XMoveWindow(dpy, win2, 260, 10);
- {
- XSizeHints sizehints;
- static const char *name = "window";
- sizehints.x = 10;
- sizehints.y = 10;
- sizehints.width = 200;
- sizehints.height = 200;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(dpy, win2, &sizehints);
- XSetStandardProperties(dpy, win2, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
-
- /* Now draw some spinning things */
- for (angle = 0; angle < 360*4; angle += 10.0) {
- /* Connect the context to window 1 */
- glXMakeCurrent(dpy, win1, ctx1);
-
- /* Clear and draw in window 1 */
- glDrawBuffer(GL_BACK);
- glClearColor(1, 1, 0, 1);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glColor3f(1, 0, 0);
- glBegin(GL_TRIANGLES);
- glVertex2f(0, 0);
- glVertex2f(cos(angle * DEGTOR), sin(angle * DEGTOR));
- glVertex2f(cos((angle + 20.0) * DEGTOR),
- sin((angle + 20.0) * DEGTOR));
- glEnd();
- glFlush();
-
- if (test == 1 || test == 3 || test == 5)
- glXSwapBuffers(dpy, win1);
-
- if (test == 5)
- glXCopyContext(dpy, ctx1, ctx2, GL_ALL_ATTRIB_BITS);
- /* Connect the context to window 2 */
- if (test == 3 || test == 4) {
- glXMakeCurrent(dpy, win2, ctx1);
- } else {
- glXMakeCurrent(dpy, win2, ctx2);
- }
-
- /* Clear and draw in window 2 */
- glDrawBuffer(GL_BACK);
- glClearColor(0, 0, 1, 1);
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1, 1, 0);
- glBegin(GL_TRIANGLES);
- glVertex2f(0, 0);
- glVertex2f(cos(angle * DEGTOR), sin(angle * DEGTOR));
- glVertex2f(cos((angle + 20.0) * DEGTOR),
- sin((angle + 20.0) * DEGTOR));
- glEnd();
- glFlush();
-
- /* Swap buffers */
- if (test == 2 || test == 4)
- glXSwapBuffers(dpy, win1);
- glXSwapBuffers(dpy, win2);
-
- /* wait a while */
- glXWaitX();
- usleep(20000);
- }
-
- return 0;
-}
diff --git a/progs/tests/manytex.c b/progs/tests/manytex.c
deleted file mode 100644
index 70ad4a767ec..00000000000
--- a/progs/tests/manytex.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* $Id: manytex.c,v 1.5 2005-09-15 01:58:39 brianp Exp $ */
-
-/*
- * test handling of many texture maps
- * Also tests texture priority and residency.
- *
- * Brian Paul
- * August 2, 2000
- */
-
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-static GLint NumTextures = 20;
-static GLuint *TextureID = NULL;
-static GLint *TextureWidth = NULL, *TextureHeight = NULL;
-static GLboolean *TextureResidency = NULL;
-static GLint TexWidth = 128, TexHeight = 128;
-static GLfloat Zrot = 0;
-static GLboolean Anim = GL_TRUE;
-static GLint WinWidth = 500, WinHeight = 400;
-static GLboolean MipMap = GL_FALSE;
-static GLboolean LinearFilter = GL_FALSE;
-static GLboolean RandomSize = GL_FALSE;
-static GLint Rows, Columns;
-static GLint LowPriorityCount = 0;
-
-
-static void Idle( void )
-{
- Zrot += 1.0;
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- GLfloat spacing = WinWidth / Columns;
- GLfloat size = spacing * 0.4;
- GLint i;
-
- /* test residency */
- if (0)
- {
- GLboolean b;
- GLint i, resident;
- b = glAreTexturesResident(NumTextures, TextureID, TextureResidency);
- if (b) {
- printf("all resident\n");
- }
- else {
- resident = 0;
- for (i = 0; i < NumTextures; i++) {
- if (TextureResidency[i]) {
- resident++;
- }
- }
- printf("%d of %d texture resident\n", resident, NumTextures);
- }
- }
-
- /* render the textured quads */
- glClear( GL_COLOR_BUFFER_BIT );
- for (i = 0; i < NumTextures; i++) {
- GLint row = i / Columns;
- GLint col = i % Columns;
- GLfloat x = col * spacing + spacing * 0.5;
- GLfloat y = row * spacing + spacing * 0.5;
-
- GLfloat maxDim = (TextureWidth[i] > TextureHeight[i])
- ? TextureWidth[i] : TextureHeight[i];
- GLfloat w = TextureWidth[i] / maxDim;
- GLfloat h = TextureHeight[i] / maxDim;
-
- glPushMatrix();
- glTranslatef(x, y, 0.0);
- glRotatef(Zrot, 0, 0, 1);
- glScalef(size, size, 1);
-
- glBindTexture(GL_TEXTURE_2D, TextureID[i]);
- glBegin(GL_POLYGON);
-#if 0
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glTexCoord2f(0, 1); glVertex2f(-1, 1);
-#else
- glTexCoord2f(0, 0); glVertex2f(-w, -h);
- glTexCoord2f(1, 0); glVertex2f( w, -h);
- glTexCoord2f(1, 1); glVertex2f( w, h);
- glTexCoord2f(0, 1); glVertex2f(-w, h);
-#endif
- glEnd();
- glPopMatrix();
- }
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- WinWidth = width;
- WinHeight = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-/*
- * Return a random int in [min, max].
- */
-static int RandomInt(int min, int max)
-{
- int i = rand();
- int j = i % (max - min + 1);
- return min + j;
-}
-
-
-
-static void Init( void )
-{
- GLint i;
-
- if (RandomSize) {
- printf("Creating %d %s random-size textures, ", NumTextures,
- MipMap ? "Mipmapped" : "non-Mipmapped");
- }
- else {
- printf("Creating %d %s %d x %d textures, ", NumTextures,
- MipMap ? "Mipmapped" : "non-Mipmapped",
- TexWidth, TexHeight);
- }
-
- if (LinearFilter) {
- printf("bilinear filtering\n");
- }
- else {
- printf("nearest filtering\n");
- }
-
-
- /* compute number of rows and columns of rects */
- {
- GLfloat area = (GLfloat) (WinWidth * WinHeight) / (GLfloat) NumTextures;
- GLfloat edgeLen = sqrt(area);
-
- Columns = WinWidth / edgeLen;
- Rows = (NumTextures + Columns - 1) / Columns;
- printf("Rows: %d Cols: %d\n", Rows, Columns);
- }
-
-
- if (!TextureID) {
- TextureID = (GLuint *) malloc(sizeof(GLuint) * NumTextures);
- assert(TextureID);
- glGenTextures(NumTextures, TextureID);
- }
-
- if (!TextureResidency) {
- TextureResidency = (GLboolean *) malloc(sizeof(GLboolean) * NumTextures);
- assert(TextureResidency);
- }
-
- if (!TextureWidth) {
- TextureWidth = (GLint *) malloc(sizeof(GLint) * NumTextures);
- assert(TextureWidth);
- }
- if (!TextureHeight) {
- TextureHeight = (GLint *) malloc(sizeof(GLint) * NumTextures);
- assert(TextureHeight);
- }
-
- for (i = 0; i < NumTextures; i++) {
- GLubyte color[4];
- GLubyte *texImage;
- GLint j, row, col;
-
- row = i / Columns;
- col = i % Columns;
-
- glBindTexture(GL_TEXTURE_2D, TextureID[i]);
-
- if (i < LowPriorityCount)
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 0.5F);
-
- if (RandomSize) {
-#if 0
- int k = (glutGet(GLUT_ELAPSED_TIME) % 7) + 2;
- TexWidth = 1 << k;
- TexHeight = 1 << k;
-#else
- TexWidth = 1 << RandomInt(2, 7);
- TexHeight = 1 << RandomInt(2, 7);
- printf("Random size of %3d: %d x %d\n", i, TexWidth, TexHeight);
-#endif
- }
-
- TextureWidth[i] = TexWidth;
- TextureHeight[i] = TexHeight;
-
- texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte));
- assert(texImage);
-
- /* determine texture color */
- color[0] = (GLint) (255.0 * ((float) col / (Columns - 1)));
- color[1] = 127;
- color[2] = (GLint) (255.0 * ((float) row / (Rows - 1)));
- color[3] = 255;
-
- /* fill in solid-colored teximage */
- for (j = 0; j < TexWidth * TexHeight; j++) {
- texImage[j*4+0] = color[0];
- texImage[j*4+1] = color[1];
- texImage[j*4+2] = color[2];
- texImage[j*4+3] = color[3];
- }
-
- if (MipMap) {
- GLint level = 0;
- GLint w = TexWidth, h = TexHeight;
- while (1) {
- glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage);
- if (w == 1 && h == 1)
- break;
- if (w > 1)
- w /= 2;
- if (h > 1)
- h /= 2;
- level++;
- /*printf("%d: %d x %d\n", level, w, h);*/
- }
- if (LinearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST_MIPMAP_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
- else {
- /* Set corners to white */
- int k = 0;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth - 1) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth * TexHeight - TexWidth) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
- k = (TexWidth * TexHeight - 1) * 4;
- texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255;
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage);
- if (LinearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
-
- free(texImage);
- }
-
- glEnable(GL_TEXTURE_2D);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 's':
- Idle();
- break;
- case 'z':
- Zrot -= step;
- break;
- case 'Z':
- Zrot += step;
- break;
- case ' ':
- Init();
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-int main( int argc, char *argv[] )
-{
- GLint i;
-
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( WinWidth, WinHeight );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-n") == 0) {
- NumTextures = atoi(argv[i+1]);
- if (NumTextures <= 0) {
- printf("Error, bad number of textures\n");
- return 1;
- }
- i++;
- }
- else if (strcmp(argv[i], "-mipmap") == 0) {
- MipMap = GL_TRUE;
- }
- else if (strcmp(argv[i], "-linear") == 0) {
- LinearFilter = GL_TRUE;
- }
- else if (strcmp(argv[i], "-size") == 0) {
- TexWidth = atoi(argv[i+1]);
- TexHeight = atoi(argv[i+2]);
- assert(TexWidth >= 1);
- assert(TexHeight >= 1);
- i += 2;
- }
- else if (strcmp(argv[i], "-randomsize") == 0) {
- RandomSize = GL_TRUE;
- }
- else if (strcmp(argv[i], "-lowpri") == 0) {
- LowPriorityCount = atoi(argv[i+1]);
- i++;
- }
- else {
- printf("Usage:\n");
- printf(" manytex [options]\n");
- printf("Options:\n");
- printf(" -n <number of texture objects>\n");
- printf(" -size <width> <height> - specify texture size\n");
- printf(" -randomsize - use random size textures\n");
- printf(" -mipmap - generate mipmaps\n");
- printf(" -linear - use linear filtering instead of nearest\n");
- printf(" -lowpri <n> - Set lower priority on <n> textures\n");
- return 0;
- }
- }
-
- Init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/tests/mipmap_limits.c b/progs/tests/mipmap_limits.c
deleted file mode 100644
index 6f6d893f77c..00000000000
--- a/progs/tests/mipmap_limits.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* Test GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL
- * Brian Paul
- * 10 May 2006
- */
-
-
-/* Copyright (c) Mark J. Kilgard, 1994. */
-
-/*
- * (c) Copyright 1993, Silicon Graphics, Inc.
- * ALL RIGHTS RESERVED
- * Permission to use, copy, modify, and distribute this software for
- * any purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation, and that
- * the name of Silicon Graphics, Inc. not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission.
- *
- * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
- * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
- * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
- * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
- * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
- * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
- * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
- * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
- * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * US Government Users Restricted Rights
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
- * (c)(1)(ii) of the Rights in Technical Data and Computer Software
- * clause at DFARS 252.227-7013 and/or in similar or successor
- * clauses in the FAR or the DOD or NASA FAR Supplement.
- * Unpublished-- rights reserved under the copyright laws of the
- * United States. Contractor/manufacturer is Silicon Graphics,
- * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
- *
- * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
- */
-/* mipmap.c
- * This program demonstrates using mipmaps for texture maps.
- * To overtly show the effect of mipmaps, each mipmap reduction
- * level has a solidly colored, contrasting texture image.
- * Thus, the quadrilateral which is drawn is drawn with several
- * different colors.
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <GL/glut.h>
-
-static GLint BaseLevel = 0, MaxLevel = 8;
-static GLfloat LodBias = 0.0;
-static GLboolean NearestFilter = GL_TRUE;
-
-
-static void MakeImage(int level, int width, int height, const GLubyte color[4])
-{
- const int makeStripes = 0;
- GLubyte img[256*256*3];
- int i, j;
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++) {
- int k = (i * width + j) * 3;
- int p = (i/8) & makeStripes;
- if (p == 0) {
- img[k + 0] = color[0];
- img[k + 1] = color[1];
- img[k + 2] = color[2];
- }
- else {
- img[k + 0] = 0;
- img[k + 1] = 0;
- img[k + 2] = 0;
- }
- }
- }
-
- glTexImage2D(GL_TEXTURE_2D, level, GL_RGB, width, height, 0,
- GL_RGB, GL_UNSIGNED_BYTE, img);
-}
-
-
-static void makeImages(void)
-{
- static const GLubyte colors[8][3] = {
- {128, 128, 128 },
- { 0, 255, 255 },
- { 255, 255, 0 },
- { 255, 0, 255 },
- { 255, 0, 0 },
- { 0, 255, 0 },
- { 0, 0, 255 },
- { 255, 255, 255 }
- };
- int i, sz = 128;
-
- for (i = 0; i < 8; i++) {
- MakeImage(i, sz, sz, colors[i]);
- sz /= 2;
- }
-}
-
-static void myinit(void)
-{
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS);
- glShadeModel(GL_FLAT);
-
- glTranslatef(0.0, 0.0, -3.6);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- makeImages();
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
- glEnable(GL_TEXTURE_2D);
-}
-
-static void display(void)
-{
- GLfloat tcm = 4.0;
- printf("GL_TEXTURE_BASE_LEVEL = %d GL_TEXTURE_MAX_LEVEL = %d Bias = %.2g filter = %s\n",
- BaseLevel, MaxLevel, LodBias,
- NearestFilter ? "LINEAR" : "NEAREST");
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
-
- if (NearestFilter) {
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST_MIPMAP_NEAREST);
- }
- else {
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
- }
-
- glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glBegin(GL_QUADS);
- glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
- glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
- glTexCoord2f(tcm, tcm); glVertex3f(3000.0, 1.0, -6000.0);
- glTexCoord2f(tcm, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
- glEnd();
- glFlush();
-}
-
-static void myReshape(int w, int h)
-{
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-static void
-key(unsigned char k, int x, int y)
-{
- (void) x;
- (void) y;
- switch (k) {
- case 'b':
- BaseLevel--;
- if (BaseLevel < 0)
- BaseLevel = 0;
- break;
- case 'B':
- BaseLevel++;
- if (BaseLevel > 10)
- BaseLevel = 10;
- break;
- case 'm':
- MaxLevel--;
- if (MaxLevel < 0)
- MaxLevel = 0;
- break;
- case 'M':
- MaxLevel++;
- if (MaxLevel > 10)
- MaxLevel = 10;
- break;
- case 'l':
- LodBias -= 0.02;
- break;
- case 'L':
- LodBias += 0.02;
- break;
- case 'f':
- NearestFilter = !NearestFilter;
- break;
- case 27: /* Escape */
- exit(0);
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-
-static void usage(void)
-{
- printf("usage:\n");
- printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n");
- printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n");
- printf(" f toggle nearest/linear filtering\n");
-}
-
-
-int main(int argc, char** argv)
-{
- glutInit(&argc, argv);
- glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize (600, 600);
- glutCreateWindow (argv[0]);
- myinit();
- glutReshapeFunc (myReshape);
- glutDisplayFunc(display);
- glutKeyboardFunc(key);
- usage();
- glutMainLoop();
- return 0; /* ANSI C requires main to return int. */
-}
diff --git a/progs/tests/multipal.c b/progs/tests/multipal.c
deleted file mode 100644
index 6ae33d751a6..00000000000
--- a/progs/tests/multipal.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* $Id: multipal.c,v 1.6 2003-12-08 09:03:36 joukj Exp $ */
-
-/*
- * Test multitexture and paletted textures.
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef __VMS
-# include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
-#else
-# include <malloc.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
-#endif
-#ifdef _WIN32
-#include <windows.h>
-#endif
-#define GL_GLEXT_LEGACY
-#include <GL/glut.h>
-
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_1_FILE "../images/tile.rgb"
-#define TEXTURE_2_FILE "../images/reflect.rgb"
-
-#define TEX0 1
-#define TEX1 2
-#define TEXBOTH 3
-#define ANIMATE 10
-#define QUIT 100
-
-static GLboolean Animate = GL_TRUE;
-
-static GLfloat Drift = 0.0;
-static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0;
-
-
-
-static void Idle( void )
-{
- if (Animate) {
- Drift += 0.05;
- if (Drift >= 1.0)
- Drift = 0.0;
-
-#ifdef GL_ARB_multitexture
- glActiveTextureARB(GL_TEXTURE0_ARB);
-#endif
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(Drift, 0.0, 0.0);
- glMatrixMode(GL_MODELVIEW);
-
-#ifdef GL_ARB_multitexture
- glActiveTextureARB(GL_TEXTURE1_ARB);
-#endif
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(0.0, Drift, 0.0);
- glMatrixMode(GL_MODELVIEW);
-
- glutPostRedisplay();
- }
-}
-
-
-static void DrawObject(void)
-{
- glBegin(GL_QUADS);
-
-#ifdef GL_ARB_multitexture
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 0.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0);
- glVertex2f(-1.0, -1.0);
-
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 0.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0);
- glVertex2f(1.0, -1.0);
-
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 2.0, 2.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0);
- glVertex2f(1.0, 1.0);
-
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 2.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0);
- glVertex2f(-1.0, 1.0);
-#else
- glTexCoord2f(0.0, 0.0);
- glVertex2f(-1.0, -1.0);
-
- glTexCoord2f(1.0, 0.0);
- glVertex2f(1.0, -1.0);
-
- glTexCoord2f(1.0, 1.0);
- glVertex2f(1.0, 1.0);
-
- glTexCoord2f(0.0, 1.0);
- glVertex2f(-1.0, 1.0);
-#endif
-
- glEnd();
-}
-
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(5.0, 5.0, 5.0);
- DrawObject();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
- /*glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );*/
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -70.0 );
-}
-
-
-static void ModeMenu(int entry)
-{
- GLboolean enable0 = GL_FALSE, enable1 = GL_FALSE;
- if (entry==TEX0) {
- enable0 = GL_TRUE;
- }
- else if (entry==TEX1) {
- enable1 = GL_TRUE;
- }
- else if (entry==TEXBOTH) {
- enable0 = GL_TRUE;
- enable1 = GL_TRUE;
- }
- else if (entry==ANIMATE) {
- Animate = !Animate;
- }
- else if (entry==QUIT) {
- exit(0);
- }
-
- if (entry != ANIMATE) {
-#ifdef GL_ARB_multitexture
- glActiveTextureARB(GL_TEXTURE0_ARB);
-#endif
- if (enable0) {
- glEnable(GL_TEXTURE_2D);
- }
- else
- glDisable(GL_TEXTURE_2D);
-
-#ifdef GL_ARB_multitexture
- glActiveTextureARB(GL_TEXTURE1_ARB);
-#endif
- if (enable1) {
- glEnable(GL_TEXTURE_2D);
- }
- else
- glDisable(GL_TEXTURE_2D);
- }
-
- glutPostRedisplay();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void load_tex(const char *fname, int channel)
-{
- GLubyte *image;
- GLenum format;
- GLint w, h;
- GLubyte *grayImage;
- int i;
- GLubyte table[256][4];
-
- image = LoadRGBImage(fname, &w, &h, &format);
- if (!image)
- exit(1);
-
- printf("%s %d x %d\n", fname, w, h);
- grayImage = malloc(w * h * 1);
- assert(grayImage);
- for (i = 0; i < w * h; i++) {
- int g = (image[i*3+0] + image[i*3+1] + image[i*3+2]) / 3;
- assert(g < 256);
- grayImage[i] = g;
- }
-
- glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX, w, h, 0, GL_COLOR_INDEX,
- GL_UNSIGNED_BYTE, grayImage);
-
- for (i = 0; i < 256; i++) {
- table[i][0] = channel ? i : 0;
- table[i][1] = i;
- table[i][2] = channel ? 0 : i;
- table[i][3] = 255;
- }
-
- glColorTableEXT(GL_TEXTURE_2D, /* target */
- GL_RGBA, /* internal format */
- 256, /* table size */
- GL_RGBA, /* table format */
- GL_UNSIGNED_BYTE, /* table type */
- table); /* the color table */
-
- free(grayImage);
- free(image);
-}
-
-
-
-static void Init( int argc, char *argv[] )
-{
- GLuint texObj[2];
- GLint units;
-
- if (!glutExtensionSupported("GL_ARB_multitexture")) {
- printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n");
- exit(1);
- }
- if (!glutExtensionSupported("GL_EXT_paletted_texture")) {
- printf("Sorry, GL_EXT_paletted_texture not supported by this renderer.\n");
- exit(1);
- }
-
- glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &units);
- printf("%d texture units supported\n", units);
-
- /* allocate two texture objects */
- glGenTextures(2, texObj);
-
- /* setup texture obj 0 */
- glBindTexture(GL_TEXTURE_2D, texObj[0]);
-#ifdef LINEAR_FILTER
- /* linear filtering looks much nicer but is much slower for Mesa */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-foo
-#else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-#endif
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- load_tex(TEXTURE_1_FILE, 0);
-#if 0
- if (!LoadRGBMipmaps(TEXTURE_1_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
-#endif
-
- /* setup texture obj 1 */
- glBindTexture(GL_TEXTURE_2D, texObj[1]);
-#ifdef LINEAR_FILTER
- /* linear filtering looks much nicer but is much slower for Mesa */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-foo
-#else
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-#endif
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- load_tex(TEXTURE_2_FILE, 1);
-#if 0
- if (!LoadRGBMipmaps(TEXTURE_2_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
-#endif
-
- /* now bind the texture objects to the respective texture units */
-#ifdef GL_ARB_multitexture
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glBindTexture(GL_TEXTURE_2D, texObj[0]);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glBindTexture(GL_TEXTURE_2D, texObj[1]);
-#endif
-
- glShadeModel(GL_FLAT);
- glClearColor(0.3, 0.3, 0.4, 1.0);
-
- ModeMenu(TEXBOTH);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 300, 300 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
-
- Init( argc, argv );
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- glutIdleFunc( Idle );
-
- glutCreateMenu(ModeMenu);
- glutAddMenuEntry("Texture 0", TEX0);
- glutAddMenuEntry("Texture 1", TEX1);
- glutAddMenuEntry("Multi-texture", TEXBOTH);
- glutAddMenuEntry("Toggle Animation", ANIMATE);
- glutAddMenuEntry("Quit", QUIT);
- glutAttachMenu(GLUT_RIGHT_BUTTON);
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/multitexarray.c b/progs/tests/multitexarray.c
deleted file mode 100644
index b4fab004a63..00000000000
--- a/progs/tests/multitexarray.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Test vertex arrays and multitexture.
- * Press 'a' to toggle vertex arrays on/off.
- * When you run this program you should see a square with four colors:
- *
- * +------+------+
- * |yellow| pink |
- * +------+------+
- * |green | blue |
- * +------+------+
- */
-
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "GL/glut.h"
-
-static GLuint Window = 0;
-
-static GLuint TexObj[2];
-static GLfloat Angle = 0.0f;
-static GLboolean UseArrays = 1, Anim = 0;
-
-static GLfloat VertArray[4][2] = {
- {-1.2, -1.2}, {1.2, -1.2}, {1.2, 1.2}, {-1.2, 1.2}
-};
-
-static GLfloat Tex0Array[4][2] = {
- {0, 0}, {1, 0}, {1, 1}, {0, 1}
-};
-
-static GLfloat Tex1Array[4][2] = {
- {0, 0}, {1, 0}, {1, 1}, {0, 1}
-};
-
-
-static void init_arrays(void)
-{
- glVertexPointer(2, GL_FLOAT, 0, VertArray);
- glEnableClientState(GL_VERTEX_ARRAY);
-
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glTexCoordPointer(2, GL_FLOAT, 0, Tex0Array);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glTexCoordPointer(2, GL_FLOAT, 0, Tex1Array);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-}
-
-
-static void draw( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 0.0, 0.0, 0.0 );
-
- /* draw first polygon */
- glPushMatrix();
- glRotatef( Angle, 0.0, 0.0, 1.0 );
-
- if (UseArrays) {
- glDrawArrays(GL_POLYGON, 0, 4);
- }
- else {
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 );
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0);
- glVertex2f( -1.0, -1.0 );
-
- glTexCoord2f( 1.0, 0.0 );
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0);
- glVertex2f( 1.0, -1.0 );
-
- glTexCoord2f( 1.0, 1.0 );
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0);
- glVertex2f( 1.0, 1.0 );
-
- glTexCoord2f( 0.0, 1.0 );
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0);
- glVertex2f( -1.0, 1.0 );
- glEnd();
- }
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-
-static void idle( void )
-{
- Angle += 2.0;
- glutPostRedisplay();
-}
-
-
-
-/* change view Angle, exit upon ESC */
-static void key(unsigned char k, int x, int y)
-{
- (void) x;
- (void) y;
- switch (k) {
- case 'a':
- UseArrays = !UseArrays;
- printf("UseArrays: %d\n", UseArrays);
- break;
- case ' ':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(idle);
- else
- glutIdleFunc(NULL);
- break;
- case 27:
- glDeleteTextures( 2, TexObj );
- glutDestroyWindow(Window);
- exit(0);
- }
- glutPostRedisplay();
-}
-
-
-
-/* new window size or exposure */
-static void reshape( int width, int height )
-{
- glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/
- glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-}
-
-
-static void init( void )
-{
- static int width=8, height=8;
- GLubyte tex[64][3];
- GLint i, j;
-
- /* generate texture object IDs */
- glGenTextures( 2, TexObj );
-
- /*
- * setup first texture object
- */
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable( GL_TEXTURE_2D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD );
-
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
- assert(glIsTexture(TexObj[0]));
-
- /* red over black */
- for (i=0;i<height;i++) {
- for (j=0;j<width;j++) {
- int p = i*width+j;
- if (i < height / 2) {
- tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 255; tex[p][1] = 0; tex[p][2] = 0;
- }
- }
- }
-
- glTexImage2D( GL_TEXTURE_2D, 0, 3, width, height, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
-
-
- /*
- * setup second texture object
- */
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glEnable( GL_TEXTURE_2D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD );
-
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
- assert(glIsTexture(TexObj[1]));
-
- /* left=green, right = blue */
- for (i=0;i<height;i++) {
- for (j=0;j<width;j++) {
- int p = i*width+j;
- if (j < width / 2) {
- tex[p][0] = 0; tex[p][1] = 255; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 255;
- }
- }
- }
- glTexImage2D( GL_TEXTURE_2D, 0, 3, width, height, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
-}
-
-
-
-int main( int argc, char *argv[] )
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(300, 300);
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
-
- Window = glutCreateWindow("Texture Objects");
- if (!Window) {
- exit(1);
- }
-
- init();
- init_arrays();
-
- glutReshapeFunc( reshape );
- glutKeyboardFunc( key );
- if (Anim)
- glutIdleFunc( idle );
- glutDisplayFunc( draw );
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/multiwindow.c b/progs/tests/multiwindow.c
deleted file mode 100644
index d4e11d316be..00000000000
--- a/progs/tests/multiwindow.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $Id: multiwindow.c,v 1.1 2001-08-21 14:25:31 brianp Exp $ */
-
-/*
- * A skeleton/template GLUT program
- *
- * Written by Brian Paul and in the public domain.
- */
-
-
-/*
- * $Log: multiwindow.c,v $
- * Revision 1.1 2001-08-21 14:25:31 brianp
- * simple multi-window GLUT test prog
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1998/11/07 14:20:14 brianp
- * added simple rotation, animation of cube
- *
- * Revision 1.1 1998/11/07 14:14:37 brianp
- * Initial revision
- *
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-static GLint Window[2];
-
-static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
-static GLboolean Anim = GL_TRUE;
-
-
-static void Idle( void )
-{
- Xrot += 3.0;
- Yrot += 4.0;
- Zrot += 2.0;
-
- glutSetWindow(Window[0]);
- glutPostRedisplay();
- glutSetWindow(Window[1]);
- glutPostRedisplay();
-}
-
-
-static void Display0( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
-
- glColor3f(0, 1, 0);
- glutSolidCube(2.0);
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Display1( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
-
- glShadeModel(GL_FLAT);
-
- glBegin(GL_TRIANGLE_STRIP);
- glColor3f(1, 0, 0);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glColor3f(1, 0, 0);
- glVertex2f( -1, 1);
- glColor3f(0, 0, 1);
- glVertex2f( 1, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'z':
- Zrot -= step;
- break;
- case 'Z':
- Zrot += step;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
-
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 400, 400 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- Window[0] = glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display0 );
- glutIdleFunc(Idle);
- printf("GL_RENDERER[0] = %s\n", (char *) glGetString(GL_RENDERER));
-
- glutInitWindowPosition( 500, 0 );
- glutInitWindowSize( 400, 400 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- Window[1] = glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display1 );
- glutIdleFunc(Idle);
- printf("GL_RENDERER[1] = %s\n", (char *) glGetString(GL_RENDERER));
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/tests/no_s3tc.c b/progs/tests/no_s3tc.c
deleted file mode 100644
index d3383ff98af..00000000000
--- a/progs/tests/no_s3tc.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file no_s3tc.c
- * Test program to verify the behavior of an OpenGL implementation when
- * an application calls \c glCompressedTexImage2D with an unsupported (but
- * valid) compression format. The most common example is calling it with
- * \c GL_COMPRESSED_RGBA_S3TC_DXT1_EXT when GL_EXT_texture_compression_s3tc
- * is not supported.
- *
- * This tests Mesa bug #1028405.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <GL/glut.h>
-#include <GL/glext.h>
-
-static unsigned data[16];
-
-int
-main( int argc, char ** argv )
-{
- float gl_version;
- GLenum format;
- GLuint size;
- GLuint width;
- GLenum err;
-
-
- glutInit( & argc, argv );
- glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
-
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 300, 300 );
- glutCreateWindow( "No S3TC Test" );
-
- gl_version = strtod( (const char *) glGetString( GL_VERSION ), NULL );
- if ( ! glutExtensionSupported( "GL_ARB_texture_compression" )
- && (gl_version < 1.3) ) {
- fprintf( stderr, "Either OpenGL 1.3 or GL_ARB_texture_compression "
- "must be supported.\n" );
- return( EXIT_SUCCESS );
- }
-
-
- if ( ! glutExtensionSupported( "GL_EXT_texture_compression_s3tc" ) ) {
- format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- width = 4;
- size = 8;
- }
- else if ( ! glutExtensionSupported( "GL_3DFX_texture_compression_FXT1" ) ) {
- format = GL_COMPRESSED_RGBA_FXT1_3DFX;
- width = 8;
- size = 16;
- }
- else {
- fprintf( stderr, "Either GL_EXT_texture_compression_s3tc or "
- "GL_3DFX_texture_compression_FXT1 must NOT be supported.\n" );
- return( EXIT_SUCCESS );
- }
-
- glCompressedTexImage2D( GL_TEXTURE_2D, 0, format, width, 4, 0,
- size, data );
- err = glGetError();
- if ( err != GL_INVALID_ENUM ) {
- fprintf( stderr, "GL error 0x%04x should have been generated, but "
- "0x%04x was generated instead.\n", GL_INVALID_ENUM, err );
- }
-
- return (err == GL_INVALID_ENUM) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/progs/tests/packedpixels.c b/progs/tests/packedpixels.c
deleted file mode 100644
index 67ffe088259..00000000000
--- a/progs/tests/packedpixels.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Test packed pixel formats for textures.
- * Brian Paul
- * 12 May 2004
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include <GL/glut.h>
-
-
-struct pixel_format {
- const char *name;
- GLenum format;
- GLenum type;
- GLint bytes;
- GLuint redTexel, greenTexel;
-};
-
-static const struct pixel_format Formats[] = {
-
- { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8",
- GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 4, 0xff000000, 0x00ff0000 },
- { "GL_RGBA/GL_UNSIGNED_INT_8_8_8_8_REV",
- GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x000000ff, 0x0000ff00 },
- { "GL_RGBA/GL_UNSIGNED_INT_10_10_10_2",
- GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, 4, 0xffc00000, 0x3ff000 },
- { "GL_RGBA/GL_UNSIGNED_INT_2_10_10_10_REV",
- GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 4, 0x3ff, 0xffc00 },
- { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4",
- GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0xf000, 0x0f00 },
- { "GL_RGBA/GL_UNSIGNED_SHORT_4_4_4_4_REV",
- GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x000f, 0x00f0 },
- { "GL_RGBA/GL_UNSIGNED_SHORT_5_5_5_1",
- GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0xf800, 0x7c0 },
- { "GL_RGBA/GL_UNSIGNED_SHORT_1_5_5_5_REV",
- GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x1f, 0x3e0 },
-
- { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8",
- GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 4, 0x0000ff00, 0x00ff0000 },
- { "GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV",
- GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0x00ff0000, 0x0000ff00 },
- { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4",
- GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x00f0, 0x0f00 },
- { "GL_BGRA/GL_UNSIGNED_SHORT_4_4_4_4_REV",
- GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0x0f00, 0x00f0 },
- { "GL_BGRA/GL_UNSIGNED_SHORT_5_5_5_1",
- GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x3e, 0x7c0 },
- { "GL_BGRA/GL_UNSIGNED_SHORT_1_5_5_5_REV",
- GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x7c00, 0x3e0 },
-
- { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8",
- GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8, 4, 0x000000ff, 0x0000ff00 },
- { "GL_ABGR_EXT/GL_UNSIGNED_INT_8_8_8_8_REV",
- GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, 4, 0xff000000, 0x00ff0000 },
- { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4",
- GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4, 2, 0x000f, 0x00f0 },
- { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_4_4_4_4_REV",
- GL_ABGR_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV, 2, 0xf000, 0x0f00 },
- { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_5_5_5_1",
- GL_ABGR_EXT, GL_UNSIGNED_SHORT_5_5_5_1, 2, 0x1, 0x3e },
- { "GL_ABGR_EXT/GL_UNSIGNED_SHORT_1_5_5_5_REV",
- GL_ABGR_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, 2, 0x8000, 0x7c00 },
-
- { "GL_RGB/GL_UNSIGNED_SHORT_5_6_5",
- GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, 0xf800, 0x7e0 },
- { "GL_RGB/GL_UNSIGNED_SHORT_5_6_5_REV",
- GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, 2, 0x1f, 0x7e0 },
- { "GL_RGB/GL_UNSIGNED_BYTE_3_3_2",
- GL_RGB, GL_UNSIGNED_BYTE_3_3_2, 1, 0xe0, 0x1c },
- { "GL_RGB/GL_UNSIGNED_BYTE_2_3_3_REV",
- GL_RGB, GL_UNSIGNED_BYTE_2_3_3_REV, 1, 0x7, 0x38 },
-
- { NULL, 0, 0, 0, 0, 0 }
-};
-
-
-struct name_format {
- const char *name;
- GLenum format;
-};
-
-static const struct name_format IntFormats[] = {
- { "GL_RGBA", GL_RGBA },
- { "GL_RGBA2", GL_RGBA2 },
- { "GL_RGBA4", GL_RGBA4 },
- { "GL_RGB5_A1", GL_RGB5_A1 },
- { "GL_RGBA8", GL_RGBA8 },
- { "GL_RGBA12", GL_RGBA12 },
- { "GL_RGBA16", GL_RGBA16 },
- { "GL_RGB10_A2", GL_RGB10_A2 },
-
- { "GL_RGB", GL_RGB },
- { "GL_R3_G3_B2", GL_R3_G3_B2 },
- { "GL_RGB4", GL_RGB4 },
- { "GL_RGB5", GL_RGB5 },
- { "GL_RGB8", GL_RGB8 },
- { "GL_RGB10", GL_RGB10 },
- { "GL_RGB12", GL_RGB12 },
- { "GL_RGB16", GL_RGB16 },
-
-};
-
-#define NUM_INT_FORMATS (sizeof(IntFormats) / sizeof(IntFormats[0]))
-static GLuint CurFormat = 0;
-
-static GLboolean Test3D = GL_FALSE;
-
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-static void
-MakeTexture(const struct pixel_format *format, GLenum intFormat, GLboolean swap)
-{
- GLubyte texBuffer[1000];
- int i;
-
- glPixelStorei(GL_UNPACK_SWAP_BYTES, swap);
-
- if (format->bytes == 1) {
- for (i = 0; i < 8; i++) {
- texBuffer[i] = format->redTexel;
- }
- for (i = 8; i < 16; i++) {
- texBuffer[i] = format->greenTexel;
- }
- }
- else if (format->bytes == 2) {
- GLushort *us = (GLushort *) texBuffer;
- for (i = 0; i < 8; i++) {
- us[i] = format->redTexel;
- }
- for (i = 8; i < 16; i++) {
- us[i] = format->greenTexel;
- }
- if (swap) {
- for (i = 0; i < 16; i++)
- us[i] = (us[i] << 8) | (us[i] >> 8);
- }
- }
- else if (format->bytes == 4) {
- GLuint *ui = (GLuint *) texBuffer;
- for (i = 0; i < 8; i++) {
- ui[i] = format->redTexel;
- }
- for (i = 8; i < 16; i++) {
- ui[i] = format->greenTexel;
- }
- if (swap) {
- for (i = 0; i < 16; i++) {
- GLuint b = ui[i];
- ui[i] = (b >> 24)
- | ((b >> 8) & 0xff00)
- | ((b << 8) & 0xff0000)
- | ((b << 24) & 0xff000000);
- }
- }
- }
- else {
- abort();
- }
-
- if (Test3D) {
- /* 4 x 4 x 4 texture, undefined data */
- glTexImage3D(GL_TEXTURE_3D, 0, intFormat, 4, 4, 4, 0,
- format->format, format->type, NULL);
- /* fill in Z=1 and Z=2 slices with the real texture data */
- glTexSubImage3D(GL_TEXTURE_3D, 0,
- 0, 0, 1, /* offset */
- 4, 4, 1, /* size */
- format->format, format->type, texBuffer);
- glTexSubImage3D(GL_TEXTURE_3D, 0,
- 0, 0, 2, /* offset */
- 4, 4, 1, /* size */
- format->format, format->type, texBuffer);
- }
- else {
- glTexImage2D(GL_TEXTURE_2D, 0, intFormat, 4, 4, 0,
- format->format, format->type, texBuffer);
- }
-
- if (glGetError()) {
- printf("GL Error for %s\n", format->name);
- memset(texBuffer, 255, 1000);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0,
- GL_RGB, GL_UNSIGNED_BYTE, texBuffer);
- }
-}
-
-
-
-static void
-Draw(void)
-{
- char s[1000];
- int w = 350, h = 20;
- int i, swap;
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- for (swap = 0; swap < 2; swap++) {
- for (i = 0; Formats[i].name; i++) {
- glPushMatrix();
- glTranslatef(swap * (w + 2), i * (h + 2), 0);
-
- MakeTexture(Formats + i, IntFormats[CurFormat].format, swap);
-
- if (Test3D)
- glEnable(GL_TEXTURE_3D);
- else
- glEnable(GL_TEXTURE_2D);
- glBegin(GL_POLYGON);
- glTexCoord3f(0, 0, 0.5); glVertex2f(0, 0);
- glTexCoord3f(1, 0, 0.5); glVertex2f(w, 0);
- glTexCoord3f(1, 1, 0.5); glVertex2f(w, h);
- glTexCoord3f(0, 1, 0.5); glVertex2f(0, h);
- glEnd();
-
- if (Test3D)
- glDisable(GL_TEXTURE_3D);
- else
- glDisable(GL_TEXTURE_2D);
- glColor3f(0, 0, 0);
- glRasterPos2i(8, 6);
- PrintString(Formats[i].name);
-
- glPopMatrix();
- }
- }
-
- glPushMatrix();
- glTranslatef(2, i * (h + 2), 0);
- glColor3f(1, 1, 1);
- glRasterPos2i(8, 6);
- PrintString("Normal");
- glRasterPos2i(w + 2, 6);
- PrintString("Byte Swapped");
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(2, (i + 1) * (h + 2), 0);
- glRasterPos2i(8, 6);
- sprintf(s, "Internal Texture Format [f/F]: %s (%d of %d)",
- IntFormats[CurFormat].name, CurFormat + 1, NUM_INT_FORMATS);
- PrintString(s);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(2, (i + 2) * (h + 2), 0);
- glRasterPos2i(8, 6);
- if (Test3D)
- PrintString("Target [2/3]: GL_TEXTURE_3D");
- else
- PrintString("Target [2/3]: GL_TEXTURE_2D");
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void
-Reshape(int width, int height)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-
-static void
-Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'F':
- if (CurFormat == 0)
- CurFormat = NUM_INT_FORMATS - 1;
- else
- CurFormat--;
- break;
- case 'f':
- CurFormat++;
- if (CurFormat == NUM_INT_FORMATS)
- CurFormat = 0;
- break;
- case '2':
- Test3D = GL_FALSE;
- break;
- case '3':
- Test3D = GL_TRUE;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init(void)
-{
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
-
-int
-main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(700, 800);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/pbo.c b/progs/tests/pbo.c
deleted file mode 100644
index b31b36cc121..00000000000
--- a/progs/tests/pbo.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * GL_EXT_pixel_buffer_object test
- *
- * Brian Paul
- * 11 March 2004
- */
-
-#define GL_GLEXT_PROTOTYPES
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-#include "../util/readtex.c" /* a hack, I know */
-
-#define IMAGE_FILE "../images/girl.rgb"
-
-static int ImgWidth, ImgHeight;
-static GLenum ImgFormat;
-static GLubyte *Image = NULL;
-
-static int APosX, APosY; /* simple drawpixels */
-static int BPosX, BPosY; /* read/draw pixels */
-static int CPosX, CPosY; /* copypixels */
-
-static GLboolean DrawFront = GL_FALSE;
-static GLboolean ScaleAndBias = GL_FALSE;
-static GLboolean Benchmark = GL_FALSE;
-
-static GLuint DrawPBO, TempPBO;
-
-
-static GLenum ReadFormat = GL_BGRA;
-static GLenum ReadType = GL_UNSIGNED_INT_8_8_8_8_REV;
-
-
-
-static void
-CheckError(int line)
-{
- GLenum err = glGetError();
- if (err) {
- printf("GL Error 0x%x at line %d\n", (int) err, line);
- }
-}
-
-
-static void
-Reset( void )
-{
- APosX = 5; APosY = 20;
- BPosX = APosX + ImgWidth + 5; BPosY = 20;
- CPosX = BPosX + ImgWidth + 5; CPosY = 20;
-}
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-static void
-SetupPixelTransfer(GLboolean invert)
-{
- if (invert) {
- glPixelTransferf(GL_RED_SCALE, -1.0);
- glPixelTransferf(GL_RED_BIAS, 1.0);
- glPixelTransferf(GL_GREEN_SCALE, -1.0);
- glPixelTransferf(GL_GREEN_BIAS, 1.0);
- glPixelTransferf(GL_BLUE_SCALE, -1.0);
- glPixelTransferf(GL_BLUE_BIAS, 1.0);
- }
- else {
- glPixelTransferf(GL_RED_SCALE, 1.0);
- glPixelTransferf(GL_RED_BIAS, 0.0);
- glPixelTransferf(GL_GREEN_SCALE, 1.0);
- glPixelTransferf(GL_GREEN_BIAS, 0.0);
- glPixelTransferf(GL_BLUE_SCALE, 1.0);
- glPixelTransferf(GL_BLUE_BIAS, 0.0);
- }
-}
-
-
-static void
-Display( void )
-{
- glClearColor(.3, .3, .3, 1);
- glClear( GL_COLOR_BUFFER_BIT );
-
- CheckError(__LINE__);
-
- /** Unbind UNPACK pixel buffer before calling glBitmap */
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
-
- glRasterPos2i(5, ImgHeight+25);
- PrintString("f = toggle front/back s = toggle scale/bias b = benchmark");
-
- glRasterPos2i(5, ImgHeight+40);
- PrintString("GL_EXT_pixel_buffer_object test");
-
- /* draw original image */
- glRasterPos2i(APosX, 5);
- PrintString("Original");
- glRasterPos2i(APosX, APosY);
- glEnable(GL_DITHER);
- SetupPixelTransfer(GL_FALSE);
- /*** Draw from the DrawPBO */
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
- glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, 0);
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
-
- CheckError(__LINE__);
-
- /* do readpixels, drawpixels */
- glRasterPos2i(BPosX, 5);
- PrintString("Read/DrawPixels");
- SetupPixelTransfer(ScaleAndBias);
- /*** read into the Temp PBO */
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, TempPBO);
- CheckError(__LINE__);
- if (Benchmark) {
- GLint reads = 0;
- GLint endTime;
- GLint startTime = glutGet(GLUT_ELAPSED_TIME);
- GLdouble seconds, pixelsPerSecond;
- printf("Benchmarking...\n");
- do {
- glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
- ReadFormat, ReadType, 0);
- reads++;
- endTime = glutGet(GLUT_ELAPSED_TIME);
- } while (endTime - startTime < 4000); /* 4 seconds */
- seconds = (double) (endTime - startTime) / 1000.0;
- pixelsPerSecond = reads * ImgWidth * ImgHeight / seconds;
- printf("Result: %d reads in %f seconds = %f pixels/sec\n",
- reads, seconds, pixelsPerSecond);
- Benchmark = GL_FALSE;
- }
- else {
- glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
- ReadFormat, ReadType, 0);
- }
- CheckError(__LINE__);
- glRasterPos2i(BPosX, BPosY);
- glDisable(GL_DITHER);
- SetupPixelTransfer(GL_FALSE);
-
- CheckError(__LINE__);
-
- /*** draw from the Temp PBO */
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, TempPBO);
- glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, 0);
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
-
- CheckError(__LINE__);
-
- /* do copypixels */
- glRasterPos2i(CPosX, 5);
- PrintString("CopyPixels");
- glRasterPos2i(CPosX, CPosY);
- glDisable(GL_DITHER);
- SetupPixelTransfer(ScaleAndBias);
- glCopyPixels(APosX, APosY, ImgWidth, ImgHeight, GL_COLOR);
-
- CheckError(__LINE__);
-
- if (!DrawFront)
- glutSwapBuffers();
- else
- glFinish();
-}
-
-
-static void
-Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void
-Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'b':
- Benchmark = GL_TRUE;
- break;
- case 's':
- ScaleAndBias = !ScaleAndBias;
- break;
- case 'f':
- DrawFront = !DrawFront;
- if (DrawFront) {
- glDrawBuffer(GL_FRONT);
- glReadBuffer(GL_FRONT);
- }
- else {
- glDrawBuffer(GL_BACK);
- glReadBuffer(GL_BACK);
- }
- printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init(void)
-{
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- if (!glutExtensionSupported("GL_EXT_pixel_buffer_object")) {
- printf("Sorry, this demo requires GL_EXT_pixel_buffer_object\n");
- exit(0);
- }
-
- Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat );
- if (!Image) {
- printf("Couldn't read %s\n", IMAGE_FILE);
- exit(0);
- }
-
- printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
-
- if (ImgFormat == GL_RGB) {
- /* convert to RGBA */
- int i;
- GLubyte *image2 = (GLubyte *) malloc(ImgWidth * ImgHeight * 4);
- printf("Converting RGB image to RGBA\n");
- for (i = 0; i < ImgWidth * ImgHeight; i++) {
- image2[i*4+0] = Image[i*3+0];
- image2[i*4+1] = Image[i*3+1];
- image2[i*4+2] = Image[i*3+2];
- image2[i*4+3] = 255;
- }
- free(Image);
- Image = image2;
- ImgFormat = GL_RGBA;
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth);
-
- Reset();
-
- /* put image into DrawPBO */
- glGenBuffersARB(1, &DrawPBO);
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
- glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT,
- ImgWidth * ImgHeight * 4, Image, GL_STATIC_DRAW);
-
- /* Setup TempPBO - used for glReadPixels & glDrawPixels */
- glGenBuffersARB(1, &TempPBO);
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, TempPBO);
- glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT,
- ImgWidth * ImgHeight * 4, NULL, GL_DYNAMIC_COPY);
-
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 750, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- Init();
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/projtex.c b/progs/tests/projtex.c
deleted file mode 100644
index e3ef948ab6a..00000000000
--- a/progs/tests/projtex.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-
-/* projtex.c - by David Yu and David Blythe, SGI */
-
-/**
- ** Demonstrates simple projective texture mapping.
- **
- ** Button1 changes view, Button2 moves texture.
- **
- ** (See: Segal, Korobkin, van Widenfelt, Foran, and Haeberli
- ** "Fast Shadows and Lighting Effects Using Texture Mapping", SIGGRAPH '92)
- **
- ** 1994,1995 -- David G Yu
- **
- ** cc -o projtex projtex.c texture.c -lglut -lGLU -lGL -lX11 -lm
- **/
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-#if 0
-#include "texture.h"
-#else
-#include "../util/readtex.c"
-#endif
-
-
-/* Some <math.h> files do not define M_PI... */
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define MAX_TEX 4
-int NumTextures = 1;
-
-int winWidth, winHeight;
-
-GLboolean redrawContinuously = GL_FALSE;
-
-float angle, axis[3];
-enum MoveModes {
- MoveNone, MoveView, MoveObject, MoveTexture
-};
-enum MoveModes mode = MoveNone;
-
-GLfloat objectXform[4][4];
-GLfloat textureXform[MAX_TEX][4][4];
-
-void (*drawObject) (void);
-void (*loadTexture) (void);
-GLboolean textureEnabled = GL_TRUE;
-GLboolean showProjection = GL_TRUE;
-GLboolean linearFilter = GL_TRUE;
-
-char *texFilename[MAX_TEX] = {
- "../images/girl.rgb",
- "../images/tile.rgb",
- "../images/bw.rgb",
- "../images/reflect.rgb"
-};
-
-
-GLfloat zoomFactor = 1.0;
-
-/*****************************************************************/
-
-
-void ActiveTexture(int i)
-{
- glActiveTextureARB(i);
-}
-
-
-/* matrix = identity */
-void
-matrixIdentity(GLfloat matrix[16])
-{
- matrix[0] = 1.0;
- matrix[1] = 0.0;
- matrix[2] = 0.0;
- matrix[3] = 0.0;
- matrix[4] = 0.0;
- matrix[5] = 1.0;
- matrix[6] = 0.0;
- matrix[7] = 0.0;
- matrix[8] = 0.0;
- matrix[9] = 0.0;
- matrix[10] = 1.0;
- matrix[11] = 0.0;
- matrix[12] = 0.0;
- matrix[13] = 0.0;
- matrix[14] = 0.0;
- matrix[15] = 1.0;
-}
-
-/* matrix2 = transpose(matrix1) */
-void
-matrixTranspose(GLfloat matrix2[16], GLfloat matrix1[16])
-{
- matrix2[0] = matrix1[0];
- matrix2[1] = matrix1[4];
- matrix2[2] = matrix1[8];
- matrix2[3] = matrix1[12];
-
- matrix2[4] = matrix1[1];
- matrix2[5] = matrix1[5];
- matrix2[6] = matrix1[9];
- matrix2[7] = matrix1[13];
-
- matrix2[8] = matrix1[2];
- matrix2[9] = matrix1[6];
- matrix2[10] = matrix1[10];
- matrix2[11] = matrix1[14];
-
- matrix2[12] = matrix1[3];
- matrix2[13] = matrix1[7];
- matrix2[14] = matrix1[14];
- matrix2[15] = matrix1[15];
-}
-
-/*****************************************************************/
-
-/* load SGI .rgb image (pad with a border of the specified width and color) */
-#if 0
-static void
-imgLoad(char *filenameIn, int borderIn, GLfloat borderColorIn[4],
- int *wOut, int *hOut, GLubyte ** imgOut)
-{
- int border = borderIn;
- int width, height;
- int w, h;
- GLubyte *image, *img, *p;
- int i, j, components;
-
- image = (GLubyte *) read_texture(filenameIn, &width, &height, &components);
- w = width + 2 * border;
- h = height + 2 * border;
- img = (GLubyte *) calloc(w * h, 4 * sizeof(unsigned char));
-
- p = img;
- for (j = -border; j < height + border; ++j) {
- for (i = -border; i < width + border; ++i) {
- if (0 <= j && j <= height - 1 && 0 <= i && i <= width - 1) {
- p[0] = image[4 * (j * width + i) + 0];
- p[1] = image[4 * (j * width + i) + 1];
- p[2] = image[4 * (j * width + i) + 2];
- p[3] = 0xff;
- } else {
- p[0] = borderColorIn[0] * 0xff;
- p[1] = borderColorIn[1] * 0xff;
- p[2] = borderColorIn[2] * 0xff;
- p[3] = borderColorIn[3] * 0xff;
- }
- p += 4;
- }
- }
- free(image);
- *wOut = w;
- *hOut = h;
- *imgOut = img;
-}
-#endif
-
-
-/*****************************************************************/
-
-/* Load the image file specified on the command line as the current texture */
-void
-loadImageTextures(void)
-{
- GLfloat borderColor[4] =
- {1.0, 1.0, 1.0, 1.0};
- int tex;
-
- for (tex = 0; tex < NumTextures; tex++) {
- GLubyte *image, *texData3, *texData4;
- GLint imgWidth, imgHeight;
- GLenum imgFormat;
- int i, j;
-
- printf("loading %s\n", texFilename[tex]);
- image = LoadRGBImage(texFilename[tex], &imgWidth, &imgHeight, &imgFormat);
- if (!image) {
- printf("can't find %s\n", texFilename[tex]);
- exit(1);
- }
- assert(imgFormat == GL_RGB);
-
- /* scale to 256x256 */
- texData3 = malloc(256 * 256 * 4);
- texData4 = malloc(256 * 256 * 4);
- assert(texData3);
- assert(texData4);
- gluScaleImage(imgFormat, imgWidth, imgHeight, GL_UNSIGNED_BYTE, image,
- 256, 256, GL_UNSIGNED_BYTE, texData3);
-
- /* convert to rgba */
- for (i = 0; i < 256 * 256; i++) {
- texData4[i*4+0] = texData3[i*3+0];
- texData4[i*4+1] = texData3[i*3+1];
- texData4[i*4+2] = texData3[i*3+2];
- texData4[i*4+3] = 128;
- }
-
- /* put transparent border around image */
- for (i = 0; i < 256; i++) {
- texData4[i*4+0] = 255;
- texData4[i*4+1] = 255;
- texData4[i*4+2] = 255;
- texData4[i*4+3] = 0;
- }
- j = 256 * 255 * 4;
- for (i = 0; i < 256; i++) {
- texData4[j + i*4+0] = 255;
- texData4[j + i*4+1] = 255;
- texData4[j + i*4+2] = 255;
- texData4[j + i*4+3] = 0;
- }
- for (i = 0; i < 256; i++) {
- j = i * 256 * 4;
- texData4[j+0] = 255;
- texData4[j+1] = 255;
- texData4[j+2] = 255;
- texData4[j+3] = 0;
- }
- for (i = 0; i < 256; i++) {
- j = i * 256 * 4 + 255 * 4;
- texData4[j+0] = 255;
- texData4[j+1] = 255;
- texData4[j+2] = 255;
- texData4[j+3] = 0;
- }
-
- ActiveTexture(GL_TEXTURE0_ARB + tex);
- glBindTexture(GL_TEXTURE_2D, tex + 1);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texData4);
-
- if (linearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- } else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
- }
-}
-
-/* Create a simple spotlight pattern and make it the current texture */
-void
-loadSpotlightTexture(void)
-{
- static int texWidth = 64, texHeight = 64;
- static GLubyte *texData;
- GLfloat borderColor[4] =
- {0.1, 0.1, 0.1, 1.0};
-
- if (!texData) {
- GLubyte *p;
- int i, j;
-
- texData = (GLubyte *) malloc(texWidth * texHeight * 4 * sizeof(GLubyte));
-
- p = texData;
- for (j = 0; j < texHeight; ++j) {
- float dy = (texHeight * 0.5 - j + 0.5) / (texHeight * 0.5);
-
- for (i = 0; i < texWidth; ++i) {
- float dx = (texWidth * 0.5 - i + 0.5) / (texWidth * 0.5);
- float r = cos(M_PI / 2.0 * sqrt(dx * dx + dy * dy));
- float c;
-
- r = (r < 0) ? 0 : r * r;
- c = 0xff * (r + borderColor[0]);
- p[0] = (c <= 0xff) ? c : 0xff;
- c = 0xff * (r + borderColor[1]);
- p[1] = (c <= 0xff) ? c : 0xff;
- c = 0xff * (r + borderColor[2]);
- p[2] = (c <= 0xff) ? c : 0xff;
- c = 0xff * (r + borderColor[3]);
- p[3] = (c <= 0xff) ? c : 0xff;
- p += 4;
- }
- }
- }
- if (linearFilter) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- } else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
- gluBuild2DMipmaps(GL_TEXTURE_2D, 4, texWidth, texHeight,
- GL_RGBA, GL_UNSIGNED_BYTE, texData);
-}
-
-/*****************************************************************/
-
-void
-checkErrors(void)
-{
- GLenum error;
- while ((error = glGetError()) != GL_NO_ERROR) {
- fprintf(stderr, "Error: %s\n", (char *) gluErrorString(error));
- }
-}
-
-void
-drawCube(void)
-{
- glBegin(GL_QUADS);
-
- glNormal3f(-1.0, 0.0, 0.0);
- glColor3f(0.80, 0.50, 0.50);
- glVertex3f(-0.5, -0.5, -0.5);
- glVertex3f(-0.5, -0.5, 0.5);
- glVertex3f(-0.5, 0.5, 0.5);
- glVertex3f(-0.5, 0.5, -0.5);
-
- glNormal3f(1.0, 0.0, 0.0);
- glColor3f(0.50, 0.80, 0.50);
- glVertex3f(0.5, 0.5, 0.5);
- glVertex3f(0.5, -0.5, 0.5);
- glVertex3f(0.5, -0.5, -0.5);
- glVertex3f(0.5, 0.5, -0.5);
-
- glNormal3f(0.0, -1.0, 0.0);
- glColor3f(0.50, 0.50, 0.80);
- glVertex3f(-0.5, -0.5, -0.5);
- glVertex3f(0.5, -0.5, -0.5);
- glVertex3f(0.5, -0.5, 0.5);
- glVertex3f(-0.5, -0.5, 0.5);
-
- glNormal3f(0.0, 1.0, 0.0);
- glColor3f(0.50, 0.80, 0.80);
- glVertex3f(0.5, 0.5, 0.5);
- glVertex3f(0.5, 0.5, -0.5);
- glVertex3f(-0.5, 0.5, -0.5);
- glVertex3f(-0.5, 0.5, 0.5);
-
- glNormal3f(0.0, 0.0, -1.0);
- glColor3f(0.80, 0.50, 0.80);
- glVertex3f(-0.5, -0.5, -0.5);
- glVertex3f(-0.5, 0.5, -0.5);
- glVertex3f(0.5, 0.5, -0.5);
- glVertex3f(0.5, -0.5, -0.5);
-
- glNormal3f(0.0, 0.0, 1.0);
- glColor3f(1.00, 0.80, 0.50);
- glVertex3f(0.5, 0.5, 0.5);
- glVertex3f(-0.5, 0.5, 0.5);
- glVertex3f(-0.5, -0.5, 0.5);
- glVertex3f(0.5, -0.5, 0.5);
- glEnd();
-}
-
-void
-drawDodecahedron(void)
-{
-#define A (0.5 * 1.61803) /* (sqrt(5) + 1) / 2 */
-#define B (0.5 * 0.61803) /* (sqrt(5) - 1) / 2 */
-#define C (0.5 * 1.0)
- GLfloat vertexes[20][3] =
- {
- {-A, 0.0, B},
- {-A, 0.0, -B},
- {A, 0.0, -B},
- {A, 0.0, B},
- {B, -A, 0.0},
- {-B, -A, 0.0},
- {-B, A, 0.0},
- {B, A, 0.0},
- {0.0, B, -A},
- {0.0, -B, -A},
- {0.0, -B, A},
- {0.0, B, A},
- {-C, -C, C},
- {-C, -C, -C},
- {C, -C, -C},
- {C, -C, C},
- {-C, C, C},
- {-C, C, -C},
- {C, C, -C},
- {C, C, C},
- };
-#undef A
-#undef B
-#undef C
- GLint polygons[12][5] =
- {
- {0, 12, 10, 11, 16},
- {1, 17, 8, 9, 13},
- {2, 14, 9, 8, 18},
- {3, 19, 11, 10, 15},
- {4, 14, 2, 3, 15},
- {5, 12, 0, 1, 13},
- {6, 17, 1, 0, 16},
- {7, 19, 3, 2, 18},
- {8, 17, 6, 7, 18},
- {9, 14, 4, 5, 13},
- {10, 12, 5, 4, 15},
- {11, 19, 7, 6, 16},
- };
- int i;
-
- glColor3f(0.75, 0.75, 0.75);
- for (i = 0; i < 12; ++i) {
- GLfloat *p0, *p1, *p2, d;
- GLfloat u[3], v[3], n[3];
-
- p0 = &vertexes[polygons[i][0]][0];
- p1 = &vertexes[polygons[i][1]][0];
- p2 = &vertexes[polygons[i][2]][0];
-
- u[0] = p2[0] - p1[0];
- u[1] = p2[1] - p1[1];
- u[2] = p2[2] - p1[2];
-
- v[0] = p0[0] - p1[0];
- v[1] = p0[1] - p1[1];
- v[2] = p0[2] - p1[2];
-
- n[0] = u[1] * v[2] - u[2] * v[1];
- n[1] = u[2] * v[0] - u[0] * v[2];
- n[2] = u[0] * v[1] - u[1] * v[0];
-
- d = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
- n[0] *= d;
- n[1] *= d;
- n[2] *= d;
-
- glBegin(GL_POLYGON);
- glNormal3fv(n);
- glVertex3fv(p0);
- glVertex3fv(p1);
- glVertex3fv(p2);
- glVertex3fv(vertexes[polygons[i][3]]);
- glVertex3fv(vertexes[polygons[i][4]]);
- glEnd();
- }
-}
-
-void
-drawSphere(void)
-{
- int numMajor = 24;
- int numMinor = 32;
- float radius = 0.8;
- double majorStep = (M_PI / numMajor);
- double minorStep = (2.0 * M_PI / numMinor);
- int i, j;
-
- glColor3f(0.50, 0.50, 0.50);
- for (i = 0; i < numMajor; ++i) {
- double a = i * majorStep;
- double b = a + majorStep;
- double r0 = radius * sin(a);
- double r1 = radius * sin(b);
- GLfloat z0 = radius * cos(a);
- GLfloat z1 = radius * cos(b);
-
- glBegin(GL_TRIANGLE_STRIP);
- for (j = 0; j <= numMinor; ++j) {
- double c = j * minorStep;
- GLfloat x = cos(c);
- GLfloat y = sin(c);
-
- glNormal3f((x * r0) / radius, (y * r0) / radius, z0 / radius);
- glTexCoord2f(j / (GLfloat) numMinor, i / (GLfloat) numMajor);
- glVertex3f(x * r0, y * r0, z0);
-
- glNormal3f((x * r1) / radius, (y * r1) / radius, z1 / radius);
- glTexCoord2f(j / (GLfloat) numMinor, (i + 1) / (GLfloat) numMajor);
- glVertex3f(x * r1, y * r1, z1);
- }
- glEnd();
- }
-}
-
-/*****************************************************************/
-
-float xmin = -0.035, xmax = 0.035;
-float ymin = -0.035, ymax = 0.035;
-float nnear = 0.1;
-float ffar = 1.9;
-float distance = -1.0;
-
-static void
-loadTextureProjection(int texUnit, GLfloat m[16])
-{
- GLfloat mInverse[4][4];
-
- /* Should use true inverse, but since m consists only of rotations, we can
- just use the transpose. */
- matrixTranspose((GLfloat *) mInverse, m);
-
- ActiveTexture(GL_TEXTURE0_ARB + texUnit);
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glTranslatef(0.5, 0.5, 0.0);
- glScalef(0.5, 0.5, 1.0);
- glFrustum(xmin, xmax, ymin, ymax, nnear, ffar);
- glTranslatef(0.0, 0.0, distance);
- glMultMatrixf((GLfloat *) mInverse);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void
-drawTextureProjection(void)
-{
- float t = ffar / nnear;
- GLfloat n[4][3];
- GLfloat f[4][3];
-
- n[0][0] = xmin;
- n[0][1] = ymin;
- n[0][2] = -(nnear + distance);
-
- n[1][0] = xmax;
- n[1][1] = ymin;
- n[1][2] = -(nnear + distance);
-
- n[2][0] = xmax;
- n[2][1] = ymax;
- n[2][2] = -(nnear + distance);
-
- n[3][0] = xmin;
- n[3][1] = ymax;
- n[3][2] = -(nnear + distance);
-
- f[0][0] = xmin * t;
- f[0][1] = ymin * t;
- f[0][2] = -(ffar + distance);
-
- f[1][0] = xmax * t;
- f[1][1] = ymin * t;
- f[1][2] = -(ffar + distance);
-
- f[2][0] = xmax * t;
- f[2][1] = ymax * t;
- f[2][2] = -(ffar + distance);
-
- f[3][0] = xmin * t;
- f[3][1] = ymax * t;
- f[3][2] = -(ffar + distance);
-
- glColor3f(1.0, 1.0, 0.0);
- glBegin(GL_LINE_LOOP);
- glVertex3fv(n[0]);
- glVertex3fv(n[1]);
- glVertex3fv(n[2]);
- glVertex3fv(n[3]);
- glVertex3fv(f[3]);
- glVertex3fv(f[2]);
- glVertex3fv(f[1]);
- glVertex3fv(f[0]);
- glVertex3fv(n[0]);
- glVertex3fv(n[1]);
- glVertex3fv(f[1]);
- glVertex3fv(f[0]);
- glVertex3fv(f[3]);
- glVertex3fv(f[2]);
- glVertex3fv(n[2]);
- glVertex3fv(n[3]);
- glEnd();
-}
-
-/*****************************************************************/
-
-void
-initialize(void)
-{
- GLfloat light0Pos[4] =
- {0.3, 0.3, 0.0, 1.0};
- GLfloat matAmb[4] =
- {0.01, 0.01, 0.01, 1.00};
- GLfloat matDiff[4] =
- {0.65, 0.65, 0.65, 1.00};
- GLfloat matSpec[4] =
- {0.30, 0.30, 0.30, 1.00};
- GLfloat matShine = 10.0;
- GLfloat eyePlaneS[] =
- {1.0, 0.0, 0.0, 0.0};
- GLfloat eyePlaneT[] =
- {0.0, 1.0, 0.0, 0.0};
- GLfloat eyePlaneR[] =
- {0.0, 0.0, 1.0, 0.0};
- GLfloat eyePlaneQ[] =
- {0.0, 0.0, 0.0, 1.0};
- int i;
-
- /* Setup Misc. */
- glClearColor(0.41, 0.41, 0.31, 0.0);
-
- glEnable(GL_DEPTH_TEST);
-
- /* glLineWidth(2.0);*/
-
- glCullFace(GL_FRONT);
- glEnable(GL_CULL_FACE);
-
- glMatrixMode(GL_PROJECTION);
- glFrustum(-0.5, 0.5, -0.5, 0.5, 1, 3);
- glMatrixMode(GL_MODELVIEW);
- glTranslatef(0, 0, -2);
-
- matrixIdentity((GLfloat *) objectXform);
- for (i = 0; i < NumTextures; i++) {
- matrixIdentity((GLfloat *) textureXform[i]);
- }
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 1, 0, 1, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- glRasterPos2i(0, 0);
-
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
-
- /* Setup Lighting */
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matAmb);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matSpec);
- glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, matShine);
-
- glEnable(GL_COLOR_MATERIAL);
-
- glLightfv(GL_LIGHT0, GL_POSITION, light0Pos);
- glEnable(GL_LIGHT0);
-
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
- glEnable(GL_LIGHTING);
-
- /* Setup Texture */
-
- (*loadTexture) ();
-
-
- for (i = 0; i < NumTextures; i++) {
- ActiveTexture(GL_TEXTURE0_ARB + i);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
- glTexGenfv(GL_S, GL_EYE_PLANE, eyePlaneS);
-
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
- glTexGenfv(GL_T, GL_EYE_PLANE, eyePlaneT);
-
- glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
- glTexGenfv(GL_R, GL_EYE_PLANE, eyePlaneR);
-
- glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
- glTexGenfv(GL_Q, GL_EYE_PLANE, eyePlaneQ);
- }
-}
-
-void
-display(void)
-{
- int i;
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- if (textureEnabled) {
- if (mode == MoveTexture || mode == MoveView) {
- /* Have OpenGL compute the new transformation (simple but slow). */
- for (i = 0; i < NumTextures; i++) {
- glPushMatrix();
- glLoadIdentity();
-#if 0
- if (i & 1)
- glRotatef(angle, axis[0], axis[1], axis[2]);
- else
-#endif
- glRotatef(angle*(i+1), axis[0], axis[1], axis[2]);
-
- glMultMatrixf((GLfloat *) textureXform[i]);
- glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) textureXform[i]);
- glPopMatrix();
- }
- }
- for (i = 0; i < NumTextures; i++) {
- loadTextureProjection(i, (GLfloat *) textureXform[i]);
- }
-
- if (showProjection) {
- for (i = 0; i < NumTextures; i++) {
- ActiveTexture(GL_TEXTURE0_ARB + i);
- glPushMatrix();
- glMultMatrixf((GLfloat *) textureXform[i]);
- glDisable(GL_LIGHTING);
- drawTextureProjection();
- glEnable(GL_LIGHTING);
- glPopMatrix();
- }
- }
- for (i = 0; i < NumTextures; i++) {
- ActiveTexture(GL_TEXTURE0_ARB + i);
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glEnable(GL_TEXTURE_GEN_R);
- glEnable(GL_TEXTURE_GEN_Q);
- }
- }
- if (mode == MoveObject || mode == MoveView) {
- /* Have OpenGL compute the new transformation (simple but slow). */
- glPushMatrix();
- glLoadIdentity();
- glRotatef(angle, axis[0], axis[1], axis[2]);
- glMultMatrixf((GLfloat *) objectXform);
- glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) objectXform);
- glPopMatrix();
- }
- glPushMatrix();
- glMultMatrixf((GLfloat *) objectXform);
- (*drawObject) ();
- glPopMatrix();
-
- for (i = 0; i < NumTextures; i++) {
- ActiveTexture(GL_TEXTURE0_ARB + i);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- glDisable(GL_TEXTURE_GEN_R);
- glDisable(GL_TEXTURE_GEN_Q);
- }
-
- if (zoomFactor > 1.0) {
- glDisable(GL_DEPTH_TEST);
- glCopyPixels(0, 0, winWidth / zoomFactor, winHeight / zoomFactor, GL_COLOR);
- glEnable(GL_DEPTH_TEST);
- }
- glFlush();
- glutSwapBuffers();
- checkErrors();
-}
-
-/*****************************************************************/
-
-/* simple trackball-like motion control */
-float lastPos[3];
-int lastTime;
-
-void
-ptov(int x, int y, int width, int height, float v[3])
-{
- float d, a;
-
- /* project x,y onto a hemi-sphere centered within width, height */
- v[0] = (2.0 * x - width) / width;
- v[1] = (height - 2.0 * y) / height;
- d = sqrt(v[0] * v[0] + v[1] * v[1]);
- v[2] = cos((M_PI / 2.0) * ((d < 1.0) ? d : 1.0));
- a = 1.0 / sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
- v[0] *= a;
- v[1] *= a;
- v[2] *= a;
-}
-
-void
-startMotion(int x, int y, int but, int time)
-{
- if (but == GLUT_LEFT_BUTTON) {
- mode = MoveView;
- } else if (but == GLUT_MIDDLE_BUTTON) {
- mode = MoveTexture;
- } else {
- return;
- }
-
- lastTime = time;
- ptov(x, y, winWidth, winHeight, lastPos);
-}
-
-void
-animate(void)
-{
- glutPostRedisplay();
-}
-
-void
-vis(int visible)
-{
- if (visible == GLUT_VISIBLE) {
- if (redrawContinuously)
- glutIdleFunc(animate);
- } else {
- if (redrawContinuously)
- glutIdleFunc(NULL);
- }
-}
-
-void
-stopMotion(int but, int time)
-{
- if ((but == GLUT_LEFT_BUTTON && mode == MoveView) ||
- (but == GLUT_MIDDLE_BUTTON && mode == MoveTexture)) {
- } else {
- return;
- }
-
- if (time == lastTime) {
- /* redrawContinuously = GL_TRUE;*/
- glutIdleFunc(animate);
- } else {
- angle = 0.0;
- redrawContinuously = GL_FALSE;
- glutIdleFunc(0);
- }
- if (!redrawContinuously) {
- mode = MoveNone;
- }
-}
-
-void
-trackMotion(int x, int y)
-{
- float curPos[3], dx, dy, dz;
-
- ptov(x, y, winWidth, winHeight, curPos);
-
- dx = curPos[0] - lastPos[0];
- dy = curPos[1] - lastPos[1];
- dz = curPos[2] - lastPos[2];
- angle = 90.0 * sqrt(dx * dx + dy * dy + dz * dz);
-
- axis[0] = lastPos[1] * curPos[2] - lastPos[2] * curPos[1];
- axis[1] = lastPos[2] * curPos[0] - lastPos[0] * curPos[2];
- axis[2] = lastPos[0] * curPos[1] - lastPos[1] * curPos[0];
-
- lastTime = glutGet(GLUT_ELAPSED_TIME);
- lastPos[0] = curPos[0];
- lastPos[1] = curPos[1];
- lastPos[2] = curPos[2];
- glutPostRedisplay();
-}
-
-/*****************************************************************/
-
-void
-object(void)
-{
- static int object;
-
- object++;
- object %= 3;
- switch (object) {
- case 0:
- drawObject = drawCube;
- break;
- case 1:
- drawObject = drawDodecahedron;
- break;
- case 2:
- drawObject = drawSphere;
- break;
- default:
- break;
- }
-}
-
-static void
-nop(void)
-{
-}
-
-void
-texture(void)
-{
- static int texture = 0;
-
- texture++;
- texture %= 3;
- if (texture == 1 && texFilename == NULL) {
- /* Skip file texture if not loaded. */
- texture++;
- }
- switch (texture) {
- case 0:
- loadTexture = nop;
- textureEnabled = GL_FALSE;
- break;
- case 1:
- loadTexture = loadImageTextures;
- (*loadTexture) ();
- textureEnabled = GL_TRUE;
- break;
- case 2:
- loadTexture = loadSpotlightTexture;
- (*loadTexture) ();
- textureEnabled = GL_TRUE;
- break;
- default:
- break;
- }
-}
-
-void
-help(void)
-{
- printf("'h' - help\n");
- printf("'l' - toggle linear/nearest filter\n");
- printf("'s' - toggle projection frustum\n");
- printf("'t' - toggle projected texture\n");
- printf("'o' - toggle object\n");
- printf("'z' - increase zoom factor\n");
- printf("'Z' - decrease zoom factor\n");
- printf("left mouse - move view\n");
- printf("middle mouse - move projection\n");
-}
-
-/* ARGSUSED1 */
-void
-key(unsigned char key, int x, int y)
-{
- switch (key) {
- case '\033':
- exit(0);
- break;
- case 'l':
- linearFilter = !linearFilter;
- (*loadTexture) ();
- break;
- case 's':
- showProjection = !showProjection;
- break;
- case 't':
- texture();
- break;
- case 'o':
- object();
- break;
- case 'z':
- zoomFactor += 1.0;
- glPixelZoom(zoomFactor, zoomFactor);
- glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor);
- break;
- case 'Z':
- zoomFactor -= 1.0;
- if (zoomFactor < 1.0)
- zoomFactor = 1.0;
- glPixelZoom(zoomFactor, zoomFactor);
- glViewport(0, 0, winWidth / zoomFactor, winHeight / zoomFactor);
- break;
- case 'h':
- help();
- break;
- }
- glutPostRedisplay();
-}
-
-void
-mouse(int button, int state, int x, int y)
-{
- if (state == GLUT_DOWN)
- startMotion(x, y, button, glutGet(GLUT_ELAPSED_TIME));
- else if (state == GLUT_UP)
- stopMotion(button, glutGet(GLUT_ELAPSED_TIME));
- glutPostRedisplay();
-}
-
-void
-reshape(int w, int h)
-{
- winWidth = w;
- winHeight = h;
- glViewport(0, 0, w / zoomFactor, h / zoomFactor);
-}
-
-
-void
-menu(int selection)
-{
- if (selection == 666) {
- exit(0);
- }
- key((unsigned char) selection, 0, 0);
-}
-
-int
-main(int argc, char **argv)
-{
- glutInit(&argc, argv);
-
- if (argc > 1) {
- NumTextures = atoi(argv[1]);
- }
- assert(NumTextures <= MAX_TEX);
-
- glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
- (void) glutCreateWindow("projtex");
-
- loadTexture = loadImageTextures;
- drawObject = drawCube;
- initialize();
- glutDisplayFunc(display);
- glutKeyboardFunc(key);
- glutReshapeFunc(reshape);
- glutMouseFunc(mouse);
- glutMotionFunc(trackMotion);
- glutVisibilityFunc(vis);
- glutCreateMenu(menu);
- glutAddMenuEntry("Toggle showing projection", 's');
- glutAddMenuEntry("Switch texture", 't');
- glutAddMenuEntry("Switch object", 'o');
- glutAddMenuEntry("Toggle filtering", 'l');
- glutAddMenuEntry("Quit", 666);
- glutAttachMenu(GLUT_RIGHT_BUTTON);
- texture();
- glutMainLoop();
- return 0; /* ANSI C requires main to return int. */
-}
diff --git a/progs/tests/readrate.c b/progs/tests/readrate.c
deleted file mode 100644
index 42ae62d48a9..00000000000
--- a/progs/tests/readrate.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Test glReadPixels speed
- * Brian Paul
- * 9 April 2004
- *
- * Compile:
- * gcc readrate.c -L/usr/X11R6/lib -lglut -lGLU -lGL -lX11 -o readrate
- */
-
-#define GL_GLEXT_PROTOTYPES
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-/* Hack, to test drawing instead of reading */
-#define DRAW 0
-
-#define MAX_WIDTH 1280
-#define MAX_HEIGHT 1024
-
-#define NUM_WIDTHS 4
-#define NUM_HEIGHTS 4
-static const GLint Widths[] = {256, 512, 1024, 1280};
-static const GLint Heights[] = {4, 32, 256, 512, 768, 1024};
-static int WidthIndex = 1, HeightIndex = 3;
-static GLubyte *Buffer = NULL;
-static GLboolean Benchmark = GL_TRUE;
-
-#define NUM_PBO 2
-
-static GLuint PBObjects[4];
-
-static GLboolean HavePBO = GL_FALSE;
-
-
-struct format_type {
- const char *Name;
- GLuint Bytes;
- GLenum Format;
- GLenum Type;
-};
-
-static struct format_type Formats[] = {
- { "GL_RGB, GLubyte", 3, GL_RGB, GL_UNSIGNED_BYTE },
- { "GL_BGR, GLubyte", 3, GL_BGR, GL_UNSIGNED_BYTE },
- { "GL_RGBA, GLubyte", 4, GL_RGBA, GL_UNSIGNED_BYTE },
- { "GL_BGRA, GLubyte", 4, GL_BGRA, GL_UNSIGNED_BYTE },
- { "GL_ABGR, GLubyte", 4, GL_ABGR_EXT, GL_UNSIGNED_BYTE },
- { "GL_RGBA, GLuint_8_8_8_8", 4, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8 },
- { "GL_BGRA, GLuint_8_8_8_8", 4, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8 },
- { "GL_BGRA, GLuint_8_8_8_8_rev", 4, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV },
-#ifdef GL_EXT_packed_depth_stencil
- { "GL_DEPTH_STENCIL_EXT, GLuint24+8", 4, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT },
-#endif
- { "GL_DEPTH_COMPONENT, GLfloat", 4, GL_DEPTH_COMPONENT, GL_FLOAT },
- { "GL_DEPTH_COMPONENT, GLuint", 4, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT }
-};
-
-#define NUM_FORMATS (sizeof(Formats) / sizeof(struct format_type))
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-static void
-MeasureFormat(struct format_type *fmt, GLint width, GLint height, GLuint pbo)
-{
- double t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
- double t1;
- int j;
-
- for (j = 0; ; j++) {
-
- glBegin(GL_POINTS);
- glVertex2f(1,1);
- glEnd();
-
-#if DRAW
- glWindowPos2iARB(0,0);
- glDrawPixels(width, height,
- fmt->Format, fmt->Type, Buffer);
- glFinish();
-#else
- if (pbo) {
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, PBObjects[j % NUM_PBO]);
- glReadPixels(0, 0, width, height,
- fmt->Format, fmt->Type, 0);
- }
- else {
- glReadPixels(0, 0, width, height,
- fmt->Format, fmt->Type, Buffer);
- }
-#endif
-
- t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
- if (t1 - t0 > 2.0) {
- GLdouble rate = width * height / (1024.0 * 1024.0) * j / (t1 - t0);
-#if DRAW
- printf("%-32s %.2f draws/sec %.2f MPixels/sec %.2f MBytes/sec\n",
- fmt->Name, j / (t1-t0), rate, rate * fmt->Bytes);
-#else
- printf("%-32s %.2f reads/sec %.2f MPixels/sec %.2f MBytes/sec\n",
- fmt->Name, j / (t1-t0), rate, rate * fmt->Bytes);
-#endif
- break;
- }
-
- if (j == 0) {
- /* check for error */
- GLenum err = glGetError();
- if (err) {
- printf("GL Error 0x%x for %s\n", err, fmt->Name);
- return;
- }
- }
- }
-}
-
-
-
-static void
-Draw(void)
-{
- char str[1000];
- int width = Widths[WidthIndex];
- int height = Heights[HeightIndex];
- int y = MAX_HEIGHT - 50;
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glWindowPos2iARB(10, y);
- sprintf(str, "ReadPixels size: %d x %d", width, height);
- PrintString(str);
- y -= 14;
-
- glWindowPos2iARB(10, y);
- PrintString("Press up/down/left/right to change image size.");
- y -= 14;
-
- glWindowPos2iARB(10, y);
- PrintString("Press 'b' to run benchmark test.");
- y -= 14;
-
- if (Benchmark) {
- glWindowPos2iARB(10, y);
- PrintString("Testing...");
- }
-
- glutSwapBuffers();
-
- if (Benchmark) {
- GLuint i, pbo;
-#if DRAW
- printf("Draw size: Width=%d Height=%d\n", width, height);
-#else
- printf("Read size: Width=%d Height=%d\n", width, height);
-#endif
- for (pbo = 0; pbo <= HavePBO; pbo++) {
- printf("Pixel Buffer Object: %d\n", pbo);
-
- if (pbo == 0) {
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, 0);
- }
-
- for (i = 0; i < NUM_FORMATS; i++) {
- MeasureFormat(Formats + i, width, height, pbo);
- }
- }
-
- Benchmark = GL_FALSE;
-
- /* redraw window text */
- glutPostRedisplay();
- }
-
-}
-
-
-static void
-Reshape(int width, int height)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1, 1, -1, 1, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-
-static void
-Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'b':
- Benchmark = 1;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-SpecialKey(int key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- if (HeightIndex + 1 < NUM_WIDTHS)
- HeightIndex++;
- break;
- case GLUT_KEY_DOWN:
- if (HeightIndex > 0)
- HeightIndex--;
- break;
- case GLUT_KEY_LEFT:
- if (WidthIndex > 0)
- WidthIndex--;
- break;
- case GLUT_KEY_RIGHT:
- if (WidthIndex + 1 < NUM_HEIGHTS)
- WidthIndex++;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init(void)
-{
- Buffer = malloc(MAX_WIDTH * MAX_HEIGHT * 4);
- assert(Buffer);
-#if DRAW
- printf("glDrawPixels test report:\n");
-#else
- printf("glReadPixels test report:\n");
-#endif
- printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
-
- if (glutExtensionSupported("GL_ARB_pixel_buffer_object")) {
- int i;
- HavePBO = 1;
- glGenBuffersARB(NUM_PBO, PBObjects);
- for (i = 0; i < NUM_PBO; i++) {
- glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, PBObjects[i]);
- glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT,
- MAX_WIDTH * MAX_HEIGHT * 4, NULL, GL_STREAM_READ);
- }
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(MAX_WIDTH, MAX_HEIGHT);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutSpecialFunc(SpecialKey);
- glutDisplayFunc(Draw);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/seccolor.c b/progs/tests/seccolor.c
deleted file mode 100644
index 77fd40647ba..00000000000
--- a/progs/tests/seccolor.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Exercise GL_EXT_secondary_color
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static int Width = 600;
-static int Height = 200;
-static GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- GLfloat t;
-
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- for (t = 0.0; t <= 1.0; t += 0.25) {
- GLfloat x = t * 10.0 - 5.0;
- GLfloat g = t;
-
- /* top row: untextured */
- glColor3f(1, 0, 0);
- glPushMatrix();
- glTranslatef(x, 1.2, 0);
-#if defined(GL_EXT_secondary_color)
- glSecondaryColor3fEXT(0, g, 0);
-#endif
- glBegin(GL_POLYGON);
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
- glPopMatrix();
-
- /* bottom row: textured */
- glColor3f(1, 1, 1);
- glEnable(GL_TEXTURE_2D);
- glPushMatrix();
- glTranslatef(x, -1.2, 0);
-#if defined(GL_EXT_secondary_color)
- glSecondaryColor3fEXT(0, g, 0);
-#endif
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glTexCoord2f(0, 1); glVertex2f(-1, 1);
- glEnd();
- glPopMatrix();
- glDisable(GL_TEXTURE_2D);
- }
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- GLubyte image[4*4][3];
- GLint i;
- if (!glutExtensionSupported("GL_EXT_secondary_color")) {
- printf("Sorry, this program requires GL_EXT_secondary_color\n");
- exit(1);
- }
-
- /* setup red texture with one back texel */
- for (i = 0; i < 4*4; i++) {
- if (i == 0) {
- image[i][0] = 0;
- image[i][1] = 0;
- image[i][2] = 0;
- }
- else {
- image[i][0] = 255;
- image[i][1] = 0;
- image[i][2] = 0;
- }
- }
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0,
- GL_RGB, GL_UNSIGNED_BYTE, image);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-#if defined(GL_EXT_secondary_color)
- glEnable(GL_COLOR_SUM_EXT);
-#endif
- glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
-
- printf("Squares should be colored from red -> orange -> yellow.\n");
- printf("Top row is untextured.\n");
- printf("Bottom row is textured (red texture with one black texel).\n");
- printf("Rows should be identical, except for lower-left texel.\n");
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/sharedtex.c b/progs/tests/sharedtex.c
deleted file mode 100644
index c3eef95fb35..00000000000
--- a/progs/tests/sharedtex.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/* $Id: sharedtex.c,v 1.2 2002-01-16 14:32:46 joukj Exp $ */
-
-/*
- * Test sharing of display lists and texture objects between GLX contests.
- * Brian Paul
- * Summer 2000
- *
- *
- * Copyright (C) 2000 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.
- */
-
-
-#include <GL/gl.h>
-#include <GL/glx.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-
-struct window {
- char DisplayName[1000];
- Display *Dpy;
- Window Win;
- GLXContext Context;
- float Angle;
- int Id;
-};
-
-
-#define MAX_WINDOWS 20
-static struct window Windows[MAX_WINDOWS];
-static int NumWindows = 0;
-
-
-static GLuint Textures[3];
-static GLuint CubeList;
-
-
-
-static void
-Error(const char *display, const char *msg)
-{
- fprintf(stderr, "Error on display %s - %s\n", display, msg);
- exit(1);
-}
-
-
-static struct window *
-AddWindow(const char *displayName, int xpos, int ypos,
- const struct window *shareWindow)
-{
- Display *dpy;
- Window win;
- GLXContext ctx;
- int attrib[] = { GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- GLX_DEPTH_SIZE, 1,
- None };
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- XVisualInfo *visinfo;
- int width = 300, height = 300;
-
- if (NumWindows >= MAX_WINDOWS)
- return NULL;
-
- dpy = XOpenDisplay(displayName);
- if (!dpy) {
- Error(displayName, "Unable to open display");
- return NULL;
- }
-
- scrnum = DefaultScreen(dpy);
- root = RootWindow(dpy, scrnum);
-
- visinfo = glXChooseVisual(dpy, scrnum, attrib);
- if (!visinfo) {
- Error(displayName, "Unable to find RGB, double-buffered visual");
- return NULL;
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(dpy, root, xpos, ypos, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr);
- if (!win) {
- Error(displayName, "Couldn't create window");
- return NULL;
- }
-
- {
- XSizeHints sizehints;
- sizehints.x = xpos;
- sizehints.y = ypos;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(dpy, win, &sizehints);
- XSetStandardProperties(dpy, win, displayName, displayName,
- None, (char **)NULL, 0, &sizehints);
- }
-
-
- ctx = glXCreateContext(dpy, visinfo,
- shareWindow ? shareWindow->Context : NULL,
- True);
- if (!ctx) {
- Error(displayName, "Couldn't create GLX context");
- return NULL;
- }
-
- XMapWindow(dpy, win);
-
- if (!glXMakeCurrent(dpy, win, ctx)) {
- Error(displayName, "glXMakeCurrent failed");
- printf("glXMakeCurrent failed in Redraw()\n");
- return NULL;
- }
-
- /* save the info for this window */
- {
- static int id = 0;
- struct window *h = &Windows[NumWindows];
- strcpy(h->DisplayName, displayName);
- h->Dpy = dpy;
- h->Win = win;
- h->Context = ctx;
- h->Angle = 0.0;
- h->Id = id++;
- NumWindows++;
- return &Windows[NumWindows-1];
- }
-
-}
-
-
-static void
-InitGLstuff(struct window *h)
-{
- if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) {
- Error(h->DisplayName, "glXMakeCurrent failed in InitGLstuff");
- return;
- }
-
- glGenTextures(3, Textures);
-
- /* setup first texture object */
- {
- GLubyte image[16][16][4];
- GLint i, j;
- glBindTexture(GL_TEXTURE_2D, Textures[0]);
-
- /* red/white checkerboard */
- for (i = 0; i < 16; i++) {
- for (j = 0; j < 16; j++) {
- if ((i ^ j) & 1) {
- image[i][j][0] = 255;
- image[i][j][1] = 255;
- image[i][j][2] = 255;
- image[i][j][3] = 255;
- }
- else {
- image[i][j][0] = 255;
- image[i][j][1] = 0;
- image[i][j][2] = 0;
- image[i][j][3] = 255;
- }
- }
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, image);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
-
- /* setup second texture object */
- {
- GLubyte image[8][8][3];
- GLint i, j;
- glBindTexture(GL_TEXTURE_2D, Textures[1]);
-
- /* green/yellow checkerboard */
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- if ((i ^ j) & 1) {
- image[i][j][0] = 0;
- image[i][j][1] = 255;
- image[i][j][2] = 0;
- }
- else {
- image[i][j][0] = 255;
- image[i][j][1] = 255;
- image[i][j][2] = 0;
- }
- }
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB,
- GL_UNSIGNED_BYTE, image);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
-
- /* setup second texture object */
- {
- GLubyte image[4][4][3];
- GLint i, j;
- glBindTexture(GL_TEXTURE_2D, Textures[2]);
-
- /* blue/gray checkerboard */
- for (i = 0; i < 4; i++) {
- for (j = 0; j < 4; j++) {
- if ((i ^ j) & 1) {
- image[i][j][0] = 0;
- image[i][j][1] = 0;
- image[i][j][2] = 255;
- }
- else {
- image[i][j][0] = 200;
- image[i][j][1] = 200;
- image[i][j][2] = 200;
- }
- }
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 4, 4, 0, GL_RGB,
- GL_UNSIGNED_BYTE, image);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
-
- /* Now make the cube object display list */
- CubeList = glGenLists(1);
- glNewList(CubeList, GL_COMPILE);
- {
- glBindTexture(GL_TEXTURE_2D, Textures[0]);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
- glTexCoord2f(1, 0); glVertex3f(-1, 1, -1);
- glTexCoord2f(1, 1); glVertex3f(-1, 1, 1);
- glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
- glEnd();
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex3f(1, -1, -1);
- glTexCoord2f(1, 0); glVertex3f(1, 1, -1);
- glTexCoord2f(1, 1); glVertex3f(1, 1, 1);
- glTexCoord2f(0, 1); glVertex3f(1, -1, 1);
- glEnd();
-
- glBindTexture(GL_TEXTURE_2D, Textures[1]);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
- glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
- glTexCoord2f(1, 1); glVertex3f( 1, -1, 1);
- glTexCoord2f(0, 1); glVertex3f(-1, -1, 1);
- glEnd();
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex3f(-1, 1, -1);
- glTexCoord2f(1, 0); glVertex3f( 1, 1, -1);
- glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
- glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
- glEnd();
-
- glBindTexture(GL_TEXTURE_2D, Textures[2]);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex3f(-1, -1, -1);
- glTexCoord2f(1, 0); glVertex3f( 1, -1, -1);
- glTexCoord2f(1, 1); glVertex3f( 1, 1, -1);
- glTexCoord2f(0, 1); glVertex3f(-1, 1, -1);
- glEnd();
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex3f(-1, -1, 1);
- glTexCoord2f(1, 0); glVertex3f( 1, -1, 1);
- glTexCoord2f(1, 1); glVertex3f( 1, 1, 1);
- glTexCoord2f(0, 1); glVertex3f(-1, 1, 1);
- glEnd();
- }
- glEndList();
-
- printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR));
-}
-
-
-
-static void
-Redraw(struct window *h)
-{
- if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) {
- Error(h->DisplayName, "glXMakeCurrent failed");
- printf("glXMakeCurrent failed in Redraw()\n");
- return;
- }
-
- h->Angle += 1.0;
-
- glShadeModel(GL_FLAT);
- glClearColor(0.25, 0.25, 0.25, 1.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_DEPTH_TEST);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- glColor3f(1, 1, 1);
-
- glPushMatrix();
- if (h->Id == 0)
- glRotatef(h->Angle, 0, 1, -1);
- else if (h->Id == 1)
- glRotatef(-(h->Angle), 0, 1, -1);
- else if (h->Id == 2)
- glRotatef(h->Angle, 0, 1, 1);
- else if (h->Id == 3)
- glRotatef(-(h->Angle), 0, 1, 1);
- glCallList(CubeList);
- glPopMatrix();
-
- glXSwapBuffers(h->Dpy, h->Win);
-}
-
-
-
-static void
-Resize(const struct window *h, unsigned int width, unsigned int height)
-{
- if (!glXMakeCurrent(h->Dpy, h->Win, h->Context)) {
- Error(h->DisplayName, "glXMakeCurrent failed in Resize()");
- return;
- }
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1, 1, -1, 1, 2, 10);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0, 0, -3.5);
-}
-
-
-
-static void
-EventLoop(void)
-{
- while (1) {
- int i;
- for (i = 0; i < NumWindows; i++) {
- struct window *h = &Windows[i];
- while (XPending(h->Dpy) > 0) {
- XEvent event;
- XNextEvent(h->Dpy, &event);
- if (event.xany.window == h->Win) {
- switch (event.type) {
- case Expose:
- Redraw(h);
- break;
- case ConfigureNotify:
- Resize(h, event.xconfigure.width, event.xconfigure.height);
- break;
- case KeyPress:
- return;
- default:
- /*no-op*/ ;
- }
- }
- else {
- printf("window mismatch\n");
- }
- }
- Redraw(h);
- }
- usleep(1);
- }
-}
-
-
-
-static void
-PrintInfo(const struct window *h)
-{
- printf("Name: %s\n", h->DisplayName);
- printf(" Display: 0x%x\n", h->Dpy);
- printf(" Window: 0x%x\n", h->Win);
- printf(" Context: 0x%x\n", h->Context);
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int i;
- struct window *h0, *h1, *h2, *h3;
-
- /* four windows and contexts sharing display lists and texture objects */
- h0 = AddWindow(":0", 10, 10, NULL);
- h1 = AddWindow(":0", 330, 10, h0);
- h2 = AddWindow(":0", 10, 350, h0);
- h3 = AddWindow(":0", 330, 350, h0);
-
- InitGLstuff(h0);
-
- EventLoop();
- return 0;
-}
diff --git a/progs/tests/stencil_wrap.c b/progs/tests/stencil_wrap.c
deleted file mode 100644
index 88cf3809caf..00000000000
--- a/progs/tests/stencil_wrap.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2004
- * 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
- * VA LINUX SYSTEM, IBM 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.
- */
-
-/**
- * \file stencil_wrap.c
- *
- * Simple test of GL_EXT_stencil_wrap functionality. Four squares are drawn
- * with different stencil modes, but all should be rendered with the same
- * final color.
- *
- * \author Ian Romanick <idr@us.ibm.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <GL/glut.h>
-
-static int Width = 550;
-static int Height = 200;
-static const GLfloat Near = 5.0, Far = 25.0;
-
-
-static void Display( void )
-{
- GLint max_stencil;
- GLint stencil_bits;
- unsigned i;
-
-
- glGetIntegerv( GL_STENCIL_BITS, & stencil_bits );
- max_stencil = (1U << stencil_bits) - 1;
- printf( "Stencil bits = %u, maximum stencil value = 0x%08x\n",
- stencil_bits, max_stencil );
-
- glClearStencil( 0 );
- glClearColor( 0.2, 0.2, 0.8, 0 );
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
- | GL_STENCIL_BUFFER_BIT );
-
-
- glPushMatrix();
-
- /* This is the "reference" square.
- */
-
- glDisable(GL_STENCIL_TEST);
- glTranslatef(-6.0, 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glEnable(GL_STENCIL_TEST);
-
- /* Draw the first two squares using the two non-wrap (i.e., saturate)
- * modes.
- */
-
- glStencilFunc(GL_ALWAYS, 0, ~0);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
-
- glTranslatef(3.0, 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.9, 0.9, 0.9 );
-
- for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- }
- glEnd();
-
- glStencilFunc(GL_EQUAL, max_stencil, ~0);
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
- glStencilFunc(GL_ALWAYS, 0, ~0);
- glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
-
- glTranslatef(3.0, 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.9, 0.9, 0.9 );
-
- for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- }
- glEnd();
-
- glStencilFunc(GL_EQUAL, 0, ~0);
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
-
-
- /* Draw the last two squares using the two wrap modes.
- */
-
- glStencilFunc(GL_ALWAYS, 0, ~0);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP);
-
- glTranslatef(3.0, 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.9, 0.9, 0.9 );
-
- for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- }
- glEnd();
-
- glStencilFunc(GL_EQUAL, 4, ~0);
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
-
- glStencilFunc(GL_ALWAYS, 0, ~0);
- glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP);
-
- glTranslatef(3.0, 0, 0);
- glBegin(GL_QUADS);
- glColor3f( 0.9, 0.9, 0.9 );
-
- for ( i = 0 ; i < 5 ; i++ ) {
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- }
- glEnd();
-
- glStencilFunc(GL_EQUAL, (max_stencil - 4), ~0);
- glBegin(GL_QUADS);
- glColor3f( 0.5, 0.5, 0.5 );
- glVertex2f(-1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 1, 1);
- glVertex2f(-1, 1);
- glEnd();
-
-
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / (float) height;
- Width = width;
- Height = height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * const ver_string = (const char * const)
- glGetString( GL_VERSION );
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", ver_string);
-
- if ( !glutExtensionSupported("GL_EXT_stencil_wrap")
- && (atof( ver_string ) < 1.4) ) {
- printf("Sorry, this program requires either GL_EXT_stencil_wrap or OpenGL 1.4.\n");
- exit(1);
- }
-
- printf("\nAll 5 squares should be the same color.\n");
- glEnable( GL_BLEND );
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( Width, Height );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL );
- glutCreateWindow( "GL_EXT_stencil_wrap test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/stencilwrap.c b/progs/tests/stencilwrap.c
deleted file mode 100644
index 753375d0f3a..00000000000
--- a/progs/tests/stencilwrap.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Test GL_EXT_stencil_wrap extension.
- * This is by no means complete, just a quick check.
- *
- * Brian Paul 30 October 2002
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-GLboolean wrapping;
-
-static void RunTest(void)
-{
- const GLenum prim = GL_QUAD_STRIP;
- GLubyte val;
- int bits, max, i;
- int expected;
- GLboolean failed;
-
- glGetIntegerv(GL_STENCIL_BITS, &bits);
- max = (1 << bits) - 1;
-
-
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_ALWAYS, 0, ~0);
-
- /* test GL_KEEP */
- glClearStencil(max);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- failed = GL_FALSE;
- printf("Testing GL_KEEP...\n");
- expected = max;
- glBegin(prim);
- glVertex2f(0, 0);
- glVertex2f(10, 0);
- glVertex2f(0, 10);
- glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf("Failed GL_KEEP test(got %u, expected %u)\n", val, expected);
- failed = GL_TRUE;
- }
- else
- printf("OK!\n");
-
- /* test GL_ZERO */
- glClearStencil(max);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
- failed = GL_FALSE;
- printf("Testing GL_ZERO...\n");
- expected = 0;
- glBegin(prim);
- glVertex2f(0, 0);
- glVertex2f(10, 0);
- glVertex2f(0, 10);
- glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf("Failed GL_ZERO test(got %u, expected %u)\n", val, expected);
- failed = GL_TRUE;
- }
- else
- printf("OK!\n");
-
- /* test GL_REPLACE */
- glClearStencil(max);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
- failed = GL_FALSE;
- printf("Testing GL_REPLACE...\n");
- expected = 0;
- glBegin(prim);
- glVertex2f(0, 0);
- glVertex2f(10, 0);
- glVertex2f(0, 10);
- glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf("Failed GL_REPLACE test(got %u, expected %u)\n", val, expected);
- failed = GL_TRUE;
- }
- else
- printf("OK!\n");
-
- /* test GL_INCR (saturation) */
- glClearStencil(0);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
- failed = GL_FALSE;
- printf("Testing GL_INCR...\n");
- for (i = 1; i < max+10; i++) {
- expected = (i > max) ? max : i;
- glBegin(prim);
- glVertex2f(0, 0); glVertex2f(10, 0);
- glVertex2f(0, 10); glVertex2f(10, 10);
- glEnd();
-
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf( "Failed GL_INCR test on iteration #%u "
- "(got %u, expected %u)\n", i, val, expected );
- failed = GL_TRUE;
- }
- }
- if ( !failed )
- printf("OK!\n");
-
- /* test GL_DECR (saturation) */
- glClearStencil(max);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
- failed = GL_FALSE;
- printf("Testing GL_DECR...\n");
- for (i = max-1; i > -10; i--) {
- expected = (i < 0) ? 0 : i;
- glBegin(prim);
- glVertex2f(0, 0); glVertex2f(10, 0);
- glVertex2f(0, 10); glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf( "Failed GL_DECR test on iteration #%u "
- "(got %u, expected %u)\n", max - i, val, expected );
- failed = GL_TRUE;
- }
- }
- if ( !failed )
- printf("OK!\n");
-
- /* test GL_INVERT */
- glClearStencil(0);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT);
- failed = GL_FALSE;
- printf("Testing GL_INVERT...\n");
- expected = max;
- glBegin(prim);
- glVertex2f(0, 0);
- glVertex2f(10, 0);
- glVertex2f(0, 10);
- glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf("Failed GL_INVERT test(got %u, expected %u)\n", val, expected);
- failed = GL_TRUE;
- }
- else
- printf("OK!\n");
-
- if(wrapping)
- {
- /* test GL_INCR_WRAP_EXT (wrap around) */
- glClearStencil(0);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
- failed = GL_FALSE;
- printf("Testing GL_INCR_WRAP_EXT...\n");
- for (i = 1; i < max+10; i++) {
- expected = i % (max + 1);
- glBegin(prim);
- glVertex2f(0, 0); glVertex2f(10, 0);
- glVertex2f(0, 10); glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf( "Failed GL_INCR_WRAP test on iteration #%u "
- "(got %u, expected %u)\n", i, val, expected );
- failed = GL_TRUE;
- }
- }
- if ( !failed )
- printf("OK!\n");
-
- /* test GL_DECR_WRAP_EXT (wrap-around) */
- glClearStencil(max);
- glClear(GL_STENCIL_BUFFER_BIT);
- glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT);
- failed = GL_FALSE;
- printf("Testing GL_DECR_WRAP_EXT...\n");
- for (i = max-1; i > -10; i--) {
- expected = (i < 0) ? max + i + 1: i;
- glBegin(prim);
- glVertex2f(0, 0); glVertex2f(10, 0);
- glVertex2f(0, 10); glVertex2f(10, 10);
- glEnd();
- glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &val);
- if (val != expected) {
- printf( "Failed GL_DECR_WRAP test on iteration #%u "
- "(got %u, expected %u)\n", max - i, val, expected );
- failed = GL_TRUE;
- }
- }
- if ( !failed )
- printf("OK!\n");
- }
-
- glDisable(GL_STENCIL_TEST);
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- RunTest();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- const char * ver_str;
- float version;
-
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
-
-
- /* Check for both the extension string and GL version 1.4 on the
- * outside chance that some vendor exports version 1.4 but doesn't
- * export the extension string. The stencil-wrap modes are a required
- * part of GL 1.4.
- */
-
- ver_str = glGetString( GL_VERSION );
- version = (ver_str == NULL) ? 1.0 : atof( ver_str );
-
- wrapping = (glutExtensionSupported("GL_EXT_stencil_wrap") || (version >= 1.4));
- if (!wrapping)
- printf("GL_EXT_stencil_wrap not supported. Only testing the rest.\n");
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 400, 400 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_STENCIL );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/subtexrate.c b/progs/tests/subtexrate.c
deleted file mode 100644
index 568b68d552d..00000000000
--- a/progs/tests/subtexrate.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Measure glTexSubImage and glCopyTexSubImage speed
- *
- * Brian Paul
- * 26 Jan 2006
- */
-
-#define GL_GLEXT_PROTOTYPES
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-
-static GLint WinWidth = 1024, WinHeight = 512;
-static GLint TexWidth = 512, TexHeight = 512;
-
-static GLuint TexObj = 1;
-
-static GLenum IntFormat = GL_RGBA8;
-static GLenum ReadFormat = GL_RGBA; /* for glReadPixels */
-
-static GLboolean DrawQuad = GL_TRUE;
-
-
-/**
- * draw teapot image, size TexWidth by TexHeight
- */
-static void
-DrawTestImage(void)
-{
- GLfloat ar;
-
- glViewport(0, 0, TexWidth, TexHeight);
- glScissor(0, 0, TexWidth, TexHeight);
- glEnable(GL_SCISSOR_TEST);
-
- glClearColor(0.5, 0.5, 0.5, 0.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- ar = (float) TexWidth / TexHeight;
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
-
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
- glFrontFace(GL_CW);
- glPushMatrix();
- glRotatef(45, 1, 0, 0);
- glRotatef(45, 0, 1, 0);
- glutSolidTeapot(2.3);
- glPopMatrix();
- glFrontFace(GL_CCW);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
-
- glDisable(GL_SCISSOR_TEST);
-
- glViewport(0, 0, WinWidth, WinHeight);
- glFinish();
-}
-
-
-/**
- * Do glCopyTexSubImage2D call (update texture with framebuffer data)
- * If doSubRect is true, do the copy in four pieces instead of all at once.
- */
-static void
-DoCopyTex(GLboolean doSubRect)
-{
- if (doSubRect) {
- /* copy in four parts */
- int w = TexWidth / 2, h = TexHeight / 2;
- int x0 = 0, y0 = 0;
- int x1 = w, y1 = h;
-#if 1
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x0, y0, w, h);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x1, y0, w, h);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x0, y1, w, h);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x1, y1, w, h);
-#else
- /* scramble */
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x1, y1, w, h);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x0, y1, w, h);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x1, y0, w, h);
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x0, y0, w, h);
-#endif
- }
- else {
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
- }
-}
-
-
-/**
- * Do glTexSubImage2D (update texture w/ user data)
- * If doSubRect, do update in four pieces, else all at once.
- */
-static void
-SubTex(GLboolean doSubRect, const GLubyte *image)
-{
- if (doSubRect) {
- /* four pieces */
- int w = TexWidth / 2, h = TexHeight / 2;
- int x0 = 0, y0 = 0;
- int x1 = w, y1 = h;
- glPixelStorei(GL_UNPACK_ROW_LENGTH, TexWidth);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
- glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, w, h,
- ReadFormat, GL_UNSIGNED_BYTE, image);
-
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1);
- glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, w, h,
- ReadFormat, GL_UNSIGNED_BYTE, image);
-
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y1);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
- glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, w, h,
- ReadFormat, GL_UNSIGNED_BYTE, image);
-
- glPixelStorei(GL_UNPACK_SKIP_ROWS, y1);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1);
- glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, w, h,
- ReadFormat, GL_UNSIGNED_BYTE, image);
- }
- else {
- /* all at once */
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexWidth, TexHeight,
- ReadFormat, GL_UNSIGNED_BYTE, image);
- }
-}
-
-
-/**
- * Measure gl[Copy]TexSubImage rate.
- * This actually also includes time to render a quad and SwapBuffers.
- */
-static void
-RunTest(GLboolean copyTex, GLboolean doSubRect)
-{
- double t0, t1;
- int iters = 0;
- float copyRate, mbRate;
- float rot = 0.0;
- int bpp, r, g, b, a;
- int w, h;
- GLubyte *image = NULL;
-
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_SIZE, &r);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_GREEN_SIZE, &g);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BLUE_SIZE, &b);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_ALPHA_SIZE, &a);
- bpp = (r + g + b + a) / 8;
-
- if (!copyTex) {
- /* read image from frame buffer */
- image = (GLubyte *) malloc(TexWidth * TexHeight * bpp);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glReadPixels(0, 0, TexWidth, TexHeight,
- ReadFormat, GL_UNSIGNED_BYTE, image);
- }
-
- glEnable(GL_TEXTURE_2D);
- glViewport(WinWidth / 2, 0, WinWidth / 2, WinHeight);
-
- t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
-
- do {
- if (copyTex)
- /* Framebuffer -> Texture */
- DoCopyTex(doSubRect);
- else {
- /* Main Mem -> Texture */
- SubTex(doSubRect, image);
- }
-
- /* draw textured quad */
- if (DrawQuad) {
- glPushMatrix();
- glRotatef(rot, 0, 0, 1);
- glTranslatef(1, 0, 0);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glTexCoord2f(0, 1); glVertex2f(-1, 1);
- glEnd();
- glPopMatrix();
- }
-
- iters++;
- rot += 2.0;
-
- t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
- if (DrawQuad) {
- glutSwapBuffers();
- }
- } while (t1 - t0 < 5.0);
-
- glDisable(GL_TEXTURE_2D);
- if (image)
- free(image);
-
- if (doSubRect) {
- w = TexWidth / 2;
- h = TexHeight / 2;
- iters *= 4;
- }
- else {
- w = TexWidth;
- h = TexHeight;
- }
-
- copyRate = iters / (t1 - t0);
- mbRate = w * h * bpp * copyRate / (1024 * 1024);
-
- if (copyTex)
- printf("glCopyTexSubImage: %d x %d, %d Bpp:\n", w, h, bpp);
- else
- printf("glTexSubImage: %d x %d, %d Bpp:\n", w, h, bpp);
- printf(" %d calls in %.2f = %.2f calls/sec, %.2f MB/s\n",
- iters, t1-t0, copyRate, mbRate);
-}
-
-
-static void
-Draw(void)
-{
- glClearColor(0.2, 0.2, 0.8, 0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- DrawTestImage();
- if (!DrawQuad) {
- glutSwapBuffers();
- }
-
- RunTest(GL_FALSE, GL_FALSE);
- RunTest(GL_FALSE, GL_TRUE);
- RunTest(GL_TRUE, GL_FALSE);
- RunTest(GL_TRUE, GL_TRUE);
-
- glutSwapBuffers();
-
- printf("exiting\n");
- exit(0);
-}
-
-
-static void
-Reshape(int width, int height)
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -15.0);
-}
-
-
-static void
-Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-SpecialKey(int key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- break;
- case GLUT_KEY_DOWN:
- break;
- case GLUT_KEY_LEFT:
- break;
- case GLUT_KEY_RIGHT:
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Init(void)
-{
- /* create initial, empty teximage */
- glBindTexture(GL_TEXTURE_2D, TexObj);
- glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-}
-
-
-
-static void
-ParseArgs(int argc, char *argv[])
-{
- int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-nodraw") == 0)
- DrawQuad = GL_FALSE;
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
- glutInit(&argc, argv);
-
- ParseArgs(argc, argv);
-
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(WinWidth, WinHeight);
- glutInitDisplayMode(mode);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutSpecialFunc(SpecialKey);
- glutDisplayFunc(Draw);
-
- printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
- Init();
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/tex1d.c b/progs/tests/tex1d.c
deleted file mode 100644
index 1fab849dd3e..00000000000
--- a/progs/tests/tex1d.c
+++ /dev/null
@@ -1,139 +0,0 @@
-
-/* Exercise 1D textures
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "GL/glut.h"
-
-static GLuint Window = 0;
-static GLuint TexObj[2];
-static GLfloat Angle = 0.0f;
-
-
-static void draw( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 1.0, 1.0, 1.0 );
-
- /* draw first polygon */
- glPushMatrix();
- glTranslatef( -1.0, 0.0, 0.0 );
- glRotatef( Angle, 0.0, 0.0, 1.0 );
- glBindTexture( GL_TEXTURE_1D, TexObj[0] );
- glBegin( GL_POLYGON );
- glTexCoord1f( 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord1f( 1.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord1f( 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord1f( 0.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-
-static void idle( void )
-{
- Angle += 2.0;
- glutPostRedisplay();
-}
-
-
-
-/* change view Angle, exit upon ESC */
-static void key(unsigned char k, int x, int y)
-{
- (void) x;
- (void) y;
- switch (k) {
- case 27:
- exit(0);
- }
-}
-
-
-
-/* new window size or exposure */
-static void reshape( int width, int height )
-{
- glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/
- glFrustum( -2.0, 2.0, -2.0, 2.0, 6.0, 20.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-}
-
-
-static void init( void )
-{
- GLubyte tex[256][3];
- GLint i;
-
-
- glDisable( GL_DITHER );
-
- /* Setup texturing */
- glEnable( GL_TEXTURE_1D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
-
-
- /* generate texture object IDs */
- glGenTextures( 2, TexObj );
-
- /* setup first texture object */
- glBindTexture( GL_TEXTURE_1D, TexObj[0] );
-
-
- for (i = 0; i < 256; i++) {
- GLfloat f;
-
- /* map 0..255 to -PI .. PI */
- f = ((i / 255.0) - .5) * (3.141592 * 2);
-
- f = sin(f);
-
- /* map -1..1 to 0..255 */
- tex[i][0] = (f+1.0)/2.0 * 255.0;
- tex[i][1] = 0;
- tex[i][2] = 0;
- }
-
- glTexImage1D( GL_TEXTURE_1D, 0, 3, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT );
-}
-
-
-
-int main( int argc, char *argv[] )
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(300, 300);
- glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
-
- Window = glutCreateWindow("Texture Objects");
- if (!Window) {
- exit(1);
- }
-
- init();
-
- glutReshapeFunc( reshape );
- glutKeyboardFunc( key );
-/* glutIdleFunc( idle ); */
- glutDisplayFunc( draw );
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/texcmp.c b/progs/tests/texcmp.c
deleted file mode 100644
index 6e822fb6895..00000000000
--- a/progs/tests/texcmp.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Compressed texture demo. Written by Daniel Borca.
- * This program is in the public domain.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#define GL_GLEXT_PROTOTYPES 1
-#include <GL/glut.h>
-
-#include "readtex.c" /* I know, this is a hack. */
-#define TEXTURE_FILE "../images/tree2.rgba"
-
-
-static float Rot = 0.0;
-static GLboolean Anim = 1;
-
-typedef struct {
- GLubyte *data;
- GLuint size;
- GLenum format;
- GLuint w, h;
-
- GLenum TC;
-
- GLubyte *cData;
- GLuint cSize;
- GLenum cFormat;
-} TEXTURE;
-
-static TEXTURE *Tx, t1, t2, t3;
-static GLboolean fxt1, dxtc, s3tc;
-
-
-static const char *TextureName (GLenum TC)
-{
- switch (TC) {
- case GL_RGB:
- return "RGB";
- case GL_RGBA:
- return "RGBA";
- case GL_COMPRESSED_RGB:
- return "COMPRESSED_RGB";
- case GL_COMPRESSED_RGBA:
- return "COMPRESSED_RGBA";
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return "GL_COMPRESSED_RGB_FXT1_3DFX";
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return "GL_COMPRESSED_RGBA_FXT1_3DFX";
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
- case GL_RGB_S3TC:
- return "GL_RGB_S3TC";
- case GL_RGB4_S3TC:
- return "GL_RGB4_S3TC";
- case GL_RGBA_S3TC:
- return "GL_RGBA_S3TC";
- case GL_RGBA4_S3TC:
- return "GL_RGBA4_S3TC";
- case 0:
- return "Invalid format";
- default:
- return "Unknown format";
- }
-}
-
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-static void Idle( void )
-{
- float t = glutGet(GLUT_ELAPSED_TIME) * 0.001; /* in seconds */
- Rot = t * 360 / 4; /* 1 rotation per 4 seconds */
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- /* draw background gradient */
- glDisable(GL_TEXTURE_2D);
- glBegin(GL_POLYGON);
- glColor3f(1.0, 0.0, 0.2); glVertex2f(-1.5, -1.0);
- glColor3f(1.0, 0.0, 0.2); glVertex2f( 1.5, -1.0);
- glColor3f(0.0, 0.0, 1.0); glVertex2f( 1.5, 1.0);
- glColor3f(0.0, 0.0, 1.0); glVertex2f(-1.5, 1.0);
- glEnd();
-
- glPushMatrix();
- glRotatef(Rot, 0, 0, 1);
-
- glEnable(GL_TEXTURE_2D);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 1); glVertex2f(-1, -0.5);
- glTexCoord2f(1, 1); glVertex2f( 1, -0.5);
- glTexCoord2f(1, 0); glVertex2f( 1, 0.5);
- glTexCoord2f(0, 0); glVertex2f(-1, 0.5);
- glEnd();
-
- glPopMatrix();
-
- /* info */
- glColor4f(1, 1, 1, 1);
-
- glRasterPos3f(-1.2, -0.7, 0);
- PrintString("Selected: ");
- PrintString(TextureName(Tx->TC));
- if (Tx->cData) {
- char tmp[64];
- glRasterPos3f(-1.2, -0.8, 0);
- PrintString("Internal: ");
- PrintString(TextureName(Tx->cFormat));
- glRasterPos3f(-1.2, -0.9, 0);
- PrintString("Size : ");
- sprintf(tmp, "%d (%d%% of %d)", Tx->cSize, Tx->cSize * 100 / Tx->size, Tx->size);
- PrintString(tmp);
- }
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho( -1.5, 1.5, -1.0, 1.0, -1.0, 1.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void ReInit( GLenum TC, TEXTURE *Tx )
-{
- GLint rv;
-
- if ((Tx->TC == TC) && (Tx->cData != NULL)) {
- glCompressedTexImage2DARB(GL_TEXTURE_2D, /* target */
- 0, /* level */
- Tx->cFormat, /* real format */
- Tx->w, /* original width */
- Tx->h, /* original height */
- 0, /* border */
- Tx->cSize, /* compressed size*/
- Tx->cData); /* compressed data*/
- } else {
- glTexImage2D(GL_TEXTURE_2D, /* target */
- 0, /* level */
- TC, /* internal format */
- Tx->w, Tx->h, /* width, height */
- 0, /* border */
- Tx->format, /* texture format */
- GL_UNSIGNED_BYTE, /* texture type */
- Tx->data); /* the texture */
-
- /* okay, now cache the compressed texture */
- Tx->TC = TC;
- if (Tx->cData != NULL) {
- free(Tx->cData);
- Tx->cData = NULL;
- }
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &rv);
- if (rv) {
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&Tx->cFormat);
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, (GLint *)&Tx->cSize);
- if ((Tx->cData = malloc(Tx->cSize)) != NULL) {
- glGetCompressedTexImageARB(GL_TEXTURE_2D, 0, Tx->cData);
- }
- }
- }
-}
-
-
-static void Init( void )
-{
- /* HEIGHT * WIDTH + 1 (for trailing '\0') */
- static char pattern[8 * 32 + 1] = {"\
- \
- MMM EEEE SSS AAA \
- M M M E S S A A \
- M M M EEEE SS A A \
- M M M E SS AAAAA \
- M M E S S A A \
- M M EEEE SSS A A \
- "
- };
-
- GLuint i, j;
-
- GLubyte (*texture1)[8 * 32][4];
- GLubyte (*texture2)[256][256][4];
-
- t1.w = 32;
- t1.h = 8;
- t1.size = t1.w * t1.h * 4;
- t1.data = malloc(t1.size);
- t1.format = GL_RGBA;
- t1.TC = GL_RGBA;
-
- texture1 = (GLubyte (*)[8 * 32][4])t1.data;
- for (i = 0; i < sizeof(pattern) - 1; i++) {
- switch (pattern[i]) {
- default:
- case ' ':
- (*texture1)[i][0] = 255;
- (*texture1)[i][1] = 255;
- (*texture1)[i][2] = 255;
- (*texture1)[i][3] = 64;
- break;
- case 'M':
- (*texture1)[i][0] = 255;
- (*texture1)[i][1] = 0;
- (*texture1)[i][2] = 0;
- (*texture1)[i][3] = 255;
- break;
- case 'E':
- (*texture1)[i][0] = 0;
- (*texture1)[i][1] = 255;
- (*texture1)[i][2] = 0;
- (*texture1)[i][3] = 255;
- break;
- case 'S':
- (*texture1)[i][0] = 0;
- (*texture1)[i][1] = 0;
- (*texture1)[i][2] = 255;
- (*texture1)[i][3] = 255;
- break;
- case 'A':
- (*texture1)[i][0] = 255;
- (*texture1)[i][1] = 255;
- (*texture1)[i][2] = 0;
- (*texture1)[i][3] = 255;
- break;
- }
- }
-
- t2.w = 256;
- t2.h = 256;
- t2.size = t2.w * t2.h * 4;
- t2.data = malloc(t2.size);
- t2.format = GL_RGBA;
- t2.TC = GL_RGBA;
-
- texture2 = (GLubyte (*)[256][256][4])t2.data;
- for (j = 0; j < t2.h; j++) {
- for (i = 0; i < t2.w; i++) {
- (*texture2)[j][i][0] = sqrt(i * j * 255 * 255 / (t2.w * t2.h));
- (*texture2)[j][i][1] = 0;
- (*texture2)[j][i][2] = 0;
- (*texture2)[j][i][3] = 255;
- }
- }
-
- t3.data = LoadRGBImage(TEXTURE_FILE, (GLint *)&t3.w, (GLint *)&t3.h, &t3.format);
- t3.size = t3.w * t3.h * ((t3.format == GL_RGB) ? 3 : 4);
- t3.TC = GL_RGBA;
-
- ReInit(GL_RGBA, Tx = &t1);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- glEnable(GL_TEXTURE_2D);
-
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- case ' ':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc( Idle );
- else
- glutIdleFunc( NULL );
- break;
- case 't':
- if (Tx == &t1) {
- Tx = &t2;
- } else if (Tx == &t2) {
- Tx = &t3;
- } else {
- Tx = &t1;
- }
- ReInit(Tx->TC, Tx);
- break;
- case '9':
- ReInit(GL_RGB, Tx);
- break;
- case '0':
- ReInit(GL_RGBA, Tx);
- break;
- case '1':
- ReInit(GL_COMPRESSED_RGB, Tx);
- break;
- case '2':
- ReInit(GL_COMPRESSED_RGBA, Tx);
- break;
- case '3':
- if (fxt1) ReInit(GL_COMPRESSED_RGB_FXT1_3DFX, Tx);
- break;
- case '4':
- if (fxt1) ReInit(GL_COMPRESSED_RGBA_FXT1_3DFX, Tx);
- break;
- case '5':
- if (dxtc) ReInit(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, Tx);
- break;
- case '6':
- if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, Tx);
- break;
- case '7':
- if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, Tx);
- break;
- case '8':
- if (dxtc) ReInit(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, Tx);
- break;
- case 'a':
- if (s3tc) ReInit(GL_RGB_S3TC, Tx);
- break;
- case 's':
- if (s3tc) ReInit(GL_RGB4_S3TC, Tx);
- break;
- case 'd':
- if (s3tc) ReInit(GL_RGBA_S3TC, Tx);
- break;
- case 'f':
- if (s3tc) ReInit(GL_RGBA4_S3TC, Tx);
- break;
- }
- glutPostRedisplay();
-}
-
-
-int main( int argc, char *argv[] )
-{
- float gl_version;
- GLint num_formats;
- GLint i;
- GLint formats[64];
-
-
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 400, 300 );
-
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
-
- if (glutCreateWindow(argv[0]) <= 0) {
- printf("Couldn't create window\n");
- exit(0);
- }
-
- gl_version = atof( (const char *) glGetString( GL_VERSION ) );
- if ( (gl_version < 1.3)
- && !glutExtensionSupported("GL_ARB_texture_compression") ) {
- printf("Sorry, GL_ARB_texture_compression not supported\n");
- exit(0);
- }
- if (glutExtensionSupported("GL_3DFX_texture_compression_FXT1")) {
- fxt1 = GL_TRUE;
- }
- if (glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
- dxtc = GL_TRUE;
- }
- if (glutExtensionSupported("GL_S3_s3tc")) {
- s3tc = GL_TRUE;
- }
-
- glGetIntegerv( GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, & num_formats );
-
- (void) memset( formats, 0, sizeof( formats ) );
- glGetIntegerv( GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats );
-
- printf( "The following texture formats are supported:\n" );
- for ( i = 0 ; i < num_formats ; i++ ) {
- printf( "\t%s\n", TextureName( formats[i] ) );
- }
-
- Init();
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc( Idle );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/texcompress2.c b/progs/tests/texcompress2.c
deleted file mode 100644
index e2eed756b62..00000000000
--- a/progs/tests/texcompress2.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Test texture compression.
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <assert.h>
-#include <stdio.h>
-#include <GL/glut.h>
-#include <GL/glx.h>
-#include "readtex.c"
-
-#define IMAGE_FILE "../images/arch.rgb"
-
-static int ImgWidth, ImgHeight;
-static GLenum ImgFormat;
-static GLenum CompFormat;
-static GLfloat EyeDist = 5.0;
-static GLfloat Rot = 0.0;
-const GLenum Target = GL_TEXTURE_2D;
-
-
-static void
-CheckError(int line)
-{
- GLenum err = glGetError();
- if (err) {
- printf("GL Error %d at line %d\n", (int) err, line);
- }
-}
-
-
-static const char *
-LookupFormat(GLenum format)
-{
- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
- default:
- return "other";
- }
-}
-
-
-static void
-TestSubTex(void)
-{
- GLboolean all = 0*GL_TRUE;
- GLubyte *buffer;
- GLint size, fmt;
- int i;
-
- glGetTexLevelParameteriv(Target, 0,
- GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &size);
- glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
-
- buffer = (GLubyte *) malloc(size);
- glGetCompressedTexImageARB(Target, 0, buffer);
-
- printf("Testing sub-texture replacement\n");
- if (all)
- glCompressedTexImage2DARB(Target, 0,
- fmt, ImgWidth, ImgHeight, 0,
- size, buffer);
- else {
- /* bottom half */
- glCompressedTexSubImage2DARB(Target, 0,
- 0, 0, /* pos */
- ImgWidth, ImgHeight / 2,
- fmt, size/2, buffer);
- /* top half */
- glCompressedTexSubImage2DARB(Target, 0,
- 0, ImgHeight / 2, /* pos */
- ImgWidth, ImgHeight / 2,
- fmt, size/2, buffer + size / 2);
- }
-
- free(buffer);
-}
-
-
-static void
-LoadCompressedImage(const char *file)
-{
- const GLenum filter = GL_LINEAR;
- GLubyte *image;
- GLint p;
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
-
- /*
- * Load image and scale if needed.
- */
- image = LoadRGBImage( file, &ImgWidth, &ImgHeight, &ImgFormat );
- if (!image) {
- printf("Couldn't read %s\n", IMAGE_FILE);
- exit(0);
- }
- printf("Image is %d x %d\n", ImgWidth, ImgHeight);
-
- /* power of two */
- assert(ImgWidth == 128 || ImgWidth == 256 || ImgWidth == 512);
- assert(ImgWidth == 128 || ImgHeight == 256 || ImgHeight == 512);
-
- if (ImgFormat == GL_RGB)
- CompFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- else
- CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
-
- if (ImgFormat == GL_RGBA) {
- int i, numAlpha = 0;
- for (i = 0; i < ImgWidth * ImgHeight; i++) {
- if (image[i*4+3] != 0 && image[i*4+3] != 0xff) {
- numAlpha++;
- }
- if (image[i*4+3] == 0)
- image[i*4+3] = 4 * i / ImgWidth;
- }
- printf("Num Alpha !=0,255: %d\n", numAlpha);
- }
-
- CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-
-
- /*
- * Give image to OpenGL and have it compress it.
- */
- glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
- ImgFormat, GL_UNSIGNED_BYTE, image);
- CheckError(__LINE__);
-
- free(image);
-
- glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_INTERNAL_FORMAT, &p);
- printf("Compressed Internal Format: %s (0x%x)\n", LookupFormat(p), p);
- assert(p == CompFormat);
-
- printf("Original size: %d bytes\n", ImgWidth * ImgHeight * 3);
- glGetTexLevelParameteriv(Target, 0, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &p);
- printf("Compressed size: %d bytes\n", p);
-
- glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter);
- glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter);
-
- TestSubTex();
-
-}
-
-
-static void
-Init(const char *file)
-{
- GLint numFormats, formats[100];
- GLint p;
-
- if (!glutExtensionSupported("GL_ARB_texture_compression")) {
- printf("Sorry, GL_ARB_texture_compression is required.\n");
- exit(1);
- }
- if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
- printf("Sorry, GL_EXT_texture_compression_s3tc is required.\n");
- exit(1);
- }
-
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numFormats);
- glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats);
- printf("%d supported compression formats: ", numFormats);
- for (p = 0; p < numFormats; p++)
- printf("0x%x ", formats[p]);
- printf("\n");
-
- LoadCompressedImage(file);
-
- glEnable(GL_TEXTURE_2D);
-
- if (ImgFormat == GL_RGBA) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- }
-}
-
-
-static void
-Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum(-1, 1, -1, 1, 4, 100);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void
-Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'd':
- EyeDist -= 1.0;
- if (EyeDist < 4.0)
- EyeDist = 4.0;
- break;
- case 'D':
- EyeDist += 1.0;
- break;
- case 'z':
- Rot += 5.0;
- break;
- case 'Z':
- Rot -= 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void
-Draw( void )
-{
- glClearColor(0.3, 0.3, .8, 0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glPushMatrix();
- glTranslatef(0, 0, -(EyeDist+0.01));
- glRotatef(Rot, 0, 0, 1);
- glBegin(GL_POLYGON);
- glTexCoord2f(0, 0); glVertex2f(-1, -1);
- glTexCoord2f(1, 0); glVertex2f( 1, -1);
- glTexCoord2f(1, 1); glVertex2f( 1, 1);
- glTexCoord2f(0, 1); glVertex2f(-1, 1);
- glEnd();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-int
-main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 600, 600 );
-
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
-
- glutCreateWindow(argv[0]);
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Draw );
-
- if (argc > 1)
- Init(argv[1]);
- else
- Init(IMAGE_FILE);
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/texfilt.c b/progs/tests/texfilt.c
deleted file mode 100644
index 6ee4bc4eae3..00000000000
--- a/progs/tests/texfilt.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * (C) Copyright IBM Corporation 2005
- * 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
- * IBM 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.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <GL/glut.h>
-
-const GLenum filter_modes[] = {
- GL_NEAREST,
- GL_LINEAR,
- GL_NEAREST_MIPMAP_NEAREST,
- GL_NEAREST_MIPMAP_LINEAR,
- GL_LINEAR_MIPMAP_NEAREST,
- GL_LINEAR_MIPMAP_LINEAR,
-};
-
-static GLenum min_filter = GL_LINEAR_MIPMAP_LINEAR;
-static GLenum mag_filter = GL_LINEAR;
-
-static unsigned segments = 64;
-static GLfloat * position_data = NULL;
-static GLfloat * texcoord_data = NULL;
-static GLfloat max_anisotropy = 0.0;
-static GLfloat anisotropy = 1.0;
-
-static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data,
- GLfloat ** tex_data );
-static void generate_textures( unsigned mode );
-
-#define min(a,b) ( (a) < (b) ) ? (a) : (b)
-#define max(a,b) ( (a) > (b) ) ? (a) : (b)
-
-
-static void Display( void )
-{
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter );
-
- if ( max_anisotropy > 0.0 ) {
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
- anisotropy );
- }
-
- glClear( GL_COLOR_BUFFER_BIT );
- glLoadIdentity();
- glTranslatef( 0.0f, 0.0f, -19.0f );
-
- glVertexPointer( 4, GL_FLOAT, 0, position_data );
- glTexCoordPointer( 2, GL_FLOAT, 0, texcoord_data );
- glEnableClientState( GL_VERTEX_ARRAY );
- glEnableClientState( GL_TEXTURE_COORD_ARRAY );
- glDrawArrays( GL_QUADS, 0, 4 * segments );
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45.0f, (GLfloat)(width)/(GLfloat)(height), 0.1f, 100.0f);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- GLfloat new_anisotropy = anisotropy;
-
- (void) x;
- (void) y;
-
-
- switch( key ) {
- case 'a': {
- new_anisotropy = anisotropy - 1.0;
- break;
- }
-
- case 'A': {
- new_anisotropy = anisotropy + 1.0;
- break;
- }
-
- case 's': {
- segments--;
- if ( segments < 3 ) {
- segments = 3;
- }
- generate_tunnel( segments, & position_data, & texcoord_data );
- break;
- }
-
- case 'S': {
- segments++;
- if ( segments > 128 ) {
- segments = 128;
- }
- generate_tunnel( segments, & position_data, & texcoord_data );
- break;
- }
- case 'q':
- case 'Q':
- case 27:
- exit(0);
- break;
- }
-
- new_anisotropy = max( new_anisotropy, 1.0 );
- new_anisotropy = min( new_anisotropy, max_anisotropy );
- if ( new_anisotropy != anisotropy ) {
- anisotropy = new_anisotropy;
- printf( "Texture anisotropy: %f%s\n", anisotropy,
- (anisotropy == 1.0) ? " (disabled)" : "" );
- }
-
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- (void) x;
- (void) y;
- (void) key;
- glutPostRedisplay();
-}
-
-
-static void menu_handler( int selection )
-{
- switch( selection >> 3 ) {
- case 0:
- glBindTexture( GL_TEXTURE_2D, selection );
- break;
-
- case 1:
- min_filter = filter_modes[ selection & 7 ];
- break;
-
- case 2:
- mag_filter = filter_modes[ selection & 7 ];
- break;
- }
-
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- glDisable(GL_CULL_FACE);
- glEnable(GL_TEXTURE_2D);
- glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
- glShadeModel(GL_SMOOTH);
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-
- generate_tunnel( segments, & position_data, & texcoord_data );
-
- glBindTexture( GL_TEXTURE_2D, 1 );
- generate_textures(1);
-
- glBindTexture( GL_TEXTURE_2D, 2 );
- generate_textures(2);
-
- glBindTexture( GL_TEXTURE_2D, 3 );
- generate_textures(3);
-
- if ( glutExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) ) {
- glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, & max_anisotropy );
- }
-
- printf("Maximum texture anisotropy: %f\n", max_anisotropy );
-
- /* Create the menus. */
-
- glutCreateMenu( menu_handler );
- glutAddMenuEntry( "Min filter: GL_NEAREST", 8 + 0 );
- glutAddMenuEntry( "Min filter: GL_LINEAR", 8 + 1 );
- glutAddMenuEntry( "Min filter: GL_NEAREST_MIMMAP_NEAREST", 8 + 2 );
- glutAddMenuEntry( "Min filter: GL_NEAREST_MIMMAP_LINEAR", 8 + 3 );
- glutAddMenuEntry( "Min filter: GL_LINEAR_MIMMAP_NEAREST", 8 + 4 );
- glutAddMenuEntry( "Min filter: GL_LINEAR_MIMMAP_LINEAR", 8 + 5 );
- glutAddMenuEntry( "Mag filter: GL_NEAREST", 16 + 0 );
- glutAddMenuEntry( "Mag filter: GL_LINEAR", 16 + 1 );
- glutAddMenuEntry( "Texture: regular mipmaps", 1 );
- glutAddMenuEntry( "Texture: blended mipmaps", 2 );
- glutAddMenuEntry( "Texture: color mipmaps", 3 );
- glutAttachMenu( GLUT_RIGHT_BUTTON );
-}
-
-
-static void generate_tunnel( unsigned num_segs, GLfloat ** pos_data,
- GLfloat ** tex_data )
-{
- const GLfloat far = 20.0f;
- const GLfloat near = -90.0f;
- const GLfloat far_tex = 30.0f;
- const GLfloat near_tex = 0.0f;
- const GLfloat angle_step = (2 * M_PI) / num_segs;
- const GLfloat tex_coord_step = 2.0 / num_segs;
- GLfloat angle = 0.0f;
- GLfloat tex_coord = 0.0f;
- unsigned i;
- GLfloat * position;
- GLfloat * texture;
-
-
- position = realloc( *pos_data, sizeof( GLfloat ) * num_segs * 4 * 4 );
- texture = realloc( *tex_data, sizeof( GLfloat ) * num_segs * 4 * 2 );
-
- *pos_data = position;
- *tex_data = texture;
-
- for ( i = 0 ; i < num_segs ; i++ ) {
- position[0] = 2.5 * sinf( angle );
- position[1] = 2.5 * cosf( angle );
- position[2] = (i & 1) ? far : near;
- position[3] = 1.0f;
-
- position[4] = position[0];
- position[5] = position[1];
- position[6] = (i & 1) ? near : far;
- position[7] = 1.0f;
-
- position += 8;
-
- texture[0] = tex_coord;
- texture[1] = (i & 1) ? far_tex : near_tex;
- texture += 2;
-
- texture[0] = tex_coord;
- texture[1] = (i & 1) ? near_tex : far_tex;
- texture += 2;
-
- angle += angle_step;
- tex_coord += tex_coord_step;
-
- position[0] = 2.5 * sinf( angle );
- position[1] = 2.5 * cosf( angle );
- position[2] = (i & 1) ? near : far;
- position[3] = 1.0f;
-
- position[4] = position[0];
- position[5] = position[1];
- position[6] = (i & 1) ? far : near;
- position[7] = 1.0f;
-
- position += 8;
-
- texture[0] = tex_coord;
- texture[1] = (i & 1) ? near_tex : far_tex;
- texture += 2;
-
- texture[0] = tex_coord;
- texture[1] = (i & 1) ? far_tex : near_tex;
- texture += 2;
- }
-}
-
-
-static void generate_textures( unsigned mode )
-{
-#define LEVEL_COLORS 6
- const GLfloat colors[LEVEL_COLORS][3] = {
- { 1.0, 0.0, 0.0 }, /* 32 x 32 */
- { 0.0, 1.0, 0.0 }, /* 16 x 16 */
- { 0.0, 0.0, 1.0 }, /* 8 x 8 */
- { 1.0, 0.0, 1.0 }, /* 4 x 4 */
- { 1.0, 1.0, 1.0 }, /* 2 x 2 */
- { 1.0, 1.0, 0.0 } /* 1 x 1 */
- };
- const unsigned checkers_per_level = 2;
- GLfloat * tex;
- unsigned level;
- unsigned size;
- GLint max_size;
-
-
- glGetIntegerv( GL_MAX_TEXTURE_SIZE, & max_size );
- if ( max_size > 512 ) {
- max_size = 512;
- }
-
- tex = malloc( sizeof( GLfloat ) * 3 * max_size * max_size );
-
- level = 0;
- for ( size = max_size ; size > 0 ; size >>= 1 ) {
- unsigned divisor = size / checkers_per_level;
- unsigned i;
- unsigned j;
- GLfloat checkers[2][3];
-
-
- if ((level == 0) || (mode == 1)) {
- checkers[0][0] = 1.0;
- checkers[0][1] = 1.0;
- checkers[0][2] = 1.0;
- checkers[1][0] = 0.0;
- checkers[1][1] = 0.0;
- checkers[1][2] = 0.0;
- }
- else if (mode == 2) {
- checkers[0][0] = colors[level % LEVEL_COLORS][0];
- checkers[0][1] = colors[level % LEVEL_COLORS][1];
- checkers[0][2] = colors[level % LEVEL_COLORS][2];
- checkers[1][0] = colors[level % LEVEL_COLORS][0] * 0.5;
- checkers[1][1] = colors[level % LEVEL_COLORS][1] * 0.5;
- checkers[1][2] = colors[level % LEVEL_COLORS][2] * 0.5;
- }
- else {
- checkers[0][0] = colors[level % LEVEL_COLORS][0];
- checkers[0][1] = colors[level % LEVEL_COLORS][1];
- checkers[0][2] = colors[level % LEVEL_COLORS][2];
- checkers[1][0] = colors[level % LEVEL_COLORS][0];
- checkers[1][1] = colors[level % LEVEL_COLORS][1];
- checkers[1][2] = colors[level % LEVEL_COLORS][2];
- }
-
- if ( divisor == 0 ) {
- divisor = 1;
-
- checkers[0][0] = (checkers[0][0] + checkers[1][0]) / 2;
- checkers[0][1] = (checkers[0][0] + checkers[1][0]) / 2;
- checkers[0][2] = (checkers[0][0] + checkers[1][0]) / 2;
- checkers[1][0] = checkers[0][0];
- checkers[1][1] = checkers[0][1];
- checkers[1][2] = checkers[0][2];
- }
-
-
- for ( i = 0 ; i < size ; i++ ) {
- for ( j = 0 ; j < size ; j++ ) {
- const unsigned idx = ((i ^ j) / divisor) & 1;
-
- tex[ ((i * size) + j) * 3 + 0] = checkers[ idx ][0];
- tex[ ((i * size) + j) * 3 + 1] = checkers[ idx ][1];
- tex[ ((i * size) + j) * 3 + 2] = checkers[ idx ][2];
- }
- }
-
- glTexImage2D( GL_TEXTURE_2D, level, GL_RGB, size, size, 0,
- GL_RGB, GL_FLOAT, tex );
- level++;
- }
-
- free( tex );
-}
-
-
-int main( int argc, char ** argv )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 800, 600 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow( "Texture Filter Test" );
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
-
- Init();
-
- printf("\nUse the right-button menu to select the texture and filter mode.\n");
- printf("Use 'A' and 'a' to increase and decrease the aniotropy.\n");
- printf("Use 'S' and 's' to increase and decrease the number of cylinder segments.\n");
- printf("Use 'q' to exit.\n\n");
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/texgenmix.c b/progs/tests/texgenmix.c
deleted file mode 100644
index be8f6775c70..00000000000
--- a/progs/tests/texgenmix.c
+++ /dev/null
@@ -1,640 +0,0 @@
-
-/*
- * Demonstrates mixed texgen/non-texgen texture coordinates.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GL/glut.h>
-
-#undef max
-#undef min
-#define max( a, b ) ((a) >= (b) ? (a) : (b))
-#define min( a, b ) ((a) <= (b) ? (a) : (b))
-
-GLfloat labelColor0[4] = { 1.0, 1.0, 1.0, 1.0 };
-GLfloat labelColor1[4] = { 1.0, 1.0, 0.4, 1.0 };
-GLfloat *labelInfoColor = labelColor0;
-
-GLboolean doubleBuffered = GL_TRUE;
-GLboolean drawTextured = GL_TRUE;
-
-int textureWidth = 64;
-int textureHeight = 64;
-
-int winWidth = 580, winHeight = 720;
-
-const GLfloat texmat_swap_rq[16] = { 1.0, 0.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 1.0,
- 0.0, 0.0, 1.0, 0.0};
-
-const GLfloat nullPlane[4] = { 0.0, 0.0, 0.0, 0.0 };
-const GLfloat ObjPlaneS1[4] = { 1.0, 0.0, 1.0, 0.0 };
-const GLfloat ObjPlaneS2[4] = { 0.5, 0.0, 0.0, 0.0 };
-const GLfloat ObjPlaneS3[4] = { 1.0, 0.0, 0.0, 0.0 };
-const GLfloat ObjPlaneT[4] = { 0.0, 1.0, 0.0, 0.0 };
-const GLfloat ObjPlaneT2[4] = { 0.0, 0.5, 0.0, 0.0 };
-const GLfloat ObjPlaneT3[4] = { 0.0, 1.0, 0.0, 0.0 };
-const GLfloat ObjPlaneR[4] = { 0.0, 0.0, 1.0, 0.0 };
-const GLfloat ObjPlaneQ[4] = { 0.0, 0.0, 0.0, 0.5 };
-
-
-static void checkErrors( void )
-{
- GLenum error;
-
- while ( (error = glGetError()) != GL_NO_ERROR ) {
- fprintf( stderr, "Error: %s\n", (char *) gluErrorString( error ) );
- }
-}
-
-static void drawString( const char *string, GLfloat x, GLfloat y,
- const GLfloat color[4] )
-{
- glColor4fv( color );
- glRasterPos2f( x, y );
-
- while ( *string ) {
- glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string );
- string++;
- }
-}
-
-static void begin2D( int width, int height )
-{
- glMatrixMode( GL_PROJECTION );
-
- glPushMatrix();
- glLoadIdentity();
-
- glOrtho( 0, width, 0, height, -1, 1 );
- glMatrixMode( GL_MODELVIEW );
-
- glPushMatrix();
- glLoadIdentity();
-}
-
-static void end2D( void )
-{
- glMatrixMode( GL_PROJECTION );
- glPopMatrix();
- glMatrixMode( GL_MODELVIEW );
- glPopMatrix();
-}
-
-static void initialize( void )
-{
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
-
- glOrtho( -1.5, 1.5, -1.5, 1.5, -1.5, 1.5 );
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- glShadeModel( GL_FLAT );
-}
-
-/* ARGSUSED1 */
-static void keyboard( unsigned char c, int x, int y )
-{
- switch ( c ) {
- case 't':
- drawTextured = !drawTextured;
- break;
- case 27: /* Escape key should force exit. */
- exit(0);
- break;
- default:
- break;
- }
- glutPostRedisplay();
-}
-
-/* ARGSUSED1 */
-static void special( int key, int x, int y )
-{
- switch ( key ) {
- case GLUT_KEY_DOWN:
- break;
- case GLUT_KEY_UP:
- break;
- case GLUT_KEY_LEFT:
- break;
- case GLUT_KEY_RIGHT:
- break;
- default:
- break;
- }
- glutPostRedisplay();
-}
-
-static void
-reshape( int w, int h )
-{
- winWidth = w;
- winHeight = h;
- /* No need to call glViewPort here since "draw" calls it! */
-}
-
-static void loadTexture( int width, int height )
-{
- int alphaSize = 1;
- int rgbSize = 3;
- GLubyte *texImage, *p;
- int elementsPerGroup, elementSize, groupSize, rowSize;
- int i, j;
-
-
- elementsPerGroup = alphaSize + rgbSize;
- elementSize = sizeof(GLubyte);
- groupSize = elementsPerGroup * elementSize;
- rowSize = width * groupSize;
-
- if ( (texImage = (GLubyte *) malloc( height * rowSize ) ) == NULL ) {
- fprintf( stderr, "texture malloc failed\n" );
- return;
- }
-
- for ( i = 0 ; i < height ; i++ )
- {
- p = texImage + i * rowSize;
-
- for ( j = 0 ; j < width ; j++ )
- {
- if ( rgbSize > 0 )
- {
- /**
- ** +-----+-----+
- ** | | |
- ** | R | G |
- ** | | |
- ** +-----+-----+
- ** | | |
- ** | Y | B |
- ** | | |
- ** +-----+-----+
- **/
- if ( i > height / 2 ) {
- if ( j < width / 2 ) {
- p[0] = 0xff;
- p[1] = 0x00;
- p[2] = 0x00;
- } else {
- p[0] = 0x00;
- p[1] = 0xff;
- p[2] = 0x00;
- }
- } else {
- if ( j < width / 2 ) {
- p[0] = 0xff;
- p[1] = 0xff;
- p[2] = 0x00;
- } else {
- p[0] = 0x00;
- p[1] = 0x00;
- p[2] = 0xff;
- }
- }
- p += 3 * elementSize;
- }
-
- if ( alphaSize > 0 )
- {
- /**
- ** +-----------+
- ** | W |
- ** | +-----+ |
- ** | | | |
- ** | | B | |
- ** | | | |
- ** | +-----+ |
- ** | |
- ** +-----------+
- **/
- int i2 = i - height / 2;
- int j2 = j - width / 2;
- int h8 = height / 8;
- int w8 = width / 8;
- if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) {
- p[0] = 0x00;
- } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) {
- p[0] = 0x55;
- } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) {
- p[0] = 0xaa;
- } else {
- p[0] = 0xff;
- }
- p += elementSize;
- }
- }
- }
-
- glTexImage2D( GL_TEXTURE_2D, 0,
- GL_RGBA, width, height, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, texImage );
-
- free( texImage );
-}
-
-
-static void drawSample( int x, int y, int w, int h,
- int texgenenabled, int coordnr )
-{
- char buf[255];
-
- glViewport( x, y, w, h );
- glScissor( x, y, w, h );
-
- glClearColor( 0.1, 0.1, 0.1, 1.0 );
- glClear( GL_COLOR_BUFFER_BIT );
-
- begin2D( w, h );
- if (texgenenabled == 2) {
- sprintf( buf, "TexCoord%df", coordnr);
- drawString( buf, 10, h - 15, labelInfoColor );
- sprintf( buf, "texgen enabled for %s coordinate(s)", coordnr == 2 ? "S" : "S/T");
- drawString( buf, 10, 5, labelInfoColor );
- }
- else if (texgenenabled == 0) {
- sprintf( buf, "TexCoord%df", coordnr);
- drawString( buf, 10, h - 15, labelInfoColor );
- drawString( "no texgen", 10, 5, labelInfoColor );
- }
- else if (texgenenabled == 1) {
- drawString( "no TexCoord", 10, h - 15, labelInfoColor );
- sprintf( buf, "texgen enabled for %s coordinate(s)",
- coordnr == 2 ? "S/T" : (coordnr == 3 ? "S/T/R" : "S/T/R/Q"));
- drawString( buf, 10, 5, labelInfoColor );
- }
-
- end2D();
-
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
-
- loadTexture( textureWidth, textureHeight );
-
- if ( drawTextured ) {
- glEnable( GL_TEXTURE_2D );
- }
-
- glDisable( GL_TEXTURE_GEN_S );
- glDisable( GL_TEXTURE_GEN_T );
- glDisable( GL_TEXTURE_GEN_R );
- glDisable( GL_TEXTURE_GEN_Q );
-
- glMatrixMode( GL_TEXTURE );
- glLoadIdentity();
- glMatrixMode( GL_MODELVIEW );
- glPushMatrix();
-
- switch (coordnr) {
- case 2:
- switch (texgenenabled) {
- case 0:
- glBegin( GL_QUADS );
- glTexCoord2f( 0.0, 0.0 );
- glVertex2f( -0.8, -0.8 );
-
- glTexCoord2f( 1.0, 0.0 );
- glVertex2f( 0.8, -0.8 );
-
- glTexCoord2f( 1.0, 1.0 );
- glVertex2f( 0.8, 0.8 );
-
- glTexCoord2f( 0.0, 1.0 );
- glVertex2f( -0.8, 0.8 );
- glEnd();
- break;
- case 1:
- glTranslatef( -0.8, -0.8, 0.0 );
- glScalef( 1.6, 1.6, 1.0 );
- glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS3);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT3);
- glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
- glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
-
- glEnable( GL_TEXTURE_GEN_S );
- glEnable( GL_TEXTURE_GEN_T );
-
- /* Issue a texcoord here to be sure Q isn't left over from a
- * previous sample.
- */
- glTexCoord1f( 0.0 );
- glBegin( GL_QUADS );
- glVertex2f( 0.0, 0.0 );
- glVertex2f( 1.0, 0.0 );
- glVertex2f( 1.0, 1.0 );
- glVertex2f( 0.0, 1.0 );
- glEnd();
- break;
- case 2:
- /* make sure that texgen T and non-texgen S coordinate are wrong */
- glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS1);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, nullPlane);
- glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
- glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
-
- glEnable( GL_TEXTURE_GEN_S );
-
- glBegin( GL_QUADS );
- /* use z coordinate to get correct texgen values... */
- glTexCoord2f( 0.0, 0.0 );
- glVertex3f( -0.8, -0.8, 0.8 );
-
- glTexCoord2f( 0.0, 0.0 );
- glVertex3f( 0.8, -0.8, 0.2 );
-
- glTexCoord2f( 0.0, 1.0 );
- glVertex3f( 0.8, 0.8, 0.2 );
-
- glTexCoord2f( 0.0, 1.0 );
- glVertex3f( -0.8, 0.8, 0.8 );
- glEnd();
- break;
- }
- break;
- case 3:
- glMatrixMode( GL_TEXTURE );
- glLoadMatrixf( texmat_swap_rq );
- glMatrixMode( GL_MODELVIEW );
- glTranslatef( -0.8, -0.8, 0.0 );
- glScalef( 1.6, 1.6, 1.0 );
- switch (texgenenabled) {
- case 0:
- glBegin( GL_QUADS );
- glTexCoord3f( 0.0, 0.0, 0.5 );
- glVertex2f( 0.0, 0.0 );
-
- glTexCoord3f( 0.5, 0.0, 0.5 );
- glVertex2f( 1.0, 0.0 );
-
- glTexCoord3f( 0.5, 0.5, 0.5 );
- glVertex2f( 1.0, 1.0 );
-
- glTexCoord3f( 0.0, 0.5, 0.5 );
- glVertex2f( 0.0, 1.0 );
- glEnd();
- break;
- case 1:
- glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
- glTexGenfv(GL_R, GL_OBJECT_PLANE, ObjPlaneR);
- glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
-
- glEnable( GL_TEXTURE_GEN_S );
- glEnable( GL_TEXTURE_GEN_T );
- glEnable( GL_TEXTURE_GEN_R );
-
- glTexCoord1f( 0.0 ); /* to make sure Q is 1.0 */
- glBegin( GL_QUADS );
- glVertex3f( 0.0, 0.0, 0.5 );
- glVertex3f( 1.0, 0.0, 0.5 );
- glVertex3f( 1.0, 1.0, 0.5 );
- glVertex3f( 0.0, 1.0, 0.5 );
- glEnd();
- break;
- case 2:
- /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */
- glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
- glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
- glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
-
- glEnable( GL_TEXTURE_GEN_S );
- glEnable( GL_TEXTURE_GEN_T );
-
- glBegin( GL_QUADS );
- glTexCoord3f( 0.0, 0.0, 0.5 );
- glVertex2f( 0.0, 0.0);
-
- glTexCoord3f( 0.0, 0.0, 0.5 );
- glVertex2f( 1.0, 0.0);
-
- glTexCoord3f( 0.0, 0.0, 0.5 );
- glVertex2f( 1.0, 1.0);
-
- glTexCoord3f( 0.0, 0.0, 0.5 );
- glVertex2f( 0.0, 1.0);
- glEnd();
- break;
- }
- break;
- case 4:
- switch (texgenenabled) {
- case 0:
- glBegin( GL_QUADS );
- /* don't need r coordinate but still setting it I'm mean */
- glTexCoord4f( 0.0, 0.0, 0.0, 0.5 );
- glVertex2f( -0.8, -0.8 );
-
- glTexCoord4f( 0.5, 0.0, 0.2, 0.5 );
- glVertex2f( 0.8, -0.8 );
-
- glTexCoord4f( 0.5, 0.5, 0.5, 0.5 );
- glVertex2f( 0.8, 0.8 );
-
- glTexCoord4f( 0.0, 0.5, 0.5, 0.5 );
- glVertex2f( -0.8, 0.8 );
- glEnd();
- break;
- case 1:
- glTranslatef( -0.8, -0.8, 0.0 );
- glScalef( 1.6, 1.6, 1.0 );
- /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */
- glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
- glTexGenfv(GL_R, GL_OBJECT_PLANE, ObjPlaneR);
- glTexGenfv(GL_Q, GL_OBJECT_PLANE, ObjPlaneQ);
-
- glEnable( GL_TEXTURE_GEN_S );
- glEnable( GL_TEXTURE_GEN_T );
- glEnable( GL_TEXTURE_GEN_R );
- glEnable( GL_TEXTURE_GEN_Q );
-
- glBegin( GL_QUADS );
- glVertex2f( 0.0, 0.0 );
- glVertex2f( 1.0, 0.0 );
- glVertex2f( 1.0, 1.0 );
- glVertex2f( 0.0, 1.0 );
- glEnd();
- break;
- case 2:
- glTranslatef( -0.8, -0.8, 0.0 );
- glScalef( 1.6, 1.6, 1.0 );
- /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */
- glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
- glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
- glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
- glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
-
- glEnable( GL_TEXTURE_GEN_S );
- glEnable( GL_TEXTURE_GEN_T );
-
- glBegin( GL_QUADS );
- glTexCoord4f( 0.0, 0.0, 0.0, 0.5 );
- glVertex2f( 0.0, 0.0 );
-
- glTexCoord4f( 0.0, 0.0, 0.2, 0.5 );
- glVertex2f( 1.0, 0.0 );
-
- glTexCoord4f( 0.0, 0.0, 0.5, 0.5 );
- glVertex2f( 1.0, 1.0 );
-
- glTexCoord4f( 0.0, 0.0, 0.75, 0.5 );
- glVertex2f( 0.0, 1.0 );
- glEnd();
- break;
- }
- break;
- }
-
- glPopMatrix();
- glDisable( GL_TEXTURE_2D );
-
-}
-
-static void display( void )
-{
- int numX = 3, numY = 3;
- float xBase = (float) winWidth * 0.01;
- float xOffset = (winWidth - xBase) / numX;
- float xSize = max( xOffset - xBase, 1 );
- float yBase = (float) winHeight * 0.01;
- float yOffset = (winHeight - yBase) / numY;
- float ySize = max( yOffset - yBase, 1 );
- float x, y;
- int i, j;
-
- glViewport( 0, 0, winWidth, winHeight );
- glDisable( GL_SCISSOR_TEST );
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glClear( GL_COLOR_BUFFER_BIT );
- glEnable( GL_SCISSOR_TEST );
-
- x = xBase;
- y = (winHeight - 1) - yOffset;
-
- for ( i = 0 ; i < numY ; i++ )
- {
-
- labelInfoColor = labelColor1;
-
-
- for ( j = 0 ; j < numX ; j++ ) {
- drawSample( x, y, xSize, ySize, i, j+2 );
- x += xOffset;
- }
-
- x = xBase;
- y -= yOffset;
- }
-
- if ( doubleBuffered ) {
- glutSwapBuffers();
- } else {
- glFlush();
- }
-
- checkErrors();
-}
-
-static void usage( char *name )
-{
- fprintf( stderr, "usage: %s [ options ]\n", name );
- fprintf( stderr, "\n" );
- fprintf( stderr, "options:\n" );
- fprintf( stderr, " -sb single buffered\n" );
- fprintf( stderr, " -db double buffered\n" );
- fprintf( stderr, " -info print OpenGL driver info\n" );
-}
-
-static void instructions( void )
-{
- fprintf( stderr, "texgenmix - mixed texgen/non-texgen texture coordinate test\n" );
- fprintf( stderr, "all quads should look the same!\n" );
- fprintf( stderr, "\n" );
- fprintf( stderr, " [t] - toggle texturing\n" );
-}
-
-int main( int argc, char *argv[] )
-{
- GLboolean info = GL_FALSE;
- int i;
-
- glutInit( &argc, argv );
-
- for ( i = 1 ; i < argc ; i++ ) {
- if ( !strcmp( "-sb", argv[i] ) ) {
- doubleBuffered = GL_FALSE;
- } else if ( !strcmp( "-db", argv[i] ) ) {
- doubleBuffered = GL_TRUE;
- } else if ( !strcmp( "-info", argv[i] ) ) {
- info = GL_TRUE;
- } else {
- usage( argv[0] );
- exit( 1 );
- }
- }
-
- if ( doubleBuffered ) {
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- } else {
- glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE );
- }
-
- glutInitWindowSize( winWidth, winHeight );
- glutInitWindowPosition( 0, 0 );
- glutCreateWindow( "Mixed texgen/non-texgen texture coordinate test" );
-
- initialize();
- instructions();
-
- if ( info ) {
- printf( "\n" );
- printf( "GL_RENDERER = %s\n", (char *) glGetString( GL_RENDERER ) );
- printf( "GL_VERSION = %s\n", (char *) glGetString( GL_VERSION ) );
- printf( "GL_VENDOR = %s\n", (char *) glGetString( GL_VENDOR ) ) ;
- printf( "GL_EXTENSIONS = %s\n", (char *) glGetString( GL_EXTENSIONS ) );
- }
-
- glutDisplayFunc( display );
- glutReshapeFunc( reshape );
- glutKeyboardFunc( keyboard );
- glutSpecialFunc( special );
- glutMainLoop();
-
- return 0;
-}
diff --git a/progs/tests/texline.c b/progs/tests/texline.c
deleted file mode 100644
index bf09b87284d..00000000000
--- a/progs/tests/texline.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $Id: texline.c,v 1.5 2004-01-28 10:07:48 keithw Exp $ */
-
-/*
- * Test textured lines.
- *
- * Brian Paul
- * September 2000
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLboolean Antialias = GL_FALSE;
-static GLboolean Animate = GL_FALSE;
-static GLint Texture = 1;
-static GLboolean Stipple = GL_FALSE;
-static GLfloat LineWidth = 1.0;
-
-static GLfloat Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
-static GLfloat DYrot = 1.0;
-static GLboolean Points = GL_FALSE;
-static GLfloat Scale = 1.0;
-
-static void Idle( void )
-{
- if (Animate) {
- Zrot += DYrot;
- glutPostRedisplay();
- }
-}
-
-
-static void Display( void )
-{
- GLfloat x, y, s, t;
-
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(Scale, Scale, Scale);
-
- if (Texture)
- glColor3f(1, 1, 1);
-
- if (Points) {
- glBegin(GL_POINTS);
- for (t = 0.0; t <= 1.0; t += 0.025) {
- for (s = 0.0; s <= 1.0; s += 0.025) {
- x = s * 2.0 - 1.0;
- y = t * 2.0 - 1.0;
- if (!Texture)
- glColor3f(1, 0, 1);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s);
- glTexCoord2f(s, t);
- glVertex2f(x, y);
- }
- }
- glEnd();
- }
- else {
- glBegin(GL_LINES);
- for (t = 0.0; t <= 1.0; t += 0.025) {
- x = t * 2.0 - 1.0;
- if (!Texture)
- glColor3f(1, 0, 1);
- glTexCoord2f(t, 0.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t);
- glVertex2f(x, -1.0);
- if (!Texture)
- glColor3f(0, 1, 0);
- glTexCoord2f(t, 1.0);
- glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t);
- glVertex2f(x, 1.0);
- }
- glEnd();
- }
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- GLfloat ar = (float) width / height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -ar, ar, -1.0, 1.0, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Antialias = !Antialias;
- if (Antialias) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_POINT_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- else {
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_POINT_SMOOTH);
- glDisable(GL_BLEND);
- }
- break;
- case 't':
- Texture++;
- if (Texture > 2)
- Texture = 0;
- if (Texture == 0) {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glDisable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glDisable(GL_TEXTURE_2D);
- }
- else if (Texture == 1) {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glDisable(GL_TEXTURE_2D);
- }
- else {
- glActiveTextureARB(GL_TEXTURE0_ARB);
- glEnable(GL_TEXTURE_2D);
- glActiveTextureARB(GL_TEXTURE1_ARB);
- glEnable(GL_TEXTURE_2D);
- }
- break;
- case 'w':
- LineWidth -= 0.25;
- if (LineWidth < 0.25)
- LineWidth = 0.25;
- glLineWidth(LineWidth);
- glPointSize(LineWidth);
- break;
- case 'W':
- LineWidth += 0.25;
- if (LineWidth > 8.0)
- LineWidth = 8.0;
- glLineWidth(LineWidth);
- glPointSize(LineWidth);
- break;
- case 'p':
- Points = !Points;
- break;
- case 's':
- Stipple = !Stipple;
- if (Stipple)
- glEnable(GL_LINE_STIPPLE);
- else
- glDisable(GL_LINE_STIPPLE);
- break;
- case ' ':
- Animate = !Animate;
- if (Animate)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 27:
- exit(0);
- break;
- }
- printf("LineWidth, PointSize = %f\n", LineWidth);
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- GLuint u;
- for (u = 0; u < 2; u++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + u);
- glBindTexture(GL_TEXTURE_2D, 10+u);
- if (u == 0)
- glEnable(GL_TEXTURE_2D);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- if (u == 0)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- else
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- }
-
- glLineStipple(1, 0xff);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition(0, 0);
- glutInitWindowSize( 400, 300 );
-
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
-
- glutCreateWindow(argv[0] );
-
- Init(argc, argv);
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Animate)
- glutIdleFunc( Idle );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/texobjshare.c b/progs/tests/texobjshare.c
deleted file mode 100644
index 2b31cb6c4d3..00000000000
--- a/progs/tests/texobjshare.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Create several OpenGL rendering contexts, sharing textures, display
- * lists, etc. Exercise binding, deleting, etc.
- *
- * Brian Paul
- * 21 December 2004
- */
-
-
-#include <GL/gl.h>
-#include <GL/glx.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <X11/keysym.h>
-
-
-/*
- * Each display/window/context:
- */
-struct context {
- char DisplayName[1000];
- Display *Dpy;
- Window Win;
- GLXContext Context;
-};
-
-
-#define MAX_CONTEXTS 200
-static struct context Contexts[MAX_CONTEXTS];
-static int NumContexts = 0;
-
-
-static void
-Error(const char *display, const char *msg)
-{
- fprintf(stderr, "Error on display %s - %s\n", display, msg);
- exit(1);
-}
-
-
-static struct context *
-CreateContext(const char *displayName, const char *name)
-{
- Display *dpy;
- Window win;
- GLXContext ctx;
- int attrib[] = { GLX_RGBA,
- GLX_RED_SIZE, 1,
- GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER,
- None };
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- XVisualInfo *visinfo;
- int width = 90, height = 90;
- int xpos = 0, ypos = 0;
-
- if (NumContexts >= MAX_CONTEXTS)
- return NULL;
-
- dpy = XOpenDisplay(displayName);
- if (!dpy) {
- Error(displayName, "Unable to open display");
- return NULL;
- }
-
- scrnum = DefaultScreen(dpy);
- root = RootWindow(dpy, scrnum);
-
- visinfo = glXChooseVisual(dpy, scrnum, attrib);
- if (!visinfo) {
- Error(displayName, "Unable to find RGB, double-buffered visual");
- return NULL;
- }
-
- /* window attributes */
- xpos = (NumContexts % 10) * 100;
- ypos = (NumContexts / 10) * 100;
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(dpy, root, xpos, ypos, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr);
- if (!win) {
- Error(displayName, "Couldn't create window");
- return NULL;
- }
-
- {
- XSizeHints sizehints;
- sizehints.x = xpos;
- sizehints.y = ypos;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(dpy, win, &sizehints);
- XSetStandardProperties(dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
- if (NumContexts == 0) {
- ctx = glXCreateContext(dpy, visinfo, NULL, True);
- }
- else {
- /* share textures & dlists with 0th context */
- ctx = glXCreateContext(dpy, visinfo, Contexts[0].Context, True);
- }
- if (!ctx) {
- Error(displayName, "Couldn't create GLX context");
- return NULL;
- }
-
- XMapWindow(dpy, win);
-
- if (!glXMakeCurrent(dpy, win, ctx)) {
- Error(displayName, "glXMakeCurrent failed");
- return NULL;
- }
-
- if (NumContexts == 0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- }
-
- /* save the info for this context */
- {
- struct context *h = &Contexts[NumContexts];
- strcpy(h->DisplayName, name);
- h->Dpy = dpy;
- h->Win = win;
- h->Context = ctx;
- NumContexts++;
- return &Contexts[NumContexts-1];
- }
-}
-
-
-static void
-MakeCurrent(int i)
-{
- if (!glXMakeCurrent(Contexts[i].Dpy, Contexts[i].Win, Contexts[i].Context)) {
- fprintf(stderr, "glXMakeCurrent failed!\n");
- }
-}
-
-
-
-static void
-DestroyContext(int i)
-{
- XDestroyWindow(Contexts[i].Dpy, Contexts[i].Win);
- glXDestroyContext(Contexts[i].Dpy, Contexts[i].Context);
- XCloseDisplay(Contexts[i].Dpy);
-}
-
-
-int
-main(int argc, char *argv[])
-{
- char *dpyName = NULL;
- int i;
- GLuint t;
- GLint tb;
-
- for (i = 0; i < 2; i++) {
- CreateContext(dpyName, "context");
- }
-
- /* Create texture and bind it in context 0 */
- MakeCurrent(0);
- glGenTextures(1, &t);
- printf("Generated texture ID %u\n", t);
- assert(!glIsTexture(t));
- glBindTexture(GL_TEXTURE_2D, t);
- assert(glIsTexture(t));
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb);
- assert(tb == t);
-
- /* Bind texture in context 1 */
- MakeCurrent(1);
- assert(glIsTexture(t));
- glBindTexture(GL_TEXTURE_2D, t);
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb);
- assert(tb == t);
-
- /* Delete texture from context 0 */
- MakeCurrent(0);
- glDeleteTextures(1, &t);
- assert(!glIsTexture(t));
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb);
- printf("After delete, binding = %d\n", tb);
-
- /* Check texture state from context 1 */
- MakeCurrent(1);
- assert(!glIsTexture(t));
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb);
- printf("In second context, binding = %d\n", tb);
- glBindTexture(GL_TEXTURE_2D, 0);
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &tb);
- assert(tb == 0);
-
-
- for (i = 0; i < NumContexts; i++) {
- DestroyContext(i);
- }
-
- printf("Success!\n");
-
- return 0;
-}
diff --git a/progs/tests/texrect.c b/progs/tests/texrect.c
deleted file mode 100644
index 3035224816f..00000000000
--- a/progs/tests/texrect.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* $Id: texrect.c,v 1.5 2004-05-06 20:27:32 brianp Exp $ */
-
-/* GL_NV_texture_rectangle test
- *
- * Brian Paul
- * 14 June 2002
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GL/glut.h>
-#include "readtex.h"
-
-#define TEXTURE_0_FILE "../images/girl.rgb"
-#define TEXTURE_1_FILE "../images/reflect.rgb"
-
-#define TEX0 1
-#define TEX7 8
-#define ANIMATE 10
-#define CLAMP 20
-#define CLAMP_TO_EDGE 21
-#define CLAMP_TO_BORDER 22
-#define LINEAR_FILTER 30
-#define NEAREST_FILTER 31
-#define QUIT 100
-
-static GLboolean Animate = GL_FALSE;
-static GLint NumUnits = 2;
-static GLboolean TexEnabled[8];
-static GLint Width[8], Height[8]; /* image sizes */
-static GLenum Format[8];
-
-static GLfloat Xrot = 00.0, Yrot = 00.0, Zrot = 0.0;
-
-
-static void Idle( void )
-{
- Zrot = glutGet(GLUT_ELAPSED_TIME) * 0.01;
- glutPostRedisplay();
-}
-
-
-static void DrawObject(void)
-{
- GLint i;
- GLfloat d = 10; /* so we can see how borders are handled */
-
- glColor3f(.1, .1, .1); /* modulate this */
-
- glPushMatrix();
-
- glRotatef(Zrot, 0, 0, 1);
-
- glBegin(GL_QUADS);
-
- for (i = 0; i < NumUnits; i++)
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, -d, -d);
- glVertex2f(-1.0, -1.0);
-
- for (i = 0; i < NumUnits; i++)
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, Width[i]+d, -d);
- glVertex2f(1.0, -1.0);
-
- for (i = 0; i < NumUnits; i++)
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, Width[i]+d, Height[i]+d);
- glVertex2f(1.0, 1.0);
-
- for (i = 0; i < NumUnits; i++)
- glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i, -d, Height[i]+d);
- glVertex2f(-1.0, 1.0);
-
- glEnd();
- glPopMatrix();
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glScalef(5.0, 5.0, 5.0);
- DrawObject();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -35.0 );
-}
-
-
-static void ModeMenu(int entry)
-{
- GLint i;
- if (entry >= TEX0 && entry < TEX0 + NumUnits) {
- /* toggle */
- i = entry - TEX0;
- TexEnabled[i] = !TexEnabled[i];
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- if (TexEnabled[i]) {
- glEnable(GL_TEXTURE_RECTANGLE_NV);
- }
- else {
- glDisable(GL_TEXTURE_RECTANGLE_NV);
- }
- printf("Enabled: ");
- for (i = 0; i < NumUnits; i++)
- printf("%d ", (int) TexEnabled[i]);
- printf("\n");
- }
- else if (entry==ANIMATE) {
- Animate = !Animate;
- if (Animate)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- }
- else if (entry==CLAMP) {
- for (i = 0; i < NumUnits; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP);
- }
- }
- else if (entry==CLAMP_TO_EDGE) {
- for (i = 0; i < NumUnits; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- }
- }
- else if (entry==CLAMP_TO_BORDER) {
- for (i = 0; i < NumUnits; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
- }
- }
- else if (entry==NEAREST_FILTER) {
- for (i = 0; i < NumUnits; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
- }
- else if (entry==LINEAR_FILTER) {
- for (i = 0; i < NumUnits; i++) {
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- }
-
- else if (entry==QUIT) {
- exit(0);
- }
-
- glutPostRedisplay();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'z':
- Zrot -= 1.0;
- break;
- case 'Z':
- Zrot += 1.0;
- break;
- case 'a':
- Animate = !Animate;
- if (Animate)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( int argc, char *argv[] )
-{
- const GLenum wrap = GL_CLAMP;
- GLuint texObj[8];
- GLint size, i;
-
- if (!glutExtensionSupported("GL_ARB_multitexture")) {
- printf("Sorry, GL_ARB_multitexture needed by this program\n");
- exit(1);
- }
-
- if (!glutExtensionSupported("GL_NV_texture_rectangle")) {
- printf("Sorry, GL_NV_texture_rectangle needed by this program\n");
- exit(1);
- }
-
- glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &NumUnits);
- printf("%d texture units supported, using 2.\n", NumUnits);
- if (NumUnits > 2)
- NumUnits = 2;
-
- glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &size);
- printf("%d x %d max texture rectangle size\n", size, size);
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- for (i = 0; i < NumUnits; i++) {
- TexEnabled[i] = GL_TRUE;
- }
-
- /* allocate two texture objects */
- glGenTextures(NumUnits, texObj);
-
- /* setup the texture objects */
- for (i = 0; i < NumUnits; i++) {
-
- glActiveTextureARB(GL_TEXTURE0_ARB + i);
-
- glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj[i]);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV,
- GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV,
- GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, wrap);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, wrap);
-
- if (i == 0) {
- GLubyte *img = LoadRGBImage(TEXTURE_0_FILE, &Width[0], &Height[0],
- &Format[0]);
- if (!img) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- printf("Texture %d: %s (%d x %d)\n", i,
- TEXTURE_0_FILE, Width[0], Height[0]);
- glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB,
- Width[0], Height[0], 0,
- Format[0], GL_UNSIGNED_BYTE, img);
- }
- else {
- GLubyte *img = LoadRGBImage(TEXTURE_1_FILE, &Width[1], &Height[1],
- &Format[1]);
- if (!img) {
- printf("Error: couldn't load texture image\n");
- exit(1);
- }
- printf("Texture %d: %s (%d x %d)\n", i,
- TEXTURE_1_FILE, Width[1], Height[1]);
- glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB,
- Width[1], Height[1], 0,
- Format[1], GL_UNSIGNED_BYTE, img);
- }
-
- if (i < 1)
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
- else
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
-
- if (TexEnabled[i])
- glEnable(GL_TEXTURE_RECTANGLE_NV);
- }
-
- glShadeModel(GL_FLAT);
- glClearColor(0.3, 0.3, 0.4, 1.0);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- GLint i;
-
- glutInit( &argc, argv );
- glutInitWindowSize( 300, 300 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
-
- Init( argc, argv );
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Animate)
- glutIdleFunc( Idle );
-
- glutCreateMenu(ModeMenu);
-
- for (i = 0; i < NumUnits; i++) {
- char s[100];
- sprintf(s, "Toggle Texture %d", i);
- glutAddMenuEntry(s, TEX0 + i);
- }
- glutAddMenuEntry("Toggle Animation", ANIMATE);
- glutAddMenuEntry("GL_CLAMP", CLAMP);
- glutAddMenuEntry("GL_CLAMP_TO_EDGE", CLAMP_TO_EDGE);
- glutAddMenuEntry("GL_CLAMP_TO_BORDER", CLAMP_TO_BORDER);
- glutAddMenuEntry("GL_NEAREST", NEAREST_FILTER);
- glutAddMenuEntry("GL_LINEAR", LINEAR_FILTER);
- glutAddMenuEntry("Quit", QUIT);
- glutAttachMenu(GLUT_RIGHT_BUTTON);
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/texwrap.c b/progs/tests/texwrap.c
deleted file mode 100644
index b888dcd100c..00000000000
--- a/progs/tests/texwrap.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $Id: texwrap.c,v 1.8 2005-08-25 03:09:12 brianp Exp $ */
-
-/*
- * Test texture wrap modes.
- * Press 'b' to toggle texture image borders. You should see the same
- * rendering whether or not you're using borders.
- *
- * Brian Paul March 2001
- */
-
-
-#define GL_GLEXT_PROTOTYPES
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glut.h>
-
-
-#ifndef GL_CLAMP_TO_BORDER
-#define GL_CLAMP_TO_BORDER 0x812D
-#endif
-
-#ifndef GL_MIRRORED_REPEAT
-#define GL_MIRRORED_REPEAT 0x8370
-#endif
-
-#ifndef GL_EXT_texture_mirror_clamp
-#define GL_MIRROR_CLAMP_EXT 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
-#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912
-#endif
-
-#define BORDER_TEXTURE 1
-#define NO_BORDER_TEXTURE 2
-
-#define SIZE 8
-static GLubyte BorderImage[SIZE+2][SIZE+2][4];
-static GLubyte NoBorderImage[SIZE][SIZE][4];
-static GLuint Border = 0;
-
-#define TILE_SIZE 110
-
-#define WRAP_MODE(m) { m , # m, GL_TRUE, 1.0, { NULL, NULL } }
-#define WRAP_EXT(m,e1,e2,v) { m , # m, GL_FALSE, v, { e1, e2 } }
-
-struct wrap_mode {
- GLenum mode;
- const char * name;
- GLboolean supported;
- GLfloat version;
- const char * extension_names[2];
-};
-
-static struct wrap_mode modes[] = {
- WRAP_MODE( GL_REPEAT ),
- WRAP_MODE( GL_CLAMP ),
- WRAP_EXT ( GL_CLAMP_TO_EDGE, "GL_EXT_texture_edge_clamp",
- "GL_SGIS_texture_edge_clamp",
- 1.2 ),
- WRAP_EXT ( GL_CLAMP_TO_BORDER, "GL_ARB_texture_border_clamp",
- "GL_SGIS_texture_border_clamp",
- 1.3 ),
- WRAP_EXT ( GL_MIRRORED_REPEAT, "GL_ARB_texture_mirrored_repeat",
- "GL_IBM_texture_mirrored_repeat",
- 1.4 ),
- WRAP_EXT ( GL_MIRROR_CLAMP_EXT, "GL_ATI_texture_mirror_once",
- "GL_EXT_texture_mirror_clamp",
- 999.0 ),
- WRAP_EXT ( GL_MIRROR_CLAMP_TO_BORDER_EXT, "GL_EXT_texture_mirror_clamp",
- NULL,
- 999.0 ),
- WRAP_EXT ( GL_MIRROR_CLAMP_TO_EDGE_EXT, "GL_ATI_texture_mirror_once",
- "GL_EXT_texture_mirror_clamp",
- 999.0 ),
- { 0 }
-};
-
-static void
-PrintString(const char *s)
-{
- while (*s) {
- glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
- s++;
- }
-}
-
-
-static void Display( void )
-{
- GLenum i, j;
- GLint offset;
- GLfloat version;
-
- /* Fill in the extensions that are supported.
- */
-
- version = atof( (char *) glGetString( GL_VERSION ) );
- for ( i = 0 ; modes[i].mode != 0 ; i++ ) {
- if ( ((modes[i].extension_names[0] != NULL)
- && glutExtensionSupported(modes[i].extension_names[0]))
- || ((modes[i].extension_names[1] != NULL)
- && glutExtensionSupported(modes[i].extension_names[1])) ) {
- modes[i].supported = GL_TRUE;
- }
- else if ( !modes[i].supported && (modes[i].version <= version) ) {
- fprintf( stderr, "WARNING: OpenGL library meets minimum version\n"
- " requirement for %s, but the\n"
- " extension string is not advertised.\n"
- " (%s%s%s)\n",
- modes[i].name,
- modes[i].extension_names[0],
- (modes[i].extension_names[1] != NULL)
- ? " or " : "",
- (modes[i].extension_names[1] != NULL)
- ? modes[i].extension_names[1] : "" );
- modes[i].supported = GL_TRUE;
- }
- }
-
-
- glClearColor(0.5, 0.5, 0.5, 1.0);
- glClear( GL_COLOR_BUFFER_BIT );
-
-#if 0
- /* draw texture as image */
- glDisable(GL_TEXTURE_2D);
- glWindowPos2iARB(1, 1);
- glDrawPixels(6, 6, GL_RGBA, GL_UNSIGNED_BYTE, (void *) TexImage);
-#endif
-
- glBindTexture(GL_TEXTURE_2D, Border ? BORDER_TEXTURE : NO_BORDER_TEXTURE);
-
-
- /* loop over min/mag filters */
- for (i = 0; i < 2; i++) {
- offset = 0;
-
- if (i) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- }
- else {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- }
-
- /* loop over border modes */
- for (j = 0; modes[j].mode != 0; j++) {
- const GLfloat x0 = 0, y0 = 0, x1 = (TILE_SIZE - 10), y1 = (TILE_SIZE - 10);
- const GLfloat b = 1.2;
- const GLfloat s0 = -b, t0 = -b, s1 = 1.0+b, t1 = 1.0+b;
-
- if ( modes[j].supported != GL_TRUE )
- continue;
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, modes[j].mode);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, modes[j].mode);
-
- glPushMatrix();
- glTranslatef(offset * TILE_SIZE + 10, i * TILE_SIZE + 40, 0);
- offset++;
-
- glEnable(GL_TEXTURE_2D);
- glColor3f(1, 1, 1);
- glBegin(GL_POLYGON);
- glTexCoord2f(s0, t0); glVertex2f(x0, y0);
- glTexCoord2f(s1, t0); glVertex2f(x1, y0);
- glTexCoord2f(s1, t1); glVertex2f(x1, y1);
- glTexCoord2f(s0, t1); glVertex2f(x0, y1);
- glEnd();
-
- /* draw red outline showing bounds of texture at s=0,1 and t=0,1 */
- glDisable(GL_TEXTURE_2D);
- glColor3f(1, 0, 0);
- glBegin(GL_LINE_LOOP);
- glVertex2f(x0 + b * (x1-x0) / (s1-s0), y0 + b * (y1-y0) / (t1-t0));
- glVertex2f(x1 - b * (x1-x0) / (s1-s0), y0 + b * (y1-y0) / (t1-t0));
- glVertex2f(x1 - b * (x1-x0) / (s1-s0), y1 - b * (y1-y0) / (t1-t0));
- glVertex2f(x0 + b * (x1-x0) / (s1-s0), y1 - b * (y1-y0) / (t1-t0));
- glEnd();
-
- glPopMatrix();
- }
- }
-
- glDisable(GL_TEXTURE_2D);
- glColor3f(1, 1, 1);
- offset = 0;
- for (i = 0; modes[i].mode != 0; i++) {
- if ( modes[i].supported ) {
- glWindowPos2iARB( offset * TILE_SIZE + 10, 5 + ((offset & 1) * 15) );
- PrintString(modes[i].name);
- offset++;
- }
- }
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(0, width, 0, height, -1, 1);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'b':
- Border = !Border;
- printf("Texture Border Size = %d\n", Border);
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const GLubyte border[4] = { 0, 255, 0, 255 };
- static const GLfloat borderf[4] = { 0, 1.0, 0, 1.0 };
- GLint i, j;
-
- for (i = 0; i < SIZE+2; i++) {
- for (j = 0; j < SIZE+2; j++) {
- if (i == 0 || j == 0 || i == SIZE+1 || j == SIZE+1) {
- /* border color */
- BorderImage[i][j][0] = border[0];
- BorderImage[i][j][1] = border[1];
- BorderImage[i][j][2] = border[2];
- BorderImage[i][j][3] = border[3];
- }
- else if ((i + j) & 1) {
- /* white */
- BorderImage[i][j][0] = 255;
- BorderImage[i][j][1] = 255;
- BorderImage[i][j][2] = 255;
- BorderImage[i][j][3] = 255;
- }
- else {
- /* black */
- BorderImage[i][j][0] = 0;
- BorderImage[i][j][1] = 0;
- BorderImage[i][j][2] = 0;
- BorderImage[i][j][3] = 0;
- }
- }
- }
-
- glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
- GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage);
-
- for (i = 0; i < SIZE; i++) {
- for (j = 0; j < SIZE; j++) {
- if ((i + j) & 1) {
- /* white */
- NoBorderImage[i][j][0] = 255;
- NoBorderImage[i][j][1] = 255;
- NoBorderImage[i][j][2] = 255;
- NoBorderImage[i][j][3] = 255;
- }
- else {
- /* black */
- NoBorderImage[i][j][0] = 0;
- NoBorderImage[i][j][1] = 0;
- NoBorderImage[i][j][2] = 0;
- NoBorderImage[i][j][3] = 0;
- }
- }
- }
-
- glBindTexture(GL_TEXTURE_2D, NO_BORDER_TEXTURE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE, SIZE, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, (void *) NoBorderImage);
- glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderf);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 1000, 270 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/vparray.c b/progs/tests/vparray.c
deleted file mode 100644
index 580a670f8e1..00000000000
--- a/progs/tests/vparray.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Test vertex arrays with GL_NV_vertex_program
- *
- * Based on a stripped-down version of the isosurf demo.
- * The vertex program is trivial: compute the resulting
- * RGB color as a linear function of vertex XYZ.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include "GL/glut.h"
-
-#define MAXVERTS 10000
-static float data[MAXVERTS][6];
-static GLint numverts;
-
-static GLfloat xrot;
-static GLfloat yrot;
-static GLboolean useArrays = GL_TRUE;
-static GLboolean useProgram = GL_TRUE;
-static GLboolean useList = GL_FALSE;
-
-
-static void read_surface( char *filename )
-{
- FILE *f;
-
- f = fopen(filename,"r");
- if (!f) {
- printf("couldn't read %s\n", filename);
- exit(1);
- }
-
- numverts = 0;
- while (!feof(f) && numverts < MAXVERTS) {
- fscanf( f, "%f %f %f %f %f %f",
- &data[numverts][0], &data[numverts][1], &data[numverts][2],
- &data[numverts][3], &data[numverts][4], &data[numverts][5] );
- numverts++;
- }
- numverts--;
-
- printf("%d vertices, %d triangles\n", numverts, numverts-2);
- printf("data = %p\n", (void *) data);
- fclose(f);
-}
-
-
-
-
-static void Display(void)
-{
- if (useProgram)
- glEnable(GL_VERTEX_PROGRAM_NV);
- else
- glDisable(GL_VERTEX_PROGRAM_NV);
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(xrot, 1, 0, 0);
- glRotatef(yrot, 0, 1, 0);
- glScalef(2, 2, 2);
- if (useArrays) {
- if (useProgram) {
- glVertexAttribPointerNV( 0, 3, GL_FLOAT, 6 * sizeof(GLfloat), data );
- glEnableClientState( GL_VERTEX_ATTRIB_ARRAY0_NV );
- glVertexAttribPointerNV( 2, 3, GL_FLOAT, 6 * sizeof(GLfloat), ((GLfloat *) data) + 3);
- glEnableClientState( GL_VERTEX_ATTRIB_ARRAY2_NV);
- }
- else {
- glVertexPointer( 3, GL_FLOAT, 6 * sizeof(GLfloat), data );
- glEnableClientState( GL_VERTEX_ARRAY );
- glNormalPointer( GL_FLOAT, 6 * sizeof(GLfloat), ((GLfloat *) data) + 3);
- glEnableClientState( GL_NORMAL_ARRAY );
- }
-
- if (useList) {
- /* dumb, but a good test */
- glNewList(1,GL_COMPILE);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, numverts);
- glEndList();
- glCallList(1);
- }
- else {
- glDrawArrays(GL_TRIANGLE_STRIP, 0, numverts);
- }
-
- glDisableClientState( GL_VERTEX_ATTRIB_ARRAY0_NV );
- glDisableClientState( GL_VERTEX_ATTRIB_ARRAY2_NV);
- glDisableClientState( GL_VERTEX_ARRAY );
- glDisableClientState( GL_NORMAL_ARRAY );
- }
- else {
- int i;
- glBegin(GL_TRIANGLE_STRIP);
- for (i = 0; i < numverts; i++) {
- glNormal3fv( data[i] + 3 );
- glVertex3fv( data[i] + 0 );
- }
- glEnd();
- }
- glPopMatrix();
-
- if (glGetError())
- printf("Error!\n");
-
- glutSwapBuffers();
-}
-
-
-static void InitMaterials(void)
-{
- static float ambient[] = {0.1, 0.1, 0.1, 1.0};
- static float diffuse[] = {0.5, 1.0, 1.0, 1.0};
- static float position0[] = {0.0, 0.0, 20.0, 0.0};
- static float position1[] = {0.0, 0.0, -20.0, 0.0};
- static float front_mat_shininess[] = {60.0};
- static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0};
- static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0};
- /*
- static float back_mat_shininess[] = {60.0};
- static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0};
- static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0};
- */
- static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0};
- static float lmodel_twoside[] = {GL_FALSE};
-
- glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT0, GL_POSITION, position0);
- glEnable(GL_LIGHT0);
-
- glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT1, GL_POSITION, position1);
- glEnable(GL_LIGHT1);
-
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
- glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse);
- glEnable(GL_LIGHTING);
-}
-
-
-static void init_program(void)
-{
- /*
- * c[0..3] = modelview matrix
- * c[4..7] = inverse modelview matrix
- * c[30] = color scale
- * c[31] = color bias
- */
- static const char prog[] =
- "!!VP1.0\n"
-
- "# RGB is proportional to XYZ \n"
-
- "MUL R0, v[OPOS], c[30]; \n"
- "ADD o[COL0], R0, c[31]; \n"
-
- "# Continue with typical modelview/projection\n"
- "MOV R3, v[OPOS]; \n"
- "DP4 o[HPOS].x, c[0], R3 ; # object x MVP -> clip\n"
- "DP4 o[HPOS].y, c[1], R3 ;\n"
- "DP4 o[HPOS].z, c[2], R3 ;\n"
- "DP4 o[HPOS].w, c[3], R3 ;\n"
-
- "END";
-
- static const GLfloat scale[4] = {2.0, 2.0, 2.0, 0.0};
- static const GLfloat bias[4] = {1.0, 1.0, 1.0, 0.0};
-
- if (!glutExtensionSupported("GL_NV_vertex_program")) {
- printf("Sorry, this program requires GL_NV_vertex_program");
- exit(1);
- }
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1,
- strlen(prog), (const GLubyte *) prog);
- assert(glIsProgramNV(1));
- glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1);
-
- /* Load the program registers */
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV);
-
- glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, 30, scale);
- glProgramParameter4fvNV(GL_VERTEX_PROGRAM_NV, 31, bias);
-}
-
-
-static void init(void)
-{
- xrot = 0;
- yrot = 0;
- glClearColor(0.0, 0.0, 1.0, 0.0);
- glEnable( GL_DEPTH_TEST );
- glEnable(GL_NORMALIZE);
- InitMaterials();
- read_surface( "../demos/isosurf.dat" );
- init_program();
-}
-
-
-static void Reshape(int width, int height)
-{
- glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5, 25 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0, 0, -15);
-}
-
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- case 'a':
- useArrays = !useArrays;
- printf("use arrays: %s\n", useArrays ? "yes" : "no");
- break;
- case 'l':
- useList = !useList;
- printf("use list: %s\n", useList ? "yes" : "no");
- break;
- case 'p':
- useProgram = !useProgram;
- printf("use program: %s\n", useProgram ? "yes" : "no");
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_LEFT:
- yrot -= 15.0;
- break;
- case GLUT_KEY_RIGHT:
- yrot += 15.0;
- break;
- case GLUT_KEY_UP:
- xrot += 15.0;
- break;
- case GLUT_KEY_DOWN:
- xrot -= 15.0;
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE );
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(400, 400);
- if (glutCreateWindow("Isosurface") <= 0) {
- exit(0);
- }
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutSpecialFunc(SpecialKey);
- glutDisplayFunc(Display);
-
- init();
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/vpeval.c b/progs/tests/vpeval.c
deleted file mode 100644
index 8b6996d3b5c..00000000000
--- a/progs/tests/vpeval.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Vertex program evaluators test.
- * Based on book/bezmesh.c
- *
- * Brian Paul
- * 22 June 2002
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-/*
- * Transform position by modelview/projection.
- * Square incoming color.
- */
-static const char prog[] =
-"!!VP1.0\n"
-
-"# Typical modelview/projection\n"
-"DP4 o[HPOS].x, c[0], v[OPOS] ; # object x MVP -> clip\n"
-"DP4 o[HPOS].y, c[1], v[OPOS] ;\n"
-"DP4 o[HPOS].z, c[2], v[OPOS] ;\n"
-"DP4 o[HPOS].w, c[3], v[OPOS] ;\n"
-
-"MOV R0, v[COL0];\n # square the color\n"
-"MUL R0, R0, R0;\n"
-"MOV o[COL0], R0;\n # store output color\n"
-
-"END";
-
-
-static int program = 1;
-
-
-GLfloat ctrlpoints[4][4][4] =
-{
- {
- {-1.5, -1.5, 4.0, 1.0},
- {-0.5, -1.5, 2.0, 1.0},
- {0.5, -1.5, -1.0, 1.0},
- {1.5, -1.5, 2.0, 1.0}},
- {
- {-1.5, -0.5, 1.0, 1.0},
- {-0.5, -0.5, 3.0, 1.0},
- {0.5, -0.5, 0.0, 1.0},
- {1.5, -0.5, -1.0, 1.0}},
- {
- {-1.5, 0.5, 4.0, 1.0},
- {-0.5, 0.5, 0.0, 1.0},
- {0.5, 0.5, 3.0, 1.0},
- {1.5, 0.5, 4.0, 1.0}},
- {
- {-1.5, 1.5, -2.0, 1.0},
- {-0.5, 1.5, -2.0, 1.0},
- {0.5, 1.5, 0.0, 1.0},
- {1.5, 1.5, -1.0, 1.0}}
-};
-
-/*
- * +-------------+
- * |green |yellow
- * | |
- * | |
- * |black |red
- * +-------------+
- */
-GLfloat colorPoints[4][4][4] =
-{
- {
- {0.0, 0.0, 0.0, 1.0},
- {0.3, 0.0, 0.0, 1.0},
- {0.6, 0.0, 0.0, 1.0},
- {1.0, 0.0, 0.0, 1.0}},
- {
- {0.0, 0.3, 0.0, 1.0},
- {0.3, 0.3, 0.0, 1.0},
- {0.6, 0.3, 0.0, 1.0},
- {1.0, 0.3, 0.0, 1.0}},
- {
- {0.0, 0.6, 0.0, 1.0},
- {0.3, 0.6, 0.0, 1.0},
- {0.6, 0.6, 0.0, 1.0},
- {1.0, 0.6, 0.0, 1.0}},
- {
- {0.0, 1.0, 0.0, 1.0},
- {0.3, 1.0, 0.0, 1.0},
- {0.6, 1.0, 0.0, 1.0},
- {1.0, 1.0, 0.0, 1.0}}
-};
-
-
-void
-initlights(void)
-{
- GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0};
- GLfloat position[] = {0.0, 0.0, 2.0, 1.0};
- GLfloat mat_diffuse[] = {0.6, 0.6, 0.6, 1.0};
- GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0};
- GLfloat mat_shininess[] = {50.0};
-
-#if 0 /* no lighting for now */
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
-
- glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT0, GL_POSITION, position);
-
- glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
- glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
- glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
-#endif
-}
-
-void
-display(void)
-{
- glClearColor(.3, .3, .3, 0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glPushMatrix();
-#if 1
- glRotatef(85.0, 1.0, 1.0, 1.0);
-#endif
- glEvalMesh2(GL_FILL, 0, 8, 0, 8);
- glPopMatrix();
- glFlush();
-}
-
-void
-myinit(int argc, char *argv[])
-{
- glClearColor(0.0, 0.0, 0.0, 1.0);
- glEnable(GL_DEPTH_TEST);
-
- initlights(); /* for lighted version only */
-
- glMapGrid2f(8, 0.0, 1.0, 8, 0.0, 1.0);
-
- if (argc > 1)
- program = 0;
-
- printf("Using vertex program attribs? %s\n", program ? "yes" : "no");
-
- if (!program) {
- glMap2f(GL_MAP2_VERTEX_4,
- 0.0, 1.0, 4, 4,
- 0.0, 1.0, 16, 4, &ctrlpoints[0][0][0]);
- glMap2f(GL_MAP2_COLOR_4,
- 0.0, 1.0, 4, 4,
- 0.0, 1.0, 16, 4, &colorPoints[0][0][0]);
- glEnable(GL_MAP2_VERTEX_4);
- glEnable(GL_MAP2_COLOR_4);
- /*
- glEnable(GL_AUTO_NORMAL);
- glEnable(GL_NORMALIZE);
- */
- }
- else {
- glMap2f(GL_MAP2_VERTEX_ATTRIB0_4_NV,
- 0.0, 1.0, 4, 4,
- 0.0, 1.0, 16, 4, &ctrlpoints[0][0][0]);
- glMap2f(GL_MAP2_VERTEX_ATTRIB3_4_NV,
- 0.0, 1.0, 4, 4,
- 0.0, 1.0, 16, 4, &colorPoints[0][0][0]);
- glEnable(GL_MAP2_VERTEX_ATTRIB0_4_NV);
- glEnable(GL_MAP2_VERTEX_ATTRIB3_4_NV);
-
- /*
- glEnable(GL_AUTO_NORMAL);
- glEnable(GL_NORMALIZE);
- */
-
- /* vertex program init */
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1,
- strlen(prog), (const GLubyte *) prog);
- assert(glIsProgramNV(1));
- glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1);
-
- /* track matrices */
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
- glEnable(GL_VERTEX_PROGRAM_NV);
- }
-}
-
-void
-myReshape(int w, int h)
-{
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- if (w <= h)
- glOrtho(-4.0, 4.0, -4.0 * (GLfloat) h / (GLfloat) w,
- 4.0 * (GLfloat) h / (GLfloat) w, -4.0, 4.0);
- else
- glOrtho(-4.0 * (GLfloat) w / (GLfloat) h,
- 4.0 * (GLfloat) w / (GLfloat) h, -4.0, 4.0, -4.0, 4.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-static void
-key(unsigned char k, int x, int y)
-{
- switch (k) {
- case 27: /* Escape */
- exit(0);
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-int
-main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowPosition(0, 0);
- glutCreateWindow(argv[0]);
- myinit(argc, argv);
- glutReshapeFunc(myReshape);
- glutDisplayFunc(display);
- glutKeyboardFunc(key);
- glutMainLoop();
- return 0; /* ANSI C requires main to return int. */
-}
diff --git a/progs/tests/vptest1.c b/progs/tests/vptest1.c
deleted file mode 100644
index 560df2c3fdc..00000000000
--- a/progs/tests/vptest1.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
-
- glBegin(GL_POLYGON);
- glVertexAttrib2fNV(0, -1, -1);
- glVertexAttrib2fNV(0, 1, -1);
- glVertexAttrib2fNV(0, 0, 1);
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const char *prog1 =
- "!!VP1.0\n"
- "MUL o[COL0].xyz, R0, c[35]; \n"
- "END\n";
- static const char *prog2 =
- "!!VP1.0\n"
- "#\n"
- "# c[0-3] = modelview projection (composite) matrix\n"
- "# c[32] = normalized light direction in object-space\n"
- "# c[35] = yellow diffuse material, (1.0, 1.0, 0.0, 1.0)\n"
- "# c[64].x = 0.0\n"
- "# c[64].z = 0.125, a scaling factor\n"
- "#\n"
- "# outputs diffuse illumination for color and perturbed position\n"
- "#\n"
- "DP3 R0, c[32], v[NRML]; # light direction DOT normal\n"
- "MUL o[COL0].xyz, R0, c[35]; \n"
- "MAX R0, c[64].x, R0; \n"
- "MUL R0, R0, v[NRML]; \n"
- "MUL R0, R0, c[64].z; \n"
- "ADD R1, v[OPOS], -R0; # perturb object space position\n"
- "DP4 o[HPOS].x, c[0], R1; \n"
- "DP4 o[HPOS].y, c[1], R1; \n"
- "DP4 o[HPOS].z, c[2], R1; \n"
- "DP4 o[HPOS].w, c[3], R1; \n"
- "END\n";
- static const char *prog3 =
- "!!VP1.0\n"
- "DP4 o[HPOS].x, c[0], v[OPOS];\n"
- "DP4 o[HPOS].y, c[1], v[OPOS];\n"
- "DP4 o[HPOS].z, c[2], v[OPOS];\n"
- "DP4 o[HPOS].w, c[3], v[OPOS];\n"
- "DP3 R0.x, c[4], v[NRML];\n"
- "DP3 R0.y, c[5], v[NRML]; \n"
- "DP3 R0.z, c[6], v[NRML]; # R0 = n' = transformed normal\n"
- "DP3 R1.x, c[32], R0; # R1.x = Lpos DOT n'\n"
- "DP3 R1.y, c[33], R0; # R1.y = hHat DOT n'\n"
- "MOV R1.w, c[38].x; # R1.w = specular power\n"
- "LIT R2, R1; # Compute lighting values\n"
- "MAD R3, c[35].x, R2.y, c[35].y; # diffuse + emissive\n"
- "MAD o[COL0].xyz, c[36], R2.z, R3; # + specular\n"
- "END\n";
- static const char *prog4 =
- "!!VP1.0\n"
- "DP4 R2, R3, c[A0.x];\n"
- "DP4 R2, R3, c[A0.x + 5];\n"
- "DP4 o[HPOS], R3, c[A0.x - 4];\n"
- "END\n";
- static const char *prog5 =
- "!!VSP1.0\n"
- "DP4 R2, R3, c[A0.x];\n"
- "DP4 R2, R3, v[0];\n"
- "DP4 c[3], R3, R2;\n"
- "END\n";
-
-
- GLuint progs[5];
-
- glGenProgramsNV(2, progs);
- assert(progs[0]);
- assert(progs[1]);
- assert(progs[0] != progs[1]);
-
- glGenProgramsNV(3, progs + 2);
- assert(progs[2]);
- assert(progs[3]);
- assert(progs[2] != progs[3]);
- assert(progs[0] != progs[2]);
-
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1,
- strlen(prog1),
- (const GLubyte *) prog1);
- assert(!glIsProgramNV(1));
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 2,
- strlen(prog2),
- (const GLubyte *) prog2);
- assert(glIsProgramNV(2));
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 3,
- strlen(prog3),
- (const GLubyte *) prog3);
- assert(glIsProgramNV(3));
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 4,
- strlen(prog4),
- (const GLubyte *) prog4);
- assert(glIsProgramNV(4));
-
- glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 5,
- strlen(prog5),
- (const GLubyte *) prog5);
- assert(glIsProgramNV(5));
-
- printf("glGetError = %d\n", (int) glGetError());
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/vptest2.c b/progs/tests/vptest2.c
deleted file mode 100644
index 2158e07f042..00000000000
--- a/progs/tests/vptest2.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Test vertex state program execution */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- glPushMatrix();
- glutSolidCube(2.0);
- glPopMatrix();
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Test1( void )
-{
- static const GLfloat p[4] = {9, 8, 7, 6};
- GLfloat q[4];
- /* test addition */
- static const char *prog =
- "!!VSP1.0\n"
- "MOV R0, c[0];\n"
- "MOV R1, c[1];\n"
- "ADD c[2], R0, R1;\n"
- "END\n";
-
- glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1,
- strlen(prog),
- (const GLubyte *) prog);
- assert(glIsProgramNV(1));
-
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 0, 1, 2, 3, 4);
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 1, 10, 20, 30, 40);
-
- glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, p);
-
- glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV, 2, GL_PROGRAM_PARAMETER_NV, q);
- printf("Result c[2] = %g %g %g %g (should be 11 22 33 44)\n",
- q[0], q[1], q[2], q[3]);
-}
-
-
-static void Test2( void )
-{
- static const GLfloat p[4] = {9, 8, 7, 6};
- GLfloat q[4];
- /* test swizzling */
- static const char *prog =
- "!!VSP1.0\n"
- "MOV R0, c[0].wzyx;\n"
- "MOV R1, c[1].wzyx;\n"
- "ADD c[2], R0, R1;\n"
- "END\n";
-
- glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1,
- strlen(prog),
- (const GLubyte *) prog);
- assert(glIsProgramNV(1));
-
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 0, 1, 2, 3, 4);
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 1, 10, 20, 30, 40);
-
- glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, p);
-
- glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV, 2, GL_PROGRAM_PARAMETER_NV, q);
- printf("Result c[2] = %g %g %g %g (should be 44 33 22 11)\n",
- q[0], q[1], q[2], q[3]);
-}
-
-
-static void Test3( void )
-{
- static const GLfloat p[4] = {0, 0, 0, 0};
- GLfloat q[4];
- /* normalize vector */
- static const char *prog =
- "!!VSP1.0\n"
- "# c[0] = (nx,ny,nz)\n"
- "# R0.xyz = normalize(R1)\n"
- "# R0.w = 1/sqrt(nx*nx + ny*ny + nz*nz)\n"
- "# c[2] = R0\n"
- "DP3 R0.w, c[0], c[0];\n"
- "RSQ R0.w, R0.w;\n"
- "MUL R0.xyz, c[0], R0.w;\n"
- "MOV c[2], R0;\n"
- "END\n";
-
- glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1,
- strlen(prog),
- (const GLubyte *) prog);
- assert(glIsProgramNV(1));
-
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 0, 0, 10, 0, 0);
-
- glExecuteProgramNV(GL_VERTEX_STATE_PROGRAM_NV, 1, p);
-
- glGetProgramParameterfvNV(GL_VERTEX_PROGRAM_NV, 2, GL_PROGRAM_PARAMETER_NV, q);
- printf("Result c[2] = %g %g %g %g (should be 0, 1, 0, 0.1)\n",
- q[0], q[1], q[2], q[3]);
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 50, 50 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Test1();
- Test2();
- Test3();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/vptest3.c b/progs/tests/vptest3.c
deleted file mode 100644
index 2c5c8000408..00000000000
--- a/progs/tests/vptest3.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Zrot = 0.0;
-
-
-static void Display( void )
-{
- glClearColor(0.3, 0.3, 0.3, 1);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glEnable(GL_VERTEX_PROGRAM_NV);
-
- glLoadIdentity();
- glRotatef(Zrot, 0, 0, 1);
-
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW, GL_IDENTITY_NV);
- glPushMatrix();
-
- glVertexAttrib3fNV(3, 1, 0.5, 0.25);
- glBegin(GL_TRIANGLES);
-#if 1
- glVertexAttrib3fNV(3, 1.0, 0.0, 0.0);
- glVertexAttrib2fNV(0, -0.5, -0.5);
- glVertexAttrib3fNV(3, 0.0, 1.0, 0.0);
- glVertexAttrib2fNV(0, 0.5, -0.5);
- glVertexAttrib3fNV(3, 0.0, 0.0, 1.0);
- glVertexAttrib2fNV(0, 0, 0.5);
-#else
- glVertex2f( -1, -1);
- glVertex2f( 1, -1);
- glVertex2f( 0, 1);
-#endif
- glEnd();
-
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- /* glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/
- glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- /*glTranslatef( 0.0, 0.0, -15.0 );*/
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- static const char *prog1 =
- "!!VP1.0\n"
- "MOV o[COL0], v[COL0];\n"
-#if 0
- "MOV o[HPOS], v[OPOS];\n"
-#else
- "DP4 o[HPOS].x, v[OPOS], c[0];\n"
- "DP4 o[HPOS].y, v[OPOS], c[1];\n"
- "DP4 o[HPOS].z, v[OPOS], c[2];\n"
- "DP4 o[HPOS].w, v[OPOS], c[3];\n"
-#endif
- "END\n";
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1,
- strlen(prog1),
- (const GLubyte *) prog1);
- assert(glIsProgramNV(1));
-
- glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1);
-
- printf("glGetError = %d\n", (int) glGetError());
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/vptorus.c b/progs/tests/vptorus.c
deleted file mode 100644
index 764dea4ec22..00000000000
--- a/progs/tests/vptorus.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * A lit, rotating torus via vertex program
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Xrot = 0.0, Yrot = 0.0, Zrot = 0.0;
-static GLboolean Anim = GL_TRUE;
-
-
-static void Idle( void )
-{
- Xrot += .3;
- Yrot += .4;
- Zrot += .2;
- glutPostRedisplay();
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
- glutSolidTorus(0.75, 2.0, 10, 20);
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case ' ':
- Xrot = Yrot = Zrot = 0;
- break;
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- /* borrowed from an nvidia demo:
- * c[0..3] = modelview matrix
- * c[4..7] = inverse modelview matrix
- * c[32] = light pos
- * c[35] = diffuse color
- */
- static const char prog[] =
- "!!VP1.0\n"
- "#Simple transform and diffuse lighting\n"
- "\n"
- "DP4 o[HPOS].x, c[0], v[OPOS] ; # object x MVP -> clip\n"
- "DP4 o[HPOS].y, c[1], v[OPOS] ;\n"
- "DP4 o[HPOS].z, c[2], v[OPOS] ;\n"
- "DP4 o[HPOS].w, c[3], v[OPOS] ;\n"
-
- "DP3 R1.x, c[4], v[NRML] ; # normal x MV-1T -> lighting normal\n"
- "DP3 R1.y, c[5], v[NRML] ;\n"
- "DP3 R1.z, c[6], v[NRML] ;\n"
-
- "DP3 R0, c[32], R1 ; # L.N\n"
- "MUL o[COL0].xyz, R0, c[35] ; # col = L.N * diffuse\n"
- "MOV o[TEX0], v[TEX0];\n"
- "END";
-
- if (!glutExtensionSupported("GL_NV_vertex_program")) {
- printf("Sorry, this program requires GL_NV_vertex_program");
- exit(1);
- }
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1,
- strlen(prog), (const GLubyte *) prog);
- assert(glIsProgramNV(1));
- glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1);
-
- /* Load the program registers */
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV);
-
- /* Light position */
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 32, 2, 2, 4, 1);
- /* Diffuse material color */
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 35, 0.25, 0, 0.25, 1);
-
- glEnable(GL_VERTEX_PROGRAM_NV);
- glEnable(GL_DEPTH_TEST);
- glClearColor(0.3, 0.3, 0.3, 1);
-
- printf("glGetError = %d\n", (int) glGetError());
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/vpwarpmesh.c b/progs/tests/vpwarpmesh.c
deleted file mode 100644
index 56aa8200ec8..00000000000
--- a/progs/tests/vpwarpmesh.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Warp a triangle mesh with a vertex program.
- */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static float Xrot = -60.0, Yrot = 0.0, Zrot = 0.0;
-static GLboolean Anim = GL_TRUE;
-static GLfloat Phi = 0.0;
-
-
-static void Idle( void )
-{
- Phi += 0.01;
- glutPostRedisplay();
-}
-
-
-static void DrawMesh( int rows, int cols )
-{
- static const GLfloat colorA[3] = { 0, 1, 0 };
- static const GLfloat colorB[3] = { 0, 0, 1 };
- const float dx = 2.0 / (cols - 1);
- const float dy = 2.0 / (rows - 1);
- float x, y;
- int i, j;
-
-#if 1
-#define COLOR3FV(c) glVertexAttrib3fvNV(3, c)
-#define VERTEX2F(x, y) glVertexAttrib2fNV(0, x, y)
-#else
-#define COLOR3FV(c) glColor3fv(c)
-#define VERTEX2F(x, y) glVertex2f(x, y)
-#endif
-
- y = -1.0;
- for (i = 0; i < rows - 1; i++) {
- glBegin(GL_QUAD_STRIP);
- x = -1.0;
- for (j = 0; j < cols; j++) {
- if ((i + j) & 1)
- COLOR3FV(colorA);
- else
- COLOR3FV(colorB);
- VERTEX2F(x, y);
- VERTEX2F(x, y + dy);
- x += dx;
- }
- glEnd();
- y += dy;
- }
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1, 0, 0);
- glRotatef(Yrot, 0, 1, 0);
- glRotatef(Zrot, 0, 0, 1);
-
- /* Position the gravity source */
- {
- GLfloat x, y, z, r = 0.5;
- x = r * cos(Phi);
- y = r * sin(Phi);
- z = 1.0;
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 30, x, y, z, 1);
- glDisable(GL_VERTEX_PROGRAM_NV);
- glBegin(GL_POINTS);
- glColor3f(1,1,1);
- glVertex3f(x, y, z);
- glEnd();
- }
-
- glEnable(GL_VERTEX_PROGRAM_NV);
- DrawMesh(8, 8);
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- float ar = (float) width / (float) height;
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0 * ar, 1.0 * ar, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -12.0 );
- glScalef(2, 2, 2);
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 'a':
- Anim = !Anim;
- if (Anim)
- glutIdleFunc(Idle);
- else
- glutIdleFunc(NULL);
- break;
- case 'p':
- Phi += 0.2;
- break;
- case 'z':
- Zrot -= 5.0;
- break;
- case 'Z':
- Zrot += 5.0;
- break;
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- const GLfloat step = 3.0;
- (void) x;
- (void) y;
- switch (key) {
- case GLUT_KEY_UP:
- Xrot -= step;
- break;
- case GLUT_KEY_DOWN:
- Xrot += step;
- break;
- case GLUT_KEY_LEFT:
- Yrot -= step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot += step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init( void )
-{
- /*
- * c[0..3] = modelview matrix
- * c[4..7] = inverse modelview matrix
- * c[30] = gravity source location
- * c[31] = gravity source strength
- * c[32] = light pos
- * c[35] = diffuse color
- */
- static const char prog[] =
- "!!VP1.0\n"
-
- "# Compute distance from vertex to gravity source\n"
- "ADD R1, c[30], -v[OPOS]; # vector from vertex to gravity\n"
- "DP3 R2, R1, R1; # dot product\n"
- "RSQ R2, R2.x; # square root = distance\n"
- "MUL R2, R2, c[31].xxxx; # scale by the gravity factor\n"
-
- "# Displace vertex by gravity factor along R1 vector\n"
- "MAD R3, R1, R2, v[OPOS];\n"
-
- "# Continue with typical modelview/projection\n"
- "DP4 o[HPOS].x, c[0], R3 ; # object x MVP -> clip\n"
- "DP4 o[HPOS].y, c[1], R3 ;\n"
- "DP4 o[HPOS].z, c[2], R3 ;\n"
- "DP4 o[HPOS].w, c[3], R3 ;\n"
-
- "MOV o[COL0], v[COL0];\n # copy input color to output color\n"
-
- "END";
-
- if (!glutExtensionSupported("GL_NV_vertex_program")) {
- printf("Sorry, this program requires GL_NV_vertex_program\n");
- exit(1);
- }
-
- glLoadProgramNV(GL_VERTEX_PROGRAM_NV, 1,
- strlen(prog), (const GLubyte *) prog);
- assert(glIsProgramNV(1));
- glBindProgramNV(GL_VERTEX_PROGRAM_NV, 1);
-
- /* Load the program registers */
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
- glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV);
-
- /* Light position */
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 32, 2, 2, 4, 1);
- /* Diffuse material color */
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 35, 0.25, 0, 0.25, 1);
-
- /* Gravity strength */
- glProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, 31, .5, 0, 0, 0);
-
- glEnable(GL_DEPTH_TEST);
- glClearColor(0.3, 0.3, 0.3, 1);
- glShadeModel(GL_FLAT);
- glPointSize(3);
- printf("glGetError = %d\n", (int) glGetError());
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
- if (Anim)
- glutIdleFunc(Idle);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/yuvrect.c b/progs/tests/yuvrect.c
deleted file mode 100644
index acef4060970..00000000000
--- a/progs/tests/yuvrect.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions.
- *
- * Brian Paul 13 September 2002
- */
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_FILE "../images/girl.rgb"
-
-static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
-static GLint ImgWidth, ImgHeight;
-static GLushort *ImageYUV = NULL;
-
-
-static void DrawObject(void)
-{
- glBegin(GL_QUADS);
-
- glTexCoord2f(0, 0);
- glVertex2f(-1.0, -1.0);
-
- glTexCoord2f(ImgWidth, 0);
- glVertex2f(1.0, -1.0);
-
- glTexCoord2f(ImgWidth, ImgHeight);
- glVertex2f(1.0, 1.0);
-
- glTexCoord2f(0, ImgHeight);
- glVertex2f(-1.0, 1.0);
-
- glEnd();
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- DrawObject();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-static void Init( int argc, char *argv[] )
-{
- GLuint texObj = 100;
- const char *file;
-
- if (!glutExtensionSupported("GL_NV_texture_rectangle")) {
- printf("Sorry, GL_NV_texture_rectangle is required\n");
- exit(0);
- }
-
- if (!glutExtensionSupported("GL_MESA_ycbcr_texture")) {
- printf("Sorry, GL_MESA_ycbcr_texture is required\n");
- exit(0);
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj);
-#ifdef LINEAR_FILTER
- /* linear filtering looks much nicer but is much slower for Mesa */
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-#else
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-#endif
-
- if (argc > 1)
- file = argv[1];
- else
- file = TEXTURE_FILE;
-
- ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight);
- if (!ImageYUV) {
- printf("Couldn't read %s\n", TEXTURE_FILE);
- exit(0);
- }
-
- printf("Image: %dx%d\n", ImgWidth, ImgHeight);
-
- glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
- GL_YCBCR_MESA, ImgWidth, ImgHeight, 0,
- GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
-
- assert(glGetError() == GL_NO_ERROR);
- glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
- 0, 0, ImgWidth, ImgHeight,
- GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
-
- assert(glGetError() == GL_NO_ERROR);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
- glEnable(GL_TEXTURE_RECTANGLE_NV);
-
- glShadeModel(GL_FLAT);
- glClearColor(0.3, 0.3, 0.4, 1.0);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 300, 300 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
-
- Init( argc, argv );
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/yuvsquare.c b/progs/tests/yuvsquare.c
deleted file mode 100644
index 3601e7a31c7..00000000000
--- a/progs/tests/yuvsquare.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions.
- *
- * Brian Paul 13 September 2002
- */
-
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-#include "../util/readtex.c" /* I know, this is a hack. */
-
-#define TEXTURE_FILE "../images/tile.rgb"
-
-static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
-static GLint ImgWidth, ImgHeight;
-static GLushort *ImageYUV = NULL;
-static GLubyte *ImageRGB = NULL;
-static const GLuint yuvObj = 100;
-static const GLuint rgbObj = 101;
-
-
-static void DrawObject(void)
-{
- glBegin(GL_QUADS);
-
- glTexCoord2f(0, 0);
- glVertex2f(-1.0, -1.0);
-
- glTexCoord2f(1, 0);
- glVertex2f(1.0, -1.0);
-
- glTexCoord2f(1, 1);
- glVertex2f(1.0, 1.0);
-
- glTexCoord2f(0, 1);
- glVertex2f(-1.0, 1.0);
-
- glEnd();
-}
-
-
-static void Display( void )
-{
- glClear( GL_COLOR_BUFFER_BIT );
-
- glPushMatrix();
- glTranslatef( -1.1, 0.0, -15.0 );
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glBindTexture(GL_TEXTURE_2D, yuvObj);
- DrawObject();
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( 1.1, 0.0, -15.0 );
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- glBindTexture(GL_TEXTURE_2D, rgbObj);
- DrawObject();
- glPopMatrix();
-
- glutSwapBuffers();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.1, 1.1, -1.1, 1.1, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void SpecialKey( int key, int x, int y )
-{
- float step = 3.0;
- (void) x;
- (void) y;
-
- switch (key) {
- case GLUT_KEY_UP:
- Xrot += step;
- break;
- case GLUT_KEY_DOWN:
- Xrot -= step;
- break;
- case GLUT_KEY_LEFT:
- Yrot += step;
- break;
- case GLUT_KEY_RIGHT:
- Yrot -= step;
- break;
- }
- glutPostRedisplay();
-}
-
-
-#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
-
-
-
-/* #define LINEAR_FILTER */
-
-static void Init( int argc, char *argv[] )
-{
- const char *file;
- GLenum format;
-
- if (!glutExtensionSupported("GL_MESA_ycbcr_texture")) {
- printf("Sorry, GL_MESA_ycbcr_texture is required\n");
- exit(0);
- }
-
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- if (argc > 1)
- file = argv[1];
- else
- file = TEXTURE_FILE;
-
- /* First load the texture as YCbCr.
- */
-
- glBindTexture(GL_TEXTURE_2D, yuvObj);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight );
- if (!ImageYUV) {
- printf("Couldn't read %s\n", TEXTURE_FILE);
- exit(0);
- }
-
- printf("Image: %dx%d\n", ImgWidth, ImgHeight);
-
-
- glTexImage2D(GL_TEXTURE_2D, 0,
- GL_YCBCR_MESA,
- ImgWidth, ImgHeight, 0,
- GL_YCBCR_MESA,
- GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
-
- glEnable(GL_TEXTURE_2D);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-
-
- /* Now load the texture as RGB.
- */
-
- glBindTexture(GL_TEXTURE_2D, rgbObj);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- ImageRGB = LoadRGBImage(file, &ImgWidth, &ImgHeight, &format );
- if (!ImageRGB) {
- printf("Couldn't read %s\n", TEXTURE_FILE);
- exit(0);
- }
-
- printf("Image: %dx%d\n", ImgWidth, ImgHeight);
-
-
- glTexImage2D(GL_TEXTURE_2D, 0,
- format,
- ImgWidth, ImgHeight, 0,
- format,
- GL_UNSIGNED_BYTE, ImageRGB);
-
- glEnable(GL_TEXTURE_2D);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-
-
- glShadeModel(GL_FLAT);
- glClearColor(0.3, 0.3, 0.4, 1.0);
-
- if (argc > 1 && strcmp(argv[1], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-
- printf( "Both images should appear the same.\n" );
-}
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowSize( 300, 300 );
- glutInitWindowPosition( 0, 0 );
- glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0] );
-
- Init( argc, argv );
-
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutSpecialFunc( SpecialKey );
- glutDisplayFunc( Display );
-
- glutMainLoop();
- return 0;
-}
diff --git a/progs/tests/zreaddraw.c b/progs/tests/zreaddraw.c
deleted file mode 100644
index e2dacbf7f2f..00000000000
--- a/progs/tests/zreaddraw.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Test glRead/DrawPixels for GL_DEPTH_COMPONENT, with pixelzoom.
- *
- * Brian Paul
- * 23 August 2003
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static GLint WinWidth = 500, WinHeight = 500;
-
-
-static void Display(void)
-{
- GLfloat depth[100 * 100];
- GLfloat depth2[400 * 400];
- GLfloat min, max;
- int i;
-
- glClearColor(0.5, 0.5, 0.5, 0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- /* draw a sphere */
- glViewport(0, 0, 100, 100);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1, 1, -1, 1, -1, 0); /* clip away back half of sphere */
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glutSolidSphere(1.0, 20, 10);
-
- /* read the depth image */
- glReadPixels(0, 0, 100, 100, GL_DEPTH_COMPONENT, GL_FLOAT, depth);
- min = max = depth[0];
- for (i = 1; i < 100 * 100; i++) {
- if (depth[i] < min)
- min = depth[i];
- if (depth[i] > max)
- max = depth[i];
- }
- printf("Depth value range: [%f, %f]\n", min, max);
-
- /* draw depth image with scaling (into z buffer) */
- glPixelZoom(4.0, 4.0);
- glWindowPos2i(100, 0);
- glDrawPixels(100, 100, GL_DEPTH_COMPONENT, GL_FLOAT, depth);
-
- /* read back scaled depth image */
- glReadPixels(100, 0, 400, 400, GL_DEPTH_COMPONENT, GL_FLOAT, depth2);
- /* draw as luminance */
- glPixelZoom(1.0, 1.0);
- glDrawPixels(400, 400, GL_LUMINANCE, GL_FLOAT, depth2);
-
- glutSwapBuffers();
-}
-
-
-static void Reshape(int width, int height)
-{
- WinWidth = width;
- WinHeight = height;
- glViewport(0, 0, width, height);
-}
-
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init(void)
-{
- const GLfloat blue[4] = {.1, .1, 1.0, 0.0};
- const GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
- const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
- const GLfloat pos[4] = {0, 0, 10, 0};
-
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, blue);
- glLightfv(GL_LIGHT0, GL_AMBIENT, gray);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-}
-
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(WinWidth, WinHeight);
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Display);
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/util/descrip.mms b/progs/util/descrip.mms
deleted file mode 100644
index 21dec4b9be4..00000000000
--- a/progs/util/descrip.mms
+++ /dev/null
@@ -1,42 +0,0 @@
-# Makefile for GLUT-based demo programs for VMS
-# contributed by Jouk Jansen joukj@crys.chem.uva.nl
-
-
-.first
- define gl [--.include.gl]
-
-.include [--]mms-config.
-
-##### MACROS #####
-
-INCDIR = ([--.include],[-.util])
-CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm
-
-.ifdef SHARE
-GL_LIBS = $(XLIBS)
-LIB_DEP = [--.lib]$(GL_SHAR) [--.lib]$(GLU_SHAR) [--.lib]$(GLUT_SHAR)
-.else
-GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS)
-LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
-.endif
-
-
-OBJS =readtex.obj,showbuffer.obj
-
-
-##### RULES #####
-.obj.exe :
- cxxlink $(MMS$TARGET_NAME),$(GL_LIBS)
-
-##### TARGETS #####
-default :
- $(MMS)$(MMSQUALIFIERS) $(OBJS)
-
-clean :
- delete *.obj;*
-
-realclean :
- delete *.obj;*
-
-readtex.obj : readtex.c
-showbuffer.obj : showbuffer.c
diff --git a/progs/util/imagesgi.cpp b/progs/util/imagesgi.cpp
deleted file mode 100644
index f5128aabec0..00000000000
--- a/progs/util/imagesgi.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-/******************************************************************************
-** Filename : imageSgi.cpp
-** UNCLASSIFIED
-**
-** Description : Utility to read SGI image format files. This code was
-** originally a SGI image loading utility provided with the
-** Mesa 3D library @ http://www.mesa3d.org by Brain Paul.
-** This has been extended to read all SGI image formats
-** (e.g. INT, INTA, RGB, RGBA).
-**
-** Revision History:
-** Date Name Description
-** 06/07/99 BRC Initial Release
-**
-** Note:
-**
-** The SGI Image Data (if not RLE)
-**
-** If the image is stored verbatim (without RLE), then image data directly
-** follows the 512 byte header. The data for each scanline of the first
-** channel is written first. If the image has more than 1 channel, all
-** the data for the first channel is written, followed by the remaining
-** channels. If the BPC value is 1, then each scanline is written as XSIZE
-** bytes. If the BPC value is 2, then each scanline is written as XSIZE
-** shorts. These shorts are stored in the byte order described above.
-**
-******************************************************************************/
-#define __IMAGESGI_CPP
-
-#include "imagesgi.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-struct sImageSgiRaw
-{
- struct sImageSgiHeader header;
- unsigned char *chan0;
- unsigned char *chan1;
- unsigned char *chan2;
- unsigned char *chan3;
- unsigned int *rowStart;
- int *rowSize;
-};
-
-// Static routines
-static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName);
-static void ImageSgiRawClose(struct sImageSgiRaw *raw);
-static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf,
- int y, int z);
-static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi
-*final);
-static void *SwitchEndian16(void *value);
-static void *SwitchEndian32(void *value);
-
-// Static variables
-FILE *mFp = NULL;
-unsigned char *mChanTmp = NULL;
-
-
-/*****************************************************************************/
-struct sImageSgi *ImageSgiOpen(char const * const fileName)
-{
- struct sImageSgiRaw *raw = NULL;
- struct sImageSgi *final = NULL;
-
- raw = ImageSgiRawOpen(fileName);
- final = new struct sImageSgi;
-
- assert(final);
- if(final)
- {
- final->header = raw->header;
- final->data = NULL;
- ImageSgiRawGetData(raw, final);
- ImageSgiRawClose(raw);
- }
-
- return final;
-} // ImageSgiRawOpen
-
-
-/*****************************************************************************/
-void ImageSgiClose(struct sImageSgi *image)
-{
-
- if(image)
- {
- if(image->data)
- delete[] image->data;
- image->data = NULL;
- delete image;
- }
- image = NULL;
-
- return;
-} // ImageSgiClose
-
-
-/*****************************************************************************/
-static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName)
-{
- struct sImageSgiRaw *raw = NULL;
- int x;
- int i;
- bool swapFlag = false;
- union
- {
- int testWord;
- char testByte[4];
- } endianTest;
- endianTest.testWord = 1;
-
- // Determine endianess of platform.
- if(endianTest.testByte[0] == 1)
- swapFlag = true;
- else
- swapFlag = false;
-
- raw = new struct sImageSgiRaw;
-
- assert(raw);
- if(raw)
- {
- raw->chan0 = NULL;
- raw->chan1 = NULL;
- raw->chan2 = NULL;
- raw->chan3 = NULL;
- raw->rowStart = NULL;
- raw->rowSize = NULL;
- mFp = fopen(fileName, "rb");
- assert(mFp);
-
- fread(&raw->header, sizeof(struct sImageSgiHeader), 1, mFp);
- if(swapFlag == true)
- {
- SwitchEndian16(&raw->header.magic);
- SwitchEndian16(&raw->header.type);
- SwitchEndian16(&raw->header.dim);
- SwitchEndian16(&raw->header.xsize);
- SwitchEndian16(&raw->header.ysize);
- SwitchEndian16(&raw->header.zsize);
- }
-
- mChanTmp = new unsigned char[raw->header.xsize * raw->header.ysize];
- assert(mChanTmp);
- switch(raw->header.zsize)
- {
- case 4:
- raw->chan3 = new unsigned char[raw->header.xsize *
-raw->header.ysize];
- assert(raw->chan3);
- case 3:
- raw->chan2 = new unsigned char[raw->header.xsize *
-raw->header.ysize];
- assert(raw->chan2);
- case 2:
- raw->chan1 = new unsigned char[raw->header.xsize *
-raw->header.ysize];
- assert(raw->chan1);
- case 1:
- raw->chan0 = new unsigned char[raw->header.xsize *
-raw->header.ysize];
- assert(raw->chan0);
- }
-
- if(raw->header.type == IMAGE_SGI_TYPE_RLE)
- {
- x = raw->header.ysize * raw->header.zsize * sizeof(unsigned int);
- raw->rowStart = new unsigned int[x];
- raw->rowSize = new int[x];
-
- fseek(mFp, sizeof(struct sImageSgiHeader), SEEK_SET);
- fread(raw->rowStart, 1, x, mFp);
- fread(raw->rowSize, 1, x, mFp);
-
- if(swapFlag == true)
- {
- for(i=0; i<x/sizeof(unsigned int); i++)
- SwitchEndian32(&raw->rowStart[i]);
- for(i=0; i<x/sizeof(int); i++)
- SwitchEndian32(&raw->rowSize[i]);
- }
-
- }
-
- }
-
- return raw;
-} // ImageSgiRawOpen
-
-
-/*****************************************************************************/
-static void ImageSgiRawClose(struct sImageSgiRaw *raw)
-{
-
- fclose(mFp);
- mFp = NULL;
-
- if(mChanTmp)
- delete[] mChanTmp;
- mChanTmp = NULL;
-
- if(raw->chan0)
- delete[] raw->chan0;
- raw->chan0 = NULL;
-
- if(raw->chan1)
- delete[] raw->chan1;
- raw->chan1 = NULL;
-
- if(raw->chan2)
- delete[] raw->chan2;
- raw->chan2 = NULL;
-
- if(raw->chan3)
- delete[] raw->chan3;
- raw->chan3 = NULL;
-
- if(raw)
- delete raw;
- raw = NULL;
-
- return;
-} // ImageSgiRawClose
-
-
-/*****************************************************************************/
-static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf,
- int y, int z)
-{
- unsigned char *iPtr = NULL;
- unsigned char *oPtr = NULL;
- unsigned char pixel;
- int count;
-
- if((raw->header.type & 0xFF00) == 0x0100)
- {
- fseek(mFp, raw->rowStart[y+z*raw->header.ysize], SEEK_SET);
- fread(mChanTmp, 1, (unsigned int)raw->rowSize[y+z*raw->header.ysize],
-mFp);
- iPtr = mChanTmp;
- oPtr = buf;
- while(1)
- {
- pixel = *iPtr++;
- count = (int)(pixel & 0x7F);
- if(!count)
- {
- return;
- }
- if (pixel & 0x80)
- {
- while (count--)
- {
- *oPtr++ = *iPtr++;
- }
- }
- else
- {
- pixel = *iPtr++;
- while (count--)
- {
- *oPtr++ = pixel;
- }
- }
- }
- }
- else
- {
- fseek(mFp,
- sizeof(struct sImageSgiHeader)+(y*raw->header.xsize) +
- (z*raw->header.xsize*raw->header.ysize),
- SEEK_SET);
- fread(buf, 1, raw->header.xsize, mFp);
- }
-
- return;
-} // ImageSgiRawGetRow
-
-
-/*****************************************************************************/
-static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi
-*final)
-{
- unsigned char *ptr = NULL;
- int i, j;
-
- final->data =
- new unsigned
-char[raw->header.xsize*raw->header.ysize*raw->header.zsize];
- assert(final->data);
-
- ptr = final->data;
- for(i=0; i<raw->header.ysize; i++)
- {
- switch(raw->header.zsize)
- {
- case 1:
- ImageSgiRawGetRow(raw, raw->chan0, i, 0);
- for(j=0; j<raw->header.xsize; j++)
- *(ptr++) = raw->chan0[j];
- break;
- case 2:
- ImageSgiRawGetRow(raw, raw->chan0, i, 0);
- ImageSgiRawGetRow(raw, raw->chan1, i, 1);
- for(j=0; j<raw->header.xsize; j++)
- {
- *(ptr++) = raw->chan0[j];
- *(ptr++) = raw->chan1[j];
- }
- break;
- case 3:
- ImageSgiRawGetRow(raw, raw->chan0, i, 0);
- ImageSgiRawGetRow(raw, raw->chan1, i, 1);
- ImageSgiRawGetRow(raw, raw->chan2, i, 2);
- for(j=0; j<raw->header.xsize; j++)
- {
- *(ptr++) = raw->chan0[j];
- *(ptr++) = raw->chan1[j];
- *(ptr++) = raw->chan2[j];
- }
- break;
- case 4:
- ImageSgiRawGetRow(raw, raw->chan0, i, 0);
- ImageSgiRawGetRow(raw, raw->chan1, i, 1);
- ImageSgiRawGetRow(raw, raw->chan2, i, 2);
- ImageSgiRawGetRow(raw, raw->chan3, i, 3);
- for(j=0; j<raw->header.xsize; j++)
- {
- *(ptr++) = raw->chan0[j];
- *(ptr++) = raw->chan1[j];
- *(ptr++) = raw->chan2[j];
- *(ptr++) = raw->chan3[j];
- }
- break;
- }
- }
-
- return;
-} // ImageSgiRawGetData
-
-
-/*****************************************************************************/
-static void *SwitchEndian16(void *value)
-{
- short value16 = *(short *) value;
- value16 = ((value16 & 0xff00) >> 8L) +
- ((value16 & 0x00ff) << 8L);
- *(short *)value = value16;
- return value;
-} // SwitchEndian16
-
-
-/*****************************************************************************/
-static void *SwitchEndian32(void *value)
-{
- int value32 = *(int *) value;
- value32 = ((value32 & 0xff000000) >> 24L) +
- ((value32 & 0x00ff0000) >> 8) +
- ((value32 & 0x0000ff00) << 8) +
- ((value32 & 0x000000ff) << 24L);
- *(int *)value = value32;
- return value;
-} // SwitchEndian32
-
diff --git a/progs/vp/Makefile b/progs/vp/Makefile
deleted file mode 100644
index c3faeb5b602..00000000000
--- a/progs/vp/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-# progs/tests/Makefile
-
-
-# These programs aren't intended to be included with the normal distro.
-# They're not too interesting but they're good for testing.
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-LIBS = $(APP_LIB_DEPS)
-
-SOURCES = \
- vp-tris.c
-
-
-
-PROGS = $(SOURCES:%.c=%)
-
-INCLUDES = -I. -I$(TOP)/include -I../samples
-
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c:
- $(CC) $(INCLUDES) $(CFLAGS) $< $(LIBS) -o $@
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: $(PROGS)
-
-clean:
- rm -f $(PROGS)
- rm -f *.o
- rm -f getproclist.h
-
-
-
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
diff --git a/progs/vp/abs.txt b/progs/vp/abs.txt
deleted file mode 100644
index cd00952e349..00000000000
--- a/progs/vp/abs.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-SUB R0, {0.5}.x, vertex.color;
-ABS result.color, R0;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/add.txt b/progs/vp/add.txt
deleted file mode 100644
index 4094cd448dc..00000000000
--- a/progs/vp/add.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-ADD R0, vertex.color, vertex.color;
-ADD result.color, R0, R0;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/arl.txt b/progs/vp/arl.txt
deleted file mode 100644
index a262b0149c6..00000000000
--- a/progs/vp/arl.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-!!ARBvp1.0
-PARAM arr[5] = { {0,1,2,3}, {4,5,6,7}, {8,9,10,11}, {12,13,14,14}, {16,17,18,19} };
-ADDRESS addr;
-TEMP R0;
-MAD R0, {5.0}.x, vertex.color, {2.0}.x;
-ARL addr.x, R0.x;
-MUL result.color, arr[addr.x-2], {.07}.x;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/dp3.txt b/progs/vp/dp3.txt
deleted file mode 100644
index 8336bd3dd8e..00000000000
--- a/progs/vp/dp3.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-DP3 result.color, vertex.color, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/dp4.txt b/progs/vp/dp4.txt
deleted file mode 100644
index 70505a494c5..00000000000
--- a/progs/vp/dp4.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-DP4 result.color, vertex.color.xxxx, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/dph.txt b/progs/vp/dph.txt
deleted file mode 100644
index c7cab1384dd..00000000000
--- a/progs/vp/dph.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-DPH result.color, vertex.color, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/dst.txt b/progs/vp/dst.txt
deleted file mode 100644
index 03613c0eece..00000000000
--- a/progs/vp/dst.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-DST result.color, vertex.color, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/ex2.txt b/progs/vp/ex2.txt
deleted file mode 100644
index bbef67bbb8a..00000000000
--- a/progs/vp/ex2.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-EX2 R0, vertex.color.x;
-SUB result.color, R0, {1.0}.x;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/flr.txt b/progs/vp/flr.txt
deleted file mode 100644
index c33280da978..00000000000
--- a/progs/vp/flr.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-ADD R0, vertex.color, {0.5}.x;
-FLR result.color, R0;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/frc.txt b/progs/vp/frc.txt
deleted file mode 100644
index d8e72b60cc7..00000000000
--- a/progs/vp/frc.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-MUL R0, vertex.color, {3.0}.x;
-FRC result.color, R0;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/lg2.txt b/progs/vp/lg2.txt
deleted file mode 100644
index 2f59b993a41..00000000000
--- a/progs/vp/lg2.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-MUL R0, vertex.color, {4.0}.x;
-LG2 result.color, R0.x;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/lit.txt b/progs/vp/lit.txt
deleted file mode 100644
index 65705b41705..00000000000
--- a/progs/vp/lit.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-SUB R0, {0.5}.x, vertex.color;
-LIT result.color, R0;
-MOV result.position, vertex.position;
-END
diff --git a/progs/vp/mad.txt b/progs/vp/mad.txt
deleted file mode 100644
index 0c9ed6c8b7f..00000000000
--- a/progs/vp/mad.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-MAD result.color, vertex.color.z, {1,0,0,1}, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/max.txt b/progs/vp/max.txt
deleted file mode 100644
index 6747ca57277..00000000000
--- a/progs/vp/max.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-MAX result.color, {0.5}.x, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/min.txt b/progs/vp/min.txt
deleted file mode 100644
index 2adc872ed9c..00000000000
--- a/progs/vp/min.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-MIN result.color, {0.5}.x, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/mov.txt b/progs/vp/mov.txt
deleted file mode 100644
index 9ce1a453067..00000000000
--- a/progs/vp/mov.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-MOV result.color, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/mul.txt b/progs/vp/mul.txt
deleted file mode 100644
index e479cdb8543..00000000000
--- a/progs/vp/mul.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-MUL result.color, vertex.color, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/pow.txt b/progs/vp/pow.txt
deleted file mode 100644
index 512412997de..00000000000
--- a/progs/vp/pow.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-POW result.color, vertex.color.x, vertex.color.y;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/rcp.txt b/progs/vp/rcp.txt
deleted file mode 100644
index e16292bd00a..00000000000
--- a/progs/vp/rcp.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-ADD R0, vertex.color.x, vertex.color.x;
-RCP result.color, R0.x;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/rsq.txt b/progs/vp/rsq.txt
deleted file mode 100644
index 3e3f3251ee0..00000000000
--- a/progs/vp/rsq.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-!!ARBvp1.0
-TEMP R0;
-MUL R0, vertex.color, {3.0}.x;
-RSQ result.color, R0.x;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/sge.txt b/progs/vp/sge.txt
deleted file mode 100644
index 3fa82e5d5ea..00000000000
--- a/progs/vp/sge.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-SGE result.color, {0.5}.x, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/slt.txt b/progs/vp/slt.txt
deleted file mode 100644
index 6bf8ffa775d..00000000000
--- a/progs/vp/slt.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-SLT result.color, {0.5}.x, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/sub.txt b/progs/vp/sub.txt
deleted file mode 100644
index a58ab101bcd..00000000000
--- a/progs/vp/sub.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-SUB result.color, vertex.color.yzxw, vertex.color;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/swz.txt b/progs/vp/swz.txt
deleted file mode 100644
index 92c58089b1a..00000000000
--- a/progs/vp/swz.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-MOV result.color, vertex.color.xxzx;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/swz2.txt b/progs/vp/swz2.txt
deleted file mode 100644
index 84c78db49f6..00000000000
--- a/progs/vp/swz2.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-SWZ result.color, vertex.color, 1,x,y,z;
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/vp/vp-tris.c b/progs/vp/vp-tris.c
deleted file mode 100644
index 5dbe5ac8359..00000000000
--- a/progs/vp/vp-tris.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */
-
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
-
-static const char *filename = NULL;
-static GLuint nr_steps = 4;
-
-static void usage( char *name )
-{
- fprintf( stderr, "usage: %s [ options ] shader_filename\n", name );
- fprintf( stderr, "\n" );
- fprintf( stderr, "options:\n" );
- fprintf( stderr, " -f flat shaded\n" );
- fprintf( stderr, " -nNr subdivision steps\n" );
-}
-
-
-static void args(int argc, char *argv[])
-{
- GLint i;
-
- for (i = 1; i < argc; i++) {
- if (strncmp(argv[i], "-n", 2) == 0) {
- nr_steps = atoi((argv[i]) + 2);
- }
- else if (strcmp(argv[i], "-f") == 0) {
- glShadeModel(GL_FLAT);
- }
- else if (i == argc - 1) {
- filename = argv[i];
- }
- else {
- usage(argv[0]);
- exit(1);
- }
- }
-
- if (!filename) {
- usage(argv[0]);
- exit(1);
- }
-}
-
-
-
-static void Init( void )
-{
- GLint errno;
- GLuint prognum;
- char buf[4096];
- GLuint sz;
- FILE *f;
-
- if ((f = fopen(filename, "r")) == NULL) {
- fprintf(stderr, "couldn't open %s\n", filename);
- exit(1);
- }
-
- sz = fread(buf, 1, sizeof(buf), f);
- if (!feof(f)) {
- fprintf(stderr, "file too long\n");
- exit(1);
- }
-
- fprintf(stderr, "%.*s\n", sz, buf);
-
- glGenProgramsARB(1, &prognum);
-
- glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
- glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- sz, (const GLubyte *) buf);
-
- errno = glGetError();
- printf("glGetError = %d\n", errno);
- if (errno != GL_NO_ERROR)
- {
- GLint errorpos;
-
- glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
- printf("errorpos: %d\n", errorpos);
- printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
- }
- assert(glIsProgramARB(prognum));
-}
-
-
-union vert {
- struct {
- GLfloat color[3];
- GLfloat pos[3];
- } v;
- GLfloat f[6];
-};
-
-static void make_midpoint( union vert *out,
- const union vert *v0,
- const union vert *v1)
-{
- int i;
- for (i = 0; i < 6; i++)
- out->f[i] = v0->f[i] + .5 * (v1->f[i] - v0->f[i]);
-}
-
-static void subdiv( union vert *v0,
- union vert *v1,
- union vert *v2,
- GLuint depth )
-{
- if (depth == 0) {
- glColor3fv(v0->v.color);
- glVertex3fv(v0->v.pos);
- glColor3fv(v1->v.color);
- glVertex3fv(v1->v.pos);
- glColor3fv(v2->v.color);
- glVertex3fv(v2->v.pos);
- }
- else {
- union vert m[3];
-
- make_midpoint(&m[0], v0, v1);
- make_midpoint(&m[1], v1, v2);
- make_midpoint(&m[2], v2, v0);
-
- subdiv(&m[0], &m[2], v0, depth-1);
- subdiv(&m[1], &m[0], v1, depth-1);
- subdiv(&m[2], &m[1], v2, depth-1);
- subdiv(&m[0], &m[1], &m[2], depth-1);
- }
-}
-
-/** Assignment */
-#define ASSIGN_3V( V, V0, V1, V2 ) \
-do { \
- V[0] = V0; \
- V[1] = V1; \
- V[2] = V2; \
-} while(0)
-
-static void Display( void )
-{
- glClearColor(0.3, 0.3, 0.3, 1);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glEnable(GL_VERTEX_PROGRAM_NV);
-
- glBegin(GL_TRIANGLES);
-
-
- {
- union vert v[3];
-
- ASSIGN_3V(v[0].v.color, 0,0,1);
- ASSIGN_3V(v[0].v.pos, 0.9, -0.9, 0.0);
- ASSIGN_3V(v[1].v.color, 1,0,0);
- ASSIGN_3V(v[1].v.pos, 0.9, 0.9, 0.0);
- ASSIGN_3V(v[2].v.color, 0,1,0);
- ASSIGN_3V(v[2].v.pos, -0.9, 0, 0.0);
-
- subdiv(&v[0], &v[1], &v[2], nr_steps);
- }
-
- glEnd();
-
-
- glFlush();
-}
-
-
-static void Reshape( int width, int height )
-{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
- /*glTranslatef( 0.0, 0.0, -15.0 );*/
-}
-
-
-static void Key( unsigned char key, int x, int y )
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-
-int main( int argc, char *argv[] )
-{
- glutInit( &argc, argv );
- glutInitWindowPosition( 0, 0 );
- glutInitWindowSize( 250, 250 );
- glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
- glutCreateWindow(argv[0]);
- glutReshapeFunc( Reshape );
- glutKeyboardFunc( Key );
- glutDisplayFunc( Display );
- args( argc, argv );
- Init();
- glutMainLoop();
- return 0;
-}
diff --git a/progs/vp/xpd.txt b/progs/vp/xpd.txt
deleted file mode 100644
index b8818ebc60e..00000000000
--- a/progs/vp/xpd.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-!!ARBvp1.0
-XPD result.color, vertex.color, {2,2,2,0};
-MOV result.position, vertex.position;
-END
-
diff --git a/progs/xdemos/.cvsignore b/progs/xdemos/.cvsignore
deleted file mode 100644
index 4adffda2d1e..00000000000
--- a/progs/xdemos/.cvsignore
+++ /dev/null
@@ -1,16 +0,0 @@
-glthreads
-glxdemo
-glxgears
-glxheads
-glxinfo
-glxpixmap
-glxpbdemo
-glxswapcontrol
-manywin
-offset
-pbinfo
-pbdemo
-wincopy
-xdemo
-xfont
-xrotfontdemo
diff --git a/src/egl/Makefile b/src/egl/Makefile
deleted file mode 100644
index 931e9d0cb86..00000000000
--- a/src/egl/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# src/egl/Makefile
-
-TOP = ../..
-
-SUBDIRS = main drivers/demo drivers/dri
-
-
-default: subdirs
-
-
-subdirs:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir ; $(MAKE)) || exit 1 ; \
- fi \
- done
-
-
-clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir ; $(MAKE) clean) ; \
- fi \
- done
diff --git a/src/egl/docs/EGL_MESA_screen_surface b/src/egl/docs/EGL_MESA_screen_surface
deleted file mode 100644
index 3a11da7ac9b..00000000000
--- a/src/egl/docs/EGL_MESA_screen_surface
+++ /dev/null
@@ -1,578 +0,0 @@
-Name
-
- MESA_screen_surface
-
-Name Strings
-
- EGL_MESA_screen_surface
-
-Contact
-
- Brian Paul
-
- To discuss, join the dri-egl@lists.freedesktop.org list.
-
-Status
-
- Preliminary - totally subject to change.
-
-Version
-
- 10 (10 August 2005)
-
-Number
-
- TBD
-
-Dependencies
-
- EGL 1.0 or later.
-
-Overview
-
- EGL 1.1 supports three types of drawing surfaces:
- * Window surfaces
- * Pixmap surfaces
- * Pbuffer surfaces
- This extension defines a fourth type of drawing surface:
- * Screen surface
-
- A screen surface is a surface for which the (front) color buffer can
- be directly displayed (i.e. scanned out) on a monitor (such as a flat
- panel or CRT). In particular the color buffer memory will be allocated
- at a location in VRAM (and in a suitable format) which can be displayed
- by the graphics hardware.
-
- Note that the width and height of the screen surface need not exactly
- match the monitor's current resolution. For example, while the monitor
- may be configured to to show 1024x768 pixels, the associated screen
- surface may be larger, such as 1200x1000. The "screen origin" attribute
- will specify which region of the screen surface which is visible on the
- monitor. The screen surface can be scrolled by changing this origin.
-
- This extension also defines functions for controlling the monitor's
- display mode (width, height, refresh rate, etc), and specifing which
- screen surface is to be displayed on a monitor.
-
- The new EGLModeMESA type and related functions are very similar to the
- EGLConfig type and related functions. The user may get a list of
- supported modes for a screen and specify the mode to be used when
- displaying a screen surface.
-
-
-Issues
-
- 1. Should EGL_INTERLACE be a supported mode attribute?
-
- Arguments against:
-
- No, this should be provided by another extension which would
- also provide the mechanisms needed to play back interlaced video
- material correctly on hardware that supports it.
- This extension should prefer non-interlaced modes. [M. Danzer]
-
- Arguments for:
-
- An interlaced display can be of use without considering video
- material. Being able to query whether a screen is operating in
- interlaced mode can be used by applications to control their
- drawing. For example: avoid drawing 1-pixel-wide horizontal lines
- if screen is interlaced. [B. Paul]
-
- Resolution: Defer for future extension?
-
-
- 2. Should EGL_REFRESH_RATE be a supported mode attribute?
-
- Arguments for:
-
- Yes, it's been shown that applications and/or users need to select
- modes by this. [M. Danzer]
-
- Many examples have been given in which it's desirable to let the
- user choose from a variety of refresh rates without having to
- restart/reconfigure. [B. Paul]
-
- Arguments against:
-
- TBD.
-
- Resolution: Yes.
-
-
- 3. Exactly how should the list of modes returned by eglChooseConfigMESA
- be sorted?
-
- Current method is described in the text below. Subject to change.
-
- Alternately, leave the sorting order undefined so that each
- implementation can return the modes in order of "most desirable"
- to "least desirable" which may depend on the display technology
- (CRT vs LCD, etc) or other factors.
-
-
- 4. How should screen blanking be supported? Note that a screen can be
- disabled or turned off by calling eglShowSurface(dpy, scrn,
- EGL_NO_SURFACE, EGL_NO_MODE_MESA). But what about power-save mode?
-
- I would defer this to other extensions that depend on this one.
- I can imagine people wanting different semantics not just in
- relation to the power management API being exposed (DPMS or whatever)
- but also relating to what events can trigger EGL_CONTEXT_LOST. Also
- I'm not sure whether power management commands are properly operations
- on the Display or on a screen surface. [A. Jackson]
-
-
- 5. Should the EGL_PHYSICAL_SIZE_EGL query be kept? The size information
- isn't always reliable (consider video projectors) but can still be
- used to determine the pixel aspect ratio.
-
- Arguments for:
-
- X supports a similar query with DisplayWidthMM(), DisplayHeightMM().
- If this information can be easily queried with EDID, why not
- make it available to the user?
-
- Arguments against:
-
- Historically, these values aren't always accurate. Also, they're
- not always applicable to the display device.
-
- Other options:
-
- Perhaps just a pixel aspect ratio should be supported. [M. Danzer]
-
- Postpone for a future extension, if needed. [A. Jackson]
-
-
- 6. Should detailed mode timing information be exposed by this API?
-
- Probably not. Instead, offer that information in a layered extension.
-
-
- 7. How should the notion of a screen's "native" mode be expressed?
- For example, LCD panels have a native resolution and refresh rate
- that looks best but other sub-optimal resolutions may be supported.
-
- The mode attribute EGL_OPTIMAL_MESA will be set for modes which
- best match the screen. [M. Danzer]
-
-
- 8. Should eglQueryModeStringMESA() be included? This function returns
- a human-readable string which corresponds to an EGLMode.
-
- Arguments for:
-
- A mode name such as "HDTV-720P" might mean more to users than
- "1280x720@60Hz" if the later were generated via code.
-
- Arguments against:
-
- There's no standard syntax for the strings. May cause more
- trouble than it's worth.
-
- Postpone for future extension. [A. Jackson]
-
- Latest discussion leaning toward omitting this function.
-
-
- 9. Should we use "Get" or "Query" for functions which return state?
- The EGL 1.x specification doesn't seem to be totally consistent
- in this regard, but "Query" is used more often.
-
- Use "Get" for mode-related queries (as for EGLConfigs) but "Query"
- for everything else.
-
-
- 10. What should be the default size for screen surfaces?
-
- For Pbuffer surfaces the default width and height are zero.
- We'll do the same for screen surfaces. Since there's no function
- to resize surfaces it's useless to have a 0x0 screen, but this isn't
- a situation that'll normally be encountered.
-
-
- 11. Should there be a function for resizing a screen surface?
-
- Suppose one wants to change the screen's size in the EGL application.
- Also suppose there's a hardware restriction such that only one screen
- surface can exist at a time (either for lack of memory or because of
- memory layout restrictions).
-
- The basic idea is that the currently displayed screen surface must
- be deallocated before a new one can be created. Perhaps a resize
- function would work better?
-
-
- 12. How should sub-pixel LCD color information be made available?
- What about the display's gamma value?
-
- Perhaps expose as additional read-only mode attributes.
-
- Perhaps postpone for a layered extension.
-
-
- 13. What happens if the user attempts to delete a screen surface that
- is currently being shown?
-
- Spec currently says that's illegal and that an error (TBD) will be
- generated.
-
-
- 14. What if the physical screen size can't be determined? Should
- a query of EGL_PHYSICAL_SIZE_MESA return [0,0]?
-
- TBD.
-
-
- 15. Suppose the device's number of RAMDACs is different from the
- number of output ports. For example, a graphics card with
- two RAMDACs but three ports (VGA, DVI, TV).
-
- Address this in a follow-on extension. [Matthias Hopf]
-
-
- 16. How should we deal with on-the-fly device changes? For example,
- the monitor being unplugged and replaced by another with different
- characteristics?
-
- A HAL event could be received via DBUS in the application [J. Smirl,
- A. Jackson].
-
- Should there be an EGL mechanism for detecting this? Maybe an
- EGL_SCREEN_LOST error (similar to EGL_CONTEXT_LOST) can be recorded
- when there's a screen change. At least then the application can
- poll to detect this situation.
-
- Maybe leave that to a future extension.
-
- See also the EGL_SCREEN_COUNT_MESA query.
-
-
- 17. What if pixel-accurate panning is not supported (see
- eglScreenPositionMESA)? [M. Danzer]
-
- Is this a common problem? Can we ignore it for now?
-
-
- 18. Should eglShowSurfaceMESA be renamed to eglShowScreenSurfaceMESA?
-
- Probably.
-
-
-
-New Procedures and Functions
-
- EGLBoolean eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
- const EGLint *attrib_list,
- EGLModeMESA *modes, EGLint modes_size,
- EGLint *num_modes)
-
- EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *modes, EGLint modes_size,
- EGLint *num_modes)
-
- EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,
- EGLint attrib, EGLint *value)
-
-
- EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,
- EGLint screens_size, EGLint *num_screens)
-
- EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-
- EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA mode)
-
- EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLint x, EGLint y)
-
-
- EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLint attrib, EGLint *value);
-
- EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface *surface)
-
- EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *mode)
-
- const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLMode mode);
-
-
-New Types
-
- EGLModeMESA
- EGLScreenMESA
-
-New Tokens
-
- New error codes:
-
- EGL_BAD_SCREEN_MESA
- EGL_BAD_MODE_MESA
-
- Screen-related tokens:
-
- EGL_SCREEN_COUNT_MESA
- EGL_SCREEN_POSITION_MESA
- EGL_PHYSICAL_SIZE_MESA
- EGL_SCREEN_BIT_MESA
- EGL_SCREEN_POSITION_GRANULARITY_MESA
-
- Mode-related tokens:
-
- EGL_MODE_ID_MESA
- EGL_REFRESH_RATE_MESA
- EGL_INTERLACED_MESA
- EGL_OPTIMAL_MESA
- EGL_NO_MODE_MESA
-
-
-Additions to Chapter X of the EGL 1.1 Specification
-
- [XXX this all has to be rewritten to fit into the EGL specification
- and match the conventions of an EGL extension. For now, just list
- all the functions with brief descriptions.]
-
-
- EGLBoolean eglChooseModeMESA(EGLDisplay dpy, const EGLScreenMESA screen,
- EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes)
-
- Like eglChooseConfig, returns a list of EGLModes which match the given
- attribute list. This does not set the screen's current display mode.
- The attribute list is a list of token/value pairs terminated with
- EGL_NONE. Supported attributes include:
-
- Name Description
- --------------------- ---------------------------------------------
- EGL_WIDTH Mode width (resolution)
- EGL_HEIGHT Mode height (resolution)
- EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000
- EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise
- EGL_OPTIMAL_MESA Set if the most is especially optimal for the
- screen (ex. for particular LCD resolutions)
-
- Any other token will generate the error EGL_BAD_ATTRIBUTE.
-
- The list of modes returned by eglChooseModeMESA will be sorted
- according to the following criteria. See the discussion of table 3.3
- in the EGL specification for more information.
-
- Selection Sort Sort
- Attribute Default Criteria Order Priority
- -------------------- -------------- ----------- ------ --------
- EGL_OPTIMAL_MESA EGL_DONT_CARE Exact 1,0 1
- EGL_INTERLACED_MESA EGL_DONT_CARE Exact 0,1 2
- EGL_REFRESH_RATE EGL_DONT_CARE AtLeast Larger 3
- EGL_WIDTH EGL_DONT_CARE AtLeast Larger 4
- EGL_HEIGHT EGL_DONT_CARE AtLeast Larger 5
- EGL_MODE_ID_MESA EGL_DONT_CARE Exact Smaller 6
-
-
- EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *modes, EGLint modes_size,
- EGLint *num_modes)
-
- Like eglGetConfigs, returns a list of all modes supported by the
- given screen. The returned modes will be sorted in the same manner
- as for eglChooseModeMESA().
-
-
-
- EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,
- EGLint attrib, EGLint *value)
-
- Used to query mode attributes. The following attributes are supported:
-
- Name Return value description
- --------------------- ----------------------------------------------
- EGL_OPTIMAL_MESA 1 indicates an optimal mode, 0 otherwise
- EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise
- EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000
- EGL_WIDTH Mode width (resolution)
- EGL_HEIGHT Mode height (resolution)
- EGL_MODE_ID_MESA A unique small integer identifier for the mode
-
- Any other token will generate the error EGL_BAD_ATTRIBUTE.
-
-
-
- EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,
- EGLint screens_size, EGLint *num_screens)
-
- This function returns an array of all available screen handles.
- <screens_size> is the maximum number of screens to return in the
- <screens> array. <num_screens> will return the number of screen handles
- placed in the array, even if <screens> is NULL.
-
- The number of screens and the availability of each may change over
- time (hot-plugging). Screen handles will not be reused. When a
- screen handle becomes invalid, function calls which reference an
- invalid handle will generate EGL_BAD_SCREEN_MESA.
-
- The first screen handle returned will be considered to be the primary
- one.
-
-
-
- EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-
- Create a surface that can be displayed on a screen. <attrib_list> is
- an array of token/value pairs terminated with EGL_NONE. Valid tokens
- include:
-
- Name Description
- ---------------- --------------------------------
- EGL_WIDTH desired surface width in pixels
- EGL_HEIGHT desired surface height in pixels
-
- Any other token will generate the error EGL_BAD_ATTRIBUTE.
- The default width and height are zero.
-
-
-
- EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA mode)
-
- This function causes a screen to show the given surface (or more
- precisely, the surface's front color buffer) with the given mode.
-
- If the surface is in any way incompatible with the mode, the error
- EGL_BAD_MATCH will be generated, EGL_FALSE will be returned, and the
- previous screen state will remain in effect. This might occur when
- the bandwidth of the video-out subsystem is exceeded, or if the mode
- specifies a width or height that's greater than the width or height
- of the surface.
-
- To disable a screen, the values EGL_NO_SURFACE and EGL_NO_MODE_MESA
- be passed as the <surface> and <mode> parameters.
-
- The values of EGL_SCREEN_POSITION_MESA are clamped to the new valid
- range computed from the screen size and surface size. If the new
- surface is EGL_NO_SURFACE, EGL_SCREEN_POSITION_MESA is set to [0, 0].
-
-
- Attempting to delete a screen surface which is currently being
- displayed will result in the error EGL_BAD_ACCESS being generated.
-
-
-
- EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLint x, EGLint y)
-
- Specifies the origin of the screen's view into the surface, if the
- surface is larger than the screen. Valid values for x and y are
- [0, surfaceWidth - screenWidth] and [0, surfaceHeight - screenHeight],
- respectively.
-
- The x and y values are also constrained to be integer multiples of the
- EGL_SCREEN_POSITION_GRANULARITY_MESA values.
-
-
-
-
- EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLint attrib, EGLint *value);
-
- Used to query screen attributes. <attrib> may be one of the following:
-
- Name Return value description
- ------------------------ ---------------------------------------------
- EGL_SCREEN_POSITION_MESA x, y position of the screen's origin with
- respect to the surface. If no surface is
- attached to the screen, [0, 0] is returned.
- EGL_SCREEN_POSITION_GRANULARITY_MESA
- Returns the granularity, in pixels, for
- which the screen position is constrained.
- EGL_PHYSICAL_SIZE_MESA Physical width and height of the screen
- in millimeters
-
- Any other token will generate the error EGL_BAD_ATTRIBUTE.
-
-
-
-
- EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface *surface)
-
- Returns the surface currently displayed on the given screen. <surface>
- may be EGL_NO_SURFACE if the screen isn't currently showing any surface.
-
-
-
-
- EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *mode)
-
- Returns the given screen's current display mode. The mode may be
- EGL_NO_MODE_MESA if the screen is currently disabled.
-
-
-
- const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
-
- Returns a human-readable string for the given mode. The string is a
- zero-terminated C string which the user should not attempt to free.
- There is no standard syntax for mode strings. Applications should
- not directly rely on mode strings.
-
-
-
-Version History
-
- 1. 15 March 2005 - BrianP
- Initial version
-
- 2. 16 March 2005 - BrianP
- Removed EGL_DEPTH_MESA
- Added EGL_PHYSICAL_WIDTH_MESA, EGL_PHYSICAL_HEIGHT_MESA queries
- Added EGL_OPTIMAL_MESA for width/height/refresh rate selection
- Added possible eglQueryModeStringMESA() function
- More details of the new functions explained.
-
- 3. 18 March 2005 - BrianP
- Added screen_number to eglChooseModeMESA().
- Fix off by one mistake in value range for ORIGIN attributes
- Added Issues section
-
- 4. 21 March 2005 - BrianP
- Removed eglScreenAttribsMESA().
- Added eglScreenPositionMESA() to set screen origin.
- Replaced EGL_SCREEN_X/Y_OFFSET_MESA with EGL_SCREEN_POSITION_MESA.
- Replaced EGL_PHYSICAL_WIDTH/HEIGHT_MESA with EGL_PHYSICAL_SIZE_MESA.
- Use EGL_OPTIMAL_MESA as a new mode attribute. (Michel Danzer)
- Added a few more issues.
-
- 5. 6 April 2005 - BrianP
- More language for eglGetModeStringMESA().
- Added issues 10, 11, 12, 13, 14.
- Updated issue 3 discussion about mode sorting.
-
- 6. 22 April 2005 - BrianP
- Fixed "LDC" typo.
- Added issues 15, 16.
- Changed dependency on EGL 1.1 to EGL 1.0
- s/EGL_NUM_SCREENS_MESA/EGL_SCREEN_COUNT_MESA/
- Added eglQueryDisplayMESA() to New Functions section.
- Clarified language for the EGL_SCREEN_COUNT_MESA query.
-
- 7. 29 April 2005 - BrianP
- Added EGLScreenMESA type and eglGetScreensMESA() function. [J. Smirl].
- Replaced EGLint screen_number parameters with EGLScreenMESA screen.
- Added issue 17 (pixel-accurate panning)
-
- 8. 2 May 2005 - BrianP
- Removed eglQueryDisplayMESA.
- Fixed a few more EGLint -> EGLScreenMESA changes.
-
- 9. 20 May 2005 - BrianP
- Fixed a few typos.
- Updated some open issues text.
-
- 10. 10 August 2005 - BrianP
- Added EGL_SCREEN_POSITION_GRANULARITY_MESA.
-
diff --git a/src/egl/drivers/demo/Makefile b/src/egl/drivers/demo/Makefile
deleted file mode 100644
index fd587b79e27..00000000000
--- a/src/egl/drivers/demo/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-# src/egl/drivers/demo/Makefile
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main
-
-
-SOURCES = demo.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: $(LIB_DIR)/demodriver.so
-
-
-$(LIB_DIR)/demodriver.so: $(OBJECTS)
- $(TOP)/bin/mklib -o demodriver.so -noprefix \
- -install $(LIB_DIR) $(OBJECTS)
-
-
-
-clean:
- rm -f *.o
- rm -f *.so
diff --git a/src/egl/drivers/demo/demo.c b/src/egl/drivers/demo/demo.c
deleted file mode 100644
index 45545755c00..00000000000
--- a/src/egl/drivers/demo/demo.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Sample driver: Demo
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-
-
-/**
- * Demo driver-specific driver class derived from _EGLDriver
- */
-typedef struct demo_driver
-{
- _EGLDriver Base; /* base class/object */
- GLuint DemoStuff;
-} DemoDriver;
-
-#define DEMO_DRIVER(D) ((DemoDriver *) (D))
-
-
-/**
- * Demo driver-specific surface class derived from _EGLSurface
- */
-typedef struct demo_surface
-{
- _EGLSurface Base; /* base class/object */
- GLuint DemoStuff;
-} DemoSurface;
-
-
-/**
- * Demo driver-specific context class derived from _EGLContext
- */
-typedef struct demo_context
-{
- _EGLContext Base; /* base class/object */
- GLuint DemoStuff;
-} DemoContext;
-
-
-
-static EGLBoolean
-demoInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- _EGLScreen *scrn;
- EGLint i;
-
- /* Create a screen */
- scrn = calloc(1, sizeof(*scrn));
- _eglAddScreen(disp, scrn);
-
- /* Create the screen's modes - silly example */
- _eglAddNewMode(scrn, 1600, 1200, 72 * 1000, "1600x1200-72");
- _eglAddNewMode(scrn, 1280, 1024, 72 * 1000, "1280x1024-70");
- _eglAddNewMode(scrn, 1280, 1024, 70 * 1000, "1280x1024-70");
- _eglAddNewMode(scrn, 1024, 768, 72 * 1000, "1024x768-72");
-
- /* Create the display's visual configs - silly example */
- for (i = 0; i < 4; i++) {
- _EGLConfig config;
- _eglInitConfig(&config, i + 1);
- _eglSetConfigAttrib(&config, EGL_RED_SIZE, 8);
- _eglSetConfigAttrib(&config, EGL_GREEN_SIZE, 8);
- _eglSetConfigAttrib(&config, EGL_BLUE_SIZE, 8);
- _eglSetConfigAttrib(&config, EGL_ALPHA_SIZE, 8);
- _eglSetConfigAttrib(&config, EGL_BUFFER_SIZE, 32);
- if (i & 1) {
- _eglSetConfigAttrib(&config, EGL_DEPTH_SIZE, 32);
- }
- if (i & 2) {
- _eglSetConfigAttrib(&config, EGL_STENCIL_SIZE, 8);
- }
- _eglSetConfigAttrib(&config, EGL_SURFACE_TYPE,
- (EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT));
- _eglAddConfig(disp, &config);
- }
-
- drv->Initialized = EGL_TRUE;
-
- *major = 1;
- *minor = 0;
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-demoTerminate(_EGLDriver *drv, EGLDisplay dpy)
-{
- /*DemoDriver *demo = DEMO_DRIVER(dpy);*/
- free(drv);
- return EGL_TRUE;
-}
-
-
-static DemoContext *
-LookupDemoContext(EGLContext ctx)
-{
- _EGLContext *c = _eglLookupContext(ctx);
- return (DemoContext *) c;
-}
-
-
-static DemoSurface *
-LookupDemoSurface(EGLSurface surf)
-{
- _EGLSurface *s = _eglLookupSurface(surf);
- return (DemoSurface *) s;
-}
-
-
-
-static EGLContext
-demoCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
-{
- _EGLConfig *conf;
- DemoContext *c;
- int i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs defined for now */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
- }
-
- c = (DemoContext *) calloc(1, sizeof(DemoContext));
- if (!c)
- return EGL_NO_CONTEXT;
-
- _eglInitContext(drv, dpy, &c->Base, config, attrib_list);
- c->DemoStuff = 1;
- printf("demoCreateContext\n");
-
- /* generate handle and insert into hash table */
- _eglSaveContext(&c->Base);
- assert(c->Base.Handle);
-
- return c->Base.Handle;
-}
-
-
-static EGLSurface
-demoCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
-{
- int i;
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface");
- return EGL_NO_SURFACE;
- }
- }
- printf("eglCreateWindowSurface()\n");
- /* XXX unfinished */
-
- return EGL_NO_SURFACE;
-}
-
-
-static EGLSurface
-demoCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
-{
- _EGLConfig *conf;
- EGLint i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
- }
-
- if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) {
- _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
-
- printf("eglCreatePixmapSurface()\n");
- return EGL_NO_SURFACE;
-}
-
-
-static EGLSurface
-demoCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- DemoSurface *surf = (DemoSurface *) calloc(1, sizeof(DemoSurface));
- if (!surf)
- return EGL_NO_SURFACE;
-
- if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_PBUFFER_BIT,
- config, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- /* a real driver would allocate the pbuffer memory here */
-
- return surf->Base.Handle;
-}
-
-
-static EGLBoolean
-demoDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
-{
- DemoSurface *fs = LookupDemoSurface(surface);
- _eglRemoveSurface(&fs->Base);
- if (fs->Base.IsBound) {
- fs->Base.DeletePending = EGL_TRUE;
- }
- else {
- free(fs);
- }
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-demoDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
-{
- DemoContext *fc = LookupDemoContext(context);
- _eglRemoveContext(&fc->Base);
- if (fc->Base.IsBound) {
- fc->Base.DeletePending = EGL_TRUE;
- }
- else {
- free(fc);
- }
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-demoMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context)
-{
- /*DemoDriver *demo = DEMO_DRIVER(dpy);*/
- DemoSurface *readSurf = LookupDemoSurface(read);
- DemoSurface *drawSurf = LookupDemoSurface(draw);
- DemoContext *ctx = LookupDemoContext(context);
- EGLBoolean b;
-
- b = _eglMakeCurrent(drv, dpy, draw, read, context);
- if (!b)
- return EGL_FALSE;
-
- /* XXX this is where we'd do the hardware context switch */
- (void) drawSurf;
- (void) readSurf;
- (void) ctx;
-
- printf("eglMakeCurrent()\n");
- return EGL_TRUE;
-}
-
-
-/**
- * The bootstrap function. Return a new DemoDriver object and
- * plug in API functions.
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy)
-{
- DemoDriver *demo;
-
- demo = (DemoDriver *) calloc(1, sizeof(DemoDriver));
- if (!demo) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglInitDriverFallbacks(&demo->Base);
- /* then plug in our Demo-specific functions */
- demo->Base.API.Initialize = demoInitialize;
- demo->Base.API.Terminate = demoTerminate;
- demo->Base.API.CreateContext = demoCreateContext;
- demo->Base.API.MakeCurrent = demoMakeCurrent;
- demo->Base.API.CreateWindowSurface = demoCreateWindowSurface;
- demo->Base.API.CreatePixmapSurface = demoCreatePixmapSurface;
- demo->Base.API.CreatePbufferSurface = demoCreatePbufferSurface;
- demo->Base.API.DestroySurface = demoDestroySurface;
- demo->Base.API.DestroyContext = demoDestroyContext;
-
- /* enable supported extensions */
- demo->Base.Extensions.MESA_screen_surface = EGL_TRUE;
- demo->Base.Extensions.MESA_copy_context = EGL_TRUE;
-
- return &demo->Base;
-}
diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile
deleted file mode 100644
index 6b50959a5ab..00000000000
--- a/src/egl/drivers/dri/Makefile
+++ /dev/null
@@ -1,64 +0,0 @@
-# src/egl/drivers/dri/Makefile
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-
-### Include directories
-INCLUDE_DIRS = \
- -I. \
- -I$(DRM_SOURCE_PATH)/shared-core \
- -I$(DRM_SOURCE_PATH)/libdrm \
- -I$(TOP)/include \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/transform \
- -I$(TOP)/src/mesa/shader \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/src/mesa/drivers/dri/common
-
-
-HEADERS = egldri.h
-
-SOURCES = egldri.c \
- $(DRM_SOURCE_PATH)/libdrm/xf86drm.c \
- $(DRM_SOURCE_PATH)/libdrm/xf86drmHash.c \
- $(DRM_SOURCE_PATH)/libdrm/xf86drmRandom.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: depend library Makefile
-
-
-# EGLdri Library
-library: $(LIB_DIR)/libEGLdri.so
-
-$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
- $(TOP)/bin/mklib -o EGLdri -major 1 -minor 0 \
- -install $(LIB_DIR) -ldl $(OBJECTS)
-
-
-clean:
- rm -f *.o
- rm -f *.so
-
-depend: $(SOURCES) $(HEADERS)
- @ echo "running $(MKDEP)"
- @ touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
- $(SOURCES) $(HEADERS) > /dev/null
-
-include depend
-# DO NOT DELETE
-
diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c
deleted file mode 100644
index cab0be2bd18..00000000000
--- a/src/egl/drivers/dri/egldri.c
+++ /dev/null
@@ -1,1138 +0,0 @@
-/**
- * Generic EGL driver for DRI.
- *
- * This file contains all the code needed to interface DRI-based drivers
- * with libEGL.
- *
- * There's a lot of dependencies on fbdev and the /sys/ filesystem.
- */
-
-
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <linux/fb.h>
-#include <assert.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/time.h>
-
-#include "egldriver.h"
-#include "egldisplay.h"
-#include "eglcontext.h"
-#include "eglconfig.h"
-#include "eglsurface.h"
-#include "eglscreen.h"
-#include "eglglobals.h"
-#include "egllog.h"
-#include "eglmode.h"
-
-#include "egldri.h"
-
-const char *sysfs = "/sys/class";
-#define None 0
-static const int empty_attribute_list[1] = { None };
-
-
-/**
- * The bootstrap function.
- * Return a new driDriver object and plug in API functions.
- * This function, in turn, loads a specific DRI driver (ex: r200_dri.so).
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy)
-{
- int length;
- char path[NAME_MAX];
- struct dirent *dirent;
-#if 1
- FILE *file;
-#endif
- DIR *dir;
- _EGLDriver *driver = NULL;;
-
- snprintf(path, sizeof(path), "%s/drm", sysfs);
- if (!(dir = opendir(path))) {
- _eglLog(_EGL_WARNING, "%s DRM devices not found.", path);
- return EGL_FALSE;
- }
- while ((dirent = readdir(dir))) {
-
- if (strncmp(&dirent->d_name[0], "card", 4) != 0)
- continue;
- if (strcmp(&dirent->d_name[4], &dpy->Name[1]) != 0)
- continue;
-
- snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name", sysfs, &dpy->Name[1]);
- _eglLog(_EGL_INFO, "Opening %s", path);
-#if 1
- file = fopen(path, "r");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s", path);
- return NULL;
- }
- fgets(path, sizeof(path), file);
- fclose(file);
-#else
- strcpy(path, "r200\n");
-#endif
- if ((length = strlen(path)) > 0)
- path[length - 1] = '\0'; /* remove the trailing newline from sysfs */
- strncat(path, "_dri", sizeof(path));
-
- driver = _eglOpenDriver(dpy, path);
-
- break;
- }
- closedir(dir);
-
- return driver;
-}
-
-
-/**
- * Called by eglCreateContext via drv->API.CreateContext().
- */
-static EGLContext
-_eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- EGLContext share_list, const EGLint *attrib_list)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driContext *c, *share;
- void *sharePriv;
- _EGLConfig *conf;
- __GLcontextModes visMode;
-
- c = (driContext *) calloc(1, sizeof(*c));
- if (!c)
- return EGL_NO_CONTEXT;
-
- if (!_eglInitContext(drv, dpy, &c->Base, config, attrib_list)) {
- free(c);
- return EGL_NO_CONTEXT;
- }
-
- if (share_list != EGL_NO_CONTEXT) {
- _EGLContext *shareCtx = _eglLookupContext(share_list);
- if (!shareCtx) {
- _eglError(EGL_BAD_CONTEXT, "eglCreateContext(share_list)");
- return EGL_FALSE;
- }
- }
- share = Lookup_driContext(share_list);
- if (share)
- sharePriv = share->driContext.private;
- else
- sharePriv = NULL;
-
- conf = _eglLookupConfig(drv, dpy, config);
- assert(conf);
- _eglConfigToContextModesRec(conf, &visMode);
-
- c->driContext.private = disp->driScreen.createNewContext(disp, &visMode,
- GLX_WINDOW_BIT, sharePriv, &c->driContext);
- if (!c->driContext.private) {
- free(c);
- return EGL_FALSE;
- }
-
- /* generate handle and insert into hash table */
- _eglSaveContext(&c->Base);
-
- return c->Base.Handle;
-}
-
-
-static EGLBoolean
-_eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext context)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driContext *ctx = Lookup_driContext(context);
- EGLBoolean b;
-
- b = _eglMakeCurrent(drv, dpy, draw, read, context);
- if (!b)
- return EGL_FALSE;
-
- if (ctx) {
- ctx->driContext.bindContext(disp, 0, read, draw, &ctx->driContext);
- }
- else {
- /* what's this??? */
- /* _mesa_make_current( NULL, NULL, NULL );*/
- }
- return EGL_TRUE;
-}
-
-
-static EGLSurface
-_eglDRICreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- driSurface *surf;
-
- surf = (driSurface *) calloc(1, sizeof(*surf));
- if (!surf) {
- return EGL_NO_SURFACE;
- }
-
- if (!_eglInitSurface(drv, dpy, &surf->Base, EGL_PBUFFER_BIT,
- config, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- /* create software-based pbuffer */
- {
-#if 0
- GLcontext *ctx = NULL; /* this _should_ be OK */
-#endif
- GLvisual visMode;
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
- assert(conf); /* bad config should be caught earlier */
- _eglConfigToContextModesRec(conf, &visMode);
-
-#if 0
- surf->mesa_framebuffer = _mesa_create_framebuffer(&visMode);
- _mesa_add_soft_renderbuffers(surf->mesa_framebuffer,
- GL_TRUE, /* color bufs */
- visMode.haveDepthBuffer,
- visMode.haveStencilBuffer,
- visMode.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */ );
-
- /* set pbuffer/framebuffer size */
- _mesa_resize_framebuffer(ctx, surf->mesa_framebuffer,
- surf->Base.Width, surf->Base.Height);
-#endif
- }
-
- _eglSaveSurface(&surf->Base);
-
- return surf->Base.Handle;
-}
-
-
-static EGLBoolean
-_eglDRIDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driSurface *fs = Lookup_driSurface(surface);
-
- _eglRemoveSurface(&fs->Base);
-
- fs->drawable.destroyDrawable(disp, fs->drawable.private);
-
- if (fs->Base.IsBound) {
- fs->Base.DeletePending = EGL_TRUE;
- }
- else {
- free(fs);
- }
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-_eglDRIDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driContext *fc = Lookup_driContext(context);
-
- _eglRemoveContext(&fc->Base);
-
- fc->driContext.destroyContext(disp, 0, fc->driContext.private);
-
- if (fc->Base.IsBound) {
- fc->Base.DeletePending = EGL_TRUE;
- }
- else {
- free(fc);
- }
- return EGL_TRUE;
-}
-
-
-/**
- * Create a drawing surface which can be directly displayed on a screen.
- */
-static EGLSurface
-_eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
- const EGLint *attrib_list)
-{
- _EGLConfig *config = _eglLookupConfig(drv, dpy, cfg);
- driDisplay *disp = Lookup_driDisplay(dpy);
- driSurface *surface;
- GLvisual visMode;
-
- surface = (driSurface *) calloc(1, sizeof(*surface));
- if (!surface) {
- return EGL_NO_SURFACE;
- }
-
- /* init base class, do error checking, etc. */
- if (!_eglInitSurface(drv, dpy, &surface->Base, EGL_SCREEN_BIT_MESA,
- cfg, attrib_list)) {
- free(surface);
- return EGL_NO_SURFACE;
- }
-
- _eglSaveSurface(&surface->Base);
-
-
- /*
- * XXX this is where we should allocate video memory for the surface!
- */
-
-
- /* convert EGLConfig to GLvisual */
- _eglConfigToContextModesRec(config, &visMode);
-
- /* Create a new DRI drawable */
- if (!disp->driScreen.createNewDrawable(disp, &visMode, surface->Base.Handle,
- &surface->drawable, GLX_WINDOW_BIT,
- empty_attribute_list)) {
- _eglRemoveSurface(&surface->Base);
- free(surface);
- return EGL_NO_SURFACE;
- }
-
- return surface->Base.Handle;
-}
-
-
-/**
- * Set the fbdev colormap to a simple linear ramp.
- */
-static void
-_eglDRILoadColormap(driScreen *scrn)
-{
- char path[ NAME_MAX ];
- char *buffer;
- int i, fd;
-
- /* cmap attribute uses 256 lines of 16 bytes.
- * Allocate one extra char for the \0 added by sprintf()
- */
- if ( !( buffer = malloc( 256 * 16 + 1 ) ) ) {
- _eglLog(_EGL_WARNING, "Out of memory in _eglDRILoadColormap");
- return;
- }
-
- /* cmap attribute uses 256 lines of 16 bytes */
- for ( i = 0; i < 256; i++ ) {
- int c = (i << 8) | i; /* expand to 16-bit value */
- sprintf(&buffer[i * 16], "%02x%c%04x%04x%04x\n", i, ' ', c, c, c);
- }
-
- snprintf(path, sizeof(path), "%s/graphics/%s/color_map", sysfs, scrn->fb);
- if ( !( fd = open( path, O_RDWR ) ) ) {
- _eglLog(_EGL_WARNING, "Unable to open %s to set colormap", path);
- return;
- }
- write( fd, buffer, 256 * 16 );
- close( fd );
-
- free( buffer );
-}
-
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- * Called via eglShowSurfaceMESA().
- */
-EGLBoolean
-_eglDRIShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
-{
- driDisplay *display = Lookup_driDisplay(dpy);
- driScreen *scrn = Lookup_driScreen(dpy, screen);
- driSurface *surf = Lookup_driSurface(surface);
- _EGLMode *mode = _eglLookupMode(dpy, m);
- FILE *file;
- char fname[NAME_MAX], buffer[1000];
- int temp;
-
- _eglLog(_EGL_DEBUG, "Enter _eglDRIShowScreenSurface");
-
- /* This will check that surface, screen, and mode are valid.
- * Also, it checks that the surface is large enough for the mode, etc.
- */
- if (!_eglShowScreenSurfaceMESA(drv, dpy, screen, surface, m))
- return EGL_FALSE;
-
- assert(surface == EGL_NO_SURFACE || surf);
- assert(m == EGL_NO_MODE_MESA || mode);
- assert(scrn);
-
- /*
- * Blank/unblank screen depending on if m == EGL_NO_MODE_MESA
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/blank", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "kernel patch?? chown all fb sysfs attrib to allow"
- " write - %s\n", fname);
- return EGL_FALSE;
- }
- snprintf(buffer, sizeof(buffer), "%d",
- (m == EGL_NO_MODE_MESA ? VESA_POWERDOWN : VESA_VSYNC_SUSPEND));
- fputs(buffer, file);
- fclose(file);
-
- if (m == EGL_NO_MODE_MESA) {
- /* all done! */
- return EGL_TRUE;
- }
-
- _eglLog(_EGL_INFO, "Setting display mode to %d x %d, %d bpp",
- mode->Width, mode->Height, display->bpp);
-
- /*
- * Set the display mode
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/mode", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s to set mode", fname);
- return EGL_FALSE;
- }
- /* note: nothing happens without the \n! */
- snprintf(buffer, sizeof(buffer), "%s\n", mode->Name);
- fputs(buffer, file);
- fclose(file);
- _eglLog(_EGL_INFO, "Set mode to %s in %s", mode->Name, fname);
-
- /*
- * Set display bpp
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/bits_per_pixel",
- sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s to set bpp", fname);
- return EGL_FALSE;
- }
- display->bpp = GET_CONFIG_ATTRIB(surf->Base.Config, EGL_BUFFER_SIZE);
- display->cpp = display->bpp / 8;
- snprintf(buffer, sizeof(buffer), "%d", display->bpp);
- fputs(buffer, file);
- fclose(file);
-
- /*
- * Unblank display
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/blank", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s", fname);
- return EGL_FALSE;
- }
- snprintf(buffer, sizeof(buffer), "%d", VESA_NO_BLANKING);
- fputs(buffer, file);
- fclose(file);
-
- /*
- * Set fbdev buffer virtual size to surface's size.
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/virtual_size", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- snprintf(buffer, sizeof(buffer), "%d,%d", surf->Base.Width, surf->Base.Height);
- fputs(buffer, file);
- rewind(file);
- fgets(buffer, sizeof(buffer), file);
- sscanf(buffer, "%d,%d", &display->virtualWidth, &display->virtualHeight);
- fclose(file);
-
- /*
- * round up pitch as needed
- */
- temp = display->virtualWidth;
- switch (display->bpp / 8) {
- case 1: temp = (display->virtualWidth + 127) & ~127; break;
- case 2: temp = (display->virtualWidth + 31) & ~31; break;
- case 3:
- case 4: temp = (display->virtualWidth + 15) & ~15; break;
- default:
- _eglLog(_EGL_WARNING, "Bad display->bpp = %d in _eglDRIShowScreenSurface");
- }
- display->virtualWidth = temp;
-
- /*
- * sanity check
- */
- if (surf->Base.Width < display->virtualWidth ||
- surf->Base.Height < display->virtualHeight) {
- /* this case _should_ have been caught at the top of this function */
- _eglLog(_EGL_WARNING, "too small of surface in _eglDRIShowScreenSurfaceMESA "
- "%d x %d < %d x %d",
- surf->Base.Width,
- surf->Base.Height,
- display->virtualWidth,
- display->virtualHeight);
- /*
- return EGL_FALSE;
- */
- }
-
- /* This used to be done in the _eglDRICreateScreens routine. */
- _eglDRILoadColormap(scrn);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Called by eglSwapBuffers via the drv->API.SwapBuffers() pointer.
- *
- * If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static EGLBoolean
-_eglDRISwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
-{
- driSurface *drawable = Lookup_driSurface(draw);
-
- /* this does error checking */
- if (!_eglSwapBuffers(drv, dpy, draw))
- return EGL_FALSE;
-
- drawable->drawable.swapBuffers(NULL, drawable->drawable.private);
-
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglDRIGetDisplayInfo(driDisplay *dpy)
-{
- char path[ NAME_MAX ];
- FILE *file;
- int i, rc;
- drmSetVersion sv;
- drm_magic_t magic;
-
- snprintf( path, sizeof( path ), "%s/graphics/fb%d/device/device", sysfs, dpy->minor );
- file = fopen( path, "r" );
- if (!file) {
- _eglLog(_EGL_WARNING, "Unable to open %s", path);
- return EGL_FALSE;
- }
- fgets( path, sizeof( path ), file );
- sscanf( path, "%x", &dpy->chipset );
- fclose( file );
-
- sprintf(path, DRM_DEV_NAME, DRM_DIR_NAME, dpy->minor);
- if ( ( dpy->drmFD = open(path, O_RDWR, 0) ) < 0 ) {
- _eglLog(_EGL_WARNING, "drmOpen failed.");
- return EGL_FALSE;
- }
-
- /* Set the interface version, asking for 1.2 */
- sv.drm_di_major = 1;
- sv.drm_di_minor = 2;
- sv.drm_dd_major = -1;
- if ((rc = drmSetInterfaceVersion(dpy->drmFD, &sv)))
- return EGL_FALSE;
-
- /* self authorize */
- if (drmGetMagic(dpy->drmFD, &magic))
- return EGL_FALSE;
- if (drmAuthMagic(dpy->drmFD, magic))
- return EGL_FALSE;
-
- /* Map framebuffer and SAREA */
- for (i = 0; ; i++) {
- drm_handle_t handle, offset;
- drmSize size;
- drmMapType type;
- drmMapFlags flags;
- int mtrr;
-
- if (drmGetMap(dpy->drmFD, i, &offset, &size, &type, &flags,
- &handle, &mtrr))
- break;
-
- if (type == DRM_FRAME_BUFFER) {
- rc = drmMap( dpy->drmFD, offset, size, (drmAddressPtr) &dpy->pFB);
- if (rc < 0) {
- _eglLog(_EGL_WARNING, "drmMap DRM_FAME_BUFFER failed");
- return EGL_FALSE;
- }
- dpy->fbSize = size;
- _eglLog(_EGL_INFO, "Found framebuffer size: %d", dpy->fbSize);
- }
- else if (type == DRM_SHM) {
- rc = drmMap(dpy->drmFD, offset, size, (drmAddressPtr) &dpy->pSAREA);
- if (rc < 0 ) {
- _eglLog(_EGL_WARNING, "drmMap DRM_SHM failed.");
- return EGL_FALSE;
- }
- dpy->SAREASize = SAREA_MAX;
- _eglLog(_EGL_DEBUG, "mapped SAREA 0x%08lx to %p, size %d",
- (unsigned long) offset, dpy->pSAREA, dpy->SAREASize );
- }
- }
-
- if (!dpy->pFB) {
- _eglLog(_EGL_WARNING, "failed to map framebuffer");
- return EGL_FALSE;
- }
-
- if (!dpy->pSAREA) {
- /* if this happens, make sure you're using the most recent DRM modules */
- _eglLog(_EGL_WARNING, "failed to map SAREA");
- return EGL_FALSE;
- }
-
- memset( dpy->pSAREA, 0, dpy->SAREASize );
-
- return EGL_TRUE;
-}
-
-
- /* Return the DRI per screen structure */
-static __DRIscreen *
-__eglFindDRIScreen(__DRInativeDisplay *ndpy, int scrn)
-{
- driDisplay *disp = (driDisplay *)ndpy;
- return &disp->driScreen;
-}
-
-
-static GLboolean
-__eglCreateContextWithConfig(__DRInativeDisplay* ndpy, int screen,
- int configID, void* context,
- drm_context_t * hHWContext)
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
- if (psp->fd) {
- if (drmCreateContext(psp->fd, hHWContext)) {
- _eglLog(_EGL_WARNING, "drmCreateContext failed.");
- return GL_FALSE;
- }
- *(void**)context = (void*) *hHWContext;
- }
-#if 0
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
-
- pDRIScreen = __glXFindDRIScreen(dpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
-
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
-
- if (psp->fd) {
- if (drmCreateContext(psp->fd, hHWContext)) {
- _eglLog(_EGL_WARNING, "drmCreateContext failed.");
- return GL_FALSE;
- }
- *(void**)contextID = (void*) *hHWContext;
- }
-#endif
- return GL_TRUE;
-}
-
-
-static GLboolean
-__eglDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context )
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
- if (psp->fd)
- drmDestroyContext(psp->fd, context);
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-__eglCreateDrawable(__DRInativeDisplay * ndpy, int screen,
- __DRIid drawable, drm_drawable_t * hHWDrawable)
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
- if (psp->fd) {
- if (drmCreateDrawable(psp->fd, hHWDrawable)) {
- _eglLog(_EGL_WARNING, "drmCreateDrawable failed.");
- return GL_FALSE;
- }
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-__eglDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable )
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
- if (psp->fd)
- drmDestroyDrawable(psp->fd, drawable);
-
- return GL_TRUE;
-}
-
-static GLboolean
-__eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
- unsigned int* index, unsigned int* stamp,
- int* X, int* Y, int* W, int* H,
- int* numClipRects, drm_clip_rect_t ** pClipRects,
- int* backX, int* backY,
- int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
- driSurface *surf = Lookup_driSurface(drawable);
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
-
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
- *X = 0;
- *Y = 0;
- *W = surf->Base.Width;
- *H = surf->Base.Height;
-
- *backX = 0;
- *backY = 0;
- *numBackClipRects = 0;
- *pBackClipRects = NULL;
-
- *numClipRects = 1;
- *pClipRects = malloc(sizeof(**pClipRects));
- **pClipRects = (drm_clip_rect_t){0, 0, surf->Base.Width, surf->Base.Height};
-
- psp->pSAREA->drawableTable[0].stamp = 1;
- *stamp = 1;
-#if 0
- GLXDrawable drawable = (GLXDrawable) draw;
- drm_clip_rect_t * cliprect;
- Display* display = (Display*)dpy;
- __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private;
- if (drawable == 0) {
- return GL_FALSE;
- }
-
- cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t));
- cliprect->x1 = drawable->x;
- cliprect->y1 = drawable->y;
- cliprect->x2 = drawable->x + drawable->w;
- cliprect->y2 = drawable->y + drawable->h;
-
- /* the drawable index is by client id */
- *index = display->clientID;
-
- *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp;
- *x = drawable->x;
- *y = drawable->y;
- *width = drawable->w;
- *height = drawable->h;
- *numClipRects = 1;
- *pClipRects = cliprect;
-
- *backX = drawable->x;
- *backY = drawable->y;
- *numBackClipRects = 0;
- *pBackClipRects = 0;
-#endif
- return GL_TRUE;
-}
-
-
-/**
- * Implement \c __DRIinterfaceMethods::getProcAddress.
- */
-static __DRIfuncPtr
-get_proc_address(const char * proc_name)
-{
- return NULL;
-}
-
-
-/**
- * Destroy a linked list of \c __GLcontextModes structures created by
- * \c _gl_context_modes_create.
- *
- * \param modes Linked list of structures to be destroyed. All structres
- * in the list will be freed.
- */
-static void
-__egl_context_modes_destroy(__GLcontextModes *modes)
-{
- while ( modes != NULL ) {
- __GLcontextModes * const next = modes->next;
-
- free( modes );
- modes = next;
- }
-}
-
-
-/**
- * Allocate a linked list of \c __GLcontextModes structures. The fields of
- * each structure will be initialized to "reasonable" default values. In
- * most cases this is the default value defined by table 3.4 of the GLX
- * 1.3 specification. This means that most values are either initialized to
- * zero or \c GLX_DONT_CARE (which is -1). As support for additional
- * extensions is added, the new values will be initialized to appropriate
- * values from the extension specification.
- *
- * \param count Number of structures to allocate.
- * \param minimum_size Minimum size of a structure to allocate. This allows
- * for differences in the version of the
- * \c __GLcontextModes stucture used in libGL and in a
- * DRI-based driver.
- * \returns A pointer to the first element in a linked list of \c count
- * stuctures on success, or \c NULL on failure.
- *
- * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
- * The fundamental assumption is that if the \c minimum_size
- * specified by the driver and the size of the \c __GLcontextModes
- * structure in libGL is the same, then the meaning of each byte in
- * the structure is the same in both places. \b Be \b careful!
- * Basically this means that fields have to be added in libGL and
- * then propagated to drivers. Drivers should \b never arbitrarilly
- * extend the \c __GLcontextModes data-structure.
- */
-static __GLcontextModes *
-__egl_context_modes_create(unsigned count, size_t minimum_size)
-{
- const size_t size = (minimum_size > sizeof( __GLcontextModes ))
- ? minimum_size : sizeof( __GLcontextModes );
- __GLcontextModes * base = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- next = & base;
- for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) malloc( size );
- if ( *next == NULL ) {
- __egl_context_modes_destroy( base );
- base = NULL;
- break;
- }
-
- (void) memset( *next, 0, size );
- (*next)->visualID = GLX_DONT_CARE;
- (*next)->visualType = GLX_DONT_CARE;
- (*next)->visualRating = GLX_NONE;
- (*next)->transparentPixel = GLX_NONE;
- (*next)->transparentRed = GLX_DONT_CARE;
- (*next)->transparentGreen = GLX_DONT_CARE;
- (*next)->transparentBlue = GLX_DONT_CARE;
- (*next)->transparentAlpha = GLX_DONT_CARE;
- (*next)->transparentIndex = GLX_DONT_CARE;
- (*next)->xRenderable = GLX_DONT_CARE;
- (*next)->fbconfigID = GLX_DONT_CARE;
- (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- next = & ((*next)->next);
- }
-
- return base;
-}
-
-
-static GLboolean
-__eglWindowExists(__DRInativeDisplay *dpy, __DRIid draw)
-{
- return EGL_TRUE;
-}
-
-
-/**
- * Get the unadjusted system time (UST). Currently, the UST is measured in
- * microseconds since Epoc. The actual resolution of the UST may vary from
- * system to system, and the units may vary from release to release.
- * Drivers should not call this function directly. They should instead use
- * \c glXGetProcAddress to obtain a pointer to the function.
- *
- * \param ust Location to store the 64-bit UST
- * \returns Zero on success or a negative errno value on failure.
- *
- * \sa glXGetProcAddress, PFNGLXGETUSTPROC
- *
- * \since Internal API version 20030317.
- */
-static int
-__eglGetUST(int64_t *ust)
-{
- struct timeval tv;
-
- if ( ust == NULL ) {
- return -EFAULT;
- }
-
- if ( gettimeofday( & tv, NULL ) == 0 ) {
- ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
- return 0;
- }
- else {
- return -errno;
- }
-}
-
-/**
- * Determine the refresh rate of the specified drawable and display.
- *
- * \param dpy Display whose refresh rate is to be determined.
- * \param drawable Drawable whose refresh rate is to be determined.
- * \param numerator Numerator of the refresh rate.
- * \param demoninator Denominator of the refresh rate.
- * \return If the refresh rate for the specified display and drawable could
- * be calculated, True is returned. Otherwise False is returned.
- *
- * \note This function is implemented entirely client-side. A lot of other
- * functionality is required to export GLX_OML_sync_control, so on
- * XFree86 this function can be called for direct-rendering contexts
- * when GLX_OML_sync_control appears in the client extension string.
- */
-static GLboolean
-__eglGetMSCRate(__DRInativeDisplay * dpy, __DRIid drawable,
- int32_t * numerator, int32_t * denominator)
-{
- return EGL_TRUE;
-}
-
-
-/**
- * Table of functions exported by the loader to the driver.
- */
-static const __DRIinterfaceMethods interface_methods = {
- get_proc_address,
-
- __egl_context_modes_create,
- __egl_context_modes_destroy,
-
- __eglFindDRIScreen,
- __eglWindowExists,
-
- __eglCreateContextWithConfig,
- __eglDestroyContext,
-
- __eglCreateDrawable,
- __eglDestroyDrawable,
- __eglGetDrawableInfo,
-
- __eglGetUST,
- __eglGetMSCRate,
-};
-
-
-static int
-__glXGetInternalVersion(void)
-{
- return 20050725;
-}
-
-static const char createNewScreenName[] = "__driCreateNewScreen_20050727";
-
-
-/**
- * Do per-display initialization.
- */
-EGLBoolean
-_eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer)
-{
- PFNCREATENEWSCREENFUNC createNewScreen;
- int api_ver = __glXGetInternalVersion();
- __DRIversion ddx_version;
- __DRIversion dri_version;
- __DRIversion drm_version;
- drmVersionPtr version;
-
- version = drmGetVersion( dpy->drmFD );
- if ( version ) {
- drm_version.major = version->version_major;
- drm_version.minor = version->version_minor;
- drm_version.patch = version->version_patchlevel;
- drmFreeVersion( version );
- }
- else {
- drm_version.major = -1;
- drm_version.minor = -1;
- drm_version.patch = -1;
- }
-
- /*
- * Get device name (like "tdfx") and the ddx version numbers.
- * We'll check the version in each DRI driver's "createScreen"
- * function.
- */
- ddx_version.major = 4;
- ddx_version.minor = 0;
- ddx_version.patch = 0;
-
- /*
- * Get the DRI X extension version.
- */
- dri_version.major = 4;
- dri_version.minor = 0;
- dri_version.patch = 0;
-
- createNewScreen = ( PFNCREATENEWSCREENFUNC ) dlsym( dpy->Base.Driver->LibHandle, createNewScreenName );
- if ( !createNewScreen ) {
- _eglLog(_EGL_WARNING, "Couldn't find %s function in the driver.",
- createNewScreenName );
- return EGL_FALSE;
- }
-
- dpy->driScreen.private = createNewScreen( dpy, 0, &dpy->driScreen, NULL,
- &ddx_version, &dri_version,
- &drm_version, framebuffer,
- dpy->pSAREA, dpy->drmFD,
- api_ver,
- & interface_methods,
- NULL);
- if (!dpy->driScreen.private)
- return EGL_FALSE;
-
- DRM_UNLOCK( dpy->drmFD, dpy->pSAREA, dpy->serverContext );
-
- return EGL_TRUE;
-}
-
-
-/**
- * Create all the EGL screens for the given display.
- */
-EGLBoolean
-_eglDRICreateScreens(driDisplay *dpy)
-{
- const int numScreens = 1; /* XXX fix this someday */
- int i;
-
- for (i = 0; i < numScreens; i++) {
- char path[ NAME_MAX ];
- FILE *file;
- driScreen *s;
-
- /* Create a screen */
- if ( !( s = ( driScreen * ) calloc( 1, sizeof( *s ) ) ) )
- return EGL_FALSE;
-
- snprintf( s->fb, NAME_MAX, "fb%d", dpy->minor );
- _eglInitScreen( &s->Base );
-
- _eglAddScreen( &dpy->Base, &s->Base );
-
- /* Create the screen's mode list */
- snprintf( path, sizeof( path ), "%s/graphics/%s/modes", sysfs, s->fb );
- file = fopen( path, "r" );
- while ( fgets( path, sizeof( path ), file ) ) {
- unsigned int x, y, r;
- char c;
- path[ strlen( path ) - 1 ] = '\0'; /* strip off \n from sysfs */
- sscanf( path, "%c:%ux%u-%u", &c, &x, &y, &r );
- _eglAddNewMode( &s->Base, x, y, r * 1000, path );
- }
- fclose( file );
-
- /*
- * NOTE: we used to set the colormap here, but that didn't work reliably.
- * Some entries near the start of the table would get corrupted by later
- * mode changes.
- */
- }
-
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy,
- EGLint *major, EGLint *minor)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- driDisplay *display;
-
- assert(disp);
-
- /* Create new driDisplay object to replace the _EGLDisplay that was
- * previously created.
- */
- display = calloc(1, sizeof(*display));
- display->Base = *disp;
- _eglHashInsert(_eglGlobal.Displays, disp->Handle, display);
- free(disp);
-
- *major = 1;
- *minor = 0;
-
- sscanf(&disp->Name[1], "%d", &display->minor);
-
- drv->Initialized = EGL_TRUE;
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-_eglDRITerminate(_EGLDriver *drv, EGLDisplay dpy)
-{
- driDisplay *display = Lookup_driDisplay(dpy);
- _eglCleanupDisplay(&display->Base);/*rename that function*/
- free(display);
- free(drv);
- return EGL_TRUE;
-}
-
-
-/**
- * Plug in the DRI-specific functions into the driver's dispatch table.
- * Also, enable some EGL extensions.
- */
-void
-_eglDRIInitDriverFallbacks(_EGLDriver *drv)
-{
- _eglInitDriverFallbacks(drv);
-
- drv->API.Initialize = _eglDRIInitialize;
- drv->API.Terminate = _eglDRITerminate;
- drv->API.CreateContext = _eglDRICreateContext;
- drv->API.MakeCurrent = _eglDRIMakeCurrent;
- drv->API.CreatePbufferSurface = _eglDRICreatePbufferSurface;
- drv->API.DestroySurface = _eglDRIDestroySurface;
- drv->API.DestroyContext = _eglDRIDestroyContext;
- drv->API.CreateScreenSurfaceMESA = _eglDRICreateScreenSurfaceMESA;
- drv->API.ShowScreenSurfaceMESA = _eglDRIShowScreenSurfaceMESA;
- drv->API.SwapBuffers = _eglDRISwapBuffers;
-
- /* enable supported extensions */
- drv->Extensions.MESA_screen_surface = EGL_TRUE;
- drv->Extensions.MESA_copy_context = EGL_TRUE;
-}
diff --git a/src/egl/drivers/dri/egldri.h b/src/egl/drivers/dri/egldri.h
deleted file mode 100644
index 34b12d64fcd..00000000000
--- a/src/egl/drivers/dri/egldri.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#ifndef EGLDRI_INCLUDED
-#define EGLDRI_INCLUDED
-
-#include "egldisplay.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-#include "eglcontext.h"
-#include "mtypes.h"
-#include "dri_util.h"
-#include "drm_sarea.h"
-
-/**
- * dri display-specific driver class derived from _EGLDisplay
- */
-typedef struct dri_display
-{
- _EGLDisplay Base; /* base class/object */
- void *pFB;
- int drmFD; /**< \brief DRM device file descriptor */
- int minor;
- unsigned long hFrameBuffer;
-
- int virtualWidth;
- int virtualHeight;
- int fbSize;
- int bpp;
- int cpp;
- int card_type;
- int SAREASize;
- drm_sarea_t *pSAREA;
- unsigned int serverContext; /**< \brief DRM context only active on server */
- unsigned long FBStart; /**< \brief physical address of the framebuffer */
- void *driverClientMsg;
- int driverClientMsgSize;
- int chipset;
- void *driverPrivate;
- drm_magic_t magic;
-
- __DRIscreen driScreen;
-
-} driDisplay;
-
-
-/**
- * dri driver-specific screen class derived from _EGLScreen
- */
-typedef struct dri_screen
-{
- _EGLScreen Base;
- char fb[NAME_MAX]; /** the screen name, like "fb0" */
-} driScreen;
-
-
-/**
- * dri driver-specific surface class derived from _EGLSurface
- */
-typedef struct dri_surface
-{
- _EGLSurface Base; /* base class/object */
- __DRIdrawable drawable;
-} driSurface;
-
-
-/**
- * dri driver-specific context class derived from _EGLContext
- */
-typedef struct dri_context
-{
- _EGLContext Base; /* base class/object */
- __DRIcontext driContext; /**< \brief context dependent methods */
-} driContext;
-
-
-
-static inline driDisplay *
-Lookup_driDisplay(EGLDisplay dpy)
-{
- _EGLDisplay *d = _eglLookupDisplay(dpy);
- return (driDisplay *) d;
-}
-
-
-static inline driScreen *
-Lookup_driScreen(EGLDisplay dpy, EGLScreenMESA screen)
-{
- _EGLScreen *s = _eglLookupScreen(dpy, screen);
- return (driScreen *) s;
-}
-
-
-static inline driContext *
-Lookup_driContext(EGLContext ctx)
-{
- _EGLContext *c = _eglLookupContext(ctx);
- return (driContext *) c;
-}
-
-
-static inline driSurface *
-Lookup_driSurface(EGLSurface surf)
-{
- _EGLSurface *s = _eglLookupSurface(surf);
- return (driSurface *) s;
-}
-
-extern void _eglDRIInitDriverFallbacks(_EGLDriver *drv);
-extern EGLBoolean _eglDRIShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA m);
-extern EGLBoolean _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor);
-extern EGLBoolean _eglDRIGetDisplayInfo(driDisplay *dpy);
-extern EGLBoolean _eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer);
-extern EGLBoolean _eglDRICreateScreens(driDisplay *dpy);
-
-#endif /* EGLDRI_INCLUDED */
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
deleted file mode 100644
index 45a4fb39b8b..00000000000
--- a/src/egl/main/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-# src/egl/main/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi
-
-HEADERS = \
- eglconfig.h \
- eglcontext.h \
- egldisplay.h \
- egldriver.h \
- eglglobals.h \
- egllog.h \
- eglhash.h \
- eglmode.h \
- eglscreen.h \
- eglsurface.h
-
-SOURCES = \
- eglapi.c \
- eglconfig.c \
- eglcontext.c \
- egldisplay.c \
- egldriver.c \
- eglglobals.c \
- egllog.c \
- eglhash.c \
- eglmode.c \
- eglscreen.c \
- eglsurface.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: depend library
-
-
-# EGL Library
-library: $(LIB_DIR)/libEGL.so
-
-$(LIB_DIR)/libEGL.so: $(OBJECTS)
- $(TOP)/bin/mklib -o EGL -major 1 -minor 0 \
- -install $(LIB_DIR) -ldl $(OBJECTS)
-
-
-
-clean:
- rm -f *.o *.so*
- rm -f core.*
-
-
-depend: $(SOURCES) $(HEADERS)
- @ echo "running $(MKDEP)"
- @ touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
- $(SOURCES) $(HEADERS) > /dev/null
-
-include depend
-# DO NOT DELETE
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
deleted file mode 100644
index bfa580e6c3f..00000000000
--- a/src/egl/main/eglapi.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/**
- * Public EGL API entrypoints
- *
- * Generally, we use the EGLDisplay parameter as a key to lookup the
- * appropriate device driver handle, then jump though the driver's
- * dispatch table to handle the function.
- *
- * That allows us the option of supporting multiple, simultaneous,
- * heterogeneous hardware devices in the future.
- *
- * The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are
- * opaque handles implemented with 32-bit unsigned integers.
- * It's up to the driver function or fallback function to look up the
- * handle and get an object.
- * By using opaque handles, we leave open the possibility of having
- * indirect rendering in the future, like GLX.
- *
- *
- * Notes on naming conventions:
- *
- * eglFooBar - public EGL function
- * EGL_FOO_BAR - public EGL token
- * EGLDatatype - public EGL datatype
- *
- * _eglFooBar - private EGL function
- * _EGLDatatype - private EGL datatype, typedef'd struct
- * _egl_struct - private EGL struct, non-typedef'd
- *
- */
-
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egltypedefs.h"
-#include "eglglobals.h"
-#include "egldriver.h"
-#include "eglsurface.h"
-
-
-
-/**
- * NOTE: displayName is treated as a string in _eglChooseDriver()!!!
- * This will probably change!
- * See _eglChooseDriver() for details!
- */
-EGLDisplay APIENTRY
-eglGetDisplay(NativeDisplayType displayName)
-{
- _EGLDisplay *dpy;
- _eglInitGlobals();
- dpy = _eglNewDisplay(displayName);
- if (dpy)
- return dpy->Handle;
- else
- return EGL_NO_DISPLAY;
-}
-
-
-EGLBoolean APIENTRY
-eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- if (dpy) {
- _EGLDriver *drv = _eglChooseDriver(dpy);
- if (drv)
- return drv->API.Initialize(drv, dpy, major, minor);
- }
- return EGL_FALSE;
-}
-
-
-EGLBoolean APIENTRY
-eglTerminate(EGLDisplay dpy)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return _eglCloseDriver(drv, dpy);
- else
- return EGL_FALSE;
-}
-
-
-const char * APIENTRY
-eglQueryString(EGLDisplay dpy, EGLint name)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return drv->API.QueryString(drv, dpy, name);
- else
- return NULL;
-}
-
-
-EGLBoolean APIENTRY
-eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- /* XXX check drv for null in remaining functions */
- return drv->API.GetConfigs(drv, dpy, configs, config_size, num_config);
-}
-
-
-EGLBoolean APIENTRY
-eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.ChooseConfig(drv, dpy, attrib_list, configs, config_size, num_config);
-}
-
-
-EGLBoolean APIENTRY
-eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.GetConfigAttrib(drv, dpy, config, attribute, value);
-}
-
-
-EGLContext APIENTRY
-eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CreateContext(drv, dpy, config, share_list, attrib_list);
-}
-
-
-EGLBoolean APIENTRY
-eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.DestroyContext(drv, dpy, ctx);
-}
-
-
-EGLBoolean APIENTRY
-eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.MakeCurrent(drv, dpy, draw, read, ctx);
-}
-
-
-EGLBoolean APIENTRY
-eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.QueryContext(drv, dpy, ctx, attribute, value);
-}
-
-
-EGLSurface APIENTRY
-eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CreateWindowSurface(drv, dpy, config, window, attrib_list);
-}
-
-
-EGLSurface APIENTRY
-eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CreatePixmapSurface(drv, dpy, config, pixmap, attrib_list);
-}
-
-
-EGLSurface APIENTRY
-eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CreatePbufferSurface(drv, dpy, config, attrib_list);
-}
-
-
-EGLBoolean APIENTRY
-eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.DestroySurface(drv, dpy, surface);
-}
-
-
-EGLBoolean APIENTRY
-eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.QuerySurface(drv, dpy, surface, attribute, value);
-}
-
-
-EGLBoolean APIENTRY
-eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.SurfaceAttrib(drv, dpy, surface, attribute, value);
-}
-
-
-EGLBoolean APIENTRY
-eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.BindTexImage(drv, dpy, surface, buffer);
-}
-
-
-EGLBoolean APIENTRY
-eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.ReleaseTexImage(drv, dpy, surface, buffer);
-}
-
-
-EGLBoolean APIENTRY
-eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.SwapInterval(drv, dpy, interval);
-}
-
-
-EGLBoolean APIENTRY
-eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.SwapBuffers(drv, dpy, draw);
-}
-
-
-EGLBoolean APIENTRY
-eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CopyBuffers(drv, dpy, surface, target);
-}
-
-
-EGLBoolean APIENTRY
-eglWaitGL(void)
-{
- EGLDisplay dpy = eglGetCurrentDisplay();
- if (dpy != EGL_NO_DISPLAY) {
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.WaitGL(drv, dpy);
- }
- else
- return EGL_FALSE;
-}
-
-
-EGLBoolean APIENTRY
-eglWaitNative(EGLint engine)
-{
- EGLDisplay dpy = eglGetCurrentDisplay();
- if (dpy != EGL_NO_DISPLAY) {
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.WaitNative(drv, dpy, engine);
- }
- else
- return EGL_FALSE;
-}
-
-
-EGLDisplay APIENTRY
-eglGetCurrentDisplay(void)
-{
- _EGLDisplay *dpy = _eglGetCurrentDisplay();
- if (dpy)
- return dpy->Handle;
- else
- return EGL_NO_DISPLAY;
-}
-
-
-EGLContext APIENTRY
-eglGetCurrentContext(void)
-{
- _EGLContext *ctx = _eglGetCurrentContext();
- if (ctx)
- return ctx->Handle;
- else
- return EGL_NO_CONTEXT;
-}
-
-
-EGLSurface APIENTRY
-eglGetCurrentSurface(EGLint readdraw)
-{
- _EGLSurface *s = _eglGetCurrentSurface(readdraw);
- if (s)
- return s->Handle;
- else
- return EGL_NO_SURFACE;
-}
-
-
-EGLint APIENTRY
-eglGetError(void)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- EGLint e = t->LastError;
- t->LastError = EGL_SUCCESS;
- return e;
-}
-
-
-void (* APIENTRY eglGetProcAddress(const char *procname))()
-{
- typedef void (*genericFunc)();
- struct name_function {
- const char *name;
- _EGLProc function;
- };
- static struct name_function egl_functions[] = {
- /* alphabetical order */
- { "eglBindTexImage", (_EGLProc) eglBindTexImage },
- { "eglChooseConfig", (_EGLProc) eglChooseConfig },
- { "eglCopyBuffers", (_EGLProc) eglCopyBuffers },
- { "eglCreateContext", (_EGLProc) eglCreateContext },
- { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface },
- { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface },
- { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface },
- { "eglDestroyContext", (_EGLProc) eglDestroyContext },
- { "eglDestroySurface", (_EGLProc) eglDestroySurface },
- { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib },
- { "eglGetConfigs", (_EGLProc) eglGetConfigs },
- { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext },
- { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay },
- { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface },
- { "eglGetDisplay", (_EGLProc) eglGetDisplay },
- { "eglGetError", (_EGLProc) eglGetError },
- { "eglGetProcAddress", (_EGLProc) eglGetProcAddress },
- { "eglInitialize", (_EGLProc) eglInitialize },
- { "eglMakeCurrent", (_EGLProc) eglMakeCurrent },
- { "eglQueryContext", (_EGLProc) eglQueryContext },
- { "eglQueryString", (_EGLProc) eglQueryString },
- { "eglQuerySurface", (_EGLProc) eglQuerySurface },
- { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage },
- { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib },
- { "eglSwapBuffers", (_EGLProc) eglSwapBuffers },
- { "eglSwapInterval", (_EGLProc) eglSwapInterval },
- { "eglTerminate", (_EGLProc) eglTerminate },
- { "eglWaitGL", (_EGLProc) eglWaitGL },
- { "eglWaitNative", (_EGLProc) eglWaitNative },
- /* Extensions */
-#ifdef EGL_MESA_screen_surface
- { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
- { "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
- { "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
- { "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA },
- { "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA },
- { "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA },
- { "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA },
- { "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA },
- { "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA },
- { "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
- { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
- { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
-#endif /* EGL_MESA_screen_surface */
-#ifdef EGL_VERSION_1_2
- { "eglBindAPI", (_EGLProc) eglBindAPI },
- { "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
- { "eglQueryAPI", (_EGLProc) eglQueryAPI },
- { "eglReleaseThread", (_EGLProc) eglReleaseThread },
- { "eglWaitClient", (_EGLProc) eglWaitClient },
-#endif /* EGL_VERSION_1_2 */
- { NULL, NULL }
- };
- EGLint i;
- for (i = 0; egl_functions[i].name; i++) {
- if (strcmp(egl_functions[i].name, procname) == 0) {
- return (genericFunc) egl_functions[i].function;
- }
- }
-#if 0
- /* XXX enable this code someday */
- return (genericFunc) _glapi_get_proc_address(procname);
-#else
- return NULL;
-#endif
-}
-
-
-/*
- * EGL_MESA_screen extension
- */
-
-EGLBoolean APIENTRY
-eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
- const EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return drv->API.ChooseModeMESA(drv, dpy, screen, attrib_list, modes, modes_size, num_modes);
- else
- return EGL_FALSE;
-}
-
-
-EGLBoolean APIENTRY
-eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return drv->API.GetModesMESA(drv, dpy, screen, modes, mode_size, num_mode);
- else
- return EGL_FALSE;
-}
-
-
-EGLBoolean APIENTRY
-eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return drv->API.GetModeAttribMESA(drv, dpy, mode, attribute, value);
- else
- return EGL_FALSE;
-}
-
-
-EGLBoolean APIENTRY
-eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return drv->API.CopyContextMESA(drv, dpy, source, dest, mask);
- else
- return EGL_FALSE;
-}
-
-
-EGLBoolean
-eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- if (drv)
- return drv->API.GetScreensMESA(drv, dpy, screens, max_screens, num_screens);
- else
- return EGL_FALSE;
-}
-
-
-EGLSurface
-eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CreateScreenSurfaceMESA(drv, dpy, config, attrib_list);
-}
-
-
-EGLBoolean
-eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.ShowScreenSurfaceMESA(drv, dpy, screen, surface, mode);
-}
-
-
-EGLBoolean
-eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.ScreenPositionMESA(drv, dpy, screen, x, y);
-}
-
-
-EGLBoolean
-eglQueryScreenMESA( EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.QueryScreenMESA(drv, dpy, screen, attribute, value);
-}
-
-
-EGLBoolean
-eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.QueryScreenSurfaceMESA(drv, dpy, screen, surface);
-}
-
-
-EGLBoolean
-eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.QueryScreenModeMESA(drv, dpy, screen, mode);
-}
-
-
-const char *
-eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.QueryModeStringMESA(drv, dpy, mode);
-}
-
-
-/**
- ** EGL 1.2
- **/
-
-#ifdef EGL_VERSION_1_2
-
-EGLBoolean
-eglBindAPI(EGLenum api)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
-
- switch (api) {
- case EGL_OPENGL_ES_API:
- if (_eglGlobal.OpenGLESAPISupported) {
- t->CurrentAPI = api;
- return EGL_TRUE;
- }
- _eglError(EGL_BAD_PARAMETER, "eglBindAPI");
- return EGL_FALSE;
- case EGL_OPENVG_API:
- if (_eglGlobal.OpenVGAPISupported) {
- t->CurrentAPI = api;
- return EGL_TRUE;
- }
- _eglError(EGL_BAD_PARAMETER, "eglBindAPI");
- return EGL_FALSE;
- default:
- return EGL_FALSE;
- }
- return EGL_TRUE;
-}
-
-
-EGLSurface
-eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
- EGLClientBuffer buffer, EGLConfig config,
- const EGLint *attrib_list)
-{
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer,
- config, attrib_list);
-}
-
-
-EGLenum
-eglQueryAPI(void)
-{
- /* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
- _EGLThreadInfo *t = _eglGetCurrentThread();
- return t->CurrentAPI;
-}
-
-
-EGLBoolean
-eglReleaseThread(void)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- EGLDisplay dpy = eglGetCurrentDisplay();
- if (dpy) {
- _EGLDriver *drv = _eglLookupDriver(dpy);
- /* unbind context */
- (void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE,
- EGL_NO_SURFACE, EGL_NO_CONTEXT);
- }
- _eglDeleteThreadData(t);
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-eglWaitClient(void)
-{
- EGLDisplay dpy = eglGetCurrentDisplay();
- if (dpy != EGL_NO_DISPLAY) {
- _EGLDriver *drv = _eglLookupDriver(dpy);
- return drv->API.WaitClient(drv, dpy);
- }
- else
- return EGL_FALSE;
-}
-
-#endif /* EGL_VERSION_1_2 */
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
deleted file mode 100644
index 555aa5dd9ef..00000000000
--- a/src/egl/main/eglapi.h
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifndef EGLAPI_INCLUDED
-#define EGLAPI_INCLUDED
-
-/**
- * Typedefs for all EGL API entrypoint functions.
- */
-
-
-/* driver funcs */
-typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
-typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
-
-/* config funcs */
-typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-
-/* context funcs */
-typedef EGLContext (*CreateContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
-typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx);
-typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-
-/* surface funcs */
-typedef EGLSurface (*CreateWindowSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
-typedef EGLSurface (*CreatePixmapSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
-typedef EGLSurface (*CreatePbufferSurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
-typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
-typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
-typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
-
-/* misc funcs */
-typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
-typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
-typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
-
-
-#ifdef EGL_MESA_screen_surface
-typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
-typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
-typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-typedef EGLSurface (*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode);
-typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
-#endif /* EGL_MESA_screen_surface */
-
-
-#ifdef EGL_VERSION_1_2
-typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, EGLDisplay dpy);
-typedef EGLSurface (*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-#endif /* EGL_VERSION_1_2 */
-
-
-
-/**
- * The API dispatcher jumps through these functions
- */
-struct _egl_api
-{
- Initialize_t Initialize;
- Terminate_t Terminate;
-
- GetConfigs_t GetConfigs;
- ChooseConfig_t ChooseConfig;
- GetConfigAttrib_t GetConfigAttrib;
-
- CreateContext_t CreateContext;
- DestroyContext_t DestroyContext;
- MakeCurrent_t MakeCurrent;
- QueryContext_t QueryContext;
-
- CreateWindowSurface_t CreateWindowSurface;
- CreatePixmapSurface_t CreatePixmapSurface;
- CreatePbufferSurface_t CreatePbufferSurface;
- DestroySurface_t DestroySurface;
- QuerySurface_t QuerySurface;
- SurfaceAttrib_t SurfaceAttrib;
- BindTexImage_t BindTexImage;
- ReleaseTexImage_t ReleaseTexImage;
- SwapInterval_t SwapInterval;
- SwapBuffers_t SwapBuffers;
- CopyBuffers_t CopyBuffers;
-
- QueryString_t QueryString;
- WaitGL_t WaitGL;
- WaitNative_t WaitNative;
-
- /* EGL_MESA_screen extension */
- ChooseModeMESA_t ChooseModeMESA;
- GetModesMESA_t GetModesMESA;
- GetModeAttribMESA_t GetModeAttribMESA;
- CopyContextMESA_t CopyContextMESA;
- GetScreensMESA_t GetScreensMESA;
- CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
- ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
- ScreenPositionMESA_t ScreenPositionMESA;
- QueryScreenMESA_t QueryScreenMESA;
- QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
- QueryScreenModeMESA_t QueryScreenModeMESA;
- QueryModeStringMESA_t QueryModeStringMESA;
-
-#ifdef EGL_VERSION_1_2
- WaitClient_t WaitClient;
- CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
-#endif
-};
-
-#endif /* EGLAPI_INCLUDED */
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
deleted file mode 100644
index c180e30d7fa..00000000000
--- a/src/egl/main/eglconfig.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/**
- * EGL Configuration (pixel format) functions.
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "eglconfig.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "egllog.h"
-
-
-#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
-
-
-/**
- * Convert an _EGLConfig to a __GLcontextModes object.
- * NOTE: This routine may be incomplete - we're only making sure that
- * the fields needed by Mesa (for _mesa_create_context/framebuffer) are
- * set correctly.
- */
-void
-_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode)
-{
- memset(mode, 0, sizeof(*mode));
-
- mode->rgbMode = GL_TRUE; /* no color index */
- mode->colorIndexMode = GL_FALSE;
- mode->doubleBufferMode = GL_TRUE; /* always DB for now */
- mode->stereoMode = GL_FALSE;
-
- mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE);
- mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE);
- mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE);
- mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE);
- mode->rgbBits = GET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE);
-
- /* no rgba masks - fix? */
-
- mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE);
- mode->haveDepthBuffer = mode->depthBits > 0;
-
- mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE);
- mode->haveStencilBuffer = mode->stencilBits > 0;
-
- /* no accum */
-
- mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL);
- mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES);
- mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS);
-
- /* surface type - not really needed */
- mode->visualType = GLX_TRUE_COLOR;
- mode->renderType = GLX_RGBA_BIT;
-}
-
-
-void
-_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val)
-{
- assert(attr >= FIRST_ATTRIB);
- assert(attr < FIRST_ATTRIB + MAX_ATTRIBS);
- config->Attrib[attr - FIRST_ATTRIB] = val;
-}
-
-
-/**
- * Init the given _EGLconfig to default values.
- * \param id the configuration's ID.
- */
-void
-_eglInitConfig(_EGLConfig *config, EGLint id)
-{
- memset(config, 0, sizeof(*config));
- config->Handle = id;
- _eglSetConfigAttrib(config, EGL_CONFIG_ID, id);
- _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_CONFIG_CAVEAT, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_NATIVE_RENDERABLE, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_SURFACE_TYPE,
- EGL_SCREEN_BIT_MESA | EGL_PBUFFER_BIT |
- EGL_PIXMAP_BIT | EGL_WINDOW_BIT);
- _eglSetConfigAttrib(config, EGL_TRANSPARENT_TYPE, EGL_NONE);
- _eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE);
- _eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE);
-#ifdef EGL_VERSION_1_2
- _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
- _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
-#endif /* EGL_VERSION_1_2 */
-}
-
-
-/**
- * Given an EGLConfig handle, return the corresponding _EGLConfig object.
- */
-_EGLConfig *
-_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config)
-{
- EGLint i;
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- for (i = 0; i < disp->NumConfigs; i++) {
- if (disp->Configs[i].Handle == config) {
- return disp->Configs + i;
- }
- }
- return NULL;
-}
-
-
-/**
- * Add the given _EGLConfig to the given display.
- */
-_EGLConfig *
-_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config)
-{
- _EGLConfig *newConfigs;
- EGLint n;
-
- n = display->NumConfigs;
-
- newConfigs = (_EGLConfig *) realloc(display->Configs,
- (n + 1) * sizeof(_EGLConfig));
- if (newConfigs) {
- display->Configs = newConfigs;
- display->Configs[n] = *config; /* copy struct */
- display->Configs[n].Handle = n;
- display->NumConfigs++;
- return display->Configs + n;
- }
- else {
- return NULL;
- }
-}
-
-
-/**
- * Parse the attrib_list to fill in the fields of the given _eglConfig
- * Return EGL_FALSE if any errors, EGL_TRUE otherwise.
- */
-EGLBoolean
-_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
-{
- EGLint i;
-
- /* set all config attribs to EGL_DONT_CARE */
- for (i = 0; i < MAX_ATTRIBS; i++) {
- config->Attrib[i] = EGL_DONT_CARE;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- const EGLint attr = attrib_list[i];
- if (attr >= EGL_BUFFER_SIZE &&
- attr <= EGL_MAX_SWAP_INTERVAL) {
- EGLint k = attr - FIRST_ATTRIB;
- assert(k >= 0);
- assert(k < MAX_ATTRIBS);
- config->Attrib[k] = attrib_list[++i];
- }
-#ifdef EGL_VERSION_1_2
- else if (attr == EGL_COLOR_BUFFER_TYPE) {
- EGLint bufType = attrib_list[++i];
- if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
- return EGL_FALSE;
- }
- _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType);
- }
- else if (attr == EGL_RENDERABLE_TYPE) {
- EGLint renType = attrib_list[++i];
- if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT)) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
- return EGL_FALSE;
- }
- _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType);
- }
- else if (attr == EGL_ALPHA_MASK_SIZE ||
- attr == EGL_LUMINANCE_SIZE) {
- EGLint value = attrib_list[++i];
- _eglSetConfigAttrib(config, attr, value);
- }
-#endif /* EGL_VERSION_1_2 */
- else {
- _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
- return EGL_FALSE;
- }
- }
- return EGL_TRUE;
-}
-
-
-#define EXACT 1
-#define ATLEAST 2
-#define MASK 3
-#define SMALLER 4
-#define SPECIAL 5
-#define NONE 6
-
-struct sort_info {
- EGLint Attribute;
- EGLint MatchCriteria;
- EGLint SortOrder;
-};
-
-/* This encodes the info from Table 3.5 of the EGL spec, ordered by
- * Sort Priority.
- *
- * XXX To do: EGL 1.2 attribs
- */
-static struct sort_info SortInfo[] = {
- { EGL_CONFIG_CAVEAT, EXACT, SPECIAL },
- { EGL_RED_SIZE, ATLEAST, SPECIAL },
- { EGL_GREEN_SIZE, ATLEAST, SPECIAL },
- { EGL_BLUE_SIZE, ATLEAST, SPECIAL },
- { EGL_ALPHA_SIZE, ATLEAST, SPECIAL },
- { EGL_BUFFER_SIZE, ATLEAST, SMALLER },
- { EGL_SAMPLE_BUFFERS, ATLEAST, SMALLER },
- { EGL_SAMPLES, ATLEAST, SMALLER },
- { EGL_DEPTH_SIZE, ATLEAST, SMALLER },
- { EGL_STENCIL_SIZE, ATLEAST, SMALLER },
- { EGL_NATIVE_VISUAL_TYPE, EXACT, SPECIAL },
- { EGL_CONFIG_ID, EXACT, SMALLER },
- { EGL_BIND_TO_TEXTURE_RGB, EXACT, NONE },
- { EGL_BIND_TO_TEXTURE_RGBA, EXACT, NONE },
- { EGL_LEVEL, EXACT, NONE },
- { EGL_NATIVE_RENDERABLE, EXACT, NONE },
- { EGL_MAX_SWAP_INTERVAL, EXACT, NONE },
- { EGL_MIN_SWAP_INTERVAL, EXACT, NONE },
- { EGL_SURFACE_TYPE, MASK, NONE },
- { EGL_TRANSPARENT_TYPE, EXACT, NONE },
- { EGL_TRANSPARENT_RED_VALUE, EXACT, NONE },
- { EGL_TRANSPARENT_GREEN_VALUE, EXACT, NONE },
- { EGL_TRANSPARENT_BLUE_VALUE, EXACT, NONE },
- { 0, 0, 0 }
-};
-
-
-/**
- * Return EGL_TRUE if the attributes of c meet or exceed the minimums
- * specified by min.
- */
-static EGLBoolean
-_eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min)
-{
- EGLint i;
- for (i = 0; SortInfo[i].Attribute != 0; i++) {
- const EGLint mv = GET_CONFIG_ATTRIB(min, SortInfo[i].Attribute);
- if (mv != EGL_DONT_CARE) {
- const EGLint cv = GET_CONFIG_ATTRIB(c, SortInfo[i].Attribute);
- if (SortInfo[i].MatchCriteria == EXACT) {
- if (cv != mv) {
- return EGL_FALSE;
- }
- }
- else if (SortInfo[i].MatchCriteria == ATLEAST) {
- if (cv < mv) {
- return EGL_FALSE;
- }
- }
- else {
- assert(SortInfo[i].MatchCriteria == MASK);
- if ((mv & cv) != mv) {
- return EGL_FALSE;
- }
- }
- }
- }
- return EGL_TRUE;
-}
-
-
-/**
- * Compare configs 'a' and 'b' and return -1 if a belongs before b,
- * 1 if a belongs after b, or 0 if they're equal.
- * Used by qsort().
- */
-static int
-_eglCompareConfigs(const void *a, const void *b)
-{
- const _EGLConfig *aConfig = (const _EGLConfig *) a;
- const _EGLConfig *bConfig = (const _EGLConfig *) b;
- EGLint i;
-
- for (i = 0; SortInfo[i].Attribute != 0; i++) {
- const EGLint aVal = GET_CONFIG_ATTRIB(aConfig, SortInfo[i].Attribute);
- const EGLint bVal = GET_CONFIG_ATTRIB(bConfig, SortInfo[i].Attribute);
- if (SortInfo[i].SortOrder == SMALLER) {
- if (aVal < bVal)
- return -1;
- else if (aVal > bVal)
- return 1;
- /* else, continue examining attribute values */
- }
- else if (SortInfo[i].SortOrder == SPECIAL) {
- if (SortInfo[i].Attribute == EGL_CONFIG_CAVEAT) {
- /* values are EGL_NONE, SLOW_CONFIG, or NON_CONFORMANT_CONFIG */
- if (aVal < bVal)
- return -1;
- else if (aVal > bVal)
- return 1;
- }
- else if (SortInfo[i].Attribute == EGL_RED_SIZE ||
- SortInfo[i].Attribute == EGL_GREEN_SIZE ||
- SortInfo[i].Attribute == EGL_BLUE_SIZE ||
- SortInfo[i].Attribute == EGL_ALPHA_SIZE) {
- if (aVal > bVal)
- return -1;
- else if (aVal < bVal)
- return 1;
- }
- else {
- assert(SortInfo[i].Attribute == EGL_NATIVE_VISUAL_TYPE);
- if (aVal < bVal)
- return -1;
- else if (aVal > bVal)
- return 1;
- }
- }
- else {
- assert(SortInfo[i].SortOrder == NONE);
- /* continue examining attribute values */
- }
- }
-
- /* all attributes identical */
- return 0;
-}
-
-
-/**
- * Typical fallback routine for eglChooseConfig
- */
-EGLBoolean
-_eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size, EGLint *num_configs)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- _EGLConfig **configList, criteria;
- EGLint i, count;
-
- /* parse the attrib_list to initialize criteria */
- if (!_eglParseConfigAttribs(&criteria, attrib_list)) {
- return EGL_FALSE;
- }
-
- /* allocate array of config pointers */
- configList = (_EGLConfig **) malloc(config_size * sizeof(_EGLConfig *));
- if (!configList) {
- _eglError(EGL_BAD_CONFIG, "eglChooseConfig(out of memory)");
- return EGL_FALSE;
- }
-
- /* make array of pointers to qualifying configs */
- for (i = count = 0; i < disp->NumConfigs && count < config_size; i++) {
- if (_eglConfigQualifies(disp->Configs + i, &criteria)) {
- configList[count++] = disp->Configs + i;
- }
- }
-
- /* sort array of pointers */
- qsort(configList, count, sizeof(_EGLConfig *), _eglCompareConfigs);
-
- /* copy config handles to output array */
- for (i = 0; i < count; i++) {
- configs[i] = configList[i]->Handle;
- }
-
- free(configList);
-
- *num_configs = count;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Fallback for eglGetConfigAttrib.
- */
-EGLBoolean
-_eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value)
-{
- const _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
- const EGLint k = attribute - FIRST_ATTRIB;
- if (k >= 0 && k < MAX_ATTRIBS) {
- *value = conf->Attrib[k];
- return EGL_TRUE;
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib");
- return EGL_FALSE;
- }
-}
-
-
-/**
- * Fallback for eglGetConfigs.
- */
-EGLBoolean
-_eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs,
- EGLint config_size, EGLint *num_config)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
-
- if (!drv->Initialized) {
- _eglError(EGL_NOT_INITIALIZED, "eglGetConfigs");
- return EGL_FALSE;
- }
-
- if (configs) {
- EGLint i;
- *num_config = MIN2(disp->NumConfigs, config_size);
- for (i = 0; i < *num_config; i++) {
- configs[i] = disp->Configs[i].Handle;
- }
- }
- else {
- /* just return total number of supported configs */
- *num_config = disp->NumConfigs;
- }
-
- return EGL_TRUE;
-}
-
-
-/**
- * Creates a set of \c __GLcontextModes that a driver will expose.
- *
- * A set of \c __GLcontextModes will be created based on the supplied
- * parameters. The number of modes processed will be 2 *
- * \c num_depth_stencil_bits * \c num_db_modes.
- *
- * For the most part, data is just copied from \c depth_bits, \c stencil_bits,
- * \c db_modes, and \c visType into each \c __GLcontextModes element.
- * However, the meanings of \c fb_format and \c fb_type require further
- * explanation. The \c fb_format specifies which color components are in
- * each pixel and what the default order is. For example, \c GL_RGB specifies
- * that red, green, blue are available and red is in the "most significant"
- * position and blue is in the "least significant". The \c fb_type specifies
- * the bit sizes of each component and the actual ordering. For example, if
- * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11]
- * are the blue value, bits [10:5] are the green value, and bits [4:0] are
- * the red value.
- *
- * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
- * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
- * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
- * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
- * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
- * still uses 32-bits.
- *
- * If in doubt, look at the tables used in the function.
- *
- * \param ptr_to_modes Pointer to a pointer to a linked list of
- * \c __GLcontextModes. Upon completion, a pointer to
- * the next element to be process will be stored here.
- * If the function fails and returns \c GL_FALSE, this
- * value will be unmodified, but some elements in the
- * linked list may be modified.
- * \param fb_format Format of the framebuffer. Currently only \c GL_RGB,
- * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported.
- * \param fb_type Type of the pixels in the framebuffer. Currently only
- * \c GL_UNSIGNED_SHORT_5_6_5,
- * \c GL_UNSIGNED_SHORT_5_6_5_REV,
- * \c GL_UNSIGNED_INT_8_8_8_8, and
- * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported.
- * \param depth_bits Array of depth buffer sizes to be exposed.
- * \param stencil_bits Array of stencil buffer sizes to be exposed.
- * \param num_depth_stencil_bits Number of entries in both \c depth_bits and
- * \c stencil_bits.
- * \param db_modes Array of buffer swap modes. If an element has a
- * value of \c GLX_NONE, then it represents a
- * single-buffered mode. Other valid values are
- * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and
- * \c GLX_SWAP_UNDEFINED_OML. See the
- * GLX_OML_swap_method extension spec for more details.
- * \param num_db_modes Number of entries in \c db_modes.
- * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
- * \c GLX_DIRECT_COLOR.
- *
- * \returns
- * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only
- * cause of failure is a bad parameter (i.e., unsupported \c fb_format or
- * \c fb_type).
- *
- * \todo
- * There is currently no way to support packed RGB modes (i.e., modes with
- * exactly 3 bytes per pixel) or floating-point modes. This could probably
- * be done by creating some new, private enums with clever names likes
- * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,
- * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it.
- */
-GLboolean
-_eglFillInConfigs(_EGLConfig * configs,
- GLenum fb_format, GLenum fb_type,
- const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
- unsigned num_depth_stencil_bits,
- const GLenum * db_modes, unsigned num_db_modes,
- int visType)
-{
- static const u_int8_t bits_table[3][4] = {
- /* R G B A */
- { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
- { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
- { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
- };
-
- /* The following arrays are all indexed by the fb_type masked with 0x07.
- * Given the four supported fb_type values, this results in valid array
- * indices of 3, 4, 5, and 7.
- */
- static const u_int32_t masks_table_rgb[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
- {0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000} /* 8_8_8_8_REV */
- };
-
- static const u_int32_t masks_table_rgba[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
- {0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}, /* 8_8_8_8_REV */
- };
-
- static const u_int32_t masks_table_bgr[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
- {0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000}, /* 8_8_8_8_REV */
- };
-
- static const u_int32_t masks_table_bgra[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
- {0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}, /* 8_8_8_8_REV */
- };
-
- static const u_int8_t bytes_per_pixel[8] = {
- 0, 0, 0, 2, 2, 4, 0, 4
- };
-
- const u_int8_t * bits;
- const u_int32_t * masks;
- const int index = fb_type & 0x07;
- _EGLConfig *config;
- unsigned i;
- unsigned j;
- unsigned k;
-
- if ( bytes_per_pixel[index] == 0 ) {
- _eglLog(_EGL_INFO,
- "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
- __FUNCTION__, __LINE__, fb_type);
- return GL_FALSE;
- }
-
- /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and
- * the _REV versions.
- *
- * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA.
- */
- switch ( fb_format ) {
- case GL_RGB:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
- masks = masks_table_rgb[index];
- break;
-
- case GL_RGBA:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
- masks = masks_table_rgba[index];
- break;
-
- case GL_BGR:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
- masks = masks_table_bgr[index];
- break;
-
- case GL_BGRA:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
- masks = masks_table_bgra[index];
- break;
-
- default:
- _eglLog(_EGL_WARNING,
- "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
- __FUNCTION__, __LINE__, fb_format);
- return GL_FALSE;
- }
-
- config = configs;
- for (k = 0; k < num_depth_stencil_bits; k++) {
- for (i = 0; i < num_db_modes; i++) {
- for (j = 0; j < 2; j++) {
- _eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]);
- _eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]);
- _eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]);
- _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]);
- _eglSetConfigAttrib(config, EGL_BUFFER_SIZE,
- bits[0] + bits[1] + bits[2] + bits[3]);
-
- _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]);
- _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]);
-
- _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA |
- EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT);
-
- config++;
- }
- }
- }
- return GL_TRUE;
-}
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
deleted file mode 100644
index 1fb976e5b4b..00000000000
--- a/src/egl/main/eglconfig.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef EGLCONFIG_INCLUDED
-#define EGLCONFIG_INCLUDED
-
-
-#include "egltypedefs.h"
-#include "GL/internal/glcore.h"
-
-
-#define MAX_ATTRIBS 100
-#define FIRST_ATTRIB EGL_BUFFER_SIZE
-
-
-struct _egl_config
-{
- EGLConfig Handle; /* the public/opaque handle which names this config */
- EGLint Attrib[MAX_ATTRIBS];
-};
-
-
-#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB] = VAL)
-#define GET_CONFIG_ATTRIB(CONF, ATTR) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB])
-
-
-extern void
-_eglInitConfig(_EGLConfig *config, EGLint id);
-
-
-extern _EGLConfig *
-_eglLookupConfig(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config);
-
-
-extern _EGLConfig *
-_eglAddConfig(_EGLDisplay *display, const _EGLConfig *config);
-
-
-extern EGLBoolean
-_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list);
-
-
-extern EGLBoolean
-_eglChooseConfig(_EGLDriver *drv, EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-
-
-extern EGLBoolean
-_eglGetConfigAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-
-
-extern EGLBoolean
-_eglGetConfigs(_EGLDriver *drv, EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-
-
-extern void
-_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val);
-
-extern GLboolean
-_eglFillInConfigs( _EGLConfig *configs,
- GLenum fb_format, GLenum fb_type,
- const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
- unsigned num_depth_stencil_bits,
- const GLenum * db_modes, unsigned num_db_modes,
- int visType );
-
-extern void
-_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode);
-
-
-#endif /* EGLCONFIG_INCLUDED */
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
deleted file mode 100644
index 374c006dae7..00000000000
--- a/src/egl/main/eglcontext.c
+++ /dev/null
@@ -1,276 +0,0 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglhash.h"
-#include "eglsurface.h"
-
-
-/**
- * Initialize the given _EGLContext object to defaults.
- */
-EGLBoolean
-_eglInitContext(_EGLDriver *drv, EGLDisplay dpy, _EGLContext *ctx,
- EGLConfig config, const EGLint *attrib_list)
-{
- _EGLConfig *conf;
- _EGLDisplay *display = _eglLookupDisplay(dpy);
- EGLint i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreateContext");
- return EGL_FALSE;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs defined for now */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
- }
-
- memset(ctx, 0, sizeof(_EGLContext));
- ctx->Display = display;
- ctx->Config = conf;
- ctx->DrawSurface = EGL_NO_SURFACE;
- ctx->ReadSurface = EGL_NO_SURFACE;
-
- return EGL_TRUE;
-}
-
-
-/*
- * Assign an EGLContext handle to the _EGLContext object then put it into
- * the hash table.
- */
-void
-_eglSaveContext(_EGLContext *ctx)
-{
- assert(ctx);
- ctx->Handle = _eglHashGenKey(_eglGlobal.Contexts);
- _eglHashInsert(_eglGlobal.Contexts, ctx->Handle, ctx);
-}
-
-
-/**
- * Remove the given _EGLContext object from the hash table.
- */
-void
-_eglRemoveContext(_EGLContext *ctx)
-{
- _eglHashRemove(_eglGlobal.Contexts, ctx->Handle);
-}
-
-
-/**
- * Return the _EGLContext object that corresponds to the given
- * EGLContext handle.
- */
-_EGLContext *
-_eglLookupContext(EGLContext ctx)
-{
- _EGLContext *c = (_EGLContext *) _eglHashLookup(_eglGlobal.Contexts, ctx);
- return c;
-}
-
-
-/**
- * Return the currently bound _EGLContext object, or NULL.
- */
-_EGLContext *
-_eglGetCurrentContext(void)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- return t->CurrentContext;
-}
-
-
-/**
- * Just a placeholder/demo function. Real driver will never use this!
- */
-EGLContext
-_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- EGLContext share_list, const EGLint *attrib_list)
-{
-#if 0 /* example code */
- _EGLContext *context;
-
- context = (_EGLContext *) calloc(1, sizeof(_EGLContext));
- if (!context)
- return EGL_NO_CONTEXT;
-
- if (!_eglInitContext(drv, dpy, context, config, attrib_list)) {
- free(context);
- return EGL_NO_CONTEXT;
- }
-
- _eglSaveContext(context);
- return context->Handle;
-#endif
- return EGL_NO_CONTEXT;
-}
-
-
-/**
- * Default fallback routine - drivers should usually override this.
- */
-EGLBoolean
-_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
-{
- _EGLContext *context = _eglLookupContext(ctx);
- if (context) {
- _eglHashRemove(_eglGlobal.Contexts, ctx);
- if (context->IsBound) {
- context->DeletePending = EGL_TRUE;
- }
- else {
- free(context);
- }
- return EGL_TRUE;
- }
- else {
- _eglError(EGL_BAD_CONTEXT, "eglDestroyContext");
- return EGL_TRUE;
- }
-}
-
-
-EGLBoolean
-_eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value)
-{
- _EGLContext *c = _eglLookupContext(ctx);
-
- (void) drv;
- (void) dpy;
-
- if (!c) {
- _eglError(EGL_BAD_CONTEXT, "eglQueryContext");
- return EGL_FALSE;
- }
-
- switch (attribute) {
- case EGL_CONFIG_ID:
- *value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
- return EGL_TRUE;
-#ifdef EGL_VERSION_1_2
- case EGL_CONTEXT_CLIENT_TYPE:
- *value = c->ClientAPI;
- return EGL_FALSE;
-#endif /* EGL_VERSION_1_2 */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
- return EGL_FALSE;
- }
-}
-
-
-/**
- * Drivers will typically call this to do the error checking and
- * update the various IsBound and DeletePending flags.
- * Then, the driver will do its device-dependent Make-Current stuff.
- */
-EGLBoolean
-_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface d,
- EGLSurface r, EGLContext context)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- _EGLContext *ctx = _eglLookupContext(context);
- _EGLSurface *draw = _eglLookupSurface(d);
- _EGLSurface *read = _eglLookupSurface(r);
-
- _EGLContext *oldContext = _eglGetCurrentContext();
- _EGLSurface *oldDrawSurface = _eglGetCurrentSurface(EGL_DRAW);
- _EGLSurface *oldReadSurface = _eglGetCurrentSurface(EGL_READ);
-
- /* error checking */
- if (ctx) {
- if (draw == NULL || read == NULL) {
- _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- return EGL_FALSE;
- }
- if (draw->Config != ctx->Config) {
- _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- return EGL_FALSE;
- }
- if (read->Config != ctx->Config) {
- _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- return EGL_FALSE;
- }
- }
-
- /*
- * check if the old context or surfaces need to be deleted
- */
- if (oldDrawSurface != NULL) {
- oldDrawSurface->IsBound = EGL_FALSE;
- if (oldDrawSurface->DeletePending) {
- /* make sure we don't try to rebind a deleted surface */
- if (draw == oldDrawSurface || draw == oldReadSurface) {
- draw = NULL;
- }
- /* really delete surface now */
- drv->API.DestroySurface(drv, dpy, oldDrawSurface->Handle);
- }
- }
- if (oldReadSurface != NULL && oldReadSurface != oldDrawSurface) {
- oldReadSurface->IsBound = EGL_FALSE;
- if (oldReadSurface->DeletePending) {
- /* make sure we don't try to rebind a deleted surface */
- if (read == oldDrawSurface || read == oldReadSurface) {
- read = NULL;
- }
- /* really delete surface now */
- drv->API.DestroySurface(drv, dpy, oldReadSurface->Handle);
- }
- }
- if (oldContext != NULL) {
- oldContext->IsBound = EGL_FALSE;
- if (oldContext->DeletePending) {
- /* make sure we don't try to rebind a deleted context */
- if (ctx == oldContext) {
- ctx = NULL;
- }
- /* really delete context now */
- drv->API.DestroyContext(drv, dpy, oldContext->Handle);
- }
- }
-
- if (ctx) {
- /* check read/draw again, in case we deleted them above */
- if (draw == NULL || read == NULL) {
- _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- return EGL_FALSE;
- }
- ctx->DrawSurface = draw;
- ctx->ReadSurface = read;
- ctx->IsBound = EGL_TRUE;
- draw->IsBound = EGL_TRUE;
- read->IsBound = EGL_TRUE;
- }
-
- t->CurrentContext = ctx;
-
- return EGL_TRUE;
-}
-
-
-/**
- * This is defined by the EGL_MESA_copy_context extension.
- */
-EGLBoolean
-_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source,
- EGLContext dest, EGLint mask)
-{
- /* This function will always have to be overridden/implemented in the
- * device driver. If the driver is based on Mesa, use _mesa_copy_context().
- */
- return EGL_FALSE;
-}
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
deleted file mode 100644
index 82bfde151f3..00000000000
--- a/src/egl/main/eglcontext.h
+++ /dev/null
@@ -1,71 +0,0 @@
-
-#ifndef EGLCONTEXT_INCLUDED
-#define EGLCONTEXT_INCLUDED
-
-
-#include "egltypedefs.h"
-
-
-/**
- * "Base" class for device driver contexts.
- */
-struct _egl_context
-{
- EGLContext Handle; /* The public/opaque handle which names this object */
-
- _EGLDisplay *Display; /* who do I belong to? */
-
- _EGLConfig *Config;
-
- _EGLSurface *DrawSurface;
- _EGLSurface *ReadSurface;
-
- EGLBoolean IsBound;
- EGLBoolean DeletePending;
-#ifdef EGL_VERSION_1_2
- EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */
-#endif /* EGL_VERSION_1_2 */
-};
-
-
-extern EGLBoolean
-_eglInitContext(_EGLDriver *drv, EGLDisplay dpy, _EGLContext *ctx,
- EGLConfig config, const EGLint *attrib_list);
-
-
-extern void
-_eglSaveContext(_EGLContext *ctx);
-
-
-extern void
-_eglRemoveContext(_EGLContext *ctx);
-
-
-extern _EGLContext *
-_eglLookupContext(EGLContext ctx);
-
-
-extern _EGLContext *
-_eglGetCurrentContext(void);
-
-
-extern EGLContext
-_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
-
-
-extern EGLBoolean
-_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx);
-
-
-extern EGLBoolean
-_eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-
-
-extern EGLBoolean
-_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-
-
-extern EGLBoolean
-_eglCopyContextMESA(_EGLDriver *drv, EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
-
-#endif /* EGLCONTEXT_INCLUDED */
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
deleted file mode 100644
index 074a85bf26b..00000000000
--- a/src/egl/main/egldisplay.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "eglglobals.h"
-#include "eglhash.h"
-
-
-static char *
-my_strdup(const char *s)
-{
- int l = strlen(s);
- char *s2 = malloc(l + 1);
- strcpy(s2, s);
- return s2;
-}
-
-
-/**
- * We're assuming that the NativeDisplayType parameter is actually
- * a string.
- * Return a new _EGLDisplay object for the given displayName
- */
-_EGLDisplay *
-_eglNewDisplay(NativeDisplayType displayName)
-{
- _EGLDisplay *dpy = (_EGLDisplay *) calloc(1, sizeof(_EGLDisplay));
- if (dpy) {
- dpy->Handle = _eglHashGenKey(_eglGlobal.Displays);
- _eglHashInsert(_eglGlobal.Displays, dpy->Handle, dpy);
- if (displayName)
- dpy->Name = my_strdup(displayName);
- else
- dpy->Name = NULL;
- dpy->Driver = NULL; /* this gets set later */
- }
- return dpy;
-}
-
-
-/**
- * Return the _EGLDisplay object that corresponds to the given public/
- * opaque display handle.
- */
-_EGLDisplay *
-_eglLookupDisplay(EGLDisplay dpy)
-{
- _EGLDisplay *d = (_EGLDisplay *) _eglHashLookup(_eglGlobal.Displays, dpy);
- return d;
-}
-
-
-_EGLDisplay *
-_eglGetCurrentDisplay(void)
-{
- _EGLContext *ctx = _eglGetCurrentContext();
- if (ctx)
- return ctx->Display;
- else
- return NULL;
-}
-
-
-void
-_eglCleanupDisplay(_EGLDisplay *disp)
-{
- /* XXX incomplete */
- free(disp->Configs);
- free(disp->Name);
- /* driver deletes _EGLDisplay */
-}
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
deleted file mode 100644
index 1a03fdd4ad9..00000000000
--- a/src/egl/main/egldisplay.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef EGLDISPLAY_INCLUDED
-#define EGLDISPLAY_INCLUDED
-
-
-#include "egltypedefs.h"
-
-
-struct _egl_display
-{
- EGLDisplay Handle;
-
- char *Name;
- _EGLDriver *Driver;
-
- EGLint NumScreens;
- _EGLScreen **Screens; /* array [NumScreens] */
-
- EGLint NumConfigs;
- _EGLConfig *Configs; /* array [NumConfigs] */
-};
-
-
-extern _EGLDisplay *
-_eglNewDisplay(NativeDisplayType displayName);
-
-
-extern _EGLDisplay *
-_eglLookupDisplay(EGLDisplay dpy);
-
-
-extern _EGLDisplay *
-_eglGetCurrentDisplay(void);
-
-
-extern void
-_eglCleanupDisplay(_EGLDisplay *disp);
-
-
-extern EGLBoolean
-_eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attrib, EGLint *value);
-
-
-
-#endif /* EGLDISPLAY_INCLUDED */
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
deleted file mode 100644
index bda06dd827d..00000000000
--- a/src/egl/main/egldriver.c
+++ /dev/null
@@ -1,272 +0,0 @@
-#include <assert.h>
-#include <dlfcn.h>
-#include <stdio.h>
-#include <string.h>
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "egllog.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-
-
-const char *DefaultDriverName = "demodriver";
-
-
-/**
- * Choose and open/init the hardware driver for the given EGLDisplay.
- * Previously, the EGLDisplay was created with _eglNewDisplay() where
- * we recorded the user's NativeDisplayType parameter.
- *
- * Now we'll use the NativeDisplayType value.
- *
- * Currently, the native display value is treated as a string.
- * If the first character is ':' we interpret it as a screen or card index
- * number (i.e. ":0" or ":1", etc)
- * Else if the first character is '!' we interpret it as specific driver name
- * (i.e. "!r200" or "!i830".
- */
-_EGLDriver *
-_eglChooseDriver(EGLDisplay display)
-{
- _EGLDisplay *dpy = _eglLookupDisplay(display);
- _EGLDriver *drv;
- const char *driverName = DefaultDriverName;
- const char *name;
-
- assert(dpy);
-
- name = dpy->Name;
- if (!name) {
- /* use default */
- }
- else if (name[0] == ':' && (name[1] >= '0' && name[1] <= '9') && !name[2]) {
- /* XXX probe hardware here to determine which driver to open */
- driverName = "libEGLdri";
- }
- else if (name[0] == '!') {
- /* use specified driver name */
- driverName = name + 1;
- }
- else {
- /* Maybe display was returned by XOpenDisplay? */
- _eglLog(_EGL_FATAL, "eglChooseDriver() bad name");
- }
-
- _eglLog(_EGL_INFO, "eglChooseDriver() choosing %s", driverName);
-
- drv = _eglOpenDriver(dpy, driverName);
- dpy->Driver = drv;
-
- return drv;
-}
-
-
-/**
- * Open/load the named driver and call its bootstrap function: _eglMain().
- * \return new _EGLDriver object.
- */
-_EGLDriver *
-_eglOpenDriver(_EGLDisplay *dpy, const char *driverName)
-{
- _EGLDriver *drv;
- _EGLMain_t mainFunc;
- void *lib;
- char driverFilename[1000];
-
- /* XXX also prepend a directory path??? */
- sprintf(driverFilename, "%s.so", driverName);
-
- _eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename);
- lib = dlopen(driverFilename, RTLD_NOW);
- if (!lib) {
- _eglLog(_EGL_WARNING, "Could not open %s (%s)",
- driverFilename, dlerror());
- return NULL;
- }
-
- mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
- if (!mainFunc) {
- _eglLog(_EGL_WARNING, "_eglMain not found in %s", driverFilename);
- dlclose(lib);
- return NULL;
- }
-
- drv = mainFunc(dpy);
- if (!drv) {
- dlclose(lib);
- return NULL;
- }
- /* with a recurvise open you want the inner most handle */
- if (!drv->LibHandle)
- drv->LibHandle = lib;
- else
- dlclose(lib);
-
- drv->Display = dpy;
- return drv;
-}
-
-
-EGLBoolean
-_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
-{
- void *handle = drv->LibHandle;
- EGLBoolean b;
-
- _eglLog(_EGL_INFO, "Closing driver");
-
- /*
- * XXX check for currently bound context/surfaces and delete them?
- */
-
- b = drv->API.Terminate(drv, dpy);
- dlclose(handle);
- return b;
-}
-
-
-/**
- * Given a display handle, return the _EGLDriver for that display.
- */
-_EGLDriver *
-_eglLookupDriver(EGLDisplay dpy)
-{
- _EGLDisplay *d = _eglLookupDisplay(dpy);
- if (d)
- return d->Driver;
- else
- return NULL;
-}
-
-
-/**
- * Plug all the available fallback routines into the given driver's
- * dispatch table.
- */
-void
-_eglInitDriverFallbacks(_EGLDriver *drv)
-{
- /* If a pointer is set to NULL, then the device driver _really_ has
- * to implement it.
- */
- drv->API.Initialize = NULL;
- drv->API.Terminate = NULL;
-
- drv->API.GetConfigs = _eglGetConfigs;
- drv->API.ChooseConfig = _eglChooseConfig;
- drv->API.GetConfigAttrib = _eglGetConfigAttrib;
-
- drv->API.CreateContext = _eglCreateContext;
- drv->API.DestroyContext = _eglDestroyContext;
- drv->API.MakeCurrent = _eglMakeCurrent;
- drv->API.QueryContext = _eglQueryContext;
-
- drv->API.CreateWindowSurface = _eglCreateWindowSurface;
- drv->API.CreatePixmapSurface = _eglCreatePixmapSurface;
- drv->API.CreatePbufferSurface = _eglCreatePbufferSurface;
- drv->API.DestroySurface = _eglDestroySurface;
- drv->API.QuerySurface = _eglQuerySurface;
- drv->API.SurfaceAttrib = _eglSurfaceAttrib;
- drv->API.BindTexImage = _eglBindTexImage;
- drv->API.ReleaseTexImage = _eglReleaseTexImage;
- drv->API.SwapInterval = _eglSwapInterval;
- drv->API.SwapBuffers = _eglSwapBuffers;
- drv->API.CopyBuffers = _eglCopyBuffers;
-
- drv->API.QueryString = _eglQueryString;
- drv->API.WaitGL = _eglWaitGL;
- drv->API.WaitNative = _eglWaitNative;
-
-#ifdef EGL_MESA_screen_surface
- drv->API.ChooseModeMESA = _eglChooseModeMESA;
- drv->API.GetModesMESA = _eglGetModesMESA;
- drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
- drv->API.GetScreensMESA = _eglGetScreensMESA;
- drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
- drv->API.ShowScreenSurfaceMESA = _eglShowScreenSurfaceMESA;
- drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
- drv->API.QueryScreenMESA = _eglQueryScreenMESA;
- drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
- drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
- drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
-#endif /* EGL_MESA_screen_surface */
-
-#ifdef EGL_VERSION_1_2
- drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
-#endif /* EGL_VERSION_1_2 */
-}
-
-
-/**
- * Examine the individual extension enable/disable flags and recompute
- * the driver's Extensions string.
- */
-static void
-_eglUpdateExtensionsString(_EGLDriver *drv)
-{
- drv->Extensions.String[0] = 0;
-
- if (drv->Extensions.MESA_screen_surface)
- strcat(drv->Extensions.String, "EGL_MESA_screen_surface ");
- if (drv->Extensions.MESA_copy_context)
- strcat(drv->Extensions.String, "EGL_MESA_copy_context ");
- assert(strlen(drv->Extensions.String) < MAX_EXTENSIONS_LEN);
-}
-
-
-
-const char *
-_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
-{
- (void) drv;
- (void) dpy;
- switch (name) {
- case EGL_VENDOR:
- return "Mesa Project";
- case EGL_VERSION:
- return "1.0";
- case EGL_EXTENSIONS:
- _eglUpdateExtensionsString(drv);
- return drv->Extensions.String;
-#ifdef EGL_VERSION_1_2
- case EGL_CLIENT_APIS:
- /* XXX need to initialize somewhere */
- return drv->ClientAPIs;
-#endif
- default:
- _eglError(EGL_BAD_PARAMETER, "eglQueryString");
- return NULL;
- }
-}
-
-
-EGLBoolean
-_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy)
-{
- /* just a placeholder */
- (void) drv;
- (void) dpy;
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
-{
- /* just a placeholder */
- (void) drv;
- (void) dpy;
- switch (engine) {
- case EGL_CORE_NATIVE_ENGINE:
- break;
- default:
- _eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
deleted file mode 100644
index 88526e973d1..00000000000
--- a/src/egl/main/egldriver.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef EGLDRIVER_INCLUDED
-#define EGLDRIVER_INCLUDED
-
-
-#include "egltypedefs.h"
-#include "eglapi.h"
-
-/* should probably use a dynamic-length string, but this will do */
-#define MAX_EXTENSIONS_LEN 1000
-
-
-/**
- * Optional EGL extensions info.
- */
-struct _egl_extensions
-{
- EGLBoolean MESA_screen_surface;
- EGLBoolean MESA_copy_context;
-
- char String[MAX_EXTENSIONS_LEN];
-};
-
-
-/**
- * Base class for device drivers.
- */
-struct _egl_driver
-{
- EGLBoolean Initialized; /* set by driver after initialized */
-
- void *LibHandle; /* dlopen handle */
-
- _EGLDisplay *Display;
-
- int ABIversion;
- int APImajor, APIminor; /* returned through eglInitialize */
- const char *ClientAPIs;
-
- _EGLAPI API;
-
- _EGLExtensions Extensions;
-};
-
-
-extern _EGLDriver *_eglMain(_EGLDisplay *dpy);
-
-
-extern _EGLDriver *
-_eglChooseDriver(EGLDisplay dpy);
-
-
-extern _EGLDriver *
-_eglOpenDriver(_EGLDisplay *dpy, const char *driverName);
-
-
-extern EGLBoolean
-_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy);
-
-
-extern _EGLDriver *
-_eglLookupDriver(EGLDisplay d);
-
-
-extern void
-_eglInitDriverFallbacks(_EGLDriver *drv);
-
-
-extern const char *
-_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name);
-
-
-extern EGLBoolean
-_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy);
-
-
-extern EGLBoolean
-_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
-
-
-
-#endif /* EGLDRIVER_INCLUDED */
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
deleted file mode 100644
index 608311d7494..00000000000
--- a/src/egl/main/eglglobals.c
+++ /dev/null
@@ -1,148 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "eglglobals.h"
-
-
-struct _egl_global _eglGlobal = { .Initialized = EGL_FALSE };
-
-
-/**
- * Init the fields in the _eglGlobal struct
- * May be safely called more than once.
- */
-void
-_eglInitGlobals(void)
-{
- if (!_eglGlobal.Initialized) {
- _eglGlobal.Displays = _eglNewHashTable();
- _eglGlobal.Contexts = _eglNewHashTable();
- _eglGlobal.Surfaces = _eglNewHashTable();
- _eglGlobal.FreeScreenHandle = 1;
- _eglGlobal.Initialized = EGL_TRUE;
-
- _eglGlobal.OpenGLESAPISupported = EGL_TRUE;
- _eglGlobal.OpenVGAPISupported = EGL_FALSE;
-
- /* XXX temporary */
- _eglGlobal.ThreadInfo = _eglNewThreadInfo();
- }
-}
-
-
-/**
- * Should call this via an atexit handler.
- */
-void
-_eglDestroyGlobals(void)
-{
- /* XXX TODO walk over table entries, deleting each */
- _eglDeleteHashTable(_eglGlobal.Displays);
- _eglDeleteHashTable(_eglGlobal.Contexts);
- _eglDeleteHashTable(_eglGlobal.Surfaces);
-}
-
-
-/**
- * Allocate and init a new _EGLThreadInfo object.
- */
-_EGLThreadInfo *
-_eglNewThreadInfo(void)
-{
- _EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo));
- if (t) {
- t->CurrentContext = EGL_NO_CONTEXT;
- t->LastError = EGL_SUCCESS;
- t->CurrentAPI = EGL_NONE;
- }
- return t;
-}
-
-
-/**
- * Delete/free a _EGLThreadInfo object.
- */
-void
-_eglDeleteThreadData(_EGLThreadInfo *t)
-{
- free(t);
-}
-
-
-
-/**
- * Return pointer to calling thread's _EGLThreadInfo object.
- * Create a new one if needed.
- * Should never return NULL.
- */
-_EGLThreadInfo *
-_eglGetCurrentThread(void)
-{
- _eglInitGlobals();
-
- /* XXX temporary */
- return _eglGlobal.ThreadInfo;
-}
-
-
-/**
- * Record EGL error code.
- */
-void
-_eglError(EGLint errCode, const char *msg)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- const char *s;
-
- if (t->LastError == EGL_SUCCESS) {
- t->LastError = errCode;
-
- switch (errCode) {
- case EGL_BAD_ACCESS:
- s = "EGL_BAD_ACCESS";
- break;
- case EGL_BAD_ALLOC:
- s = "EGL_BAD_ALLOC";
- break;
- case EGL_BAD_ATTRIBUTE:
- s = "EGL_BAD_ATTRIBUTE";
- break;
- case EGL_BAD_CONFIG:
- s = "EGL_BAD_CONFIG";
- break;
- case EGL_BAD_CONTEXT:
- s = "EGL_BAD_CONTEXT";
- break;
- case EGL_BAD_CURRENT_SURFACE:
- s = "EGL_BAD_CURRENT_SURFACE";
- break;
- case EGL_BAD_DISPLAY:
- s = "EGL_BAD_DISPLAY";
- break;
- case EGL_BAD_MATCH:
- s = "EGL_BAD_MATCH";
- break;
- case EGL_BAD_NATIVE_PIXMAP:
- s = "EGL_BAD_NATIVE_PIXMAP";
- break;
- case EGL_BAD_NATIVE_WINDOW:
- s = "EGL_BAD_NATIVE_WINDOW";
- break;
- case EGL_BAD_PARAMETER:
- s = "EGL_BAD_PARAMETER";
- break;
- case EGL_BAD_SURFACE:
- s = "EGL_BAD_SURFACE";
- break;
- case EGL_BAD_SCREEN_MESA:
- s = "EGL_BAD_SCREEN_MESA";
- break;
- case EGL_BAD_MODE_MESA:
- s = "EGL_BAD_MODE_MESA";
- break;
- default:
- s = "other";
- }
- /* XXX temporary */
- fprintf(stderr, "EGL user error 0x%x (%s) in %s\n", errCode, s, msg);
- }
-}
diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h
deleted file mode 100644
index c16baa2d6bd..00000000000
--- a/src/egl/main/eglglobals.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef EGLGLOBALS_INCLUDED
-#define EGLGLOBALS_INCLUDED
-
-#include "egltypedefs.h"
-#include "eglhash.h"
-
-
-/**
- * Per-thread info
- */
-struct _egl_thread_info
-{
- EGLint LastError;
- _EGLContext *CurrentContext;
- EGLenum CurrentAPI;
-};
-
-
-/**
- * Global library data
- */
-struct _egl_global
-{
- EGLBoolean Initialized;
-
- _EGLHashtable *Displays;
- _EGLHashtable *Contexts;
- _EGLHashtable *Surfaces;
-
- EGLScreenMESA FreeScreenHandle;
-
- /* XXX these may be temporary */
- EGLBoolean OpenGLESAPISupported;
- EGLBoolean OpenVGAPISupported;
-
- /* XXX temporary - should be thread-specific data (TSD) */
- _EGLThreadInfo *ThreadInfo;
-};
-
-
-extern struct _egl_global _eglGlobal;
-
-
-extern void
-_eglInitGlobals(void);
-
-
-extern void
-_eglDestroyGlobals(void);
-
-
-extern _EGLThreadInfo *
-_eglNewThreadInfo(void);
-
-
-extern void
-_eglDeleteThreadData(_EGLThreadInfo *t);
-
-
-extern _EGLThreadInfo *
-_eglGetCurrentThread(void);
-
-
-extern void
-_eglError(EGLint errCode, const char *msg);
-
-
-#endif /* EGLGLOBALS_INCLUDED */
diff --git a/src/egl/main/eglhash.c b/src/egl/main/eglhash.c
deleted file mode 100644
index 8e3da2e9061..00000000000
--- a/src/egl/main/eglhash.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/**
- * \file hash.c
- * Generic hash table.
- *
- * This code taken from Mesa and adapted.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "eglhash.h"
-
-
-#define TABLE_SIZE 1023 /**< Size of lookup table/array */
-
-#define HASH_FUNC(K) ((K) % TABLE_SIZE)
-
-
-/*
- * Unfinished mutex stuff
- */
-
-typedef int _EGLMutex;
-
-static void
-_eglInitMutex(_EGLMutex m)
-{
-}
-
-static void
-_eglDestroyMutex(_EGLMutex m)
-{
-}
-
-static void
-_eglLockMutex(_EGLMutex m)
-{
-}
-
-static void
-_eglUnlockMutex(_EGLMutex m)
-{
-}
-
-
-
-typedef struct _egl_hashentry _EGLHashentry;
-
-struct _egl_hashentry
-{
- EGLuint Key; /**< the entry's key */
- void *Data; /**< the entry's data */
- _EGLHashentry *Next; /**< pointer to next entry */
-};
-
-
-struct _egl_hashtable
-{
- _EGLHashentry *Table[TABLE_SIZE]; /**< the lookup table */
- EGLuint MaxKey; /**< highest key inserted so far */
- _EGLMutex Mutex; /**< mutual exclusion lock */
-};
-
-
-/**
- * Create a new hash table.
- *
- * \return pointer to a new, empty hash table.
- */
-_EGLHashtable *
-_eglNewHashTable(void)
-{
- _EGLHashtable *table = (_EGLHashtable *) calloc(1, sizeof(_EGLHashtable));
- if (table) {
- _eglInitMutex(table->Mutex);
- table->MaxKey = 1;
- }
- return table;
-}
-
-
-
-/**
- * Delete a hash table.
- * Frees each entry on the hash table and then the hash table structure itself.
- * Note that the caller should have already traversed the table and deleted
- * the objects in the table (i.e. We don't free the entries' data pointer).
- *
- * \param table the hash table to delete.
- */
-void
-_eglDeleteHashTable(_EGLHashtable *table)
-{
- EGLuint i;
- assert(table);
- for (i = 0; i < TABLE_SIZE; i++) {
- _EGLHashentry *entry = table->Table[i];
- while (entry) {
- _EGLHashentry *next = entry->Next;
- free(entry);
- entry = next;
- }
- }
- _eglDestroyMutex(table->Mutex);
- free(table);
-}
-
-
-
-/**
- * Lookup an entry in the hash table.
- *
- * \param table the hash table.
- * \param key the key.
- *
- * \return pointer to user's data or NULL if key not in table
- */
-void *
-_eglHashLookup(const _EGLHashtable *table, EGLuint key)
-{
- EGLuint pos;
- const _EGLHashentry *entry;
-
- assert(table);
-
- if (!key)
- return NULL;
-
- pos = HASH_FUNC(key);
- entry = table->Table[pos];
- while (entry) {
- if (entry->Key == key) {
- return entry->Data;
- }
- entry = entry->Next;
- }
- return NULL;
-}
-
-
-
-/**
- * Insert a key/pointer pair into the hash table.
- * If an entry with this key already exists we'll replace the existing entry.
- *
- * \param table the hash table.
- * \param key the key (not zero).
- * \param data pointer to user data.
- */
-void
-_eglHashInsert(_EGLHashtable *table, EGLuint key, void *data)
-{
- /* search for existing entry with this key */
- EGLuint pos;
- _EGLHashentry *entry;
-
- assert(table);
- assert(key);
-
- _eglLockMutex(table->Mutex);
-
- if (key > table->MaxKey)
- table->MaxKey = key;
-
- pos = HASH_FUNC(key);
- entry = table->Table[pos];
- while (entry) {
- if (entry->Key == key) {
- /* replace entry's data */
- entry->Data = data;
- _eglUnlockMutex(table->Mutex);
- return;
- }
- entry = entry->Next;
- }
-
- /* alloc and insert new table entry */
- entry = (_EGLHashentry *) malloc(sizeof(_EGLHashentry));
- entry->Key = key;
- entry->Data = data;
- entry->Next = table->Table[pos];
- table->Table[pos] = entry;
-
- _eglUnlockMutex(table->Mutex);
-}
-
-
-
-/**
- * Remove an entry from the hash table.
- *
- * \param table the hash table.
- * \param key key of entry to remove.
- *
- * While holding the hash table's lock, searches the entry with the matching
- * key and unlinks it.
- */
-void
-_eglHashRemove(_EGLHashtable *table, EGLuint key)
-{
- EGLuint pos;
- _EGLHashentry *entry, *prev;
-
- assert(table);
- assert(key);
-
- _eglLockMutex(table->Mutex);
-
- pos = HASH_FUNC(key);
- prev = NULL;
- entry = table->Table[pos];
- while (entry) {
- if (entry->Key == key) {
- /* found it! */
- if (prev) {
- prev->Next = entry->Next;
- }
- else {
- table->Table[pos] = entry->Next;
- }
- free(entry);
- _eglUnlockMutex(table->Mutex);
- return;
- }
- prev = entry;
- entry = entry->Next;
- }
-
- _eglUnlockMutex(table->Mutex);
-}
-
-
-
-/**
- * Get the key of the "first" entry in the hash table.
- *
- * This is used in the course of deleting all display lists when
- * a context is destroyed.
- *
- * \param table the hash table
- *
- * \return key for the "first" entry in the hash table.
- *
- * While holding the lock, walks through all table positions until finding
- * the first entry of the first non-empty one.
- */
-EGLuint
-_eglHashFirstEntry(_EGLHashtable *table)
-{
- EGLuint pos;
- assert(table);
- _eglLockMutex(table->Mutex);
- for (pos = 0; pos < TABLE_SIZE; pos++) {
- if (table->Table[pos]) {
- _eglUnlockMutex(table->Mutex);
- return table->Table[pos]->Key;
- }
- }
- _eglUnlockMutex(table->Mutex);
- return 0;
-}
-
-
-/**
- * Given a hash table key, return the next key. This is used to walk
- * over all entries in the table. Note that the keys returned during
- * walking won't be in any particular order.
- * \return next hash key or 0 if end of table.
- */
-EGLuint
-_eglHashNextEntry(const _EGLHashtable *table, EGLuint key)
-{
- const _EGLHashentry *entry;
- EGLuint pos;
-
- assert(table);
- assert(key);
-
- /* Find the entry with given key */
- pos = HASH_FUNC(key);
- entry = table->Table[pos];
- while (entry) {
- if (entry->Key == key) {
- break;
- }
- entry = entry->Next;
- }
-
- if (!entry) {
- /* the key was not found, we can't find next entry */
- return 0;
- }
-
- if (entry->Next) {
- /* return next in linked list */
- return entry->Next->Key;
- }
- else {
- /* look for next non-empty table slot */
- pos++;
- while (pos < TABLE_SIZE) {
- if (table->Table[pos]) {
- return table->Table[pos]->Key;
- }
- pos++;
- }
- return 0;
- }
-}
-
-
-/**
- * Dump contents of hash table for debugging.
- *
- * \param table the hash table.
- */
-void
-_eglHashPrint(const _EGLHashtable *table)
-{
- EGLuint i;
- assert(table);
- for (i = 0; i < TABLE_SIZE; i++) {
- const _EGLHashentry *entry = table->Table[i];
- while (entry) {
- printf("%u %p\n", entry->Key, entry->Data);
- entry = entry->Next;
- }
- }
-}
-
-
-
-/**
- * Return a new, unused hash key.
- */
-EGLuint
-_eglHashGenKey(_EGLHashtable *table)
-{
- EGLuint k;
-
- _eglLockMutex(table->Mutex);
- k = table->MaxKey;
- table->MaxKey++;
- _eglUnlockMutex(table->Mutex);
- return k;
-}
-
diff --git a/src/egl/main/eglhash.h b/src/egl/main/eglhash.h
deleted file mode 100644
index 1d6db9598ce..00000000000
--- a/src/egl/main/eglhash.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * \file eglhash.h
- * Generic hash table.
- */
-
-
-#ifndef EGLHASH_INCLUDED
-#define EGLHASH_INCLUDED
-
-
-/* XXX move this? */
-typedef unsigned int EGLuint;
-
-
-typedef struct _egl_hashtable _EGLHashtable;
-
-
-extern _EGLHashtable *_eglNewHashTable(void);
-
-extern void _eglDeleteHashTable(_EGLHashtable *table);
-
-extern void *_eglHashLookup(const _EGLHashtable *table, EGLuint key);
-
-extern void _eglHashInsert(_EGLHashtable *table, EGLuint key, void *data);
-
-extern void _eglHashRemove(_EGLHashtable *table, EGLuint key);
-
-extern EGLuint _eglHashFirstEntry(_EGLHashtable *table);
-
-extern EGLuint _eglHashNextEntry(const _EGLHashtable *table, EGLuint key);
-
-extern void _eglHashPrint(const _EGLHashtable *table);
-
-extern EGLuint _eglHashGenKey(_EGLHashtable *table);
-
-extern void _egltest_hash_functions(void);
-
-
-#endif /* EGLHASH_INCLUDED */
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
deleted file mode 100644
index 59b1d2684e3..00000000000
--- a/src/egl/main/egllog.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Logging facility for debug/info messages.
- */
-
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "egllog.h"
-
-#define MAXSTRING 1000
-
-
-/* XXX init this with an env var or something */
-static EGLint ReportingLevel = _EGL_DEBUG;
-
-
-/**
- * Log a message to stderr.
- * \param level one of _EGL_FATAL, _EGL_WARNING, _EGL_INFO, _EGL_DEBUG.
- */
-void
-_eglLog(EGLint level, const char *fmtStr, ...)
-{
- va_list args;
- char msg[MAXSTRING];
- const char *levelStr;
-
- if (level <= ReportingLevel) {
- switch (level) {
- case _EGL_FATAL:
- levelStr = "Fatal";
- break;
- case _EGL_WARNING:
- levelStr = "Warning";
- break;
- case _EGL_INFO:
- levelStr = "Info";
- break;
- case _EGL_DEBUG:
- levelStr = "Debug";
- break;
- default:
- levelStr = "";
- }
-
- va_start(args, fmtStr);
- vsnprintf(msg, MAXSTRING, fmtStr, args);
- va_end(args);
-
- fprintf(stderr, "EGL %s: %s\n", levelStr, msg);
-
- if (level == _EGL_FATAL) {
- exit(1); /* or abort()? */
- }
- }
-}
diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h
deleted file mode 100644
index 2fa352f155d..00000000000
--- a/src/egl/main/egllog.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef EGLLOG_INCLUDED
-#define EGLLOG_INCLUDED
-
-#include "egltypedefs.h"
-
-#define _EGL_FATAL 0 /* unrecoverable error */
-#define _EGL_WARNING 1 /* recoverable error/problem */
-#define _EGL_INFO 2 /* just useful info */
-#define _EGL_DEBUG 3 /* useful info for debugging */
-
-
-extern void
-_eglLog(EGLint level, const char *fmtStr, ...);
-
-
-#endif /* EGLLOG_INCLUDED */
diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c
deleted file mode 100644
index 786432234bb..00000000000
--- a/src/egl/main/eglmode.c
+++ /dev/null
@@ -1,431 +0,0 @@
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglmode.h"
-#include "eglglobals.h"
-#include "eglscreen.h"
-
-
-#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
-
-
-static char *
-my_strdup(const char *s)
-{
- if (s) {
- int l = strlen(s);
- char *s2 = malloc(l + 1);
- if (s2)
- strcpy(s2, s);
- return s2;
- }
- else {
- return NULL;
- }
-}
-
-
-/**
- * Given an EGLModeMESA handle, return the corresponding _EGLMode object
- * or null if non-existant.
- */
-_EGLMode *
-_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode)
-{
- const _EGLDisplay *disp = _eglLookupDisplay(dpy);
- EGLint scrnum;
-
- /* loop over all screens on the display */
- for (scrnum = 0; scrnum < disp->NumScreens; scrnum++) {
- const _EGLScreen *scrn = disp->Screens[scrnum];
- EGLint i;
- /* search list of modes for handle */
- for (i = 0; i < scrn->NumModes; i++) {
- if (scrn->Modes[i].Handle == mode) {
- return scrn->Modes + i;
- }
- }
- }
-
- return NULL;
-}
-
-
-/**
- * Add a new mode with the given attributes (width, height, depth, refreshRate)
- * to the given screen.
- * Assign a new mode ID/handle to the mode as well.
- * \return pointer to the new _EGLMode
- */
-_EGLMode *
-_eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height,
- EGLint refreshRate, const char *name)
-{
- EGLint n;
- _EGLMode *newModes;
-
- assert(screen);
- assert(width > 0);
- assert(height > 0);
- assert(refreshRate > 0);
-
- n = screen->NumModes;
- newModes = (_EGLMode *) realloc(screen->Modes, (n+1) * sizeof(_EGLMode));
- if (newModes) {
- screen->Modes = newModes;
- screen->Modes[n].Handle = n + 1;
- screen->Modes[n].Width = width;
- screen->Modes[n].Height = height;
- screen->Modes[n].RefreshRate = refreshRate;
- screen->Modes[n].Optimal = EGL_FALSE;
- screen->Modes[n].Interlaced = EGL_FALSE;
- screen->Modes[n].Name = my_strdup(name);
- screen->NumModes++;
- return screen->Modes + n;
- }
- else {
- return NULL;
- }
-}
-
-
-
-/**
- * Parse the attrib_list to fill in the fields of the given _eglMode
- * Return EGL_FALSE if any errors, EGL_TRUE otherwise.
- */
-static EGLBoolean
-_eglParseModeAttribs(_EGLMode *mode, const EGLint *attrib_list)
-{
- EGLint i;
-
- /* init all attribs to EGL_DONT_CARE */
- mode->Handle = EGL_DONT_CARE;
- mode->Width = EGL_DONT_CARE;
- mode->Height = EGL_DONT_CARE;
- mode->RefreshRate = EGL_DONT_CARE;
- mode->Optimal = EGL_DONT_CARE;
- mode->Interlaced = EGL_DONT_CARE;
- mode->Name = NULL;
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- case EGL_MODE_ID_MESA:
- mode->Handle = attrib_list[++i];
- if (mode->Handle <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(handle)");
- return EGL_FALSE;
- }
- break;
- case EGL_WIDTH:
- mode->Width = attrib_list[++i];
- if (mode->Width <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(width)");
- return EGL_FALSE;
- }
- break;
- case EGL_HEIGHT:
- mode->Height = attrib_list[++i];
- if (mode->Height <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(height)");
- return EGL_FALSE;
- }
- break;
- case EGL_REFRESH_RATE_MESA:
- mode->RefreshRate = attrib_list[++i];
- if (mode->RefreshRate <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(refresh rate)");
- return EGL_FALSE;
- }
- break;
- case EGL_INTERLACED_MESA:
- mode->Interlaced = attrib_list[++i];
- if (mode->Interlaced != EGL_TRUE && mode->Interlaced != EGL_FALSE) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(interlaced)");
- return EGL_FALSE;
- }
- break;
- case EGL_OPTIMAL_MESA:
- mode->Optimal = attrib_list[++i];
- if (mode->Optimal != EGL_TRUE && mode->Optimal != EGL_FALSE) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(optimal)");
- return EGL_FALSE;
- }
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglChooseModeMESA");
- return EGL_FALSE;
- }
- }
- return EGL_TRUE;
-}
-
-
-/**
- * Determine if the candidate mode's attributes are at least as good
- * as the minimal mode's.
- * \return EGL_TRUE if qualifies, EGL_FALSE otherwise
- */
-static EGLBoolean
-_eglModeQualifies(const _EGLMode *c, const _EGLMode *min)
-{
- if (min->Handle != EGL_DONT_CARE && c->Handle != min->Handle)
- return EGL_FALSE;
- if (min->Width != EGL_DONT_CARE && c->Width < min->Width)
- return EGL_FALSE;
- if (min->Height != EGL_DONT_CARE && c->Height < min->Height)
- return EGL_FALSE;
- if (min->RefreshRate != EGL_DONT_CARE && c->RefreshRate < min->RefreshRate)
- return EGL_FALSE;
- if (min->Optimal != EGL_DONT_CARE && c->Optimal != min->Optimal)
- return EGL_FALSE;
- if (min->Interlaced != EGL_DONT_CARE && c->Interlaced != min->Interlaced)
- return EGL_FALSE;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Return value of given mode attribute, or -1 if bad attrib.
- */
-static EGLint
-getModeAttrib(const _EGLMode *m, EGLint attrib)
-{
- switch (attrib) {
- case EGL_MODE_ID_MESA:
- return m->Handle;
- case EGL_WIDTH:
- return m->Width;
- case EGL_HEIGHT:
- return m->Height;
- case EGL_REFRESH_RATE_MESA:
- return m->RefreshRate;
- case EGL_OPTIMAL_MESA:
- return m->Optimal;
- case EGL_INTERLACED_MESA:
- return m->Interlaced;
- default:
- return -1;
- }
-}
-
-
-#define SMALLER 1
-#define LARGER 2
-
-struct sort_info {
- EGLint Attrib;
- EGLint Order; /* SMALLER or LARGER */
-};
-
-/* the order of these entries is the priority */
-static struct sort_info SortInfo[] = {
- { EGL_OPTIMAL_MESA, LARGER },
- { EGL_INTERLACED_MESA, SMALLER },
- { EGL_WIDTH, LARGER },
- { EGL_HEIGHT, LARGER },
- { EGL_REFRESH_RATE_MESA, LARGER },
- { EGL_MODE_ID_MESA, SMALLER },
- { 0, 0 }
-};
-
-
-/**
- * Compare modes 'a' and 'b' and return -1 if a belongs before b, or 1 if a
- * belongs after b, or 0 if they're equal.
- * Used by qsort().
- */
-static int
-_eglCompareModes(const void *a, const void *b)
-{
- const _EGLMode *aMode = *((const _EGLMode **) a);
- const _EGLMode *bMode = *((const _EGLMode **) b);
- EGLint i;
-
- for (i = 0; SortInfo[i].Attrib; i++) {
- const EGLint aVal = getModeAttrib(aMode, SortInfo[i].Attrib);
- const EGLint bVal = getModeAttrib(bMode, SortInfo[i].Attrib);
- if (aVal == bVal) {
- /* a tie */
- continue;
- }
- else if (SortInfo[i].Order == SMALLER) {
- return (aVal < bVal) ? -1 : 1;
- }
- else if (SortInfo[i].Order == LARGER) {
- return (aVal > bVal) ? -1 : 1;
- }
- }
-
- /* all attributes identical */
- return 0;
-}
-
-
-/**
- * Search for EGLModes which match the given attribute list.
- * Called via eglChooseModeMESA API function.
- */
-EGLBoolean
-_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- const EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes)
-{
- const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
- _EGLMode **modeList, min;
- EGLint i, count;
-
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, "eglChooseModeMESA");
- return EGL_FALSE;
- }
-
- if (!_eglParseModeAttribs(&min, attrib_list)) {
- /* error code will have been recorded */
- return EGL_FALSE;
- }
-
- /* allocate array of mode pointers */
- modeList = (_EGLMode **) malloc(modes_size * sizeof(_EGLMode *));
- if (!modeList) {
- _eglError(EGL_BAD_MODE_MESA, "eglChooseModeMESA(out of memory)");
- return EGL_FALSE;
- }
-
- /* make array of pointers to qualifying modes */
- for (i = count = 0; i < scrn->NumModes && count < modes_size; i++) {
- if (_eglModeQualifies(scrn->Modes + i, &min)) {
- modeList[count++] = scrn->Modes + i;
- }
- }
-
- /* sort array of pointers */
- qsort(modeList, count, sizeof(_EGLMode *), _eglCompareModes);
-
- /* copy mode handles to output array */
- for (i = 0; i < count; i++) {
- modes[i] = modeList[i]->Handle;
- }
-
- free(modeList);
-
- *num_modes = count;
-
- return EGL_TRUE;
-}
-
-
-
-/**
- * Return all possible modes for the given screen. No sorting of results.
- * Called via eglGetModesMESA() API function.
- */
-EGLBoolean
-_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes)
-{
- _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
-
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, "eglGetModesMESA");
- return EGL_FALSE;
- }
-
- if (modes) {
- EGLint i;
- *num_modes = MIN2(scrn->NumModes, modes_size);
- for (i = 0; i < *num_modes; i++) {
- modes[i] = scrn->Modes[i].Handle;
- }
- }
- else {
- /* just return total number of supported modes */
- *num_modes = scrn->NumModes;
- }
-
- return EGL_TRUE;
-}
-
-
-/**
- * Query an attribute of a mode.
- */
-EGLBoolean
-_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLModeMESA mode, EGLint attribute, EGLint *value)
-{
- _EGLMode *m = _eglLookupMode(dpy, mode);
- EGLint v;
-
- if (!m) {
- _eglError(EGL_BAD_MODE_MESA, "eglGetModeAttribMESA");
- return EGL_FALSE;
- }
-
- v = getModeAttrib(m, attribute);
- if (v < 0) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttribMESA");
- return EGL_FALSE;
- }
- *value = v;
- return EGL_TRUE;
-}
-
-
-/**
- * Return human-readable string for given mode.
- * This is the default function called by eglQueryModeStringMESA().
- */
-const char *
-_eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode)
-{
- _EGLMode *m = _eglLookupMode(dpy, mode);
- if (!m) {
- _eglError(EGL_BAD_MODE_MESA, "eglQueryModeStringMESA");
- return NULL;
- }
- return m->Name;
-}
-
-
-#if 0
-static int
-_eglRand(int max)
-{
- return rand() % max;
-}
-
-void
-_eglTestModeModule(void)
-{
- EGLint count = 30;
- _EGLMode *modes = (_EGLMode *) malloc(count * sizeof(_EGLMode));
- _EGLMode **modeList = (_EGLMode **) malloc(count * sizeof(_EGLMode*));
- EGLint i;
-
- for (i = 0; i < count; i++) {
- modes[i].Handle = _eglRand(20);
- modes[i].Width = 512 + 256 * _eglRand(2);
- modes[i].Height = 512 + 256 * _eglRand(2);
- modes[i].RefreshRate = 50 + 5 * _eglRand(3);
- modes[i].Interlaced = _eglRand(2);
- modes[i].Optimal = _eglRand(4) == 0;
- modeList[i] = modes + i;
- }
-
- /* sort array of pointers */
- qsort(modeList, count, sizeof(_EGLMode *), compareModes);
-
- for (i = 0; i < count; i++) {
- _EGLMode *m = modeList[i];
- printf("%2d: %3d %4d x %4d @ %3d opt %d int %d\n", i,
- m->Handle, m->Width, m->Height, m->RefreshRate,
- m->Optimal, m->Interlaced);
- }
-}
-#endif
diff --git a/src/egl/main/eglmode.h b/src/egl/main/eglmode.h
deleted file mode 100644
index e70da857595..00000000000
--- a/src/egl/main/eglmode.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef EGLMODE_INCLUDED
-#define EGLMODE_INCLUDED
-
-#include "egltypedefs.h"
-
-
-/**
- * Data structure which corresponds to an EGLModeMESA.
- */
-struct _egl_mode
-{
- EGLModeMESA Handle; /* the public/opaque handle which names this mode */
- EGLint Width, Height; /* size in pixels */
- EGLint RefreshRate; /* rate * 1000.0 */
- EGLint Optimal;
- EGLint Interlaced;
- const char *Name;
-
- /* Other possible attributes */
- /* interlaced */
- /* external sync */
-};
-
-
-extern _EGLMode *
-_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode);
-
-
-extern _EGLMode *
-_eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height,
- EGLint refreshRate, const char *name);
-
-
-extern EGLBoolean
-_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- const EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes);
-
-
-extern EGLBoolean
-_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-
-
-extern EGLBoolean
-_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode,
- EGLint attribute, EGLint *value);
-
-
-extern const char *
-_eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
-
-
-#endif /* EGLMODE_INCLUDED */
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
deleted file mode 100644
index 9c9a8377bf2..00000000000
--- a/src/egl/main/eglscreen.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Ideas for screen management extension to EGL.
- *
- * Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc).
- * The screens' handles can be obtained with eglGetScreensMESA().
- *
- * A new kind of EGLSurface is possible- one which can be directly scanned
- * out on a screen. Such a surface is created with eglCreateScreenSurface().
- *
- * To actually display a screen surface on a screen, the eglShowSurface()
- * function is called.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "egldisplay.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglconfig.h"
-#include "eglsurface.h"
-#include "eglscreen.h"
-
-
-/**
- * Return a new screen handle/ID.
- * NOTE: we never reuse these!
- */
-EGLScreenMESA
-_eglAllocScreenHandle(void)
-{
- EGLScreenMESA s = _eglGlobal.FreeScreenHandle;
- _eglGlobal.FreeScreenHandle++;
- return s;
-}
-
-
-/**
- * Initialize an _EGLScreen object to default values.
- */
-void
-_eglInitScreen(_EGLScreen *screen)
-{
- memset(screen, 0, sizeof(_EGLScreen));
- screen->StepX = 1;
- screen->StepY = 1;
-}
-
-
-/**
- * Given a public screen handle, return the internal _EGLScreen object.
- */
-_EGLScreen *
-_eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen)
-{
- EGLint i;
- _EGLDisplay *display = _eglLookupDisplay(dpy);
-
- if (!display)
- return NULL;
-
- for (i = 0; i < display->NumScreens; i++) {
- if (display->Screens[i]->Handle == screen)
- return display->Screens[i];
- }
- return NULL;
-}
-
-
-/**
- * Add the given _EGLScreen to the display's list of screens.
- */
-void
-_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen)
-{
- EGLint n;
-
- assert(display);
- assert(screen);
-
- screen->Handle = _eglAllocScreenHandle();
- n = display->NumScreens;
- display->Screens = realloc(display->Screens, (n+1) * sizeof(_EGLScreen *));
- display->Screens[n] = screen;
- display->NumScreens++;
-}
-
-
-
-EGLBoolean
-_eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens,
- EGLint max_screens, EGLint *num_screens)
-{
- _EGLDisplay *display = _eglLookupDisplay(dpy);
- EGLint n;
-
- if (!display) {
- _eglError(EGL_BAD_DISPLAY, "eglGetScreensMESA");
- return EGL_FALSE;
- }
-
- if (display->NumScreens > max_screens) {
- n = max_screens;
- }
- else {
- n = display->NumScreens;
- }
-
- if (screens) {
- EGLint i;
- for (i = 0; i < n; i++)
- screens[i] = display->Screens[i]->Handle;
- }
- if (num_screens)
- *num_screens = n;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Example function - drivers should do a proper implementation.
- */
-EGLSurface
-_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
-#if 0 /* THIS IS JUST EXAMPLE CODE */
- _EGLSurface *surf;
-
- surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface));
- if (!surf)
- return EGL_NO_SURFACE;
-
- if (!_eglInitSurface(drv, dpy, surf, EGL_SCREEN_BIT_MESA,
- config, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- _eglSaveSurface(surf);
-
- return surf->Handle;
-#endif
- return EGL_NO_SURFACE;
-}
-
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- *
- * This is just a placeholder function; drivers will always override
- * this with code that _really_ shows the surface.
- */
-EGLBoolean
-_eglShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen, EGLSurface surface,
- EGLModeMESA m)
-{
- _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
- _EGLMode *mode = _eglLookupMode(dpy, m);
-
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, "eglShowSurfaceMESA");
- return EGL_FALSE;
- }
- if (!mode && (m != EGL_NO_MODE_MESA )) {
- _eglError(EGL_BAD_MODE_MESA, "eglShowSurfaceMESA");
- return EGL_FALSE;
- }
-
- if (surface == EGL_NO_SURFACE) {
- scrn->CurrentSurface = NULL;
- }
- else {
- _EGLSurface *surf = _eglLookupSurface(surface);
- if (!surf || surf->Type != EGL_SCREEN_BIT_MESA) {
- _eglError(EGL_BAD_SURFACE, "eglShowSurfaceMESA");
- return EGL_FALSE;
- }
- if (surf->Width < mode->Width || surf->Height < mode->Height) {
- _eglError(EGL_BAD_SURFACE,
- "eglShowSurfaceMESA(surface smaller than screen size)");
- return EGL_FALSE;
- }
-
- scrn->CurrentSurface = surf;
- scrn->CurrentMode = mode;
- }
- return EGL_TRUE;
-}
-
-
-/**
- * Set a screen's current display mode.
- * Note: mode = EGL_NO_MODE is valid (turns off the screen)
- *
- * This is just a placeholder function; drivers will always override
- * this with code that _really_ sets the mode.
- */
-EGLBoolean
-_eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA mode)
-{
- _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
-
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, "eglScreenModeMESA");
- return EGL_FALSE;
- }
-
- scrn->CurrentMode = _eglLookupMode(dpy, mode);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Set a screen's surface origin.
- */
-EGLBoolean
-_eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen, EGLint x, EGLint y)
-{
- _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, "eglScreenPositionMESA");
- return EGL_FALSE;
- }
-
- scrn->OriginX = x;
- scrn->OriginY = y;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Query a screen's current surface.
- */
-EGLBoolean
-_eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen, EGLSurface *surface)
-{
- const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
- if (scrn->CurrentSurface)
- *surface = scrn->CurrentSurface->Handle;
- else
- *surface = EGL_NO_SURFACE;
- return EGL_TRUE;
-}
-
-
-/**
- * Query a screen's current mode.
- */
-EGLBoolean
-_eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLModeMESA *mode)
-{
- const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
- if (scrn->CurrentMode)
- *mode = scrn->CurrentMode->Handle;
- else
- *mode = EGL_NO_MODE_MESA;
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLint attribute, EGLint *value)
-{
- const _EGLScreen *scrn = _eglLookupScreen(dpy, screen);
-
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, "eglQueryScreenMESA");
- return EGL_FALSE;
- }
-
- switch (attribute) {
- case EGL_SCREEN_POSITION_MESA:
- value[0] = scrn->OriginX;
- value[1] = scrn->OriginY;
- break;
- case EGL_SCREEN_POSITION_GRANULARITY_MESA:
- value[0] = scrn->StepX;
- value[1] = scrn->StepY;
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA");
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
-
-/**
- * Delete the modes associated with given screen.
- */
-void
-_eglDestroyScreenModes(_EGLScreen *scrn)
-{
- EGLint i;
- for (i = 0; i < scrn->NumModes; i++) {
- if (scrn->Modes[i].Name)
- free((char *) scrn->Modes[i].Name); /* cast away const */
- }
- if (scrn->Modes)
- free(scrn->Modes);
- scrn->Modes = NULL;
- scrn->NumModes = 0;
-}
-
-
-/**
- * Default fallback routine - drivers should usually override this.
- */
-void
-_eglDestroyScreen(_EGLScreen *scrn)
-{
- _eglDestroyScreenModes(scrn);
- free(scrn);
-}
-
diff --git a/src/egl/main/eglscreen.h b/src/egl/main/eglscreen.h
deleted file mode 100644
index 833439b4107..00000000000
--- a/src/egl/main/eglscreen.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef EGLSCREEN_INCLUDED
-#define EGLSCREEN_INCLUDED
-
-
-/**
- * Per-screen information.
- * Note that an EGL screen doesn't have a size. A screen may be set to
- * one of several display modes (width/height/scanrate). The screen
- * then displays a drawing surface. The drawing surface must be at least
- * as large as the display mode's resolution. If it's larger, the
- * OriginX and OriginY fields control what part of the surface is visible
- * on the screen.
- */
-struct _egl_screen
-{
- EGLScreenMESA Handle; /* The public/opaque handle which names this object */
-
- _EGLMode *CurrentMode;
- _EGLSurface *CurrentSurface;
-
- EGLint OriginX, OriginY; /**< Origin of scan-out region w.r.t. surface */
- EGLint StepX, StepY; /**< Screen position/origin granularity */
-
- EGLint NumModes;
- _EGLMode *Modes; /**< array [NumModes] */
-};
-
-
-extern EGLScreenMESA
-_eglAllocScreenHandle(void);
-
-
-extern void
-_eglInitScreen(_EGLScreen *screen);
-
-
-extern _EGLScreen *
-_eglLookupScreen(EGLDisplay dpy, EGLScreenMESA screen);
-
-
-extern void
-_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen);
-
-
-extern EGLBoolean
-_eglGetScreensMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-
-
-extern EGLSurface
-_eglCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-
-
-extern EGLBoolean
-_eglShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA mode);
-
-
-extern EGLBoolean
-_eglScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA mode);
-
-
-extern EGLBoolean
-_eglScreenPositionMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-
-
-extern EGLBoolean
-_eglQueryDisplayMESA(_EGLDriver *drv, EGLDisplay dpy, EGLint attribute, EGLint *value);
-
-
-extern EGLBoolean
-_eglQueryScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen, EGLSurface *surface);
-
-
-extern EGLBoolean
-_eglQueryScreenModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-
-
-extern EGLBoolean
-_eglQueryScreenMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-
-
-extern void
-_eglDestroyScreenModes(_EGLScreen *scrn);
-
-
-extern void
-_eglDestroyScreen(_EGLScreen *scrn);
-
-
-#endif /* EGLSCREEN_INCLUDED */
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
deleted file mode 100644
index 874f318e966..00000000000
--- a/src/egl/main/eglsurface.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/**
- * Surface-related functions.
- */
-
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include "eglcontext.h"
-#include "eglconfig.h"
-#include "eglglobals.h"
-#include "eglhash.h"
-#include "egllog.h"
-#include "eglsurface.h"
-
-
-/**
- * Do error check on parameters and initialize the given _EGLSurface object.
- * \return EGL_TRUE if no errors, EGL_FALSE otherwise.
- */
-EGLBoolean
-_eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
- _EGLSurface *surf, EGLint type, EGLConfig config,
- const EGLint *attrib_list)
-{
- const char *func;
- _EGLConfig *conf;
- EGLint width = 0, height = 0, largest = 0;
- EGLint texFormat = 0, texTarget = 0, mipmapTex = 0;
- EGLint renderBuffer = EGL_BACK_BUFFER;
-#ifdef EGL_VERSION_1_2
- EGLint colorspace = EGL_COLORSPACE_sRGB;
- EGLint alphaFormat = EGL_ALPHA_FORMAT_NONPRE;
-#endif
- EGLint i;
-
- switch (type) {
- case EGL_WINDOW_BIT:
- func = "eglCreateWindowSurface";
- break;
- case EGL_PIXMAP_BIT:
- func = "eglCreatePixmapSurface";
- renderBuffer = EGL_SINGLE_BUFFER;
- break;
- case EGL_PBUFFER_BIT:
- func = "eglCreatePBufferSurface";
- break;
- case EGL_SCREEN_BIT_MESA:
- func = "eglCreateScreenSurface";
- renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
- break;
- default:
- _eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
- return EGL_FALSE;
- }
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, func);
- return EGL_FALSE;
- }
-
- /*
- * Parse attribute list. Different kinds of surfaces support different
- * attributes.
- */
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- case EGL_WIDTH:
- if (type == EGL_PBUFFER_BIT || type == EGL_SCREEN_BIT_MESA) {
- width = attrib_list[++i];
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_HEIGHT:
- if (type == EGL_PBUFFER_BIT || type == EGL_SCREEN_BIT_MESA) {
- height = attrib_list[++i];
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_LARGEST_PBUFFER:
- if (type == EGL_PBUFFER_BIT) {
- largest = attrib_list[++i];
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_TEXTURE_FORMAT:
- if (type == EGL_PBUFFER_BIT) {
- texFormat = attrib_list[++i];
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_TEXTURE_TARGET:
- if (type == EGL_PBUFFER_BIT) {
- texTarget = attrib_list[++i];
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_MIPMAP_TEXTURE:
- if (type == EGL_PBUFFER_BIT) {
- mipmapTex = attrib_list[++i];
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
-#ifdef EGL_VERSION_1_2
- case EGL_RENDER_BUFFER:
- if (type == EGL_WINDOW_BIT) {
- renderBuffer = attrib_list[++i];
- if (renderBuffer != EGL_BACK_BUFFER &&
- renderBuffer != EGL_SINGLE_BUFFER) {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_COLORSPACE:
- if (type == EGL_WINDOW_BIT ||
- type == EGL_PBUFFER_BIT ||
- type == EGL_PIXMAP_BIT) {
- colorspace = attrib_list[++i];
- if (colorspace != EGL_COLORSPACE_sRGB &&
- colorspace != EGL_COLORSPACE_LINEAR) {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
- case EGL_ALPHA_FORMAT:
- if (type == EGL_WINDOW_BIT ||
- type == EGL_PBUFFER_BIT ||
- type == EGL_PIXMAP_BIT) {
- alphaFormat = attrib_list[++i];
- if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE &&
- alphaFormat != EGL_ALPHA_FORMAT_PRE) {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- }
- else {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- break;
-
-#endif /* EGL_VERSION_1_2 */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
- }
-
- if (width <= 0 || height <= 0) {
- _eglError(EGL_BAD_ATTRIBUTE, func);
- return EGL_FALSE;
- }
-
- memset(surf, 0, sizeof(_EGLSurface));
- surf->Config = conf;
- surf->Type = type;
- surf->Width = width;
- surf->Height = height;
- surf->TextureFormat = texFormat;
- surf->TextureTarget = texTarget;
- surf->MipmapTexture = mipmapTex;
- surf->MipmapLevel = 0;
- surf->SwapInterval = 0;
-#ifdef EGL_VERSION_1_2
- surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */
- surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */
- surf->VerticalResolution = EGL_UNKNOWN; /* set by caller */
- surf->AspectRatio = EGL_UNKNOWN; /* set by caller */
- surf->RenderBuffer = renderBuffer;
- surf->AlphaFormat = alphaFormat;
- surf->Colorspace = colorspace;
-#endif
-
- return EGL_TRUE;
-}
-
-
-void
-_eglSaveSurface(_EGLSurface *surf)
-{
- assert(surf);
- assert(!surf->Handle);
- surf->Handle = _eglHashGenKey(_eglGlobal.Contexts);
- assert(surf->Handle);
- _eglHashInsert(_eglGlobal.Surfaces, surf->Handle, surf);
-}
-
-
-void
-_eglRemoveSurface(_EGLSurface *surf)
-{
- _eglHashRemove(_eglGlobal.Surfaces, surf->Handle);
-}
-
-
-_EGLSurface *
-_eglLookupSurface(EGLSurface surf)
-{
- _EGLSurface *c = (_EGLSurface *) _eglHashLookup(_eglGlobal.Surfaces, surf);
- return c;
-}
-
-
-_EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw)
-{
- _EGLContext *ctx = _eglGetCurrentContext();
- if (ctx) {
- switch (readdraw) {
- case EGL_DRAW:
- return ctx->DrawSurface;
- case EGL_READ:
- return ctx->ReadSurface;
- default:
- return NULL;
- }
- }
- return NULL;
-}
-
-
-EGLBoolean
-_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
-{
- /* Basically just do error checking here. Drivers have to do the
- * actual buffer swap.
- */
- _EGLContext *context = _eglGetCurrentContext();
- _EGLSurface *surface = _eglLookupSurface(draw);
- if (context && context->DrawSurface != surface) {
- _eglError(EGL_BAD_SURFACE, "eglSwapBuffers");
- return EGL_FALSE;
- }
- if (surface == NULL) {
- _eglError(EGL_BAD_SURFACE, "eglSwapBuffers");
- return EGL_FALSE;
- }
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface,
- NativePixmapType target)
-{
- /* copy surface to native pixmap */
- /* All implementation burdon for this is in the device driver */
- return EGL_FALSE;
-}
-
-
-EGLBoolean
-_eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
- EGLint attribute, EGLint *value)
-{
- _EGLSurface *surface = _eglLookupSurface(surf);
- if (surface == NULL) {
- _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
- return EGL_FALSE;
- }
- switch (attribute) {
- case EGL_WIDTH:
- *value = surface->Width;
- return EGL_TRUE;
- case EGL_HEIGHT:
- *value = surface->Height;
- return EGL_TRUE;
- case EGL_CONFIG_ID:
- *value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
- return EGL_TRUE;
- /*XXX case EGL_LARGEST_PBUFFER:*/
- case EGL_SURFACE_TYPE:
- *value = surface->Type;
- return EGL_TRUE;
-#ifdef EGL_VERSION_1_1
- case EGL_TEXTURE_FORMAT:
- /* texture attributes: only for pbuffers, no error otherwise */
- if (surface->Type == EGL_PBUFFER_BIT)
- *value = surface->TextureFormat;
- return EGL_TRUE;
- case EGL_TEXTURE_TARGET:
- if (surface->Type == EGL_PBUFFER_BIT)
- *value = surface->TextureTarget;
- return EGL_TRUE;
- case EGL_MIPMAP_TEXTURE:
- if (surface->Type == EGL_PBUFFER_BIT)
- *value = surface->MipmapTexture;
- return EGL_TRUE;
- case EGL_MIPMAP_LEVEL:
- if (surface->Type == EGL_PBUFFER_BIT)
- *value = surface->MipmapLevel;
- return EGL_TRUE;
-#endif /* EGL_VERSION_1_1 */
-#ifdef EGL_VERSION_1_2
- case EGL_SWAP_BEHAVIOR:
- *value = surface->SwapBehavior;
- return EGL_TRUE;
- case EGL_RENDER_BUFFER:
- *value = surface->RenderBuffer;
- return EGL_TRUE;
- case EGL_PIXEL_ASPECT_RATIO:
- *value = surface->AspectRatio;
- return EGL_TRUE;
- case EGL_HORIZONTAL_RESOLUTION:
- *value = surface->HorizontalResolution;
- return EGL_TRUE;
- case EGL_VERTICAL_RESOLUTION:
- *value = surface->VerticalResolution;
- return EGL_TRUE;
- case EGL_ALPHA_FORMAT:
- *value = surface->AlphaFormat;
- return EGL_TRUE;
- case EGL_COLORSPACE:
- *value = surface->Colorspace;
- return EGL_TRUE;
-#endif /* EGL_VERSION_1_2 */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
- }
-}
-
-
-/**
- * Example function - drivers should do a proper implementation.
- */
-EGLSurface
-_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- NativeWindowType window, const EGLint *attrib_list)
-{
-#if 0 /* THIS IS JUST EXAMPLE CODE */
- _EGLSurface *surf;
-
- surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface));
- if (!surf)
- return EGL_NO_SURFACE;
-
- if (!_eglInitSurface(drv, dpy, surf, EGL_WINDOW_BIT, config, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- _eglSaveSurface(surf);
-
- return surf->Handle;
-#endif
- return EGL_NO_SURFACE;
-}
-
-
-/**
- * Example function - drivers should do a proper implementation.
- */
-EGLSurface
-_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- NativePixmapType pixmap, const EGLint *attrib_list)
-{
-#if 0 /* THIS IS JUST EXAMPLE CODE */
- _EGLSurface *surf;
-
- surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface));
- if (!surf)
- return EGL_NO_SURFACE;
-
- if (!_eglInitSurface(drv, dpy, surf, EGL_PIXMAP_BIT, config, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- _eglSaveSurface(surf);
-
- return surf->Handle;
-#endif
- return EGL_NO_SURFACE;
-}
-
-
-/**
- * Example function - drivers should do a proper implementation.
- */
-EGLSurface
-_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
-#if 0 /* THIS IS JUST EXAMPLE CODE */
- _EGLSurface *surf;
-
- surf = (_EGLSurface *) calloc(1, sizeof(_EGLSurface));
- if (!surf)
- return EGL_NO_SURFACE;
-
- if (!_eglInitSurface(drv, dpy, surf, EGL_PBUFFER_BIT, config, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- _eglSaveSurface(surf);
-
- return surf->Handle;
-#endif
- return EGL_NO_SURFACE;
-}
-
-
-/**
- * Default fallback routine - drivers should usually override this.
- */
-EGLBoolean
-_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
-{
- _EGLSurface *surf = _eglLookupSurface(surface);
- if (surf) {
- _eglHashRemove(_eglGlobal.Surfaces, surface);
- if (surf->IsBound) {
- surf->DeletePending = EGL_TRUE;
- }
- else {
- free(surf);
- }
- return EGL_TRUE;
- }
- else {
- _eglError(EGL_BAD_SURFACE, "eglDestroySurface");
- return EGL_FALSE;
- }
-}
-
-
-/**
- * Default fallback routine - drivers might override this.
- */
-EGLBoolean
-_eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf, EGLint attribute, EGLint value)
-{
- _EGLSurface *surface = _eglLookupSurface(surf);
-
- if (surface == NULL) {
- _eglError(EGL_BAD_SURFACE, "eglSurfaceAttrib");
- return EGL_FALSE;
- }
-
- switch (attribute) {
- case EGL_MIPMAP_LEVEL:
- surface->MipmapLevel = value;
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglSurfaceAttrib");
- return EGL_FALSE;
- }
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- /* XXX unfinished */
- return EGL_FALSE;
-}
-
-
-EGLBoolean
-_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- /* XXX unfinished */
- return EGL_FALSE;
-}
-
-
-EGLBoolean
-_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval)
-{
- _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW);
- if (surf == NULL) {
- _eglError(EGL_BAD_SURFACE, "eglSwapInterval");
- return EGL_FALSE;
- }
- surf->SwapInterval = interval;
- return EGL_TRUE;
-}
-
-
-#ifdef EGL_VERSION_1_2
-
-/**
- * Example function - drivers should do a proper implementation.
- */
-EGLSurface
-_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
- EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list)
-{
- if (buftype != EGL_OPENVG_IMAGE) {
- _eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer");
- return EGL_NO_SURFACE;
- }
-
- return EGL_NO_SURFACE;
-}
-
-#endif /* EGL_VERSION_1_2 */
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
deleted file mode 100644
index 79abeca0b2a..00000000000
--- a/src/egl/main/eglsurface.h
+++ /dev/null
@@ -1,117 +0,0 @@
-#ifndef EGLSURFACE_INCLUDED
-#define EGLSURFACE_INCLUDED
-
-
-#include "egltypedefs.h"
-
-
-/**
- * "Base" class for device driver surfaces.
- */
-struct _egl_surface
-{
- EGLSurface Handle; /* The public/opaque handle which names this object */
- _EGLConfig *Config;
-
- /* May need reference counting here */
- EGLBoolean IsBound;
- EGLBoolean DeletePending;
-
- EGLint Type; /* one of EGL_WINDOW_BIT, EGL_PIXMAP_BIT or EGL_PBUFFER_BIT */
- EGLint Width, Height;
- EGLint TextureFormat, TextureTarget;
- EGLint MipmapTexture, MipmapLevel;
- EGLint SwapInterval;
-
- /* If type == EGL_SCREEN_BIT: */
- EGLint VisibleRefCount; /* number of screens I'm displayed on */
-
-#ifdef EGL_VERSION_1_2
- EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
- EGLint HorizontalResolution, VerticalResolution;
- EGLint AspectRatio;
- EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
- EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
- EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
-#endif /* EGL_VERSION_1_2 */
-};
-
-
-extern EGLBoolean
-_eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
- _EGLSurface *surf, EGLint type, EGLConfig config,
- const EGLint *attrib_list);
-
-
-extern void
-_eglSaveSurface(_EGLSurface *surf);
-
-
-extern void
-_eglRemoveSurface(_EGLSurface *surf);
-
-
-extern _EGLSurface *
-_eglLookupSurface(EGLSurface surf);
-
-
-extern _EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw);
-
-
-extern EGLBoolean
-_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
-
-
-extern EGLBoolean
-_eglCopyBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
-
-
-extern EGLBoolean
-_eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-
-
-extern EGLSurface
-_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
-
-
-extern EGLSurface
-_eglCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
-
-
-extern EGLSurface
-_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-
-
-extern EGLBoolean
-_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
-
-
-extern EGLBoolean
-_eglSurfaceAttrib(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-
-
-extern EGLBoolean
-_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-
-
-extern EGLBoolean
-_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-
-
-extern EGLBoolean
-_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
-
-
-#ifdef EGL_VERSION_1_2
-
-extern EGLSurface
-_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
- EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list);
-
-#endif /* EGL_VERSION_1_2 */
-
-
-
-#endif /* EGLSURFACE_INCLUDED */
diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h
deleted file mode 100644
index fa8cb496f8d..00000000000
--- a/src/egl/main/egltypedefs.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef EGLTYPEDEFS_INCLUDED
-#define EGLTYPEDEFS_INCLUDED
-
-
-#include <GLES/egl.h>
-
-
-typedef struct _egl_api _EGLAPI;
-
-typedef struct _egl_config _EGLConfig;
-
-typedef struct _egl_context _EGLContext;
-
-typedef struct _egl_display _EGLDisplay;
-
-typedef struct _egl_driver _EGLDriver;
-
-typedef struct _egl_extensions _EGLExtensions;
-
-typedef struct _egl_mode _EGLMode;
-
-typedef struct _egl_screen _EGLScreen;
-
-typedef struct _egl_surface _EGLSurface;
-
-typedef struct _egl_thread_info _EGLThreadInfo;
-
-
-typedef void (*_EGLProc)();
-
-typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy);
-
-
-#endif /* EGLTYPEDEFS_INCLUDED */
diff --git a/src/glu/mesa/Makefile b/src/glu/mesa/Makefile
deleted file mode 100644
index 69a4ea88cf3..00000000000
--- a/src/glu/mesa/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# src/glu/mesa/Makefile
-
-TOP = ../../..
-
-include $(TOP)/configs/current
-
-GLU_MAJOR = 1
-GLU_MINOR = 1
-GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
-
-C_SOURCES = \
- glu.c \
- mipmap.c \
- nurbs.c \
- nurbscrv.c \
- nurbssrf.c \
- nurbsutl.c \
- polytest.c \
- project.c \
- quadric.c \
- tess.c \
- tesselat.c
-
-OBJECTS = $(C_SOURCES:.c=.o)
-
-INCLUDES = -I. -I- -I$(TOP)/include
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
-
-##### TARGETS #####
-
-default:
- @if [ "${CONFIG_NAME}" = "beos" ] ; then \
- echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \
- exit 0 ; \
- else \
- $(MAKE) "${LIB_DIR}/${GLU_LIB_NAME}" ; \
- fi
-
-$(LIB_DIR):
- -mkdir $(LIB_DIR)
-
-# Make the library:
-$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS)
- @ $(TOP)/bin/mklib -o $(GLU_LIB) -linker '$(CC)' \
- -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \
- $(MKLIB_OPTIONS) -install $(LIB_DIR) \
- $(GLU_LIB_DEPS) $(OBJECTS)
-
-clean:
- -rm -f *.o */*.o */*/*.o
- -rm -f *.lo */*.lo */*/*.lo
- -rm -f *.la */*.la */*/*.la
diff --git a/src/glu/mesa/Makefile.DJ b/src/glu/mesa/Makefile.DJ
deleted file mode 100644
index 92bcdaae945..00000000000
--- a/src/glu/mesa/Makefile.DJ
+++ /dev/null
@@ -1,100 +0,0 @@
-# Mesa 3-D graphics library
-# Version: 4.0
-#
-# Copyright (C) 1999 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.
-
-# DOS/DJGPP glu makefile v1.5 for Mesa
-#
-# Copyright (C) 2002 - Daniel Borca
-# Email : dborca@users.sourceforge.net
-# Web : http://www.geocities.com/dborca
-
-
-#
-# Available options:
-#
-# Environment variables:
-# CFLAGS
-#
-# Targets:
-# all: build GLU
-# clean: remove object files
-#
-
-
-
-.PHONY: all clean
-
-TOP = ../../..
-LIBDIR = $(TOP)/lib
-GLU_LIB = libglu.a
-GLU_DXE = glu.dxe
-GLU_IMP = libiglu.a
-
-export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib
-
-CC = gcc
-CFLAGS += -I$(TOP)/include
-
-AR = ar
-ARFLAGS = crus
-
-HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
-
-ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
-UNLINK = del $(subst /,\,$(1))
-else
-UNLINK = $(RM) $(1)
-endif
-
-CORE_SOURCES = \
- glu.c \
- mipmap.c \
- nurbs.c \
- nurbscrv.c \
- nurbssrf.c \
- nurbsutl.c \
- polytest.c \
- project.c \
- quadric.c \
- tess.c \
- tesselat.c
-
-SOURCES = $(CORE_SOURCES)
-
-OBJECTS = $(SOURCES:.c=.o)
-
-.c.o:
- $(CC) -o $@ $(CFLAGS) -c $<
-
-all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)
-
-$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
- $(AR) $(ARFLAGS) $@ $^
-
-$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
-ifeq ($(HAVEDXE3),)
- $(warning Missing DXE3 package... Skipping $(GLU_DXE))
-else
- -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -Y $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $^
-endif
-
-clean:
- -$(call UNLINK,*.o)
diff --git a/src/glu/mesa/Makefile.m32 b/src/glu/mesa/Makefile.m32
deleted file mode 100644
index 3e217ef5d52..00000000000
--- a/src/glu/mesa/Makefile.m32
+++ /dev/null
@@ -1,63 +0,0 @@
-# Makefile for GLU for GCC-2.95.2/Mingw32 contributed by
-# Paul Garceau <pgarceau@teleport.com>
-
-# Mesa 3-D graphics library
-# Version: 3.3
-# Copyright (C) 1995-1999 Brian Paul
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
-MESA_MAJOR=3
-MESA_MINOR=3
-MESA_TINY=0
-VERSION=$(MESA_MAJOR).$(MESA_MINOR)
-
-CFLAGS = -I. -DWIN32 -D__WIN32__ -D_WINDOWS \
- -O2 -funroll-loops \
- -fexpensive-optimizations -fomit-frame-pointer -ffast-math \
- -malign-loops=2 -malign-jumps=2 -malign-functions=2 \
- -mwindows
-CC = gcc
-MAKELIB = ar ru
-GLU_LIB = libGLU.a
-
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = ../include
-LIBDIR = ../lib
-
-SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
- polytest.c project.c quadric.c tess.c tesselat.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c -I$(INCDIR) $(CFLAGS) $<
-
-
-
-##### TARGETS #####
-
-# Make the library:
-$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
- $(MAKELIB) $(GLU_LIB) $(MAJOR) $(MINOR) $(TINY) $(OBJECTS) \ No newline at end of file
diff --git a/src/glu/mesa/Makefile.ugl b/src/glu/mesa/Makefile.ugl
deleted file mode 100644
index fc189bd8047..00000000000
--- a/src/glu/mesa/Makefile.ugl
+++ /dev/null
@@ -1,96 +0,0 @@
-# Mesa 3-D graphics library
-# Version: 3.5
-#
-# Copyright (C) 2001 Wind River Systems, Inc
-
-# The MIT License
-# 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
-# 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.
-
-# Makefile for GLU library
-
-##### MACROS #####
-GLU_MAJOR = 1
-GLU_MINOR = 3
-GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
-
-##### RULES #####
-
-include ../rules.windml
-
-GLU_SOURCES = \
- glu.c \
- mipmap.c \
- nurbs.c \
- nurbscrv.c \
- nurbssrf.c \
- nurbsutl.c \
- polytest.c \
- project.c \
- quadric.c \
- tess.c \
- tesselat.c \
- ../src/windml/tornado/torMesaGLUInit.c
-
-GLU_OBJECTS = $(GLU_SOURCES:.c=.o)
-GLU_OBJNAME = $(MESA_LIBDIR)/objMesaGLU.o
-
-SOURCES = $(GLU_SOURCES)
-
-##### TARGETS #####
-
-all: depend.$(CPU)$(TOOL) $(GLU_OBJNAME)
-
-# Make the GLU library
-$(GLU_OBJNAME): $(GLU_OBJECTS)
-# $(LD) -r $(GLU_OBJECTS) -o $(MESA_OBJNAME)
- $(LD) -r $(GLU_OBJECTS) -o $(GLU_OBJNAME)
-# $(AR) rus $(MESA_LIBNAME) $(GLU_OBJNAME)
-# $(AR) rus $(VX_LIBNAME) $(GLU_OBJNAME)
-
-depend.$(CPU)$(TOOL):
-ifeq ($(WIND_HOST_TYPE),x86-win32)
- @ $(RM) $@
- @ $(ECHO) Creating depend.$(CPU)$(TOOL)
-ifneq ($(SOURCES),)
- @ for %f in ($(SOURCES)) do \
- $(CC) -MM $(CFLAGS) %f >>$@
-endif
-else
-Makefile
- @ $(RM) $@
- @ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
-ifneq ($(SOURCES),)
- @ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
- do \
- $(CC) -MM $(CFLAGS) $$FILE \
- | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
- done
-endif
-endif
-
-.PHONY = clean
-
-clean:
-# $(AR) d $(MESA_LIBNAME) $(GLU_OBJNAME)
-# $(AR) d $(VX_LIBNAME) $(GLU_OBJNAME)
- $(RM) $(GLU_OBJNAME)
- $(RM) $(GLU_OBJECTS)
- $(RM) depend.$(CPU)$(TOOL)
-
-include depend.$(CPU)$(TOOL)
diff --git a/src/glu/mesa/MesaGLU.def b/src/glu/mesa/MesaGLU.def
deleted file mode 100644
index 0cdd7bb7875..00000000000
--- a/src/glu/mesa/MesaGLU.def
+++ /dev/null
@@ -1,62 +0,0 @@
-LIBRARY GLU32
-DESCRIPTION 'GLU for Windows Mesa'
-EXETYPE WINDOWS
-CODE MOVEABLE DISCARDABLE
-DATA MOVEABLE SINGLE
-HEAPSIZE 256000
-
-STACKSIZE 4096
-
-EXPORTS
- gluLookAt
- gluOrtho2D
- gluPerspective
- gluPickMatrix
- gluProject
- gluUnProject
- gluErrorString
- gluScaleImage
- gluBuild1DMipmaps
- gluBuild2DMipmaps
- gluNewQuadric
- gluDeleteQuadric
- gluQuadricDrawStyle
- gluQuadricOrientation
- gluQuadricNormals
- gluQuadricTexture
- gluQuadricCallback
- gluCylinder
- gluSphere
- gluDisk
- gluPartialDisk
- gluNewNurbsRenderer
- gluDeleteNurbsRenderer
- gluLoadSamplingMatrices
- gluNurbsProperty
- gluGetNurbsProperty
- gluBeginCurve
- gluEndCurve
- gluNurbsCurve
- gluBeginSurface
- gluEndSurface
- gluNurbsSurface
- gluBeginTrim
- gluEndTrim
- gluPwlCurve
- gluNurbsCallback
- gluNewTess
- gluDeleteTess
-; gluTessBeginPolygon
-; gluTessBeginContour
- gluTessVertex
-; gluTessEndContour
-; gluTessEndPolygon
-; gluTessProperty
-; gluTessNormal
- gluTessCallback
-; gluGetTessProperty
- gluBeginPolygon
- gluNextContour
- gluEndPolygon
- gluGetString
-
diff --git a/src/glu/mesa/README1 b/src/glu/mesa/README1
deleted file mode 100644
index 75968572ff6..00000000000
--- a/src/glu/mesa/README1
+++ /dev/null
@@ -1,195 +0,0 @@
-
-Notes on the GLU polygon tesselation facility implemented by Bogdan Sikorski...
-
-
-
-The tesselation module is provided under the same terms as the Mesa
-package.
-
-This is the first release of polygon tesselation code for Mesa.
-It was written during my very little free time, so lets name it:
-"its not perfect". If someone hates pointers, don't look at the code.
-I preffer dynamic allocation versus static. But _all_ ideas, suggestions,
-bug reports and fixes are welcome (if You want, also flames). I am aware
-that many things could have been written using better techniques, but time
-that I could devote to this library was very limited. It is not well commented,
-excuse me. Also I am thinking of continuing working on this code to improve,
-fix and polish it. And make it as compliant as possible to the OpenGL, so
-software ports from OpenGL to Mesa will work correctly. If You know of any
-differences in behaviour, expected input/output between Mesa tesselation library
-and OpenGL, please send me a note. I explain later on why I am not
-confident with this code.
-
-I tried to be fully compliant with the OpenGL routines. By "tried" I mean that
-up to my knowledge it behaves as OpenGL tesselation routines. Just recently
-I began to experiment with OpenGL (actually only Mesa), and also have
-no access to any machine providing official implementation of OpenGL,
-nor access to books (particulary Addison-Wesley publications). Thus my
-knowledge on how the original tesselation code works, what kind of data
-it expects etc. is based _only_ on the publicly available documentation
-provided by SGI. Namely:
-
-* "The OpenGL Graphics System Utility Library" by K.P.Smith
- (Silicon Graphics, 1992)
-* "The OpenGL Graphics Interface" by M.Segal and K.Akeley
- (Silicon Graphics, 19??)
-* "OpenGL and X, Part 1: Introduction" by M.J.Kilgard
- (Silicon Graphics, 1994)
-* "OpenGL and X, Part 2: Using OpenGL with Xlib" by M.J.Kilgard
- (Silicon Graphics, 1994)
-* "OpenGL Graphics with the X Window System" by P.Karlton
- (Silicon Graphics, 1993)
-* Online Docs - Appendix C of OpenGL Programming Guide, Polygon Tesselation
- (partial text cut and sent by e-mail)
-
-
-The tesselation routines use slightly different prototypes than the ones
-specified in the mentioned above publications. The _only_ differences are
-the enumeration types which are not GLenum, but are GLUenum. So the
-implemented routines have following prototypes:
-
-GLUtringulatorObj *gluNewTess(void);
-
-void gluTessCallback(GLUtriangulatorObj *,GLUenum,void (*)());
- ^^^^^^^
-void gluBeginPolygon(GLUtriangulatorObj *);
-
-void gluTessVertex(GLUtriangulatorObj *,GLdouble [3],void *);
-
-void gluNextContour(GLUtriangulatorObj *,GLUenum);
- ^^^^^^^
-void gluEndPolygon(GLUtriangulatorObj *);
-
-const GLubyte *gluErrorString(GLUenum);
- ^^^^^^^
- prototypes for callback functions:
-
-void <begin>(GLUenum);
- ^^^^^^^
-void <edgeFlag>(GLboolean);
-void <vertex>(void *);
-void <end>(void);
-void <error>(GLUenum);
- ^^^^^^^
-
-The begin callback will be called only with GLU_TRIANGLES. No support
-for traingle fans or strips yet.
-
-In case of errors an internal error variable is set to the appropiate
-error enum values (GLU_TESS_ERROR?). Initially it is set to GLU_NO_ERROR.
-The OpenGL library provides 8 error conditions, the tesselation code
-of Mesa provides 9. They are:
-
-GLU_TESS_ERROR1: missing gluEndPolygon /* same as OpenGL */
-GLU_TESS_ERROR2: missing gluBeginPolygon /* same as OpenGL */
-GLU_TESS_ERROR3: misoriented contour /* not used in Mesa
- in OpenGL is bad orientation or intersecting edges */
-GLU_TESS_ERROR4: vertex/edge intersection /* same as OpenGL */
-GLU_TESS_ERROR5: misoriented or self-intersecting loops /* same as OpenGL */
-GLU_TESS_ERROR6: coincident vertices /* same as OpenGL */
-GLU_TESS_ERROR7: colinear vertices /* OpenGL's illegal data */
-GLU_TESS_ERROR8: intersecting edges /* same as OpenGL */
-GLU_TESS_ERROR9: not coplanar contours /* new for Mesa */
-
-The Mesa tesselation code ignores all data and calls after detecting an error
-codition. This means that a _new_ tesselation object must be used for further
-triangulations. Maybe this is too restrictive, and will be lifted in
-future versions.
-
-The tesselation code completely ignores the type parameter passed in
-gluNextContour. It also doesn't check if the passed parameter is a legal
-enum value - ignores silently (maybe at least this should be checked).
-The reason I chose this behaviour is based on what I read in the
-beforementioned documents. I cite:
-
-"....
-void gluNextContour(GLUtriangulatorObj *tessobj, GLenum type);
-
-Marks the beginning of the next contour when multiple contours make up the
-boundary of the polygon to be tessellated. type can be GLU_EXTERIOR,
-GLU_INTERIOR, GLU_CCW, GLU_CW, or GLU_UNKNOWN. These serve only as
-to the tessellation. If you get them right, the tessellation might
-go faster. If you get them wrong, they're ignored, and the tesselation still
-works.
-....."
-
-I hope You agree with me that my decision was correct. Mesa tesselation
-_always_ checks by itself the interrelations between contours. Just as if
-all contours were specified with the type GLU_UNKNOWN.
-
-One of OpenGL's policy is not to check all error conditions - rely sometimes
-that the user "got things right". This is justified, since exhausting
-error checking is timeconsuming, and would significantly slow down
-a correct application. The Mesa tesselation code assumes only _one_ condition
-when triangulating - all vertices in a contour are planar. This is _not_
-checked for correctness. Trying to tesselate such objects will lead to
-unpredictable output.
-
-And now we arrive to the moment where I would like to list the required
-(but checked for) conditions for triangulation, as well as summarize the
-library:
-
-* all contours in a single tesselation cycle _must_ be coplanar - if not
- an error is raised (and if provided a call to the error callback
- is made)
-* the contours can be passed in _any_ order, exteriors and holes can be
- intermixed within a tesselation cycle and the correct hierarchy
- will be determined by the library; thus specifying first holes then
- exteriors, then holes within holes form a valid input.
-* a hole within a hole is consider to be a yet another exterior contour
-* multiple exterior contours (polygons) can be tesselated in one cycle;
- _but_ this significantly degrades performance since many tests will be
- performed for every contour pair; if You want triangulation to be fast
- tesselate a single polygon (with possible holes) one at a time.
-* orientation of exterior contours is arbitray, but if it has holes,
- all interior holes of this particular exterior contour _must_ have an
- opposite orientation.
-* the output triangles have the same orientation as the exterior contour
- that forms them
-* each triangle is "enclosed" within the begin and end callbacks;
- this is not efficent, but was made on purpose; so if triangulation
- results in 2 triangles the following callbacks will be made in such
- order:
- <begin>(GLU_TRAINGLES)
- <vertex>(...) /* 3 vertices of first triangle */
- <vertex>(...)
- <vertex>(...)
- <end>()
- <begin>(GLU_TRAINGLES)
- <vertex>(...) /* 3 vertices of second triangle */
- <vertex>(...)
- <vertex>(...)
- <end>()
- Of course only when begin, vertex, and end callback were provided,
- otherwise no output is done (actually tesselation does not take place).
-* You will notice that some output traingles are very "thin"; there
- exist possible several ways to traingulate a polygon, but "smart" code
- avoiding such cases would require time to write, and will impact on
- execution speed.
-* like OpenGL, no new vertices are introduced during triangulation
-* if the edgeflag callback is provided it will be called whenever
- the just-about-to be output vertex begins a different type of edge
- than the previous vertices; always before the first output a call
- is made with GL_TRUE, to allow synchronization.
-* all intermediate computations are done using GLdouble type, and comparisons
- are biased with a precision value (EPSILON defined in tess.h)
-* the point_in_poly function is my adaptation of code from the
- comp.graphics.alg newsgroup FAQ (originally written by Mr. Wm. Randolph
- Franklin, modified by Scott Anguish).
-* the edge_edge_intersect test is also an adopted code from comp.graphics.alg
- newsgroup FAQ
-* the general idea for traingulation used in this library is described in
- the book "Computational Geometry in C" by Joseph O'Rourke.
-
-
-Excuse my English, its not my mother tongue. I should be available for some
-time uner the following e-mail address. But For how long I am not certain.
-Once I am settled in my new place, I'll post on the Mesa mailing list
-my new address.
-
-(PS: today is my last day of work here, I'm changing my job).
-
-Bogdan. ( bogdan@dia.unisa.it )
-
-Apr 28, 1995.
-
diff --git a/src/glu/mesa/README2 b/src/glu/mesa/README2
deleted file mode 100644
index 3c9959179b0..00000000000
--- a/src/glu/mesa/README2
+++ /dev/null
@@ -1,43 +0,0 @@
-The current NURBS implementation has no trimming facilities yet.
-
-The code is not well commented.
-
-1) Normal calculus fails for special cases of NURBS (independent
- of the NURBS modules)
- Those cases arise when for u or v, some control points
- for a fixed value of that parameter form the same point.
- Imagine a Bezier patch degenerated into a "triangle".
-
- v ^ 0,1,2 order=3
- | *
- |
- | 3* 4* 5*
- |
- | 6* 7* 8*
- |
- |
- +------------------------> u
-
- The calculus of du derivative at triple point (0,1 and 2) will fail.
- As a result, the normal vector will be 0.
- The eval2.c code has to be changed to handle the above situation.
-
-2) Adjacent NURBS surfaces ("sharing" the same control points along
- the "joining" edge) will be sampled with the same factor.
- This prevents the formation of "cracks".
- When the control polygon of the "shared" edge is not the same,
- cracks might appear.
-
-The sampling tolerance is sometimes not respected!
-A NURBS object is broken into Bezier curves/surfaces. If one of such
-Bezier objects has a local high curvature with other portions of it
-relatively flat then the high curvature part will be sampled more dense that
-its flatter regions.
-The flat regions might be tesselated into quads having sides of length
-greater than the current sampling tolernace setting.
-I believe such behaviour is acceptable, though not along the concept of
-sampling tolerance.
-
-February 20, 1996.
-
-Bogdan.
diff --git a/src/glu/mesa/all.h b/src/glu/mesa/all.h
deleted file mode 100644
index 874c9359254..00000000000
--- a/src/glu/mesa/all.h
+++ /dev/null
@@ -1,54 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file includes all .h files needed for the GLU source code for
- * the purpose of precompiled headers.
- *
- * If the preprocessor symbol PCH is defined at compile time then each
- * of the .c files will #include "all.h" only, instead of a bunch of
- * individual .h files.
- */
-
-
-#ifndef GLU_ALL_H
-#define GLU_ALL_H
-
-
-#ifndef PC_HEADER
-This is an error. all.h should be included only if PCH is defined.
-#endif
-
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "GL/gl.h"
-#include "GL/glu.h"
-#include "gluP.h"
-#include "nurbs.h"
-#include "tess.h"
-
-
-#endif /*GLU_ALL_H */
diff --git a/src/glu/mesa/descrip.mms b/src/glu/mesa/descrip.mms
deleted file mode 100644
index 2b3f64d8bcc..00000000000
--- a/src/glu/mesa/descrip.mms
+++ /dev/null
@@ -1,61 +0,0 @@
-# Makefile for GLU for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-
-.first
- define gl [-.include.gl]
-
-.include [-]mms-config.
-
-##### MACROS #####
-
-VPATH = RCS
-
-INCDIR = $disk2:[-.include]
-LIBDIR = [-.lib]
-CFLAGS = /include=$(INCDIR)/define=(FBIND=1)/name=(as_is,short)/float=ieee/ieee=denorm
-
-SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
- polytest.c project.c quadric.c tess.c tesselat.c
-
-OBJECTS =glu.obj,mipmap.obj,nurbs.obj,nurbscrv.obj,nurbssrf.obj,nurbsutl.obj,\
- polytest.obj,project.obj,quadric.obj,tess.obj,tesselat.obj
-
-
-##### RULES #####
-
-VERSION=MesaGlu V3.2
-
-##### TARGETS #####
-
-# Make the library:
-$(LIBDIR)$(GLU_LIB) : $(OBJECTS)
-.ifdef SHARE
- @ WRITE_ SYS$OUTPUT " generating mesagl1.opt"
- @ OPEN_/WRITE FILE mesagl1.opt
- @ WRITE_ FILE "!"
- @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)"
- @ WRITE_ FILE "!"
- @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)"""
- @ WRITE_ FILE "GSMATCH=LEQUAL,3,2
- @ WRITE_ FILE "$(OBJECTS)"
- @ WRITE_ FILE "[-.lib]libmesagl.exe/SHARE"
- @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE"
- @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE"
- @ CLOSE_ FILE
- @ WRITE_ SYS$OUTPUT " generating mesagl.map ..."
- @ LINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT
- @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..."
- @ @[-.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt
- @ WRITE_ SYS$OUTPUT " linking $(GLU_LIB) ..."
- @ LINK_/noinform/NODEB/SHARE=$(GLU_LIB)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt
-.else
- @ $(MAKELIB) $(GLU_LIB) $(OBJECTS)
-.endif
- @ rename $(GLU_LIB)* $(LIBDIR)
-
-clean :
- delete *.obj;*
- purge
-
-include mms_depend.
-
diff --git a/src/glu/mesa/glu.c b/src/glu/mesa/glu.c
deleted file mode 100644
index f9e33980a4e..00000000000
--- a/src/glu/mesa/glu.c
+++ /dev/null
@@ -1,416 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- * Copyright (C) 1995-2001 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gluP.h"
-#endif
-
-
-/*
- * Miscellaneous utility functions
- */
-
-
-#ifndef M_PI
-#define M_PI 3.1415926536
-#endif
-#define EPS 0.00001
-
-#ifndef GLU_INCOMPATIBLE_GL_VERSION
-#define GLU_INCOMPATIBLE_GL_VERSION 100903
-#endif
-
-
-void GLAPIENTRY
-gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez,
- GLdouble centerx, GLdouble centery, GLdouble centerz,
- GLdouble upx, GLdouble upy, GLdouble upz)
-{
- GLdouble m[16];
- GLdouble x[3], y[3], z[3];
- GLdouble mag;
-
- /* Make rotation matrix */
-
- /* Z vector */
- z[0] = eyex - centerx;
- z[1] = eyey - centery;
- z[2] = eyez - centerz;
- mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
- if (mag) { /* mpichler, 19950515 */
- z[0] /= mag;
- z[1] /= mag;
- z[2] /= mag;
- }
-
- /* Y vector */
- y[0] = upx;
- y[1] = upy;
- y[2] = upz;
-
- /* X vector = Y cross Z */
- x[0] = y[1] * z[2] - y[2] * z[1];
- x[1] = -y[0] * z[2] + y[2] * z[0];
- x[2] = y[0] * z[1] - y[1] * z[0];
-
- /* Recompute Y = Z cross X */
- y[0] = z[1] * x[2] - z[2] * x[1];
- y[1] = -z[0] * x[2] + z[2] * x[0];
- y[2] = z[0] * x[1] - z[1] * x[0];
-
- /* mpichler, 19950515 */
- /* cross product gives area of parallelogram, which is < 1.0 for
- * non-perpendicular unit-length vectors; so normalize x, y here
- */
-
- mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
- if (mag) {
- x[0] /= mag;
- x[1] /= mag;
- x[2] /= mag;
- }
-
- mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
- if (mag) {
- y[0] /= mag;
- y[1] /= mag;
- y[2] /= mag;
- }
-
-#define M(row,col) m[col*4+row]
- M(0, 0) = x[0];
- M(0, 1) = x[1];
- M(0, 2) = x[2];
- M(0, 3) = 0.0;
- M(1, 0) = y[0];
- M(1, 1) = y[1];
- M(1, 2) = y[2];
- M(1, 3) = 0.0;
- M(2, 0) = z[0];
- M(2, 1) = z[1];
- M(2, 2) = z[2];
- M(2, 3) = 0.0;
- M(3, 0) = 0.0;
- M(3, 1) = 0.0;
- M(3, 2) = 0.0;
- M(3, 3) = 1.0;
-#undef M
- glMultMatrixd(m);
-
- /* Translate Eye to Origin */
- glTranslated(-eyex, -eyey, -eyez);
-
-}
-
-
-
-void GLAPIENTRY
-gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)
-{
- glOrtho(left, right, bottom, top, -1.0, 1.0);
-}
-
-
-
-static void
-frustum(GLdouble left, GLdouble right,
- GLdouble bottom, GLdouble top,
- GLdouble nearval, GLdouble farval)
-{
- GLdouble x, y, a, b, c, d;
- GLdouble m[16];
-
- x = (2.0 * nearval) / (right - left);
- y = (2.0 * nearval) / (top - bottom);
- a = (right + left) / (right - left);
- b = (top + bottom) / (top - bottom);
- c = -(farval + nearval) / ( farval - nearval);
- d = -(2.0 * farval * nearval) / (farval - nearval);
-
-#define M(row,col) m[col*4+row]
- M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F;
- M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F;
- M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d;
- M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F;
-#undef M
-
- glMultMatrixd(m);
-}
-
-
-void GLAPIENTRY
-gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
-{
- GLdouble xmin, xmax, ymin, ymax;
-
- ymax = zNear * tan(fovy * M_PI / 360.0);
- ymin = -ymax;
- xmin = ymin * aspect;
- xmax = ymax * aspect;
-
- /* don't call glFrustum() because of error semantics (covglu) */
- frustum(xmin, xmax, ymin, ymax, zNear, zFar);
-}
-
-
-
-void GLAPIENTRY
-gluPickMatrix(GLdouble x, GLdouble y,
- GLdouble width, GLdouble height, GLint viewport[4])
-{
- GLfloat m[16];
- GLfloat sx, sy;
- GLfloat tx, ty;
-
- sx = viewport[2] / width;
- sy = viewport[3] / height;
- tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
- ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
-
-#define M(row,col) m[col*4+row]
- M(0, 0) = sx;
- M(0, 1) = 0.0;
- M(0, 2) = 0.0;
- M(0, 3) = tx;
- M(1, 0) = 0.0;
- M(1, 1) = sy;
- M(1, 2) = 0.0;
- M(1, 3) = ty;
- M(2, 0) = 0.0;
- M(2, 1) = 0.0;
- M(2, 2) = 1.0;
- M(2, 3) = 0.0;
- M(3, 0) = 0.0;
- M(3, 1) = 0.0;
- M(3, 2) = 0.0;
- M(3, 3) = 1.0;
-#undef M
-
- glMultMatrixf(m);
-}
-
-
-
-const GLubyte *GLAPIENTRY
-gluErrorString(GLenum errorCode)
-{
- static char *tess_error[] = {
- "missing gluBeginPolygon",
- "missing gluBeginContour",
- "missing gluEndPolygon",
- "missing gluEndContour",
- "misoriented or self-intersecting loops",
- "coincident vertices",
- "colinear vertices",
- "FIST recovery process fatal error"
- };
- static char *nurbs_error[] = {
- "spline order un-supported",
- "too few knots",
- "valid knot range is empty",
- "decreasing knot sequence knot",
- "knot multiplicity greater than order of spline",
- "endcurve() must follow bgncurve()",
- "bgncurve() must precede endcurve()",
- "missing or extra geometric data",
- "can't draw pwlcurves",
- "missing bgncurve()",
- "missing bgnsurface()",
- "endtrim() must precede endsurface()",
- "bgnsurface() must precede endsurface()",
- "curve of improper type passed as trim curve",
- "bgnsurface() must precede bgntrim()",
- "endtrim() must follow bgntrim()",
- "bgntrim() must precede endtrim()",
- "invalid or missing trim curve",
- "bgntrim() must precede pwlcurve()",
- "pwlcurve referenced twice",
- "pwlcurve and nurbscurve mixed",
- "improper usage of trim data type",
- "nurbscurve referenced twice",
- "nurbscurve and pwlcurve mixed",
- "nurbssurface referenced twice",
- "invalid property",
- "endsurface() must follow bgnsurface()",
- "misoriented trim curves",
- "intersecting trim curves",
- "UNUSED",
- "unconnected trim curves",
- "unknown knot error",
- "negative vertex count encountered",
- "negative byte-stride encountered",
- "unknown type descriptor",
- "null control array or knot vector",
- "duplicate point on pwlcurve"
- };
-
- /* GL Errors */
- if (errorCode == GL_NO_ERROR) {
- return (GLubyte *) "no error";
- }
- else if (errorCode == GL_INVALID_VALUE) {
- return (GLubyte *) "invalid value";
- }
- else if (errorCode == GL_INVALID_ENUM) {
- return (GLubyte *) "invalid enum";
- }
- else if (errorCode == GL_INVALID_OPERATION) {
- return (GLubyte *) "invalid operation";
- }
- else if (errorCode == GL_STACK_OVERFLOW) {
- return (GLubyte *) "stack overflow";
- }
- else if (errorCode == GL_STACK_UNDERFLOW) {
- return (GLubyte *) "stack underflow";
- }
- else if (errorCode == GL_OUT_OF_MEMORY) {
- return (GLubyte *) "out of memory";
- }
- /* GLU Errors */
- else if (errorCode == GLU_NO_ERROR) {
- return (GLubyte *) "no error";
- }
- else if (errorCode == GLU_INVALID_ENUM) {
- return (GLubyte *) "invalid enum";
- }
- else if (errorCode == GLU_INVALID_VALUE) {
- return (GLubyte *) "invalid value";
- }
- else if (errorCode == GLU_OUT_OF_MEMORY) {
- return (GLubyte *) "out of memory";
- }
- else if (errorCode == GLU_INCOMPATIBLE_GL_VERSION) {
- return (GLubyte *) "incompatible GL version";
- }
- else if (errorCode >= GLU_TESS_ERROR1 && errorCode <= GLU_TESS_ERROR8) {
- return (GLubyte *) tess_error[errorCode - GLU_TESS_ERROR1];
- }
- else if (errorCode >= GLU_NURBS_ERROR1 && errorCode <= GLU_NURBS_ERROR37) {
- return (GLubyte *) nurbs_error[errorCode - GLU_NURBS_ERROR1];
- }
- else {
- return NULL;
- }
-}
-
-
-
-/*
- * New in GLU 1.1
- */
-
-const GLubyte *GLAPIENTRY
-gluGetString(GLenum name)
-{
- static char *extensions = "GL_EXT_abgr";
- static char *version = "1.1 Mesa 3.5";
-
- switch (name) {
- case GLU_EXTENSIONS:
- return (GLubyte *) extensions;
- case GLU_VERSION:
- return (GLubyte *) version;
- default:
- return NULL;
- }
-}
-
-
-
-#if 0 /* gluGetProcAddressEXT not finalized yet! */
-
-#ifdef __cplusplus
- /* for BeOS R4.5 */
-void GLAPIENTRY(*gluGetProcAddressEXT(const GLubyte * procName)) (...)
-#else
-void (GLAPIENTRY * gluGetProcAddressEXT(const GLubyte * procName)) ()
-#endif
-{
- struct proc
- {
- const char *name;
- void *address;
- };
- static struct proc procTable[] = {
- {"gluGetProcAddressEXT", (void *) gluGetProcAddressEXT}, /* me! */
-
- /* new 1.1 functions */
- {"gluGetString", (void *) gluGetString},
-
- /* new 1.2 functions */
- {"gluTessBeginPolygon", (void *) gluTessBeginPolygon},
- {"gluTessBeginContour", (void *) gluTessBeginContour},
- {"gluTessEndContour", (void *) gluTessEndContour},
- {"gluTessEndPolygon", (void *) gluTessEndPolygon},
- {"gluGetTessProperty", (void *) gluGetTessProperty},
-
- /* new 1.3 functions */
-
- {NULL, NULL}
- };
- GLuint i;
-
- for (i = 0; procTable[i].address; i++) {
- if (strcmp((const char *) procName, procTable[i].name) == 0)
- return (void (GLAPIENTRY *) ()) procTable[i].address;
- }
-
- return NULL;
-}
-
-#endif
-
-
-
-/*
- * New in GLU 1.3
- */
-#ifdef GLU_VERSION_1_3
-GLboolean GLAPIENTRY
-gluCheckExtension(const GLubyte *extName, const GLubyte * extString)
-{
- assert(extName);
- assert(extString);
- {
- const int len = strlen((const char *) extName);
- const char *start = (const char *) extString;
-
- while (1) {
- const char *c = strstr(start, (const char *) extName);
- if (!c)
- return GL_FALSE;
-
- if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0))
- return GL_TRUE;
-
- start = c + len;
- }
- }
-}
-#endif
diff --git a/src/glu/mesa/gluP.h b/src/glu/mesa/gluP.h
deleted file mode 100644
index dc1b05b6a1b..00000000000
--- a/src/glu/mesa/gluP.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- * Copyright (C) 1995-2004 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file allows the GLU code to be compiled either with the Mesa
- * headers or with the real OpenGL headers.
- */
-
-
-#ifndef GLUP_H
-#define GLUP_H
-
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <string.h>
-
-
-#if defined(_WIN32) && !defined(__WIN32__)
-# define __WIN32__
-#endif
-
-#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__))
-# pragma warning( disable : 4068 ) /* unknown pragma */
-# pragma warning( disable : 4710 ) /* function 'foo' not inlined */
-# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
-# pragma warning( disable : 4127 ) /* conditional expression is constant */
-# if defined(MESA_MINWARN)
-# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
-# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
-# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
-# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
-# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
-# endif
-# define GLCALLBACK __stdcall
-# if defined(__CYGWIN__)
-# define GLCALLBACKPCAST *
-# else
-# define GLCALLBACKPCAST __stdcall *
-# endif
-#else
-/* non-Windows compilation */
-# define GLCALLBACK
-# define GLCALLBACKPCAST *
-#endif /* WIN32 / CYGWIN bracket */
-
-/* compatability guard so we don't need to change client code */
-
-#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP)
-# define CALLBACK GLCALLBACK
-#endif
-
-
-
-#ifndef GLU_TESS_ERROR9
- /* If we're using the real OpenGL header files... */
-# define GLU_TESS_ERROR9 100159
-#endif
-
-
-#define GLU_NO_ERROR GL_NO_ERROR
-
-
-/* for Sun: */
-#ifdef SUNOS4
-#define MEMCPY( DST, SRC, BYTES) \
- memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) )
-#else
-#define MEMCPY( DST, SRC, BYTES) \
- memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) )
-#endif
-
-
-#ifndef NULL
-# define NULL 0
-#endif
-
-
-#endif
diff --git a/src/glu/mesa/mipmap.c b/src/glu/mesa/mipmap.c
deleted file mode 100644
index d85ce9b9b0a..00000000000
--- a/src/glu/mesa/mipmap.c
+++ /dev/null
@@ -1,824 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.4
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gluP.h"
-#endif
-
-
-/*
- * Compute ceiling of integer quotient of A divided by B:
- */
-#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
-
-#ifdef EPSILON
-#undef EPSILON
-#endif
-#define EPSILON 0.001
-
-
-/* To work around optimizer bug in MSVC4.1 */
-#if defined(__WIN32__) && !defined(OPENSTEP)
-void
-dummy(GLuint j, GLuint k)
-{
-}
-#else
-#define dummy(J, K)
-#endif
-
-
-GLint GLAPIENTRY
-gluScaleImage(GLenum format,
- GLsizei widthin, GLsizei heightin,
- GLenum typein, const void *datain,
- GLsizei widthout, GLsizei heightout,
- GLenum typeout, void *dataout)
-{
- GLint components, i, j, k;
- GLfloat *tempin, *tempout;
- GLfloat sx, sy;
- GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels;
- GLint packrowlength, packalignment, packskiprows, packskippixels;
- GLint sizein, sizeout;
- GLint rowstride, rowlen;
-
-
- /* Determine number of components per pixel */
- switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- components = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- components = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- components = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
-#ifdef GL_EXT_abgr
- case GL_ABGR_EXT:
-#endif
- components = 4;
- break;
- default:
- return GLU_INVALID_ENUM;
- }
-
- /* Determine bytes per input datum */
- switch (typein) {
- case GL_UNSIGNED_BYTE:
- sizein = sizeof(GLubyte);
- break;
- case GL_BYTE:
- sizein = sizeof(GLbyte);
- break;
- case GL_UNSIGNED_SHORT:
- sizein = sizeof(GLushort);
- break;
- case GL_SHORT:
- sizein = sizeof(GLshort);
- break;
- case GL_UNSIGNED_INT:
- sizein = sizeof(GLuint);
- break;
- case GL_INT:
- sizein = sizeof(GLint);
- break;
- case GL_FLOAT:
- sizein = sizeof(GLfloat);
- break;
- case GL_BITMAP:
- /* not implemented yet */
- default:
- return GL_INVALID_ENUM;
- }
-
- /* Determine bytes per output datum */
- switch (typeout) {
- case GL_UNSIGNED_BYTE:
- sizeout = sizeof(GLubyte);
- break;
- case GL_BYTE:
- sizeout = sizeof(GLbyte);
- break;
- case GL_UNSIGNED_SHORT:
- sizeout = sizeof(GLushort);
- break;
- case GL_SHORT:
- sizeout = sizeof(GLshort);
- break;
- case GL_UNSIGNED_INT:
- sizeout = sizeof(GLuint);
- break;
- case GL_INT:
- sizeout = sizeof(GLint);
- break;
- case GL_FLOAT:
- sizeout = sizeof(GLfloat);
- break;
- case GL_BITMAP:
- /* not implemented yet */
- default:
- return GL_INVALID_ENUM;
- }
-
- /* Get glPixelStore state */
- glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpackrowlength);
- glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackalignment);
- glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpackskiprows);
- glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpackskippixels);
- glGetIntegerv(GL_PACK_ROW_LENGTH, &packrowlength);
- glGetIntegerv(GL_PACK_ALIGNMENT, &packalignment);
- glGetIntegerv(GL_PACK_SKIP_ROWS, &packskiprows);
- glGetIntegerv(GL_PACK_SKIP_PIXELS, &packskippixels);
-
- /* Allocate storage for intermediate images */
- tempin = (GLfloat *) malloc(widthin * heightin
- * components * sizeof(GLfloat));
- if (!tempin) {
- return GLU_OUT_OF_MEMORY;
- }
- tempout = (GLfloat *) malloc(widthout * heightout
- * components * sizeof(GLfloat));
- if (!tempout) {
- free(tempin);
- return GLU_OUT_OF_MEMORY;
- }
-
-
- /*
- * Unpack the pixel data and convert to floating point
- */
-
- if (unpackrowlength > 0) {
- rowlen = unpackrowlength;
- }
- else {
- rowlen = widthin;
- }
- if (sizein >= unpackalignment) {
- rowstride = components * rowlen;
- }
- else {
- rowstride = unpackalignment / sizein
- * CEILING(components * rowlen * sizein, unpackalignment);
- }
-
- switch (typein) {
- case GL_UNSIGNED_BYTE:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLubyte *ubptr = (GLubyte *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * ubptr++;
- }
- }
- break;
- case GL_BYTE:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLbyte *bptr = (GLbyte *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * bptr++;
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLushort *usptr = (GLushort *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * usptr++;
- }
- }
- break;
- case GL_SHORT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLshort *sptr = (GLshort *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * sptr++;
- }
- }
- break;
- case GL_UNSIGNED_INT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLuint *uiptr = (GLuint *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * uiptr++;
- }
- }
- break;
- case GL_INT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLint *iptr = (GLint *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * iptr++;
- }
- }
- break;
- case GL_FLOAT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLfloat *fptr = (GLfloat *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = *fptr++;
- }
- }
- break;
- default:
- return GLU_INVALID_ENUM;
- }
-
-
- /*
- * Scale the image!
- */
-
- if (widthout > 1)
- sx = (GLfloat) (widthin - 1) / (GLfloat) (widthout - 1);
- else
- sx = (GLfloat) (widthin - 1);
- if (heightout > 1)
- sy = (GLfloat) (heightin - 1) / (GLfloat) (heightout - 1);
- else
- sy = (GLfloat) (heightin - 1);
-
-/*#define POINT_SAMPLE*/
-#ifdef POINT_SAMPLE
- for (i = 0; i < heightout; i++) {
- GLint ii = i * sy;
- for (j = 0; j < widthout; j++) {
- GLint jj = j * sx;
-
- GLfloat *src = tempin + (ii * widthin + jj) * components;
- GLfloat *dst = tempout + (i * widthout + j) * components;
-
- for (k = 0; k < components; k++) {
- *dst++ = *src++;
- }
- }
- }
-#else
- if (sx < 1.0 && sy < 1.0) {
- /* magnify both width and height: use weighted sample of 4 pixels */
- GLint i0, i1, j0, j1;
- GLfloat alpha, beta;
- GLfloat *src00, *src01, *src10, *src11;
- GLfloat s1, s2;
- GLfloat *dst;
-
- for (i = 0; i < heightout; i++) {
- i0 = i * sy;
- i1 = i0 + 1;
- if (i1 >= heightin)
- i1 = heightin - 1;
-/* i1 = (i+1) * sy - EPSILON;*/
- alpha = i * sy - i0;
- for (j = 0; j < widthout; j++) {
- j0 = j * sx;
- j1 = j0 + 1;
- if (j1 >= widthin)
- j1 = widthin - 1;
-/* j1 = (j+1) * sx - EPSILON; */
- beta = j * sx - j0;
-
- /* compute weighted average of pixels in rect (i0,j0)-(i1,j1) */
- src00 = tempin + (i0 * widthin + j0) * components;
- src01 = tempin + (i0 * widthin + j1) * components;
- src10 = tempin + (i1 * widthin + j0) * components;
- src11 = tempin + (i1 * widthin + j1) * components;
-
- dst = tempout + (i * widthout + j) * components;
-
- for (k = 0; k < components; k++) {
- s1 = *src00++ * (1.0 - beta) + *src01++ * beta;
- s2 = *src10++ * (1.0 - beta) + *src11++ * beta;
- *dst++ = s1 * (1.0 - alpha) + s2 * alpha;
- }
- }
- }
- }
- else {
- /* shrink width and/or height: use an unweighted box filter */
- GLint i0, i1;
- GLint j0, j1;
- GLint ii, jj;
- GLfloat sum, *dst;
-
- for (i = 0; i < heightout; i++) {
- i0 = i * sy;
- i1 = i0 + 1;
- if (i1 >= heightin)
- i1 = heightin - 1;
-/* i1 = (i+1) * sy - EPSILON; */
- for (j = 0; j < widthout; j++) {
- j0 = j * sx;
- j1 = j0 + 1;
- if (j1 >= widthin)
- j1 = widthin - 1;
-/* j1 = (j+1) * sx - EPSILON; */
-
- dst = tempout + (i * widthout + j) * components;
-
- /* compute average of pixels in the rectangle (i0,j0)-(i1,j1) */
- for (k = 0; k < components; k++) {
- sum = 0.0;
- for (ii = i0; ii <= i1; ii++) {
- for (jj = j0; jj <= j1; jj++) {
- sum += *(tempin + (ii * widthin + jj) * components + k);
- }
- }
- sum /= (j1 - j0 + 1) * (i1 - i0 + 1);
- *dst++ = sum;
- }
- }
- }
- }
-#endif
-
-
- /*
- * Return output image
- */
-
- if (packrowlength > 0) {
- rowlen = packrowlength;
- }
- else {
- rowlen = widthout;
- }
- if (sizeout >= packalignment) {
- rowstride = components * rowlen;
- }
- else {
- rowstride = packalignment / sizeout
- * CEILING(components * rowlen * sizeout, packalignment);
- }
-
- switch (typeout) {
- case GL_UNSIGNED_BYTE:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLubyte *ubptr = (GLubyte *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *ubptr++ = (GLubyte) tempout[k++];
- }
- }
- break;
- case GL_BYTE:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLbyte *bptr = (GLbyte *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *bptr++ = (GLbyte) tempout[k++];
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLushort *usptr = (GLushort *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *usptr++ = (GLushort) tempout[k++];
- }
- }
- break;
- case GL_SHORT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLshort *sptr = (GLshort *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *sptr++ = (GLshort) tempout[k++];
- }
- }
- break;
- case GL_UNSIGNED_INT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLuint *uiptr = (GLuint *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *uiptr++ = (GLuint) tempout[k++];
- }
- }
- break;
- case GL_INT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLint *iptr = (GLint *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *iptr++ = (GLint) tempout[k++];
- }
- }
- break;
- case GL_FLOAT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLfloat *fptr = (GLfloat *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *fptr++ = tempout[k++];
- }
- }
- break;
- default:
- return GLU_INVALID_ENUM;
- }
-
-
- /* free temporary image storage */
- free(tempin);
- free(tempout);
-
- return 0;
-}
-
-
-
-/*
- * Return the largest k such that 2^k <= n.
- */
-static GLint
-ilog2(GLint n)
-{
- GLint k;
-
- if (n <= 0)
- return 0;
- for (k = 0; n >>= 1; k++);
- return k;
-}
-
-
-
-/*
- * Find the value nearest to n which is also a power of two.
- */
-static GLint
-round2(GLint n)
-{
- GLint m;
-
- for (m = 1; m < n; m *= 2);
-
- /* m>=n */
- if (m - n <= n - m / 2) {
- return m;
- }
- else {
- return m / 2;
- }
-}
-
-
-/*
- * Given an pixel format and datatype, return the number of bytes to
- * store one pixel.
- */
-static GLint
-bytes_per_pixel(GLenum format, GLenum type)
-{
- GLint n, m;
-
- switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- n = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- n = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- n = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
-#ifdef GL_EXT_abgr
- case GL_ABGR_EXT:
-#endif
- n = 4;
- break;
- default:
- n = 0;
- }
-
- switch (type) {
- case GL_UNSIGNED_BYTE:
- m = sizeof(GLubyte);
- break;
- case GL_BYTE:
- m = sizeof(GLbyte);
- break;
- case GL_BITMAP:
- m = 1;
- break;
- case GL_UNSIGNED_SHORT:
- m = sizeof(GLushort);
- break;
- case GL_SHORT:
- m = sizeof(GLshort);
- break;
- case GL_UNSIGNED_INT:
- m = sizeof(GLuint);
- break;
- case GL_INT:
- m = sizeof(GLint);
- break;
- case GL_FLOAT:
- m = sizeof(GLfloat);
- break;
- default:
- m = 0;
- }
-
- return n * m;
-}
-
-
-
-/*
- * WARNING: This function isn't finished and has never been tested!!!!
- */
-GLint GLAPIENTRY
-gluBuild1DMipmaps(GLenum target, GLint components,
- GLsizei width, GLenum format, GLenum type, const void *data)
-{
- GLubyte *texture;
- GLint levels, max_levels;
- GLint new_width, max_width;
- GLint i, j, k, l;
-
- if (width < 1)
- return GLU_INVALID_VALUE;
-
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_width);
- max_levels = ilog2(max_width) + 1;
-
- /* Compute how many mipmap images to make */
- levels = ilog2(width) + 1;
- if (levels > max_levels) {
- levels = max_levels;
- }
-
- new_width = 1 << (levels - 1);
-
- texture = (GLubyte *) malloc(new_width * components);
- if (!texture) {
- return GLU_OUT_OF_MEMORY;
- }
-
- if (width != new_width) {
- /* initial rescaling */
- switch (type) {
- case GL_UNSIGNED_BYTE:
- {
- GLubyte *ub_data = (GLubyte *) data;
- for (i = 0; i < new_width; i++) {
- j = i * width / new_width;
- for (k = 0; k < components; k++) {
- texture[i * components + k] = ub_data[j * components + k];
- }
- }
- }
- break;
- default:
- /* Not implemented */
- return GLU_ERROR;
- }
- }
-
- /* generate and load mipmap images */
- for (l = 0; l < levels; l++) {
- glTexImage1D(GL_TEXTURE_1D, l, components, new_width, 0,
- format, GL_UNSIGNED_BYTE, texture);
-
- /* Scale image down to 1/2 size */
- new_width = new_width / 2;
- for (i = 0; i < new_width; i++) {
- for (k = 0; k < components; k++) {
- GLint sample1, sample2;
- sample1 = (GLint) texture[i * 2 * components + k];
- sample2 = (GLint) texture[(i * 2 + 1) * components + k];
- texture[i * components + k] = (GLubyte) ((sample1 + sample2) / 2);
- }
- }
- }
-
- free(texture);
-
- return 0;
-}
-
-
-
-GLint GLAPIENTRY
-gluBuild2DMipmaps(GLenum target, GLint components,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const void *data)
-{
- GLint w, h, maxsize;
- void *image, *newimage;
- GLint neww, newh, level, bpp;
- int error;
- GLboolean done;
- GLint retval = 0;
- GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels;
- GLint packrowlength, packalignment, packskiprows, packskippixels;
-
- if (width < 1 || height < 1)
- return GLU_INVALID_VALUE;
-
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
-
- w = round2(width);
- if (w > maxsize) {
- w = maxsize;
- }
- h = round2(height);
- if (h > maxsize) {
- h = maxsize;
- }
-
- bpp = bytes_per_pixel(format, type);
- if (bpp == 0) {
- /* probably a bad format or type enum */
- return GLU_INVALID_ENUM;
- }
-
- /* Get current glPixelStore values */
- glGetIntegerv(GL_UNPACK_ROW_LENGTH, &unpackrowlength);
- glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpackalignment);
- glGetIntegerv(GL_UNPACK_SKIP_ROWS, &unpackskiprows);
- glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &unpackskippixels);
- glGetIntegerv(GL_PACK_ROW_LENGTH, &packrowlength);
- glGetIntegerv(GL_PACK_ALIGNMENT, &packalignment);
- glGetIntegerv(GL_PACK_SKIP_ROWS, &packskiprows);
- glGetIntegerv(GL_PACK_SKIP_PIXELS, &packskippixels);
-
- /* set pixel packing */
- glPixelStorei(GL_PACK_ROW_LENGTH, 0);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_SKIP_ROWS, 0);
- glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
-
- done = GL_FALSE;
-
- if (w != width || h != height) {
- /* must rescale image to get "top" mipmap texture image */
- image = malloc((w + 4) * h * bpp);
- if (!image) {
- return GLU_OUT_OF_MEMORY;
- }
- error = gluScaleImage(format, width, height, type, data,
- w, h, type, image);
- if (error) {
- retval = error;
- done = GL_TRUE;
- }
- }
- else {
- image = (void *) data;
- }
-
- level = 0;
- while (!done) {
- if (image != data) {
- /* set pixel unpacking */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- }
-
- glTexImage2D(target, level, components, w, h, 0, format, type, image);
-
- if (w == 1 && h == 1)
- break;
-
- neww = (w < 2) ? 1 : w / 2;
- newh = (h < 2) ? 1 : h / 2;
- newimage = malloc((neww + 4) * newh * bpp);
- if (!newimage) {
- return GLU_OUT_OF_MEMORY;
- }
-
- error = gluScaleImage(format, w, h, type, image,
- neww, newh, type, newimage);
- if (error) {
- retval = error;
- done = GL_TRUE;
- }
-
- if (image != data) {
- free(image);
- }
- image = newimage;
-
- w = neww;
- h = newh;
- level++;
- }
-
- if (image != data) {
- free(image);
- }
-
- /* Restore original glPixelStore state */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, unpackrowlength);
- glPixelStorei(GL_UNPACK_ALIGNMENT, unpackalignment);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, unpackskiprows);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpackskippixels);
- glPixelStorei(GL_PACK_ROW_LENGTH, packrowlength);
- glPixelStorei(GL_PACK_ALIGNMENT, packalignment);
- glPixelStorei(GL_PACK_SKIP_ROWS, packskiprows);
- glPixelStorei(GL_PACK_SKIP_PIXELS, packskippixels);
-
- return retval;
-}
diff --git a/src/glu/mesa/mms_depend b/src/glu/mesa/mms_depend
deleted file mode 100644
index ed59ca9de89..00000000000
--- a/src/glu/mesa/mms_depend
+++ /dev/null
@@ -1,15 +0,0 @@
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-glu.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
-mipmap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
-nurbs.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h
-nurbscrv.obj : nurbs.h gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
-nurbssrf.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h
-nurbsutl.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h
-project.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
-quadric.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
-tess.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
-tess_fist.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
-tess_hash.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
-tess_heap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
-tess_clip.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
diff --git a/src/glu/mesa/nurbs.c b/src/glu/mesa/nurbs.c
deleted file mode 100644
index 3f102b4e455..00000000000
--- a/src/glu/mesa/nurbs.c
+++ /dev/null
@@ -1,628 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "nurbs.h"
-#endif
-
-
-void
-call_user_error(GLUnurbsObj * nobj, GLenum error)
-{
- nobj->error = error;
- if (nobj->error_callback != NULL) {
- (*(nobj->error_callback)) (error);
- }
- else {
- printf("NURBS error %d %s\n", error, (char *) gluErrorString(error));
- }
-}
-
-
-
-GLUnurbsObj *GLAPIENTRY
-gluNewNurbsRenderer(void)
-{
- GLUnurbsObj *n;
- GLfloat tmp_viewport[4];
- GLint i, j;
-
- n = (GLUnurbsObj *) malloc(sizeof(GLUnurbsObj));
- if (n) {
- /* init */
- n->culling = GL_FALSE;
- n->nurbs_type = GLU_NURBS_NONE;
- n->error = GLU_NO_ERROR;
- n->error_callback = NULL;
- n->auto_load_matrix = GL_TRUE;
- n->sampling_tolerance = 50.0;
- n->parametric_tolerance = 0.5;
- n->u_step = n->v_step = 100;
- n->sampling_method = GLU_PATH_LENGTH;
- n->display_mode = GLU_FILL;
- /* in case the user doesn't supply the sampling matrices */
- /* set projection and modelview to identity */
- for (i = 0; i < 4; i++)
- for (j = 0; j < 4; j++)
- if (i == j) {
- n->sampling_matrices.model[i * 4 + j] = 1.0;
- n->sampling_matrices.proj[i * 4 + j] = 1.0;
- }
- else {
- n->sampling_matrices.model[i * 4 + j] = 0.0;
- n->sampling_matrices.proj[i * 4 + j] = 0.0;
- }
- /* and set the viewport sampling matrix to current ciewport */
- glGetFloatv(GL_VIEWPORT, tmp_viewport);
- for (i = 0; i < 4; i++)
- n->sampling_matrices.viewport[i] = tmp_viewport[i];
- n->trim = NULL;
- }
- return n;
-}
-
-
-
-void GLAPIENTRY
-gluDeleteNurbsRenderer(GLUnurbsObj * nobj)
-{
- if (nobj) {
- free(nobj);
- }
-}
-
-
-
-void GLAPIENTRY
-gluLoadSamplingMatrices(GLUnurbsObj * nobj,
- const GLfloat modelMatrix[16],
- const GLfloat projMatrix[16], const GLint viewport[4])
-{
- GLint i;
-
- for (i = 0; i < 16; i++) {
- nobj->sampling_matrices.model[i] = modelMatrix[i];
- nobj->sampling_matrices.proj[i] = projMatrix[i];
- }
- for (i = 0; i < 4; i++)
- nobj->sampling_matrices.viewport[i] = viewport[i];
-}
-
-
-void GLAPIENTRY
-gluNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat value)
-{
- GLenum val;
-
- switch (property) {
- case GLU_SAMPLING_TOLERANCE:
- if (value <= 0.0) {
- call_user_error(nobj, GLU_INVALID_VALUE);
- return;
- }
- nobj->sampling_tolerance = value;
- break;
- case GLU_PARAMETRIC_TOLERANCE:
- if (value <= 0.0) {
- call_user_error(nobj, GLU_INVALID_VALUE);
- return;
- }
- nobj->parametric_tolerance = value;
- break;
- case GLU_U_STEP:
- if (value <= 0.0) {
- call_user_error(nobj, GLU_INVALID_VALUE);
- return;
- }
- nobj->u_step = (GLint) value;
- break;
- case GLU_V_STEP:
- if (value <= 0.0) {
- call_user_error(nobj, GLU_INVALID_VALUE);
- return;
- }
- nobj->v_step = (GLint) value;
- break;
- case GLU_SAMPLING_METHOD:
- val = (GLenum) value;
- if (val != GLU_PATH_LENGTH && val != GLU_PARAMETRIC_ERROR
- && val != GLU_DOMAIN_DISTANCE) {
- call_user_error(nobj, GLU_INVALID_ENUM);
- return;
- }
- nobj->sampling_method = val;
- break;
- case GLU_DISPLAY_MODE:
- val = (GLenum) value;
- if (val != GLU_FILL && val != GLU_OUTLINE_POLYGON
- && val != GLU_OUTLINE_PATCH) {
- call_user_error(nobj, GLU_INVALID_ENUM);
- return;
- }
- if (nobj->nurbs_type == GLU_NURBS_CURVE) {
- call_user_error(nobj, GLU_NURBS_ERROR26);
- return;
- }
- nobj->display_mode = val;
- if (val == GLU_OUTLINE_PATCH)
- fprintf(stderr,
- "NURBS, for the moment, can display only in POLYGON mode\n");
- break;
- case GLU_CULLING:
- val = (GLenum) value;
- if (val != GL_TRUE && val != GL_FALSE) {
- call_user_error(nobj, GLU_INVALID_ENUM);
- return;
- }
- nobj->culling = (GLboolean) value;
- break;
- case GLU_AUTO_LOAD_MATRIX:
- val = (GLenum) value;
- if (val != GL_TRUE && val != GL_FALSE) {
- call_user_error(nobj, GLU_INVALID_ENUM);
- return;
- }
- nobj->auto_load_matrix = (GLboolean) value;
- break;
- default:
- call_user_error(nobj, GLU_NURBS_ERROR26);
- }
-}
-
-
-void GLAPIENTRY
-gluGetNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat * value)
-{
- switch (property) {
- case GLU_SAMPLING_TOLERANCE:
- *value = nobj->sampling_tolerance;
- break;
- case GLU_DISPLAY_MODE:
- *value = (GLfloat) (GLint) nobj->display_mode;
- break;
- case GLU_CULLING:
- *value = nobj->culling ? 1.0 : 0.0;
- break;
- case GLU_AUTO_LOAD_MATRIX:
- *value = nobj->auto_load_matrix ? 1.0 : 0.0;
- break;
- default:
- call_user_error(nobj, GLU_INVALID_ENUM);
- }
-}
-
-
-
-void GLAPIENTRY
-gluBeginCurve(GLUnurbsObj * nobj)
-{
- if (nobj->nurbs_type == GLU_NURBS_CURVE) {
- call_user_error(nobj, GLU_NURBS_ERROR6);
- return;
- }
- nobj->nurbs_type = GLU_NURBS_CURVE;
- nobj->curve.geom.type = GLU_INVALID_ENUM;
- nobj->curve.color.type = GLU_INVALID_ENUM;
- nobj->curve.texture.type = GLU_INVALID_ENUM;
- nobj->curve.normal.type = GLU_INVALID_ENUM;
-}
-
-
-void GLAPIENTRY
-gluEndCurve(GLUnurbsObj * nobj)
-{
- if (nobj->nurbs_type == GLU_NURBS_NONE) {
- call_user_error(nobj, GLU_NURBS_ERROR7);
- return;
- }
- if (nobj->curve.geom.type == GLU_INVALID_ENUM) {
- call_user_error(nobj, GLU_NURBS_ERROR8);
- nobj->nurbs_type = GLU_NURBS_NONE;
- return;
- }
- glPushAttrib((GLbitfield) (GL_EVAL_BIT | GL_ENABLE_BIT));
- glDisable(GL_MAP1_VERTEX_3);
- glDisable(GL_MAP1_VERTEX_4);
- glDisable(GL_MAP1_INDEX);
- glDisable(GL_MAP1_COLOR_4);
- glDisable(GL_MAP1_NORMAL);
- glDisable(GL_MAP1_TEXTURE_COORD_1);
- glDisable(GL_MAP1_TEXTURE_COORD_2);
- glDisable(GL_MAP1_TEXTURE_COORD_3);
- glDisable(GL_MAP1_TEXTURE_COORD_4);
- glDisable(GL_MAP2_VERTEX_3);
- glDisable(GL_MAP2_VERTEX_4);
- glDisable(GL_MAP2_INDEX);
- glDisable(GL_MAP2_COLOR_4);
- glDisable(GL_MAP2_NORMAL);
- glDisable(GL_MAP2_TEXTURE_COORD_1);
- glDisable(GL_MAP2_TEXTURE_COORD_2);
- glDisable(GL_MAP2_TEXTURE_COORD_3);
- glDisable(GL_MAP2_TEXTURE_COORD_4);
- do_nurbs_curve(nobj);
- glPopAttrib();
- nobj->nurbs_type = GLU_NURBS_NONE;
-}
-
-
-void GLAPIENTRY
-gluNurbsCurve(GLUnurbsObj * nobj, GLint nknots, GLfloat * knot,
- GLint stride, GLfloat * ctlarray, GLint order, GLenum type)
-{
- if (nobj->nurbs_type == GLU_NURBS_TRIM) {
-#if 0
-/* TODO: NOT IMPLEMENTED YET */
- nurbs_trim *ptr1;
- trim_list *ptr2;
-
- if (type != GLU_MAP1_TRIM_2 && type != GLU_MAP1_TRIM_3) {
- call_user_error(nobj, GLU_NURBS_ERROR14);
- return;
- }
- for (ptr1 = nobj->trim; ptr1->next; ptr1 = ptr1->next);
- if (ptr1->trim_loop) {
- for (ptr2 = ptr1->trim_loop; ptr2->next; ptr2 = ptr2->next);
- if ((ptr2->next = (trim_list *) malloc(sizeof(trim_list))) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return;
- }
- ptr2 = ptr2->next;
- }
- else {
- if ((ptr2 = (trim_list *) malloc(sizeof(trim_list))) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return;
- }
- ptr1->trim_loop = ptr2;
- }
- ptr2->trim_type = GLU_TRIM_NURBS;
- ptr2->curve.nurbs_curve.knot_count = nknots;
- ptr2->curve.nurbs_curve.knot = knot;
- ptr2->curve.nurbs_curve.stride = stride;
- ptr2->curve.nurbs_curve.ctrlarray = ctlarray;
- ptr2->curve.nurbs_curve.order = order;
- ptr2->curve.nurbs_curve.dim = (type == GLU_MAP1_TRIM_2 ? 2 : 3);
- ptr2->curve.nurbs_curve.type = type;
- ptr2->next = NULL;
-#endif
- }
- else {
- if (type == GLU_MAP1_TRIM_2 || type == GLU_MAP1_TRIM_3) {
- call_user_error(nobj, GLU_NURBS_ERROR22);
- return;
- }
- if (nobj->nurbs_type != GLU_NURBS_CURVE) {
- call_user_error(nobj, GLU_NURBS_ERROR10);
- return;
- }
- switch (type) {
- case GL_MAP1_VERTEX_3:
- case GL_MAP1_VERTEX_4:
- if (nobj->curve.geom.type != GLU_INVALID_ENUM) {
- call_user_error(nobj, GLU_NURBS_ERROR8);
- return;
- }
- nobj->curve.geom.type = type;
- nobj->curve.geom.knot_count = nknots;
- nobj->curve.geom.knot = knot;
- nobj->curve.geom.stride = stride;
- nobj->curve.geom.ctrlarray = ctlarray;
- nobj->curve.geom.order = order;
- break;
- case GL_MAP1_INDEX:
- case GL_MAP1_COLOR_4:
- nobj->curve.color.type = type;
- nobj->curve.color.knot_count = nknots;
- nobj->curve.color.knot = knot;
- nobj->curve.color.stride = stride;
- nobj->curve.color.ctrlarray = ctlarray;
- nobj->curve.color.order = order;
- break;
- case GL_MAP1_NORMAL:
- nobj->curve.normal.type = type;
- nobj->curve.normal.knot_count = nknots;
- nobj->curve.normal.knot = knot;
- nobj->curve.normal.stride = stride;
- nobj->curve.normal.ctrlarray = ctlarray;
- nobj->curve.normal.order = order;
- break;
- case GL_MAP1_TEXTURE_COORD_1:
- case GL_MAP1_TEXTURE_COORD_2:
- case GL_MAP1_TEXTURE_COORD_3:
- case GL_MAP1_TEXTURE_COORD_4:
- nobj->curve.texture.type = type;
- nobj->curve.texture.knot_count = nknots;
- nobj->curve.texture.knot = knot;
- nobj->curve.texture.stride = stride;
- nobj->curve.texture.ctrlarray = ctlarray;
- nobj->curve.texture.order = order;
- break;
- default:
- call_user_error(nobj, GLU_INVALID_ENUM);
- }
- }
-}
-
-
-void GLAPIENTRY
-gluBeginSurface(GLUnurbsObj * nobj)
-{
- switch (nobj->nurbs_type) {
- case GLU_NURBS_NONE:
- nobj->nurbs_type = GLU_NURBS_SURFACE;
- nobj->surface.geom.type = GLU_INVALID_ENUM;
- nobj->surface.color.type = GLU_INVALID_ENUM;
- nobj->surface.texture.type = GLU_INVALID_ENUM;
- nobj->surface.normal.type = GLU_INVALID_ENUM;
- break;
- case GLU_NURBS_TRIM:
- call_user_error(nobj, GLU_NURBS_ERROR16);
- break;
- case GLU_NURBS_SURFACE:
- case GLU_NURBS_NO_TRIM:
- case GLU_NURBS_TRIM_DONE:
- call_user_error(nobj, GLU_NURBS_ERROR27);
- break;
- case GLU_NURBS_CURVE:
- call_user_error(nobj, GLU_NURBS_ERROR6);
- break;
- }
-}
-
-
-void GLAPIENTRY
-gluEndSurface(GLUnurbsObj * nobj)
-{
- switch (nobj->nurbs_type) {
- case GLU_NURBS_NONE:
- call_user_error(nobj, GLU_NURBS_ERROR13);
- break;
- case GLU_NURBS_TRIM:
- call_user_error(nobj, GLU_NURBS_ERROR12);
- break;
- case GLU_NURBS_TRIM_DONE:
-/* if(nobj->trim->trim_loop==NULL)
- {
- call_user_error(nobj,GLU_NURBS_ERROR18);
- return;
- }*/
- /* no break - fallthrough */
- case GLU_NURBS_NO_TRIM:
- glPushAttrib((GLbitfield)
- (GL_EVAL_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT));
- glDisable(GL_MAP2_VERTEX_3);
- glDisable(GL_MAP2_VERTEX_4);
- glDisable(GL_MAP2_INDEX);
- glDisable(GL_MAP2_COLOR_4);
- glDisable(GL_MAP2_NORMAL);
- glDisable(GL_MAP2_TEXTURE_COORD_1);
- glDisable(GL_MAP2_TEXTURE_COORD_2);
- glDisable(GL_MAP2_TEXTURE_COORD_3);
- glDisable(GL_MAP2_TEXTURE_COORD_4);
-/* glDisable(GL_MAP1_VERTEX_3);
- glDisable(GL_MAP1_VERTEX_4);
- glDisable(GL_MAP1_INDEX);
- glDisable(GL_MAP1_COLOR_4);
- glDisable(GL_MAP1_NORMAL);
- glDisable(GL_MAP1_TEXTURE_COORD_1);
- glDisable(GL_MAP1_TEXTURE_COORD_2);
- glDisable(GL_MAP1_TEXTURE_COORD_3);
- glDisable(GL_MAP1_TEXTURE_COORD_4);*/
- do_nurbs_surface(nobj);
- glPopAttrib();
- break;
- default:
- call_user_error(nobj, GLU_NURBS_ERROR8);
- }
- nobj->nurbs_type = GLU_NURBS_NONE;
-}
-
-
-void GLAPIENTRY
-gluNurbsSurface(GLUnurbsObj * nobj,
- GLint sknot_count, GLfloat * sknot,
- GLint tknot_count, GLfloat * tknot,
- GLint s_stride, GLint t_stride,
- GLfloat * ctrlarray, GLint sorder, GLint torder, GLenum type)
-{
- if (nobj->nurbs_type == GLU_NURBS_NO_TRIM
- || nobj->nurbs_type == GLU_NURBS_TRIM
- || nobj->nurbs_type == GLU_NURBS_TRIM_DONE) {
- if (type == GL_MAP2_VERTEX_3 || type == GL_MAP2_VERTEX_4) {
- call_user_error(nobj, GLU_NURBS_ERROR8);
- return;
- }
- }
- else if (nobj->nurbs_type != GLU_NURBS_SURFACE) {
- call_user_error(nobj, GLU_NURBS_ERROR11);
- return;
- }
- switch (type) {
- case GL_MAP2_VERTEX_3:
- case GL_MAP2_VERTEX_4:
- nobj->surface.geom.sknot_count = sknot_count;
- nobj->surface.geom.sknot = sknot;
- nobj->surface.geom.tknot_count = tknot_count;
- nobj->surface.geom.tknot = tknot;
- nobj->surface.geom.s_stride = s_stride;
- nobj->surface.geom.t_stride = t_stride;
- nobj->surface.geom.ctrlarray = ctrlarray;
- nobj->surface.geom.sorder = sorder;
- nobj->surface.geom.torder = torder;
- nobj->surface.geom.type = type;
- nobj->nurbs_type = GLU_NURBS_NO_TRIM;
- break;
- case GL_MAP2_INDEX:
- case GL_MAP2_COLOR_4:
- nobj->surface.color.sknot_count = sknot_count;
- nobj->surface.color.sknot = sknot;
- nobj->surface.color.tknot_count = tknot_count;
- nobj->surface.color.tknot = tknot;
- nobj->surface.color.s_stride = s_stride;
- nobj->surface.color.t_stride = t_stride;
- nobj->surface.color.ctrlarray = ctrlarray;
- nobj->surface.color.sorder = sorder;
- nobj->surface.color.torder = torder;
- nobj->surface.color.type = type;
- break;
- case GL_MAP2_NORMAL:
- nobj->surface.normal.sknot_count = sknot_count;
- nobj->surface.normal.sknot = sknot;
- nobj->surface.normal.tknot_count = tknot_count;
- nobj->surface.normal.tknot = tknot;
- nobj->surface.normal.s_stride = s_stride;
- nobj->surface.normal.t_stride = t_stride;
- nobj->surface.normal.ctrlarray = ctrlarray;
- nobj->surface.normal.sorder = sorder;
- nobj->surface.normal.torder = torder;
- nobj->surface.normal.type = type;
- break;
- case GL_MAP2_TEXTURE_COORD_1:
- case GL_MAP2_TEXTURE_COORD_2:
- case GL_MAP2_TEXTURE_COORD_3:
- case GL_MAP2_TEXTURE_COORD_4:
- nobj->surface.texture.sknot_count = sknot_count;
- nobj->surface.texture.sknot = sknot;
- nobj->surface.texture.tknot_count = tknot_count;
- nobj->surface.texture.tknot = tknot;
- nobj->surface.texture.s_stride = s_stride;
- nobj->surface.texture.t_stride = t_stride;
- nobj->surface.texture.ctrlarray = ctrlarray;
- nobj->surface.texture.sorder = sorder;
- nobj->surface.texture.torder = torder;
- nobj->surface.texture.type = type;
- break;
- default:
- call_user_error(nobj, GLU_INVALID_ENUM);
- }
-}
-
-
-void GLAPIENTRY
-gluNurbsCallback(GLUnurbsObj * nobj, GLenum which, void (GLCALLBACK * fn) ())
-{
- nobj->error_callback = (void (GLCALLBACKPCAST) (GLenum)) fn;
-
- if (which != GLU_ERROR)
- call_user_error(nobj, GLU_INVALID_ENUM);
-}
-
-void GLAPIENTRY
-gluBeginTrim(GLUnurbsObj * nobj)
-{
-#if 0
- nurbs_trim *ptr;
-#endif
-
- if (nobj->nurbs_type != GLU_NURBS_TRIM_DONE)
- if (nobj->nurbs_type != GLU_NURBS_NO_TRIM) {
- call_user_error(nobj, GLU_NURBS_ERROR15);
- return;
- }
- nobj->nurbs_type = GLU_NURBS_TRIM;
- fprintf(stderr, "NURBS - trimming not supported yet\n");
-#if 0
- if ((ptr = (nurbs_trim *) malloc(sizeof(nurbs_trim))) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return;
- }
- if (nobj->trim) {
- nurbs_trim *tmp_ptr;
-
- for (tmp_ptr = nobj->trim; tmp_ptr->next; tmp_ptr = tmp_ptr->next);
- tmp_ptr->next = ptr;
- }
- else
- nobj->trim = ptr;
- ptr->trim_loop = NULL;
- ptr->segments = NULL;
- ptr->next = NULL;
-#endif
-}
-
-void GLAPIENTRY
-gluPwlCurve(GLUnurbsObj * nobj, GLint count, GLfloat * array, GLint stride,
- GLenum type)
-{
-#if 0
- nurbs_trim *ptr1;
- trim_list *ptr2;
-#endif
- if (nobj->nurbs_type == GLU_NURBS_CURVE) {
- call_user_error(nobj, GLU_NURBS_ERROR9);
- return;
- }
- if (nobj->nurbs_type == GLU_NURBS_NONE) {
- call_user_error(nobj, GLU_NURBS_ERROR19);
- return;
- }
- if (type != GLU_MAP1_TRIM_2 && type != GLU_MAP1_TRIM_3) {
- call_user_error(nobj, GLU_NURBS_ERROR14);
- return;
- }
-#if 0
- for (ptr1 = nobj->trim; ptr1->next; ptr1 = ptr1->next);
- if (ptr1->trim_loop) {
- for (ptr2 = ptr1->trim_loop; ptr2->next; ptr2 = ptr2->next);
- if ((ptr2->next = (trim_list *) malloc(sizeof(trim_list))) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return;
- }
- ptr2 = ptr2->next;
- }
- else {
- if ((ptr2 = (trim_list *) malloc(sizeof(trim_list))) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return;
- }
- ptr1->trim_loop = ptr2;
- }
- ptr2->trim_type = GLU_TRIM_PWL;
- ptr2->curve.pwl_curve.pt_count = count;
- ptr2->curve.pwl_curve.ctrlarray = array;
- ptr2->curve.pwl_curve.stride = stride;
- ptr2->curve.pwl_curve.dim = (type == GLU_MAP1_TRIM_2 ? 2 : 3);
- ptr2->curve.pwl_curve.type = type;
- ptr2->next = NULL;
-#endif
-}
-
-void GLAPIENTRY
-gluEndTrim(GLUnurbsObj * nobj)
-{
- if (nobj->nurbs_type != GLU_NURBS_TRIM) {
- call_user_error(nobj, GLU_NURBS_ERROR17);
- return;
- }
- nobj->nurbs_type = GLU_NURBS_TRIM_DONE;
-}
diff --git a/src/glu/mesa/nurbs.h b/src/glu/mesa/nurbs.h
deleted file mode 100644
index 3642e213a8c..00000000000
--- a/src/glu/mesa/nurbs.h
+++ /dev/null
@@ -1,252 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifndef NURBS_H
-#define NURBS_H
-
-
-#define EPSILON 1e-06 /* epsilon for double precision compares */
-
-typedef enum
-{
- GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM,
- GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE
-}
-GLU_nurbs_enum;
-
-typedef enum
-{
- GLU_TRIM_NURBS, GLU_TRIM_PWL
-}
-GLU_trim_enum;
-
-typedef struct
-{
- GLint sknot_count;
- GLfloat *sknot;
- GLint tknot_count;
- GLfloat *tknot;
- GLint s_stride;
- GLint t_stride;
- GLfloat *ctrlarray;
- GLint sorder;
- GLint torder;
- GLint dim;
- GLenum type;
-}
-surface_attribs;
-
-typedef struct
-{
- surface_attribs geom;
- surface_attribs color;
- surface_attribs texture;
- surface_attribs normal;
-}
-nurbs_surface;
-
-typedef struct
-{
- GLint knot_count;
- GLfloat *knot;
- GLint stride;
- GLfloat *ctrlarray;
- GLint order;
- GLint dim;
- GLenum type;
-}
-curve_attribs;
-
-typedef struct
-{
- GLint pt_count;
- GLfloat *ctrlarray;
- GLint stride;
- GLint dim;
- GLenum type;
-}
-pwl_curve_attribs;
-
-typedef struct
-{
- curve_attribs geom;
- curve_attribs color;
- curve_attribs texture;
- curve_attribs normal;
-}
-nurbs_curve;
-
-typedef struct trim_list_str
-{
- GLU_trim_enum trim_type;
- union
- {
- pwl_curve_attribs pwl_curve;
- curve_attribs nurbs_curve;
- }
- curve;
- struct trim_list_str *next;
-}
-trim_list;
-
-typedef struct seg_trim_str
-{
- GLfloat *points;
- GLint pt_cnt, seg_array_len;
- struct seg_trim_str *next;
-}
-trim_segments;
-
-typedef struct nurbs_trim_str
-{
- trim_list *trim_loop;
- trim_segments *segments;
- struct nurbs_trim_str *next;
-}
-nurbs_trim;
-
-typedef struct
-{
- GLfloat model[16], proj[16], viewport[4];
-}
-culling_and_sampling_str;
-
-struct GLUnurbs
-{
- GLboolean culling;
- GLenum error;
- void (GLCALLBACK * error_callback) (GLenum err);
- GLenum display_mode;
- GLU_nurbs_enum nurbs_type;
- GLboolean auto_load_matrix;
- culling_and_sampling_str sampling_matrices;
- GLenum sampling_method;
- GLfloat sampling_tolerance;
- GLfloat parametric_tolerance;
- GLint u_step, v_step;
- nurbs_surface surface;
- nurbs_curve curve;
- nurbs_trim *trim;
-};
-
-typedef struct
-{
- GLfloat *knot;
- GLint nknots;
- GLfloat *unified_knot;
- GLint unified_nknots;
- GLint order;
- GLint t_min, t_max;
- GLint delta_nknots;
- GLboolean open_at_begin, open_at_end;
- GLfloat *new_knot;
- GLfloat *alpha;
-}
-knot_str_type;
-
-typedef struct
-{
- GLfloat *geom_ctrl;
- GLint geom_s_stride, geom_t_stride;
- GLfloat **geom_offsets;
- GLint geom_s_pt_cnt, geom_t_pt_cnt;
- GLfloat *color_ctrl;
- GLint color_s_stride, color_t_stride;
- GLfloat **color_offsets;
- GLint color_s_pt_cnt, color_t_pt_cnt;
- GLfloat *normal_ctrl;
- GLint normal_s_stride, normal_t_stride;
- GLfloat **normal_offsets;
- GLint normal_s_pt_cnt, normal_t_pt_cnt;
- GLfloat *texture_ctrl;
- GLint texture_s_stride, texture_t_stride;
- GLfloat **texture_offsets;
- GLint texture_s_pt_cnt, texture_t_pt_cnt;
- GLint s_bezier_cnt, t_bezier_cnt;
-}
-new_ctrl_type;
-
-extern void call_user_error(GLUnurbsObj * nobj, GLenum error);
-
-extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order);
-
-extern GLenum explode_knot(knot_str_type * the_knot);
-
-extern GLenum calc_alphas(knot_str_type * the_knot);
-
-extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride,
- knot_str_type * the_knot, GLint dim,
- GLfloat ** new_ctrl, GLint * ncontrol);
-
-extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl,
- GLint n_ctrl, GLint order, GLint dim,
- GLint ** factors);
-
-extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- int **sfactors, GLint ** tfactors);
-
-extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- int **sfactors, GLint ** tfactors);
-
-extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj,
- new_ctrl_type * new_ctrl,
- int **sfactors, GLint ** tfactors);
-
-extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl,
- GLint n_ctrl, GLint stride, GLint dim);
-
-extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl,
- GLint s_n_ctrl, GLint t_n_ctrl,
- GLint s_stride, GLint t_stride,
- GLint dim);
-
-extern void do_nurbs_curve(GLUnurbsObj * nobj);
-
-extern void do_nurbs_surface(GLUnurbsObj * nobj);
-
-extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- GLint * sfactors, GLint * tfactors);
-
-extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src,
- GLfloat maximal_min_knot,
- GLfloat minimal_max_knot);
-
-extern GLenum select_knot_working_range(GLUnurbsObj * nobj,
- knot_str_type * geom_knot,
- knot_str_type * color_knot,
- knot_str_type * normal_knot,
- knot_str_type * texture_knot);
-
-extern void free_unified_knots(knot_str_type * geom_knot,
- knot_str_type * color_knot,
- knot_str_type * normal_knot,
- knot_str_type * texture_knot);
-
-
-
-#endif
diff --git a/src/glu/mesa/nurbscrv.c b/src/glu/mesa/nurbscrv.c
deleted file mode 100644
index 4483e1f7761..00000000000
--- a/src/glu/mesa/nurbscrv.c
+++ /dev/null
@@ -1,444 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "nurbs.h"
-#endif
-
-
-static int
-get_curve_dim(GLenum type)
-{
- switch (type) {
- case GL_MAP1_VERTEX_3:
- return 3;
- case GL_MAP1_VERTEX_4:
- return 4;
- case GL_MAP1_INDEX:
- return 1;
- case GL_MAP1_COLOR_4:
- return 4;
- case GL_MAP1_NORMAL:
- return 3;
- case GL_MAP1_TEXTURE_COORD_1:
- return 1;
- case GL_MAP1_TEXTURE_COORD_2:
- return 2;
- case GL_MAP1_TEXTURE_COORD_3:
- return 3;
- case GL_MAP1_TEXTURE_COORD_4:
- return 4;
- default:
- abort(); /* TODO: is this OK? */
- }
- return 0; /*never get here */
-}
-
-static GLenum
-test_nurbs_curve(GLUnurbsObj * nobj, curve_attribs * attribs)
-{
- GLenum err;
- GLint tmp_int;
-
- if (attribs->order < 0) {
- call_user_error(nobj, GLU_INVALID_VALUE);
- return GLU_ERROR;
- }
- glGetIntegerv(GL_MAX_EVAL_ORDER, &tmp_int);
- if (attribs->order > tmp_int || attribs->order < 2) {
- call_user_error(nobj, GLU_NURBS_ERROR1);
- return GLU_ERROR;
- }
- if (attribs->knot_count < attribs->order + 2) {
- call_user_error(nobj, GLU_NURBS_ERROR2);
- return GLU_ERROR;
- }
- if (attribs->stride < 0) {
- call_user_error(nobj, GLU_NURBS_ERROR34);
- return GLU_ERROR;
- }
- if (attribs->knot == NULL || attribs->ctrlarray == NULL) {
- call_user_error(nobj, GLU_NURBS_ERROR36);
- return GLU_ERROR;
- }
- if ((err = test_knot(attribs->knot_count, attribs->knot, attribs->order))
- != GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- return GLU_NO_ERROR;
-}
-
-static GLenum
-test_nurbs_curves(GLUnurbsObj * nobj)
-{
- /* test the geometric data */
- if (test_nurbs_curve(nobj, &(nobj->curve.geom)) != GLU_NO_ERROR)
- return GLU_ERROR;
- /* now test the attributive data */
- /* color */
- if (nobj->curve.color.type != GLU_INVALID_ENUM)
- if (test_nurbs_curve(nobj, &(nobj->curve.color)) != GLU_NO_ERROR)
- return GLU_ERROR;
- /* normal */
- if (nobj->curve.normal.type != GLU_INVALID_ENUM)
- if (test_nurbs_curve(nobj, &(nobj->curve.normal)) != GLU_NO_ERROR)
- return GLU_ERROR;
- /* texture */
- if (nobj->curve.texture.type != GLU_INVALID_ENUM)
- if (test_nurbs_curve(nobj, &(nobj->curve.texture)) != GLU_NO_ERROR)
- return GLU_ERROR;
- return GLU_NO_ERROR;
-}
-
-/* prepare the knot information structures */
-static GLenum
-fill_knot_structures(GLUnurbsObj * nobj, knot_str_type * geom_knot,
- knot_str_type * color_knot, knot_str_type * normal_knot,
- knot_str_type * texture_knot)
-{
- GLint order;
- GLfloat *knot;
- GLint nknots;
- GLint t_min, t_max;
-
- geom_knot->unified_knot = NULL;
- knot = geom_knot->knot = nobj->curve.geom.knot;
- nknots = geom_knot->nknots = nobj->curve.geom.knot_count;
- order = geom_knot->order = nobj->curve.geom.order;
- geom_knot->delta_nknots = 0;
- t_min = geom_knot->t_min = order - 1;
- t_max = geom_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- geom_knot->open_at_begin = GL_TRUE;
- }
- else
- geom_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- geom_knot->open_at_end = GL_TRUE;
- }
- else
- geom_knot->open_at_end = GL_FALSE;
- if (nobj->curve.color.type != GLU_INVALID_ENUM) {
- color_knot->unified_knot = (GLfloat *) 1;
- knot = color_knot->knot = nobj->curve.color.knot;
- nknots = color_knot->nknots = nobj->curve.color.knot_count;
- order = color_knot->order = nobj->curve.color.order;
- color_knot->delta_nknots = 0;
- t_min = color_knot->t_min = order - 1;
- t_max = color_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- color_knot->open_at_begin = GL_TRUE;
- }
- else
- color_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- color_knot->open_at_end = GL_TRUE;
- }
- else
- color_knot->open_at_end = GL_FALSE;
- }
- else
- color_knot->unified_knot = NULL;
- if (nobj->curve.normal.type != GLU_INVALID_ENUM) {
- normal_knot->unified_knot = (GLfloat *) 1;
- knot = normal_knot->knot = nobj->curve.normal.knot;
- nknots = normal_knot->nknots = nobj->curve.normal.knot_count;
- order = normal_knot->order = nobj->curve.normal.order;
- normal_knot->delta_nknots = 0;
- t_min = normal_knot->t_min = order - 1;
- t_max = normal_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- normal_knot->open_at_begin = GL_TRUE;
- }
- else
- normal_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- normal_knot->open_at_end = GL_TRUE;
- }
- else
- normal_knot->open_at_end = GL_FALSE;
- }
- else
- normal_knot->unified_knot = NULL;
- if (nobj->curve.texture.type != GLU_INVALID_ENUM) {
- texture_knot->unified_knot = (GLfloat *) 1;
- knot = texture_knot->knot = nobj->curve.texture.knot;
- nknots = texture_knot->nknots = nobj->curve.texture.knot_count;
- order = texture_knot->order = nobj->curve.texture.order;
- texture_knot->delta_nknots = 0;
- t_min = texture_knot->t_min = order - 1;
- t_max = texture_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- texture_knot->open_at_begin = GL_TRUE;
- }
- else
- texture_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- texture_knot->open_at_end = GL_TRUE;
- }
- else
- texture_knot->open_at_end = GL_FALSE;
- }
- else
- texture_knot->unified_knot = NULL;
- return GLU_NO_ERROR;
-}
-
-/* covert the NURBS curve into a series of adjacent Bezier curves */
-static GLenum
-convert_curve(knot_str_type * the_knot, curve_attribs * attrib,
- GLfloat ** new_ctrl, GLint * ncontrol)
-{
- GLenum err;
-
- if ((err = explode_knot(the_knot)) != GLU_NO_ERROR) {
- if (the_knot->unified_knot) {
- free(the_knot->unified_knot);
- the_knot->unified_knot = NULL;
- }
- return err;
- }
- if (the_knot->unified_knot) {
- free(the_knot->unified_knot);
- the_knot->unified_knot = NULL;
- }
- if ((err = calc_alphas(the_knot)) != GLU_NO_ERROR) {
- free(the_knot->new_knot);
- return err;
- }
- free(the_knot->new_knot);
- if ((err = calc_new_ctrl_pts(attrib->ctrlarray, attrib->stride, the_knot,
- attrib->dim, new_ctrl, ncontrol))
- != GLU_NO_ERROR) {
- free(the_knot->alpha);
- return err;
- }
- free(the_knot->alpha);
- return GLU_NO_ERROR;
-}
-
-/* covert curves - geometry and possible attribute ones into equivalent */
-/* sequence of adjacent Bezier curves */
-static GLenum
-convert_curves(GLUnurbsObj * nobj, GLfloat ** new_geom_ctrl,
- GLint * ncontrol, GLfloat ** new_color_ctrl,
- GLfloat ** new_normal_ctrl, GLfloat ** new_texture_ctrl)
-{
- knot_str_type geom_knot, color_knot, normal_knot, texture_knot;
- GLint junk;
- GLenum err;
-
- *new_color_ctrl = *new_normal_ctrl = *new_texture_ctrl = NULL;
-
- if (fill_knot_structures(nobj, &geom_knot, &color_knot, &normal_knot,
- &texture_knot) != GLU_NO_ERROR)
- return GLU_ERROR;
-
- /* unify knots - all knots should have the same number of working */
- /* ranges */
- if (
- (err =
- select_knot_working_range(nobj, &geom_knot, &color_knot, &normal_knot,
- &texture_knot)) != GLU_NO_ERROR) {
- return err;
- }
- /* convert the geometry curve */
- nobj->curve.geom.dim = get_curve_dim(nobj->curve.geom.type);
- if ((err = convert_curve(&geom_knot, &(nobj->curve.geom), new_geom_ctrl,
- ncontrol)) != GLU_NO_ERROR) {
- free_unified_knots(&geom_knot, &color_knot, &normal_knot,
- &texture_knot);
- call_user_error(nobj, err);
- return err;
- }
- /* if additional attributive curves are given convert them as well */
- if (color_knot.unified_knot) {
- nobj->curve.color.dim = get_curve_dim(nobj->curve.color.type);
- if ((err = convert_curve(&color_knot, &(nobj->curve.color),
- new_color_ctrl, &junk)) != GLU_NO_ERROR) {
- free_unified_knots(&geom_knot, &color_knot, &normal_knot,
- &texture_knot);
- free(*new_geom_ctrl);
- call_user_error(nobj, err);
- return err;
- }
- }
- if (normal_knot.unified_knot) {
- nobj->curve.normal.dim = get_curve_dim(nobj->curve.normal.type);
- if ((err = convert_curve(&normal_knot, &(nobj->curve.normal),
- new_normal_ctrl, &junk)) != GLU_NO_ERROR) {
- free_unified_knots(&geom_knot, &color_knot, &normal_knot,
- &texture_knot);
- free(*new_geom_ctrl);
- if (*new_color_ctrl)
- free(*new_color_ctrl);
- call_user_error(nobj, err);
- return err;
- }
- }
- if (texture_knot.unified_knot) {
- nobj->curve.texture.dim = get_curve_dim(nobj->curve.texture.type);
- if ((err = convert_curve(&texture_knot, &(nobj->curve.texture),
- new_texture_ctrl, &junk)) != GLU_NO_ERROR) {
- free_unified_knots(&geom_knot, &color_knot, &normal_knot,
- &texture_knot);
- free(*new_geom_ctrl);
- if (*new_color_ctrl)
- free(*new_color_ctrl);
- if (*new_normal_ctrl)
- free(*new_normal_ctrl);
- call_user_error(nobj, err);
- return err;
- }
- }
- return GLU_NO_ERROR;
-}
-
-/* main NURBS curve procedure */
-void
-do_nurbs_curve(GLUnurbsObj * nobj)
-{
- GLint geom_order, color_order = 0, normal_order = 0, texture_order = 0;
- GLenum geom_type;
- GLint n_ctrl;
- GLfloat *new_geom_ctrl, *new_color_ctrl, *new_normal_ctrl,
- *new_texture_ctrl;
- GLfloat *geom_ctrl = 0, *color_ctrl = 0, *normal_ctrl = 0, *texture_ctrl = 0;
- GLint *factors;
- GLint i, j;
- GLint geom_dim, color_dim = 0, normal_dim = 0, texture_dim = 0;
-
- /* test the user supplied data */
- if (test_nurbs_curves(nobj) != GLU_NO_ERROR)
- return;
-
- if (convert_curves(nobj, &new_geom_ctrl, &n_ctrl, &new_color_ctrl,
- &new_normal_ctrl, &new_texture_ctrl) != GLU_NO_ERROR)
- return;
-
- geom_order = nobj->curve.geom.order;
- geom_type = nobj->curve.geom.type;
- geom_dim = nobj->curve.geom.dim;
-
- if (glu_do_sampling_crv(nobj, new_geom_ctrl, n_ctrl, geom_order, geom_dim,
- &factors) != GLU_NO_ERROR) {
- free(new_geom_ctrl);
- if (new_color_ctrl)
- free(new_color_ctrl);
- if (new_normal_ctrl)
- free(new_normal_ctrl);
- if (new_texture_ctrl)
- free(new_texture_ctrl);
- return;
- }
- glEnable(geom_type);
- if (new_color_ctrl) {
- glEnable(nobj->curve.color.type);
- color_dim = nobj->curve.color.dim;
- color_ctrl = new_color_ctrl;
- color_order = nobj->curve.color.order;
- }
- if (new_normal_ctrl) {
- glEnable(nobj->curve.normal.type);
- normal_dim = nobj->curve.normal.dim;
- normal_ctrl = new_normal_ctrl;
- normal_order = nobj->curve.normal.order;
- }
- if (new_texture_ctrl) {
- glEnable(nobj->curve.texture.type);
- texture_dim = nobj->curve.texture.dim;
- texture_ctrl = new_texture_ctrl;
- texture_order = nobj->curve.texture.order;
- }
- for (i = 0, j = 0, geom_ctrl = new_geom_ctrl;
- i < n_ctrl; i += geom_order, j++, geom_ctrl += geom_order * geom_dim) {
- if (fine_culling_test_2D
- (nobj, geom_ctrl, geom_order, geom_dim, geom_dim)) {
- color_ctrl += color_order * color_dim;
- normal_ctrl += normal_order * normal_dim;
- texture_ctrl += texture_order * texture_dim;
- continue;
- }
- glMap1f(geom_type, 0.0, 1.0, geom_dim, geom_order, geom_ctrl);
- if (new_color_ctrl) {
- glMap1f(nobj->curve.color.type, 0.0, 1.0, color_dim,
- color_order, color_ctrl);
- color_ctrl += color_order * color_dim;
- }
- if (new_normal_ctrl) {
- glMap1f(nobj->curve.normal.type, 0.0, 1.0, normal_dim,
- normal_order, normal_ctrl);
- normal_ctrl += normal_order * normal_dim;
- }
- if (new_texture_ctrl) {
- glMap1f(nobj->curve.texture.type, 0.0, 1.0, texture_dim,
- texture_order, texture_ctrl);
- texture_ctrl += texture_order * texture_dim;
- }
- glMapGrid1f(factors[j], 0.0, 1.0);
- glEvalMesh1(GL_LINE, 0, factors[j]);
- }
- free(new_geom_ctrl);
- free(factors);
- if (new_color_ctrl)
- free(new_color_ctrl);
- if (new_normal_ctrl)
- free(new_normal_ctrl);
- if (new_texture_ctrl)
- free(new_texture_ctrl);
-}
diff --git a/src/glu/mesa/nurbssrf.c b/src/glu/mesa/nurbssrf.c
deleted file mode 100644
index d39fa47d18a..00000000000
--- a/src/glu/mesa/nurbssrf.c
+++ /dev/null
@@ -1,1317 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gluP.h"
-#include "nurbs.h"
-#endif
-
-
-static int
-get_surface_dim(GLenum type)
-{
- switch (type) {
- case GL_MAP2_VERTEX_3:
- return 3;
- case GL_MAP2_VERTEX_4:
- return 4;
- case GL_MAP2_INDEX:
- return 1;
- case GL_MAP2_COLOR_4:
- return 4;
- case GL_MAP2_NORMAL:
- return 3;
- case GL_MAP2_TEXTURE_COORD_1:
- return 1;
- case GL_MAP2_TEXTURE_COORD_2:
- return 2;
- case GL_MAP2_TEXTURE_COORD_3:
- return 3;
- case GL_MAP2_TEXTURE_COORD_4:
- return 4;
- default:
- abort(); /* TODO: is this OK? */
- }
- return 0; /*never get here */
-}
-
-static GLenum
-test_nurbs_surface(GLUnurbsObj * nobj, surface_attribs * attrib)
-{
- GLenum err;
- GLint tmp_int;
-
- if (attrib->sorder < 0 || attrib->torder < 0) {
- call_user_error(nobj, GLU_INVALID_VALUE);
- return GLU_ERROR;
- }
- glGetIntegerv(GL_MAX_EVAL_ORDER, &tmp_int);
- if (attrib->sorder > tmp_int || attrib->sorder < 2) {
- call_user_error(nobj, GLU_NURBS_ERROR1);
- return GLU_ERROR;
- }
- if (attrib->torder > tmp_int || attrib->torder < 2) {
- call_user_error(nobj, GLU_NURBS_ERROR1);
- return GLU_ERROR;
- }
- if (attrib->sknot_count < attrib->sorder + 2) {
- call_user_error(nobj, GLU_NURBS_ERROR2);
- return GLU_ERROR;
- }
- if (attrib->tknot_count < attrib->torder + 2) {
- call_user_error(nobj, GLU_NURBS_ERROR2);
- return GLU_ERROR;
- }
- if (attrib->s_stride < 0 || attrib->t_stride < 0) {
- call_user_error(nobj, GLU_NURBS_ERROR34);
- return GLU_ERROR;
- }
- if (attrib->sknot == NULL || attrib->tknot == NULL
- || attrib->ctrlarray == NULL) {
- call_user_error(nobj, GLU_NURBS_ERROR36);
- return GLU_ERROR;
- }
- if ((err = test_knot(attrib->tknot_count, attrib->tknot, attrib->torder))
- != GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- if ((err = test_knot(attrib->sknot_count, attrib->sknot, attrib->sorder))
- != GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- return GLU_NO_ERROR;
-}
-
-static GLenum
-test_nurbs_surfaces(GLUnurbsObj * nobj)
-{
- /* test the geometric data */
- if (test_nurbs_surface(nobj, &(nobj->surface.geom)) != GLU_NO_ERROR)
- return GLU_ERROR;
- /* now test the attributive data */
- /* color */
- if (nobj->surface.color.type != GLU_INVALID_ENUM)
- if (test_nurbs_surface(nobj, &(nobj->surface.color)) != GLU_NO_ERROR)
- return GLU_ERROR;
- /* normal */
- if (nobj->surface.normal.type != GLU_INVALID_ENUM)
- if (test_nurbs_surface(nobj, &(nobj->surface.normal)) != GLU_NO_ERROR)
- return GLU_ERROR;
- /* texture */
- if (nobj->surface.texture.type != GLU_INVALID_ENUM)
- if (test_nurbs_surface(nobj, &(nobj->surface.texture)) != GLU_NO_ERROR)
- return GLU_ERROR;
- return GLU_NO_ERROR;
-}
-
-static GLenum
-convert_surf(knot_str_type * s_knot, knot_str_type * t_knot,
- surface_attribs * attrib, GLfloat ** new_ctrl,
- GLint * s_n_ctrl, GLint * t_n_ctrl)
-{
- GLfloat **tmp_ctrl;
- GLfloat *ctrl_offset;
- GLint tmp_n_control;
- GLint i, j, t_cnt, s_cnt;
- GLint tmp_stride;
- GLint dim;
- GLenum err;
-
- /* valid range is empty? */
- if ((s_knot->unified_knot != NULL && s_knot->unified_nknots == 0) ||
- (t_knot->unified_knot != NULL && t_knot->unified_nknots == 0)) {
- if (s_knot->unified_knot) {
- free(s_knot->unified_knot);
- s_knot->unified_knot = NULL;
- }
- if (t_knot->unified_knot) {
- free(t_knot->unified_knot);
- t_knot->unified_knot = NULL;
- }
- *s_n_ctrl = 0;
- *t_n_ctrl = 0;
- return GLU_NO_ERROR;
- }
- t_cnt = attrib->tknot_count - attrib->torder;
- s_cnt = attrib->sknot_count - attrib->sorder;
- if ((tmp_ctrl = (GLfloat **) malloc(sizeof(GLfloat *) * t_cnt)) == NULL)
- return GLU_OUT_OF_MEMORY;
- if ((err = explode_knot(s_knot)) != GLU_NO_ERROR) {
- free(tmp_ctrl);
- if (s_knot->unified_knot) {
- free(s_knot->unified_knot);
- s_knot->unified_knot = NULL;
- }
- return err;
- }
- if (s_knot->unified_knot) {
- free(s_knot->unified_knot);
- s_knot->unified_knot = NULL;
- }
- if ((err = calc_alphas(s_knot)) != GLU_NO_ERROR) {
- free(tmp_ctrl);
- free(s_knot->new_knot);
- return err;
- }
- free(s_knot->new_knot);
- ctrl_offset = attrib->ctrlarray;
- dim = attrib->dim;
- for (i = 0; i < t_cnt; i++) {
- if ((err = calc_new_ctrl_pts(ctrl_offset, attrib->s_stride, s_knot,
- dim, &(tmp_ctrl[i]),
- &tmp_n_control)) != GLU_NO_ERROR) {
- for (--i; i <= 0; i--)
- free(tmp_ctrl[i]);
- free(tmp_ctrl);
- free(s_knot->alpha);
- return err;
- }
- ctrl_offset += attrib->t_stride;
- }
- free(s_knot->alpha);
- tmp_stride = dim * tmp_n_control;
- if ((*new_ctrl = (GLfloat *) malloc(sizeof(GLfloat) * tmp_stride * t_cnt))
- == NULL) {
- for (i = 0; i < t_cnt; i++)
- free(tmp_ctrl[i]);
- free(tmp_ctrl);
- return GLU_OUT_OF_MEMORY;
- }
- for (i = 0; i < tmp_n_control; i++)
- for (j = 0; j < t_cnt; j++)
- MEMCPY(*new_ctrl + j * dim + i * dim * t_cnt, tmp_ctrl[j] + dim * i,
- sizeof(GLfloat) * dim);
- for (i = 0; i < t_cnt; i++)
- free(tmp_ctrl[i]);
- free(tmp_ctrl);
- *s_n_ctrl = tmp_n_control;
-
- if ((tmp_ctrl = (GLfloat **) malloc(sizeof(GLfloat *) * (*s_n_ctrl))) ==
- NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- if ((err = explode_knot(t_knot)) != GLU_NO_ERROR) {
- free(tmp_ctrl);
- if (t_knot->unified_knot) {
- free(t_knot->unified_knot);
- t_knot->unified_knot = NULL;
- }
- return err;
- }
- if (t_knot->unified_knot) {
- free(t_knot->unified_knot);
- t_knot->unified_knot = NULL;
- }
- if ((err = calc_alphas(t_knot)) != GLU_NO_ERROR) {
- free(tmp_ctrl);
- free(t_knot->new_knot);
- return err;
- }
- free(t_knot->new_knot);
- ctrl_offset = *new_ctrl;
- for (i = 0; i < (*s_n_ctrl); i++) {
- if ((err = calc_new_ctrl_pts(ctrl_offset, dim, t_knot,
- dim, &(tmp_ctrl[i]),
- &tmp_n_control)) != GLU_NO_ERROR) {
- for (--i; i <= 0; i--)
- free(tmp_ctrl[i]);
- free(tmp_ctrl);
- free(t_knot->alpha);
- return err;
- }
- ctrl_offset += dim * t_cnt;
- }
- free(t_knot->alpha);
- free(*new_ctrl);
- tmp_stride = dim * tmp_n_control;
- if (
- (*new_ctrl =
- (GLfloat *) malloc(sizeof(GLfloat) * tmp_stride * (*s_n_ctrl))) ==
- NULL) {
- for (i = 0; i < (*s_n_ctrl); i++)
- free(tmp_ctrl[i]);
- free(tmp_ctrl);
- return GLU_OUT_OF_MEMORY;
- }
- for (i = 0; i < (*s_n_ctrl); i++) {
- MEMCPY(*new_ctrl + i * tmp_stride, tmp_ctrl[i],
- sizeof(GLfloat) * tmp_stride);
- free(tmp_ctrl[i]);
- }
- free(tmp_ctrl);
- *t_n_ctrl = tmp_n_control;
- return GLU_NO_ERROR;
-}
-
-/* prepare the knot information structures */
-static GLenum
-fill_knot_structures(GLUnurbsObj * nobj,
- knot_str_type * geom_s_knot, knot_str_type * geom_t_knot,
- knot_str_type * color_s_knot,
- knot_str_type * color_t_knot,
- knot_str_type * normal_s_knot,
- knot_str_type * normal_t_knot,
- knot_str_type * texture_s_knot,
- knot_str_type * texture_t_knot)
-{
- GLint order;
- GLfloat *knot;
- GLint nknots;
- GLint t_min, t_max;
-
- geom_s_knot->unified_knot = NULL;
- knot = geom_s_knot->knot = nobj->surface.geom.sknot;
- nknots = geom_s_knot->nknots = nobj->surface.geom.sknot_count;
- order = geom_s_knot->order = nobj->surface.geom.sorder;
- geom_s_knot->delta_nknots = 0;
- t_min = geom_s_knot->t_min = order - 1;
- t_max = geom_s_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- geom_s_knot->open_at_begin = GL_TRUE;
- }
- else
- geom_s_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- geom_s_knot->open_at_end = GL_TRUE;
- }
- else
- geom_s_knot->open_at_end = GL_FALSE;
- geom_t_knot->unified_knot = NULL;
- knot = geom_t_knot->knot = nobj->surface.geom.tknot;
- nknots = geom_t_knot->nknots = nobj->surface.geom.tknot_count;
- order = geom_t_knot->order = nobj->surface.geom.torder;
- geom_t_knot->delta_nknots = 0;
- t_min = geom_t_knot->t_min = order - 1;
- t_max = geom_t_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- geom_t_knot->open_at_begin = GL_TRUE;
- }
- else
- geom_t_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- geom_t_knot->open_at_end = GL_TRUE;
- }
- else
- geom_t_knot->open_at_end = GL_FALSE;
-
- if (nobj->surface.color.type != GLU_INVALID_ENUM) {
- color_s_knot->unified_knot = (GLfloat *) 1;
- knot = color_s_knot->knot = nobj->surface.color.sknot;
- nknots = color_s_knot->nknots = nobj->surface.color.sknot_count;
- order = color_s_knot->order = nobj->surface.color.sorder;
- color_s_knot->delta_nknots = 0;
- t_min = color_s_knot->t_min = order - 1;
- t_max = color_s_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- color_s_knot->open_at_begin = GL_TRUE;
- }
- else
- color_s_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- color_s_knot->open_at_end = GL_TRUE;
- }
- else
- color_s_knot->open_at_end = GL_FALSE;
- color_t_knot->unified_knot = (GLfloat *) 1;
- knot = color_t_knot->knot = nobj->surface.color.tknot;
- nknots = color_t_knot->nknots = nobj->surface.color.tknot_count;
- order = color_t_knot->order = nobj->surface.color.torder;
- color_t_knot->delta_nknots = 0;
- t_min = color_t_knot->t_min = order - 1;
- t_max = color_t_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- color_t_knot->open_at_begin = GL_TRUE;
- }
- else
- color_t_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- color_t_knot->open_at_end = GL_TRUE;
- }
- else
- color_t_knot->open_at_end = GL_FALSE;
- }
- else {
- color_s_knot->unified_knot = NULL;
- color_t_knot->unified_knot = NULL;
- }
-
- if (nobj->surface.normal.type != GLU_INVALID_ENUM) {
- normal_s_knot->unified_knot = (GLfloat *) 1;
- knot = normal_s_knot->knot = nobj->surface.normal.sknot;
- nknots = normal_s_knot->nknots = nobj->surface.normal.sknot_count;
- order = normal_s_knot->order = nobj->surface.normal.sorder;
- normal_s_knot->delta_nknots = 0;
- t_min = normal_s_knot->t_min = order - 1;
- t_max = normal_s_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- normal_s_knot->open_at_begin = GL_TRUE;
- }
- else
- normal_s_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- normal_s_knot->open_at_end = GL_TRUE;
- }
- else
- normal_s_knot->open_at_end = GL_FALSE;
- normal_t_knot->unified_knot = (GLfloat *) 1;
- knot = normal_t_knot->knot = nobj->surface.normal.tknot;
- nknots = normal_t_knot->nknots = nobj->surface.normal.tknot_count;
- order = normal_t_knot->order = nobj->surface.normal.torder;
- normal_t_knot->delta_nknots = 0;
- t_min = normal_t_knot->t_min = order - 1;
- t_max = normal_t_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- normal_t_knot->open_at_begin = GL_TRUE;
- }
- else
- normal_t_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- normal_t_knot->open_at_end = GL_TRUE;
- }
- else
- normal_t_knot->open_at_end = GL_FALSE;
- }
- else {
- normal_s_knot->unified_knot = NULL;
- normal_t_knot->unified_knot = NULL;
- }
-
- if (nobj->surface.texture.type != GLU_INVALID_ENUM) {
- texture_s_knot->unified_knot = (GLfloat *) 1;
- knot = texture_s_knot->knot = nobj->surface.texture.sknot;
- nknots = texture_s_knot->nknots = nobj->surface.texture.sknot_count;
- order = texture_s_knot->order = nobj->surface.texture.sorder;
- texture_s_knot->delta_nknots = 0;
- t_min = texture_s_knot->t_min = order - 1;
- t_max = texture_s_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- texture_s_knot->open_at_begin = GL_TRUE;
- }
- else
- texture_s_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- texture_s_knot->open_at_end = GL_TRUE;
- }
- else
- texture_s_knot->open_at_end = GL_FALSE;
- texture_t_knot->unified_knot = (GLfloat *) 1;
- knot = texture_t_knot->knot = nobj->surface.texture.tknot;
- nknots = texture_t_knot->nknots = nobj->surface.texture.tknot_count;
- order = texture_t_knot->order = nobj->surface.texture.torder;
- texture_t_knot->delta_nknots = 0;
- t_min = texture_t_knot->t_min = order - 1;
- t_max = texture_t_knot->t_max = nknots - order;
- if (fabs(knot[t_min] - knot[t_max]) < EPSILON) {
- call_user_error(nobj, GLU_NURBS_ERROR3);
- return GLU_ERROR;
- }
- if (fabs(knot[0] - knot[t_min]) < EPSILON) {
- /* knot open at beggining */
- texture_t_knot->open_at_begin = GL_TRUE;
- }
- else
- texture_t_knot->open_at_begin = GL_FALSE;
- if (fabs(knot[t_max] - knot[nknots - 1]) < EPSILON) {
- /* knot open at end */
- texture_t_knot->open_at_end = GL_TRUE;
- }
- else
- texture_t_knot->open_at_end = GL_FALSE;
- }
- else {
- texture_s_knot->unified_knot = NULL;
- texture_t_knot->unified_knot = NULL;
- }
- return GLU_NO_ERROR;
-}
-
-
-static void
-free_new_ctrl(new_ctrl_type * p)
-{
- if (p->geom_ctrl)
- free(p->geom_ctrl);
- if (p->geom_offsets)
- free(p->geom_offsets);
- if (p->color_ctrl) {
- free(p->color_ctrl);
- if (p->color_offsets)
- free(p->color_offsets);
- }
- if (p->normal_ctrl) {
- free(p->normal_ctrl);
- if (p->normal_offsets)
- free(p->normal_offsets);
- }
- if (p->texture_ctrl) {
- free(p->texture_ctrl);
- if (p->texture_offsets)
- free(p->texture_offsets);
- }
-}
-
-/* convert surfaces - geometry and possible attribute ones into equivalent */
-/* sequence of adjacent Bezier patches */
-static GLenum
-convert_surfs(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl)
-{
- knot_str_type geom_s_knot, color_s_knot, normal_s_knot, texture_s_knot;
- knot_str_type geom_t_knot, color_t_knot, normal_t_knot, texture_t_knot;
- GLenum err;
-
- if ((err = fill_knot_structures(nobj, &geom_s_knot, &geom_t_knot,
- &color_s_knot, &color_t_knot,
- &normal_s_knot, &normal_t_knot,
- &texture_s_knot,
- &texture_t_knot)) != GLU_NO_ERROR) {
- return err;
- }
- /* unify knots - all knots should have the same working range */
- if ((err = select_knot_working_range(nobj, &geom_s_knot, &color_s_knot,
- &normal_s_knot,
- &texture_s_knot)) != GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return err;
- }
- if ((err = select_knot_working_range(nobj, &geom_t_knot, &color_t_knot,
- &normal_t_knot,
- &texture_t_knot)) != GLU_NO_ERROR) {
- free_unified_knots(&geom_s_knot, &color_s_knot, &normal_s_knot,
- &texture_s_knot);
- call_user_error(nobj, err);
- return err;
- }
-
- /* convert the geometry surface */
- nobj->surface.geom.dim = get_surface_dim(nobj->surface.geom.type);
- if ((err = convert_surf(&geom_s_knot, &geom_t_knot, &(nobj->surface.geom),
- &(new_ctrl->geom_ctrl), &(new_ctrl->geom_s_pt_cnt),
- &(new_ctrl->geom_t_pt_cnt))) != GLU_NO_ERROR) {
- free_unified_knots(&geom_s_knot, &color_s_knot, &normal_s_knot,
- &texture_s_knot);
- free_unified_knots(&geom_t_knot, &color_t_knot, &normal_t_knot,
- &texture_t_knot);
- call_user_error(nobj, err);
- return err;
- }
- /* if additional attributive surfaces are given convert them as well */
- if (color_s_knot.unified_knot) {
- nobj->surface.color.dim = get_surface_dim(nobj->surface.color.type);
- if (
- (err =
- convert_surf(&color_s_knot, &color_t_knot, &(nobj->surface.color),
- &(new_ctrl->color_ctrl), &(new_ctrl->color_s_pt_cnt),
- &(new_ctrl->color_t_pt_cnt))) != GLU_NO_ERROR) {
- free_unified_knots(&color_s_knot, &color_s_knot, &normal_s_knot,
- &texture_s_knot);
- free_unified_knots(&color_t_knot, &color_t_knot, &normal_t_knot,
- &texture_t_knot);
- free_new_ctrl(new_ctrl);
- call_user_error(nobj, err);
- return err;
- }
- }
- if (normal_s_knot.unified_knot) {
- nobj->surface.normal.dim = get_surface_dim(nobj->surface.normal.type);
- if ((err = convert_surf(&normal_s_knot, &normal_t_knot,
- &(nobj->surface.normal),
- &(new_ctrl->normal_ctrl),
- &(new_ctrl->normal_s_pt_cnt),
- &(new_ctrl->normal_t_pt_cnt))) !=
- GLU_NO_ERROR) {
- free_unified_knots(&normal_s_knot, &normal_s_knot, &normal_s_knot,
- &texture_s_knot);
- free_unified_knots(&normal_t_knot, &normal_t_knot, &normal_t_knot,
- &texture_t_knot);
- free_new_ctrl(new_ctrl);
- call_user_error(nobj, err);
- return err;
- }
- }
- if (texture_s_knot.unified_knot) {
- nobj->surface.texture.dim = get_surface_dim(nobj->surface.texture.type);
- if ((err = convert_surf(&texture_s_knot, &texture_t_knot,
- &(nobj->surface.texture),
- &(new_ctrl->texture_ctrl),
- &(new_ctrl->texture_s_pt_cnt),
- &(new_ctrl->texture_t_pt_cnt))) !=
- GLU_NO_ERROR) {
- free_unified_knots(&texture_s_knot, &texture_s_knot, &texture_s_knot,
- &texture_s_knot);
- free_unified_knots(&texture_t_knot, &texture_t_knot, &texture_t_knot,
- &texture_t_knot);
- free_new_ctrl(new_ctrl);
- call_user_error(nobj, err);
- return err;
- }
- }
- return GLU_NO_ERROR;
-}
-
-/* tesselate the "boundary" Bezier edge strips */
-static void
-tesselate_strip_t_line(GLint top_start, GLint top_end, GLint top_z,
- GLint bottom_start, GLint bottom_end, GLint bottom_z,
- GLint bottom_domain)
-{
- GLint top_cnt, bottom_cnt, tri_cnt, k;
- GLint direction;
-
- top_cnt = top_end - top_start;
- direction = (top_cnt >= 0 ? 1 : -1);
- bottom_cnt = bottom_end - bottom_start;
- glBegin(GL_LINES);
- while (top_cnt) {
- if (bottom_cnt)
- tri_cnt = top_cnt / bottom_cnt;
- else
- tri_cnt = abs(top_cnt);
- for (k = 0; k <= tri_cnt; k++, top_start += direction) {
- glEvalCoord2f((GLfloat) bottom_z / bottom_domain,
- (GLfloat) bottom_start / bottom_domain);
- glEvalPoint2(top_z, top_start);
- }
- if (bottom_cnt) {
- glEvalCoord2f((GLfloat) bottom_z / bottom_domain,
- (GLfloat) bottom_start / bottom_domain);
- bottom_start += direction;
- top_start -= direction;
- glEvalCoord2f((GLfloat) bottom_z / bottom_domain,
- (GLfloat) bottom_start / bottom_domain);
- glEvalCoord2f((GLfloat) bottom_z / bottom_domain,
- (GLfloat) bottom_start / bottom_domain);
- glEvalPoint2(top_z, top_start);
- }
- top_cnt -= direction * tri_cnt;
- bottom_cnt -= direction;
- }
- glEnd();
-}
-
-
-static void
-tesselate_strip_t_fill(GLint top_start, GLint top_end, GLint top_z,
- GLint bottom_start, GLint bottom_end, GLint bottom_z,
- GLint bottom_domain)
-{
- GLint top_cnt, bottom_cnt, tri_cnt, k;
- GLint direction;
-
- top_cnt = top_end - top_start;
- direction = (top_cnt >= 0 ? 1 : -1);
- bottom_cnt = bottom_end - bottom_start;
- while (top_cnt) {
- if (bottom_cnt)
- tri_cnt = top_cnt / bottom_cnt;
- else
- tri_cnt = abs(top_cnt);
- glBegin(GL_TRIANGLE_FAN);
- glEvalCoord2f((GLfloat) bottom_z / bottom_domain,
- (GLfloat) bottom_start / bottom_domain);
- for (k = 0; k <= tri_cnt; k++, top_start += direction)
- glEvalPoint2(top_z, top_start);
- if (bottom_cnt) {
- bottom_start += direction;
- top_start -= direction;
- glEvalCoord2f((GLfloat) bottom_z / bottom_domain,
- (GLfloat) bottom_start / bottom_domain);
- }
- glEnd();
- top_cnt -= direction * tri_cnt;
- bottom_cnt -= direction;
- }
-}
-
-
-static void
-tesselate_strip_t(GLenum display_mode, GLint top_start, GLint top_end,
- GLint top_z, GLint bottom_start, GLint bottom_end,
- GLint bottom_z, GLint bottom_domain)
-{
- if (display_mode == GL_FILL)
- tesselate_strip_t_fill(top_start, top_end, top_z, bottom_start,
- bottom_end, bottom_z, bottom_domain);
- else
- tesselate_strip_t_line(top_start, top_end, top_z, bottom_start,
- bottom_end, bottom_z, bottom_domain);
-}
-
-
-static void
-tesselate_strip_s_fill(GLint top_start, GLint top_end, GLint top_z,
- GLint bottom_start, GLint bottom_end, GLint bottom_z,
- GLfloat bottom_domain)
-{
- GLint top_cnt, bottom_cnt, tri_cnt, k;
- GLint direction;
-
- top_cnt = top_end - top_start;
- direction = (top_cnt >= 0 ? 1 : -1);
- bottom_cnt = bottom_end - bottom_start;
- while (top_cnt) {
- if (bottom_cnt)
- tri_cnt = top_cnt / bottom_cnt;
- else
- tri_cnt = abs(top_cnt);
- glBegin(GL_TRIANGLE_FAN);
- glEvalCoord2f((GLfloat) bottom_start / bottom_domain,
- (GLfloat) bottom_z / bottom_domain);
- for (k = 0; k <= tri_cnt; k++, top_start += direction)
- glEvalPoint2(top_start, top_z);
- if (bottom_cnt) {
- bottom_start += direction;
- top_start -= direction;
- glEvalCoord2f((GLfloat) bottom_start / bottom_domain,
- (GLfloat) bottom_z / bottom_domain);
- }
- glEnd();
- top_cnt -= direction * tri_cnt;
- bottom_cnt -= direction;
- }
-}
-
-
-static void
-tesselate_strip_s_line(GLint top_start, GLint top_end, GLint top_z,
- GLint bottom_start, GLint bottom_end, GLint bottom_z,
- GLfloat bottom_domain)
-{
- GLint top_cnt, bottom_cnt, tri_cnt, k;
- GLint direction;
-
- top_cnt = top_end - top_start;
- direction = (top_cnt >= 0 ? 1 : -1);
- bottom_cnt = bottom_end - bottom_start;
- glBegin(GL_LINES);
- while (top_cnt) {
- if (bottom_cnt)
- tri_cnt = top_cnt / bottom_cnt;
- else
- tri_cnt = abs(top_cnt);
- for (k = 0; k <= tri_cnt; k++, top_start += direction) {
- glEvalCoord2f((GLfloat) bottom_start / bottom_domain,
- (GLfloat) bottom_z / bottom_domain);
- glEvalPoint2(top_start, top_z);
- }
- if (bottom_cnt) {
- glEvalCoord2f((GLfloat) bottom_start / bottom_domain,
- (GLfloat) bottom_z / bottom_domain);
- bottom_start += direction;
- top_start -= direction;
- glEvalCoord2f((GLfloat) bottom_start / bottom_domain,
- (GLfloat) bottom_z / bottom_domain);
- glEvalPoint2(top_start, top_z);
- glEvalCoord2f((GLfloat) bottom_start / bottom_domain,
- (GLfloat) bottom_z / bottom_domain);
- }
- top_cnt -= direction * tri_cnt;
- bottom_cnt -= direction;
- }
- glEnd();
-}
-
-
-static void
-tesselate_strip_s(GLenum display_mode, GLint top_start, GLint top_end,
- GLint top_z, GLint bottom_start, GLint bottom_end,
- GLint bottom_z, GLfloat bottom_domain)
-{
- if (display_mode == GL_FILL)
- tesselate_strip_s_fill(top_start, top_end, top_z, bottom_start,
- bottom_end, bottom_z, bottom_domain);
- else
- tesselate_strip_s_line(top_start, top_end, top_z, bottom_start,
- bottom_end, bottom_z, bottom_domain);
-}
-
-static void
-tesselate_bottom_left_corner(GLenum display_mode, GLfloat s_1, GLfloat t_1)
-{
- if (display_mode == GL_FILL) {
- glBegin(GL_TRIANGLE_FAN);
- glEvalPoint2(1, 1);
- glEvalCoord2f(s_1, 0.0);
- glEvalCoord2f(0.0, 0.0);
- glEvalCoord2f(0.0, t_1);
- }
- else {
- glBegin(GL_LINES);
- glEvalCoord2f(0.0, 0.0);
- glEvalCoord2f(0.0, t_1);
- glEvalCoord2f(0.0, 0.0);
- glEvalPoint2(1, 1);
- glEvalCoord2f(0.0, 0.0);
- glEvalCoord2f(s_1, 0.0);
- }
- glEnd();
-}
-
-static void
-tesselate_bottom_right_corner(GLenum display_mode, GLint v_top,
- GLint v_bottom, GLfloat s_1, GLfloat t_1)
-{
- if (display_mode == GL_FILL) {
- glBegin(GL_TRIANGLE_FAN);
- glEvalPoint2(1, v_top);
- glEvalCoord2f(0.0, v_bottom * t_1);
- glEvalCoord2f(0.0, (v_bottom + 1) * t_1);
- glEvalCoord2f(s_1, (v_bottom + 1) * t_1);
- }
- else {
- glBegin(GL_LINES);
- glEvalCoord2f(0.0, (v_bottom + 1) * t_1);
- glEvalPoint2(1, v_top);
- glEvalCoord2f(0.0, (v_bottom + 1) * t_1);
- glEvalCoord2f(0.0, v_bottom * t_1);
- glEvalCoord2f(0.0, (v_bottom + 1) * t_1);
- glEvalCoord2f(s_1, (v_bottom + 1) * t_1);
- }
- glEnd();
-}
-
-static void
-tesselate_top_left_corner(GLenum display_mode, GLint u_right, GLint u_left,
- GLfloat s_1, GLfloat t_1)
-{
- if (display_mode == GL_FILL) {
- glBegin(GL_TRIANGLE_FAN);
- glEvalPoint2(u_right, 1);
- glEvalCoord2f((u_left + 1) * s_1, t_1);
- glEvalCoord2f((u_left + 1) * s_1, 0.0);
- glEvalCoord2f(u_left * s_1, 0.0);
- }
- else {
- glBegin(GL_LINES);
- glEvalCoord2f((u_left + 1) * s_1, 0.0);
- glEvalPoint2(u_right, 1);
- glEvalCoord2f((u_left + 1) * s_1, 0.0);
- glEvalCoord2f(u_left * s_1, 0.0);
- glEvalCoord2f((u_left + 1) * s_1, 0.0);
- glEvalCoord2f((u_left + 1) * s_1, t_1);
- }
- glEnd();
-}
-
-static void
-tesselate_top_right_corner(GLenum display_mode, GLint u_left, GLint v_bottom,
- GLint u_right, GLint v_top, GLfloat s_1,
- GLfloat t_1)
-{
- if (display_mode == GL_FILL) {
- glBegin(GL_TRIANGLE_FAN);
- glEvalPoint2(u_left, v_bottom);
- glEvalCoord2f((u_right - 1) * s_1, v_top * t_1);
- glEvalCoord2f(u_right * s_1, v_top * t_1);
- glEvalCoord2f(u_right * s_1, (v_top - 1) * t_1);
- }
- else {
- glBegin(GL_LINES);
- glEvalCoord2f(u_right * s_1, v_top * t_1);
- glEvalPoint2(u_left, v_bottom);
- glEvalCoord2f(u_right * s_1, v_top * t_1);
- glEvalCoord2f(u_right * s_1, (v_top - 1) * t_1);
- glEvalCoord2f(u_right * s_1, v_top * t_1);
- glEvalCoord2f((u_right - 1) * s_1, v_top * t_1);
- }
- glEnd();
-}
-
-/* do mesh mapping of Bezier */
-static void
-nurbs_map_bezier(GLenum display_mode, GLint * sfactors, GLint * tfactors,
- GLint s_bezier_cnt, GLint t_bezier_cnt, GLint s, GLint t)
-{
- GLint top, bottom, right, left;
-
-
- if (s == 0) {
- top = *(tfactors + t * 3);
- bottom = *(tfactors + t * 3 + 1);
- }
- else if (s == s_bezier_cnt - 1) {
- top = *(tfactors + t * 3 + 2);
- bottom = *(tfactors + t * 3);
- }
- else {
- top = bottom = *(tfactors + t * 3);
- }
- if (t == 0) {
- left = *(sfactors + s * 3 + 1);
- right = *(sfactors + s * 3);
- }
- else if (t == t_bezier_cnt - 1) {
- left = *(sfactors + s * 3);
- right = *(sfactors + s * 3 + 2);
- }
- else {
- left = right = *(sfactors + s * 3);
- }
-
- if (top > bottom) {
- if (left < right) {
- glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0);
- glEvalMesh2(display_mode, 1, right, 1, top);
- tesselate_strip_s(display_mode, 1, right, 1, 1, left, 0,
- (GLfloat) left);
- tesselate_bottom_left_corner(display_mode, (GLfloat) (1.0 / left),
- (GLfloat) (1.0 / bottom));
-/* tesselate_strip_t(display_mode,1,top,1,1,bottom,0,(GLfloat)bottom);*/
- tesselate_strip_t(display_mode, top, 1, 1, bottom, 1, 0,
- (GLfloat) bottom);
- }
- else if (left == right) {
- glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0);
- glEvalMesh2(display_mode, 1, right, 0, top);
-/* tesselate_strip_t(display_mode,0,top,1,0,bottom,0,(GLfloat)bottom);*/
- tesselate_strip_t(display_mode, top, 0, 1, bottom, 0, 0,
- (GLfloat) bottom);
- }
- else {
- glMapGrid2f(left, 0.0, 1.0, top, 0.0, 1.0);
- glEvalMesh2(display_mode, 1, left, 0, top - 1);
-/* tesselate_strip_t(display_mode,0,top-1,1,0,bottom-1,0,
- (GLfloat)bottom);*/
- tesselate_strip_t(display_mode, top - 1, 0, 1, bottom - 1, 0, 0,
- (GLfloat) bottom);
- tesselate_bottom_right_corner(display_mode, top - 1, bottom - 1,
- (GLfloat) (1.0 / right),
- (GLfloat) (1.0 / bottom));
-/* tesselate_strip_s(display_mode,1,left,top-1,1,right,right,
- (GLfloat)right);*/
- tesselate_strip_s(display_mode, left, 1, top - 1, right, 1, right,
- (GLfloat) right);
- }
- }
- else if (top == bottom) {
- if (left < right) {
- glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0);
- glEvalMesh2(display_mode, 0, right, 1, top);
- tesselate_strip_s(display_mode, 0, right, 1, 0, left, 0,
- (GLfloat) left);
- }
- else if (left == right) {
- glMapGrid2f(right, 0.0, 1.0, top, 0.0, 1.0);
- glEvalMesh2(display_mode, 0, right, 0, top);
- }
- else {
- glMapGrid2f(left, 0.0, 1.0, top, 0.0, 1.0);
- glEvalMesh2(display_mode, 0, left, 0, top - 1);
-/* tesselate_strip_s(display_mode,0,left,top-1,0,right,right,
- (GLfloat)right);*/
- tesselate_strip_s(display_mode, left, 0, top - 1, right, 0, right,
- (GLfloat) right);
- }
- }
- else {
- if (left < right) {
- glMapGrid2f(right, 0.0, 1.0, bottom, 0.0, 1.0);
- glEvalMesh2(display_mode, 0, right - 1, 1, bottom);
- tesselate_strip_s(display_mode, 0, right - 1, 1, 0, left - 1, 0,
- (GLfloat) left);
- tesselate_top_left_corner(display_mode, right - 1, left - 1,
- (GLfloat) (1.0 / left),
- (GLfloat) (1.0 / top));
- tesselate_strip_t(display_mode, 1, bottom, right - 1, 1, top, top,
- (GLfloat) top);
- }
- else if (left == right) {
- glMapGrid2f(right, 0.0, 1.0, bottom, 0.0, 1.0);
- glEvalMesh2(display_mode, 0, right - 1, 0, bottom);
- tesselate_strip_t(display_mode, 0, bottom, right - 1, 0, top, top,
- (GLfloat) top);
- }
- else {
- glMapGrid2f(left, 0.0, 1.0, bottom, 0.0, 1.0);
- glEvalMesh2(display_mode, 0, left - 1, 0, bottom - 1);
- tesselate_strip_t(display_mode, 0, bottom - 1, left - 1, 0, top - 1,
- top, (GLfloat) top);
- tesselate_top_right_corner(display_mode, left - 1, bottom - 1, right,
- top, (GLfloat) (1.0 / right),
- (GLfloat) (1.0 / top));
-/* tesselate_strip_s(display_mode,0,left-1,bottom-1,0,right-1,right,
- (GLfloat)right);*/
- tesselate_strip_s(display_mode, left - 1, 0, bottom - 1, right - 1,
- 0, right, (GLfloat) right);
- }
- }
-}
-
-/* draw NURBS surface in OUTLINE POLYGON mode */
-static void
-draw_polygon_mode(GLenum display_mode, GLUnurbsObj * nobj,
- new_ctrl_type * new_ctrl, GLint * sfactors,
- GLint * tfactors)
-{
- GLsizei offset;
- GLint t_bezier_cnt, s_bezier_cnt;
- GLboolean do_color, do_normal, do_texture;
- GLint i, j;
-
- t_bezier_cnt = new_ctrl->t_bezier_cnt;
- s_bezier_cnt = new_ctrl->s_bezier_cnt;
- glEnable(nobj->surface.geom.type);
- if (new_ctrl->color_ctrl) {
- glEnable(nobj->surface.color.type);
- do_color = GL_TRUE;
- }
- else
- do_color = GL_FALSE;
- if (new_ctrl->normal_ctrl) {
- glEnable(nobj->surface.normal.type);
- do_normal = GL_TRUE;
- }
- else
- do_normal = GL_FALSE;
- if (new_ctrl->texture_ctrl) {
- glEnable(nobj->surface.texture.type);
- do_texture = GL_TRUE;
- }
- else
- do_texture = GL_FALSE;
- for (j = 0; j < s_bezier_cnt; j++) {
- for (i = 0; i < t_bezier_cnt; i++) {
- offset = j * t_bezier_cnt + i;
- if (fine_culling_test_3D(nobj, *(new_ctrl->geom_offsets + offset),
- nobj->surface.geom.sorder,
- nobj->surface.geom.torder,
- new_ctrl->geom_s_stride,
- new_ctrl->geom_t_stride,
- nobj->surface.geom.dim)) continue;
- glMap2f(nobj->surface.geom.type, 0.0, 1.0, new_ctrl->geom_s_stride,
- nobj->surface.geom.sorder, 0.0, 1.0, new_ctrl->geom_t_stride,
- nobj->surface.geom.torder,
- *(new_ctrl->geom_offsets + offset));
- if (do_color) {
- glMap2f(nobj->surface.color.type, 0.0, 1.0,
- new_ctrl->color_s_stride, nobj->surface.color.sorder,
- 0.0, 1.0, new_ctrl->color_t_stride,
- nobj->surface.color.torder,
- *(new_ctrl->color_offsets + offset));
- }
- if (do_normal) {
- glMap2f(nobj->surface.normal.type, 0.0, 1.0,
- new_ctrl->normal_s_stride, nobj->surface.normal.sorder,
- 0.0, 1.0, new_ctrl->normal_t_stride,
- nobj->surface.normal.torder,
- *(new_ctrl->normal_offsets + offset));
- }
- if (do_texture) {
- glMap2f(nobj->surface.texture.type, 0.0, 1.0,
- new_ctrl->texture_s_stride, nobj->surface.texture.sorder,
- 0.0, 1.0, new_ctrl->texture_t_stride,
- nobj->surface.texture.torder,
- *(new_ctrl->texture_offsets + offset));
- }
-/* glMapGrid2f(sfactors[j*3+0],0.0,1.0,tfactors[i*3+0],0.0,1.0);
- glEvalMesh2(display_mode,0,sfactors[j*3+0],0,tfactors[i*3+0]);*/
- nurbs_map_bezier(display_mode, sfactors, tfactors, s_bezier_cnt,
- t_bezier_cnt, j, i);
- }
- }
-}
-
-
-
-/* draw NURBS surface in OUTLINE POLYGON mode */
-#if 0
-static void
-draw_patch_mode(GLenum display_mode, GLUnurbsObj * nobj,
- new_ctrl_type * new_ctrl, GLint * sfactors, GLint * tfactors)
-{
- GLsizei offset;
- GLint t_bezier_cnt, s_bezier_cnt;
- GLboolean do_color, do_normal, do_texture;
- GLint i, j;
-
- t_bezier_cnt = new_ctrl->t_bezier_cnt;
- s_bezier_cnt = new_ctrl->s_bezier_cnt;
- glEnable(nobj->surface.geom.type);
- if (new_ctrl->color_ctrl) {
- glEnable(nobj->surface.color.type);
- do_color = GL_TRUE;
- }
- else
- do_color = GL_FALSE;
- if (new_ctrl->normal_ctrl) {
- glEnable(nobj->surface.normal.type);
- do_normal = GL_TRUE;
- }
- else
- do_normal = GL_FALSE;
- if (new_ctrl->texture_ctrl) {
- glEnable(nobj->surface.texture.type);
- do_texture = GL_TRUE;
- }
- else
- do_texture = GL_FALSE;
- for (j = 0; j < s_bezier_cnt; j++) {
- for (i = 0; i < t_bezier_cnt; i++) {
- offset = j * t_bezier_cnt + i;
- if (fine_culling_test_3D(nobj, *(new_ctrl->geom_offsets + offset),
- nobj->surface.geom.sorder,
- nobj->surface.geom.torder,
- new_ctrl->geom_s_stride,
- new_ctrl->geom_t_stride,
- nobj->surface.geom.dim)) continue;
- glMap2f(nobj->surface.geom.type, 0.0, 1.0, new_ctrl->geom_s_stride,
- nobj->surface.geom.sorder, 0.0, 1.0, new_ctrl->geom_t_stride,
- nobj->surface.geom.torder,
- *(new_ctrl->geom_offsets + offset));
- if (do_color) {
- glMap2f(nobj->surface.color.type, 0.0, 1.0,
- new_ctrl->color_s_stride, nobj->surface.color.sorder,
- 0.0, 1.0, new_ctrl->color_t_stride,
- nobj->surface.color.torder,
- *(new_ctrl->color_offsets + offset));
- }
- if (do_normal) {
- glMap2f(nobj->surface.normal.type, 0.0, 1.0,
- new_ctrl->normal_s_stride, nobj->surface.normal.sorder,
- 0.0, 1.0, new_ctrl->normal_t_stride,
- nobj->surface.normal.torder,
- *(new_ctrl->normal_offsets + offset));
- }
- if (do_texture) {
- glMap2f(nobj->surface.texture.type, 0.0, 1.0,
- new_ctrl->texture_s_stride, nobj->surface.texture.sorder,
- 0.0, 1.0, new_ctrl->texture_t_stride,
- nobj->surface.texture.torder,
- *(new_ctrl->texture_offsets + offset));
- }
- nurbs_map_bezier(display_mode, sfactors, tfactors, s_bezier_cnt,
- t_bezier_cnt, i, j);
-/* glMapGrid2f(sfactors[j],0.0,1.0,tfactors[i],0.0,1.0);
- glEvalMesh2(display_mode,0,sfactors[j],0,tfactors[i]);*/
- }
- }
-}
-#endif
-
-
-
-static void
-init_new_ctrl(new_ctrl_type * p)
-{
- p->geom_ctrl = p->color_ctrl = p->normal_ctrl = p->texture_ctrl = NULL;
- p->geom_offsets = p->color_offsets = p->normal_offsets =
- p->texture_offsets = NULL;
- p->s_bezier_cnt = p->t_bezier_cnt = 0;
-}
-
-
-static GLenum
-augment_new_ctrl(GLUnurbsObj * nobj, new_ctrl_type * p)
-{
- GLsizei offset_size;
- GLint i, j;
-
- p->s_bezier_cnt = (p->geom_s_pt_cnt) / (nobj->surface.geom.sorder);
- p->t_bezier_cnt = (p->geom_t_pt_cnt) / (nobj->surface.geom.torder);
- offset_size = (p->s_bezier_cnt) * (p->t_bezier_cnt);
- p->geom_t_stride = nobj->surface.geom.dim;
- p->geom_s_stride = (p->geom_t_pt_cnt) * (nobj->surface.geom.dim);
- p->color_t_stride = nobj->surface.color.dim;
- p->color_s_stride = (p->color_t_pt_cnt) * (nobj->surface.color.dim);
- p->normal_t_stride = nobj->surface.normal.dim;
- p->normal_s_stride = (p->normal_t_pt_cnt) * (nobj->surface.normal.dim);
- p->texture_t_stride = nobj->surface.texture.dim;
- p->texture_s_stride = (p->texture_t_pt_cnt) * (nobj->surface.texture.dim);
- if (
- (p->geom_offsets =
- (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- if (p->color_ctrl)
- if (
- (p->color_offsets =
- (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) {
- free_new_ctrl(p);
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- if (p->normal_ctrl)
- if (
- (p->normal_offsets =
- (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) {
- free_new_ctrl(p);
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- if (p->texture_ctrl)
- if (
- (p->texture_offsets =
- (GLfloat **) malloc(sizeof(GLfloat *) * offset_size)) == NULL) {
- free_new_ctrl(p);
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- for (i = 0; i < p->s_bezier_cnt; i++)
- for (j = 0; j < p->t_bezier_cnt; j++)
- *(p->geom_offsets + i * (p->t_bezier_cnt) + j) =
- p->geom_ctrl + i * (nobj->surface.geom.sorder) *
- (nobj->surface.geom.dim) * (p->geom_t_pt_cnt) +
- j * (nobj->surface.geom.dim) * (nobj->surface.geom.torder);
- if (p->color_ctrl)
- for (i = 0; i < p->s_bezier_cnt; i++)
- for (j = 0; j < p->t_bezier_cnt; j++)
- *(p->color_offsets + i * (p->t_bezier_cnt) + j) =
- p->color_ctrl + i * (nobj->surface.color.sorder) *
- (nobj->surface.color.dim) * (p->color_t_pt_cnt) +
- j * (nobj->surface.color.dim) * (nobj->surface.color.torder);
- if (p->normal_ctrl)
- for (i = 0; i < p->s_bezier_cnt; i++)
- for (j = 0; j < p->t_bezier_cnt; j++)
- *(p->normal_offsets + i * (p->t_bezier_cnt) + j) =
- p->normal_ctrl + i * (nobj->surface.normal.sorder) *
- (nobj->surface.normal.dim) * (p->normal_t_pt_cnt) +
- j * (nobj->surface.normal.dim) * (nobj->surface.normal.torder);
- if (p->texture_ctrl)
- for (i = 0; i < p->s_bezier_cnt; i++)
- for (j = 0; j < p->t_bezier_cnt; j++)
- *(p->texture_offsets + i * (p->t_bezier_cnt) + j) =
- p->texture_ctrl + i * (nobj->surface.texture.sorder) *
- (nobj->surface.texture.dim) * (p->texture_t_pt_cnt) +
- j * (nobj->surface.texture.dim) *
- (nobj->surface.texture.torder);
- return GLU_NO_ERROR;
-}
-
-/* main NURBS surface procedure */
-void
-do_nurbs_surface(GLUnurbsObj * nobj)
-{
- GLint *sfactors, *tfactors;
- new_ctrl_type new_ctrl;
-
- /* test user supplied data */
- if (test_nurbs_surfaces(nobj) != GLU_NO_ERROR)
- return;
-
- init_new_ctrl(&new_ctrl);
-
- if (convert_surfs(nobj, &new_ctrl) != GLU_NO_ERROR)
- return;
- if (augment_new_ctrl(nobj, &new_ctrl) != GLU_NO_ERROR)
- return;
- switch (nobj->sampling_method) {
- case GLU_PATH_LENGTH:
- if (glu_do_sampling_3D(nobj, &new_ctrl, &sfactors, &tfactors) !=
- GLU_NO_ERROR) {
- free_new_ctrl(&new_ctrl);
- return;
- }
- break;
- case GLU_DOMAIN_DISTANCE:
- if (glu_do_sampling_uv(nobj, &new_ctrl, &sfactors, &tfactors) !=
- GLU_NO_ERROR) {
- free_new_ctrl(&new_ctrl);
- return;
- }
- break;
- case GLU_PARAMETRIC_ERROR:
- if (glu_do_sampling_param_3D(nobj, &new_ctrl, &sfactors, &tfactors) !=
- GLU_NO_ERROR) {
- free_new_ctrl(&new_ctrl);
- return;
- }
- break;
- default:
- abort();
- }
- glFrontFace(GL_CW);
- switch (nobj->display_mode) {
- case GLU_FILL:
-/* if(polygon_trimming(nobj,&new_ctrl,sfactors,tfactors)==GLU_NO_ERROR)*/
- draw_polygon_mode(GL_FILL, nobj, &new_ctrl, sfactors, tfactors);
- break;
- case GLU_OUTLINE_POLYGON:
- /* TODO - missing trimming handeling */
-/* just for now - no OUTLINE_PATCH mode
- draw_patch_mode(GL_LINE,nobj,&new_ctrl,sfactors,tfactors);
- break; */
- case GLU_OUTLINE_PATCH:
-/* if(polygon_trimming(nobj,&new_ctrl,sfactors,tfactors)==GLU_NO_ERROR)*/
- draw_polygon_mode(GL_LINE, nobj, &new_ctrl, sfactors, tfactors);
- break;
- default:
- abort(); /* TODO: is this OK? */
- }
- free(sfactors);
- free(tfactors);
- free_new_ctrl(&new_ctrl);
-}
diff --git a/src/glu/mesa/nurbsutl.c b/src/glu/mesa/nurbsutl.c
deleted file mode 100644
index b46348a50b2..00000000000
--- a/src/glu/mesa/nurbsutl.c
+++ /dev/null
@@ -1,1309 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "nurbs.h"
-#endif
-
-
-GLenum test_knot(GLint nknots, GLfloat * knot, GLint order)
-{
- GLsizei i;
- GLint knot_mult;
- GLfloat tmp_knot;
-
- tmp_knot = knot[0];
- knot_mult = 1;
- for (i = 1; i < nknots; i++) {
- if (knot[i] < tmp_knot)
- return GLU_NURBS_ERROR4;
- if (fabs(tmp_knot - knot[i]) > EPSILON) {
- if (knot_mult > order)
- return GLU_NURBS_ERROR5;
- knot_mult = 1;
- tmp_knot = knot[i];
- }
- else
- ++knot_mult;
- }
- return GLU_NO_ERROR;
-}
-
-static int
-/* qsort function */
-#if defined(WIN32) && !defined(OPENSTEP)
- __cdecl
-#endif
-knot_sort(const void *a, const void *b)
-{
- GLfloat x, y;
-
- x = *((GLfloat *) a);
- y = *((GLfloat *) b);
- if (fabs(x - y) < EPSILON)
- return 0;
- if (x > y)
- return 1;
- return -1;
-}
-
-/* insert into dest knot all values within the valid range from src knot */
-/* that do not appear in dest */
-void
-collect_unified_knot(knot_str_type * dest, knot_str_type * src,
- GLfloat maximal_min_knot, GLfloat minimal_max_knot)
-{
- GLfloat *src_knot, *dest_knot;
- GLint src_t_min, src_t_max, dest_t_min, dest_t_max;
- GLint src_nknots, dest_nknots;
- GLint i, j, k, new_cnt;
- GLboolean not_found_flag;
-
- src_knot = src->unified_knot;
- dest_knot = dest->unified_knot;
- src_t_min = src->t_min;
- src_t_max = src->t_max;
- dest_t_min = dest->t_min;
- dest_t_max = dest->t_max;
- src_nknots = src->unified_nknots;
- dest_nknots = dest->unified_nknots;
-
- k = new_cnt = dest_nknots;
- for (i = src_t_min; i <= src_t_max; i++)
- if (src_knot[i] - maximal_min_knot > -EPSILON &&
- src_knot[i] - minimal_max_knot < EPSILON) {
- not_found_flag = GL_TRUE;
- for (j = dest_t_min; j <= dest_t_max; j++)
- if (fabs(dest_knot[j] - src_knot[i]) < EPSILON) {
- not_found_flag = GL_FALSE;
- break;
- }
- if (not_found_flag) {
- /* knot from src is not in dest - add this knot to dest */
- dest_knot[k++] = src_knot[i];
- ++new_cnt;
- ++(dest->t_max); /* the valid range widens */
- ++(dest->delta_nknots); /* increment the extra knot value counter */
- }
- }
- dest->unified_nknots = new_cnt;
- qsort((void *) dest_knot, (size_t) new_cnt, (size_t) sizeof(GLfloat),
- &knot_sort);
-}
-
-/* basing on the new common knot range for all attributes set */
-/* t_min and t_max values for each knot - they will be used later on */
-/* by explode_knot() and calc_new_ctrl_pts */
-static void
-set_new_t_min_t_max(knot_str_type * geom_knot, knot_str_type * color_knot,
- knot_str_type * normal_knot, knot_str_type * texture_knot,
- GLfloat maximal_min_knot, GLfloat minimal_max_knot)
-{
- GLuint t_min = 0, t_max = 0, cnt = 0;
-
- if (minimal_max_knot - maximal_min_knot < EPSILON) {
- /* knot common range empty */
- geom_knot->t_min = geom_knot->t_max = 0;
- color_knot->t_min = color_knot->t_max = 0;
- normal_knot->t_min = normal_knot->t_max = 0;
- texture_knot->t_min = texture_knot->t_max = 0;
- }
- else {
- if (geom_knot->unified_knot != NULL) {
- cnt = geom_knot->unified_nknots;
- for (t_min = 0; t_min < cnt; t_min++)
- if (fabs((geom_knot->unified_knot)[t_min] - maximal_min_knot) <
- EPSILON) break;
- for (t_max = cnt - 1; t_max; t_max--)
- if (fabs((geom_knot->unified_knot)[t_max] - minimal_max_knot) <
- EPSILON) break;
- }
- else if (geom_knot->nknots) {
- cnt = geom_knot->nknots;
- for (t_min = 0; t_min < cnt; t_min++)
- if (fabs((geom_knot->knot)[t_min] - maximal_min_knot) < EPSILON)
- break;
- for (t_max = cnt - 1; t_max; t_max--)
- if (fabs((geom_knot->knot)[t_max] - minimal_max_knot) < EPSILON)
- break;
- }
- geom_knot->t_min = t_min;
- geom_knot->t_max = t_max;
- if (color_knot->unified_knot != NULL) {
- cnt = color_knot->unified_nknots;
- for (t_min = 0; t_min < cnt; t_min++)
- if (fabs((color_knot->unified_knot)[t_min] - maximal_min_knot) <
- EPSILON) break;
- for (t_max = cnt - 1; t_max; t_max--)
- if (fabs((color_knot->unified_knot)[t_max] - minimal_max_knot) <
- EPSILON) break;
- color_knot->t_min = t_min;
- color_knot->t_max = t_max;
- }
- if (normal_knot->unified_knot != NULL) {
- cnt = normal_knot->unified_nknots;
- for (t_min = 0; t_min < cnt; t_min++)
- if (fabs((normal_knot->unified_knot)[t_min] - maximal_min_knot) <
- EPSILON) break;
- for (t_max = cnt - 1; t_max; t_max--)
- if (fabs((normal_knot->unified_knot)[t_max] - minimal_max_knot) <
- EPSILON) break;
- normal_knot->t_min = t_min;
- normal_knot->t_max = t_max;
- }
- if (texture_knot->unified_knot != NULL) {
- cnt = texture_knot->unified_nknots;
- for (t_min = 0; t_min < cnt; t_min++)
- if (fabs((texture_knot->unified_knot)[t_min] - maximal_min_knot)
- < EPSILON)
- break;
- for (t_max = cnt - 1; t_max; t_max--)
- if (fabs((texture_knot->unified_knot)[t_max] - minimal_max_knot)
- < EPSILON)
- break;
- texture_knot->t_min = t_min;
- texture_knot->t_max = t_max;
- }
- }
-}
-
-/* modify all knot valid ranges in such a way that all have the same */
-/* range, common to all knots */
-/* do this by knot insertion */
-GLenum
-select_knot_working_range(GLUnurbsObj * nobj, knot_str_type * geom_knot,
- knot_str_type * color_knot,
- knot_str_type * normal_knot,
- knot_str_type * texture_knot)
-{
- GLint max_nknots;
- GLfloat maximal_min_knot, minimal_max_knot;
- GLint i;
-
- /* find the maximum modified knot length */
- max_nknots = geom_knot->nknots;
- if (color_knot->unified_knot)
- max_nknots += color_knot->nknots;
- if (normal_knot->unified_knot)
- max_nknots += normal_knot->nknots;
- if (texture_knot->unified_knot)
- max_nknots += texture_knot->nknots;
- maximal_min_knot = (geom_knot->knot)[geom_knot->t_min];
- minimal_max_knot = (geom_knot->knot)[geom_knot->t_max];
- /* any attirb data ? */
- if (max_nknots != geom_knot->nknots) {
- /* allocate space for the unified knots */
- if ((geom_knot->unified_knot =
- (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) {
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- /* copy the original knot to the unified one */
- geom_knot->unified_nknots = geom_knot->nknots;
- for (i = 0; i < geom_knot->nknots; i++)
- (geom_knot->unified_knot)[i] = (geom_knot->knot)[i];
- if (color_knot->unified_knot) {
- if ((color_knot->knot)[color_knot->t_min] - maximal_min_knot >
- EPSILON)
- maximal_min_knot = (color_knot->knot)[color_knot->t_min];
- if (minimal_max_knot - (color_knot->knot)[color_knot->t_max] >
- EPSILON)
- minimal_max_knot = (color_knot->knot)[color_knot->t_max];
- if ((color_knot->unified_knot =
- (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) {
- free(geom_knot->unified_knot);
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- /* copy the original knot to the unified one */
- color_knot->unified_nknots = color_knot->nknots;
- for (i = 0; i < color_knot->nknots; i++)
- (color_knot->unified_knot)[i] = (color_knot->knot)[i];
- }
- if (normal_knot->unified_knot) {
- if ((normal_knot->knot)[normal_knot->t_min] - maximal_min_knot >
- EPSILON)
- maximal_min_knot = (normal_knot->knot)[normal_knot->t_min];
- if (minimal_max_knot - (normal_knot->knot)[normal_knot->t_max] >
- EPSILON)
- minimal_max_knot = (normal_knot->knot)[normal_knot->t_max];
- if ((normal_knot->unified_knot =
- (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) {
- free(geom_knot->unified_knot);
- free(color_knot->unified_knot);
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- /* copy the original knot to the unified one */
- normal_knot->unified_nknots = normal_knot->nknots;
- for (i = 0; i < normal_knot->nknots; i++)
- (normal_knot->unified_knot)[i] = (normal_knot->knot)[i];
- }
- if (texture_knot->unified_knot) {
- if ((texture_knot->knot)[texture_knot->t_min] - maximal_min_knot >
- EPSILON)
- maximal_min_knot = (texture_knot->knot)[texture_knot->t_min];
- if (minimal_max_knot - (texture_knot->knot)[texture_knot->t_max] >
- EPSILON)
- minimal_max_knot = (texture_knot->knot)[texture_knot->t_max];
- if ((texture_knot->unified_knot =
- (GLfloat *) malloc(sizeof(GLfloat) * max_nknots)) == NULL) {
- free(geom_knot->unified_knot);
- free(color_knot->unified_knot);
- free(normal_knot->unified_knot);
- call_user_error(nobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- /* copy the original knot to the unified one */
- texture_knot->unified_nknots = texture_knot->nknots;
- for (i = 0; i < texture_knot->nknots; i++)
- (texture_knot->unified_knot)[i] = (texture_knot->knot)[i];
- }
- /* work on the geometry knot with all additional knot values */
- /* appearing in attirbutive knots */
- if (minimal_max_knot - maximal_min_knot < EPSILON) {
- /* empty working range */
- geom_knot->unified_nknots = 0;
- color_knot->unified_nknots = 0;
- normal_knot->unified_nknots = 0;
- texture_knot->unified_nknots = 0;
- }
- else {
- if (color_knot->unified_knot)
- collect_unified_knot(geom_knot, color_knot, maximal_min_knot,
- minimal_max_knot);
- if (normal_knot->unified_knot)
- collect_unified_knot(geom_knot, normal_knot, maximal_min_knot,
- minimal_max_knot);
- if (texture_knot->unified_knot)
- collect_unified_knot(geom_knot, texture_knot, maximal_min_knot,
- minimal_max_knot);
- /* since we have now built the "unified" geometry knot */
- /* add same knot values to all attributive knots */
- if (color_knot->unified_knot)
- collect_unified_knot(color_knot, geom_knot, maximal_min_knot,
- minimal_max_knot);
- if (normal_knot->unified_knot)
- collect_unified_knot(normal_knot, geom_knot, maximal_min_knot,
- minimal_max_knot);
- if (texture_knot->unified_knot)
- collect_unified_knot(texture_knot, geom_knot, maximal_min_knot,
- minimal_max_knot);
- }
- }
- set_new_t_min_t_max(geom_knot, color_knot, normal_knot, texture_knot,
- maximal_min_knot, minimal_max_knot);
- return GLU_NO_ERROR;
-}
-
-void
-free_unified_knots(knot_str_type * geom_knot, knot_str_type * color_knot,
- knot_str_type * normal_knot, knot_str_type * texture_knot)
-{
- if (geom_knot->unified_knot)
- free(geom_knot->unified_knot);
- if (color_knot->unified_knot)
- free(color_knot->unified_knot);
- if (normal_knot->unified_knot)
- free(normal_knot->unified_knot);
- if (texture_knot->unified_knot)
- free(texture_knot->unified_knot);
-}
-
-GLenum explode_knot(knot_str_type * the_knot)
-{
- GLfloat *knot, *new_knot;
- GLint nknots, n_new_knots = 0;
- GLint t_min, t_max;
- GLint ord;
- GLsizei i, j, k;
- GLfloat tmp_float;
-
- if (the_knot->unified_knot) {
- knot = the_knot->unified_knot;
- nknots = the_knot->unified_nknots;
- }
- else {
- knot = the_knot->knot;
- nknots = the_knot->nknots;
- }
- ord = the_knot->order;
- t_min = the_knot->t_min;
- t_max = the_knot->t_max;
-
- for (i = t_min; i <= t_max;) {
- tmp_float = knot[i];
- for (j = 0; j < ord && (i + j) <= t_max; j++)
- if (fabs(tmp_float - knot[i + j]) > EPSILON)
- break;
- n_new_knots += ord - j;
- i += j;
- }
- /* alloc space for new_knot */
- if (
- (new_knot =
- (GLfloat *) malloc(sizeof(GLfloat) * (nknots + n_new_knots + 1))) == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- /* fill in new knot */
- for (j = 0; j < t_min; j++)
- new_knot[j] = knot[j];
- for (i = j; i <= t_max; i++) {
- tmp_float = knot[i];
- for (k = 0; k < ord; k++) {
- new_knot[j++] = knot[i];
- if (tmp_float == knot[i + 1])
- i++;
- }
- }
- for (i = t_max + 1; i < (int) nknots; i++)
- new_knot[j++] = knot[i];
- /* fill in the knot structure */
- the_knot->new_knot = new_knot;
- the_knot->delta_nknots += n_new_knots;
- the_knot->t_max += n_new_knots;
- return GLU_NO_ERROR;
-}
-
-GLenum calc_alphas(knot_str_type * the_knot)
-{
- GLfloat tmp_float;
- int i, j, k, m, n;
- int order;
- GLfloat *alpha, *alpha_new, *tmp_alpha;
- GLfloat denom;
- GLfloat *knot, *new_knot;
-
-
- knot = the_knot->knot;
- order = the_knot->order;
- new_knot = the_knot->new_knot;
- n = the_knot->nknots - the_knot->order;
- m = n + the_knot->delta_nknots;
- if ((alpha = (GLfloat *) malloc(sizeof(GLfloat) * n * m)) == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- if ((alpha_new = (GLfloat *) malloc(sizeof(GLfloat) * n * m)) == NULL) {
- free(alpha);
- return GLU_OUT_OF_MEMORY;
- }
- for (j = 0; j < m; j++) {
- for (i = 0; i < n; i++) {
- if ((knot[i] <= new_knot[j]) && (new_knot[j] < knot[i + 1]))
- tmp_float = 1.0;
- else
- tmp_float = 0.0;
- alpha[i + j * n] = tmp_float;
- }
- }
- for (k = 1; k < order; k++) {
- for (j = 0; j < m; j++)
- for (i = 0; i < n; i++) {
- denom = knot[i + k] - knot[i];
- if (fabs(denom) < EPSILON)
- tmp_float = 0.0;
- else
- tmp_float = (new_knot[j + k] - knot[i]) / denom *
- alpha[i + j * n];
- denom = knot[i + k + 1] - knot[i + 1];
- if (fabs(denom) > EPSILON)
- tmp_float += (knot[i + k + 1] - new_knot[j + k]) / denom *
- alpha[(i + 1) + j * n];
- alpha_new[i + j * n] = tmp_float;
- }
- tmp_alpha = alpha_new;
- alpha_new = alpha;
- alpha = tmp_alpha;
- }
- the_knot->alpha = alpha;
- free(alpha_new);
- return GLU_NO_ERROR;
-}
-
-GLenum
-calc_new_ctrl_pts(GLfloat * ctrl, GLint stride, knot_str_type * the_knot,
- GLint dim, GLfloat ** new_ctrl, GLint * ncontrol)
-{
- GLsizei i, j, k, l, m, n;
- GLsizei index1, index2;
- GLfloat *alpha;
- GLfloat *new_knot;
-
- new_knot = the_knot->new_knot;
- n = the_knot->nknots - the_knot->order;
- alpha = the_knot->alpha;
-
- m = the_knot->t_max + 1 - the_knot->t_min - the_knot->order;
- k = the_knot->t_min;
- /* allocate space for new control points */
- if ((*new_ctrl = (GLfloat *) malloc(sizeof(GLfloat) * dim * m)) == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- for (j = 0; j < m; j++) {
- for (l = 0; l < dim; l++)
- (*new_ctrl)[j * dim + l] = 0.0;
- for (i = 0; i < n; i++) {
- index1 = i + (j + k) * n;
- index2 = i * stride;
- for (l = 0; l < dim; l++)
- (*new_ctrl)[j * dim + l] += alpha[index1] * ctrl[index2 + l];
- }
- }
- *ncontrol = (GLint) m;
- return GLU_NO_ERROR;
-}
-
-static GLint
-calc_factor(GLfloat * pts, GLint order, GLint indx, GLint stride,
- GLfloat tolerance, GLint dim)
-{
- GLdouble model[16], proj[16];
- GLint viewport[4];
- GLdouble x, y, z, w, winx1, winy1, winz, winx2, winy2;
- GLint i;
- GLdouble len, dx, dy;
-
- glGetDoublev(GL_MODELVIEW_MATRIX, model);
- glGetDoublev(GL_PROJECTION_MATRIX, proj);
- glGetIntegerv(GL_VIEWPORT, viewport);
- if (dim == 4) {
- w = (GLdouble) pts[indx + 3];
- x = (GLdouble) pts[indx] / w;
- y = (GLdouble) pts[indx + 1] / w;
- z = (GLdouble) pts[indx + 2] / w;
- gluProject(x, y, z, model, proj, viewport, &winx1, &winy1, &winz);
- len = 0.0;
- for (i = 1; i < order; i++) {
- w = (GLdouble) pts[indx + i * stride + 3];
- x = (GLdouble) pts[indx + i * stride] / w;
- y = (GLdouble) pts[indx + i * stride + 1] / w;
- z = (GLdouble) pts[indx + i * stride + 2] / w;
- if (gluProject
- (x, y, z, model, proj, viewport, &winx2, &winy2, &winz)) {
- dx = winx2 - winx1;
- dy = winy2 - winy1;
- len += sqrt(dx * dx + dy * dy);
- }
- winx1 = winx2;
- winy1 = winy2;
- }
- }
- else {
- x = (GLdouble) pts[indx];
- y = (GLdouble) pts[indx + 1];
- if (dim == 2)
- z = 0.0;
- else
- z = (GLdouble) pts[indx + 2];
- gluProject(x, y, z, model, proj, viewport, &winx1, &winy1, &winz);
- len = 0.0;
- for (i = 1; i < order; i++) {
- x = (GLdouble) pts[indx + i * stride];
- y = (GLdouble) pts[indx + i * stride + 1];
- if (dim == 2)
- z = 0.0;
- else
- z = (GLdouble) pts[indx + i * stride + 2];
- if (gluProject
- (x, y, z, model, proj, viewport, &winx2, &winy2, &winz)) {
- dx = winx2 - winx1;
- dy = winy2 - winy1;
- len += sqrt(dx * dx + dy * dy);
- }
- winx1 = winx2;
- winy1 = winy2;
- }
- }
- len /= tolerance;
- return ((GLint) len + 1);
-}
-
-/* we can't use the Mesa evaluators - no way to get the point coords */
-/* so we use our own Bezier point calculus routines */
-/* because I'm lazy, I reuse the ones from eval.c */
-
-static void
-bezier_curve(GLfloat * cp, GLfloat * out, GLfloat t,
- GLuint dim, GLuint order, GLint offset)
-{
- GLfloat s, powert;
- GLuint i, k, bincoeff;
-
- if (order >= 2) {
- bincoeff = order - 1;
- s = 1.0 - t;
-
- for (k = 0; k < dim; k++)
- out[k] = s * cp[k] + bincoeff * t * cp[offset + k];
-
- for (i = 2, cp += 2 * offset, powert = t * t; i < order;
- i++, powert *= t, cp += offset) {
- bincoeff *= order - i;
- bincoeff /= i;
-
- for (k = 0; k < dim; k++)
- out[k] = s * out[k] + bincoeff * powert * cp[k];
- }
- }
- else { /* order=1 -> constant curve */
-
- for (k = 0; k < dim; k++)
- out[k] = cp[k];
- }
-}
-
-static GLint
-calc_parametric_factor(GLfloat * pts, GLint order, GLint indx, GLint stride,
- GLfloat tolerance, GLint dim)
-{
- GLdouble model[16], proj[16];
- GLint viewport[4];
- GLdouble x, y, z, w, x1, y1, z1, x2, y2, z2, x3, y3, z3;
- GLint i;
- GLint P;
- GLfloat bez_pt[4];
- GLdouble len = 0.0, tmp, z_med;
-
- P = 2 * (order + 2);
- glGetDoublev(GL_MODELVIEW_MATRIX, model);
- glGetDoublev(GL_PROJECTION_MATRIX, proj);
- glGetIntegerv(GL_VIEWPORT, viewport);
- z_med = (viewport[2] + viewport[3]) * 0.5;
- switch (dim) {
- case 4:
- for (i = 1; i < P; i++) {
- bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 4,
- order, stride);
- w = (GLdouble) bez_pt[3];
- x = (GLdouble) bez_pt[0] / w;
- y = (GLdouble) bez_pt[1] / w;
- z = (GLdouble) bez_pt[2] / w;
- gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3);
- z3 *= z_med;
- bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 4,
- order, stride);
- w = (GLdouble) bez_pt[3];
- x = (GLdouble) bez_pt[0] / w;
- y = (GLdouble) bez_pt[1] / w;
- z = (GLdouble) bez_pt[2] / w;
- gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1);
- z1 *= z_med;
- bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 4,
- order, stride);
- w = (GLdouble) bez_pt[3];
- x = (GLdouble) bez_pt[0] / w;
- y = (GLdouble) bez_pt[1] / w;
- z = (GLdouble) bez_pt[2] / w;
- gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2);
- z2 *= z_med;
- /* calc distance between point (x3,y3,z3) and line segment */
- /* <x1,y1,z1><x2,y2,z2> */
- x = x2 - x1;
- y = y2 - y1;
- z = z2 - z1;
- tmp = sqrt(x * x + y * y + z * z);
- x /= tmp;
- y /= tmp;
- z /= tmp;
- tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z;
- x = x1 + x * tmp - x3;
- y = y1 + y * tmp - y3;
- z = z1 + z * tmp - z3;
- tmp = sqrt(x * x + y * y + z * z);
- if (tmp > len)
- len = tmp;
- }
- break;
- case 3:
- for (i = 1; i < P; i++) {
- bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 3,
- order, stride);
- x = (GLdouble) bez_pt[0];
- y = (GLdouble) bez_pt[1];
- z = (GLdouble) bez_pt[2];
- gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3);
- z3 *= z_med;
- bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 3,
- order, stride);
- x = (GLdouble) bez_pt[0];
- y = (GLdouble) bez_pt[1];
- z = (GLdouble) bez_pt[2];
- gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1);
- z1 *= z_med;
- bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 3,
- order, stride);
- x = (GLdouble) bez_pt[0];
- y = (GLdouble) bez_pt[1];
- z = (GLdouble) bez_pt[2];
- gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2);
- z2 *= z_med;
- /* calc distance between point (x3,y3,z3) and line segment */
- /* <x1,y1,z1><x2,y2,z2> */
- x = x2 - x1;
- y = y2 - y1;
- z = z2 - z1;
- tmp = sqrt(x * x + y * y + z * z);
- x /= tmp;
- y /= tmp;
- z /= tmp;
- tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z;
- x = x1 + x * tmp - x3;
- y = y1 + y * tmp - y3;
- z = z1 + z * tmp - z3;
- tmp = sqrt(x * x + y * y + z * z);
- if (tmp > len)
- len = tmp;
- }
- break;
- case 2:
- for (i = 1; i < P; i++) {
- bezier_curve(pts + indx, bez_pt, (GLfloat) i / (GLfloat) P, 2,
- order, stride);
- x = (GLdouble) bez_pt[0];
- y = (GLdouble) bez_pt[1];
- z = 0.0;
- gluProject(x, y, z, model, proj, viewport, &x3, &y3, &z3);
- z3 *= z_med;
- bezier_curve(pts + indx, bez_pt, (GLfloat) (i - 1) / (GLfloat) P, 2,
- order, stride);
- x = (GLdouble) bez_pt[0];
- y = (GLdouble) bez_pt[1];
- z = 0.0;
- gluProject(x, y, z, model, proj, viewport, &x1, &y1, &z1);
- z1 *= z_med;
- bezier_curve(pts + indx, bez_pt, (GLfloat) (i + 1) / (GLfloat) P, 2,
- order, stride);
- x = (GLdouble) bez_pt[0];
- y = (GLdouble) bez_pt[1];
- z = 0.0;
- gluProject(x, y, z, model, proj, viewport, &x2, &y2, &z2);
- z2 *= z_med;
- /* calc distance between point (x3,y3,z3) and line segment */
- /* <x1,y1,z1><x2,y2,z2> */
- x = x2 - x1;
- y = y2 - y1;
- z = z2 - z1;
- tmp = sqrt(x * x + y * y + z * z);
- x /= tmp;
- y /= tmp;
- z /= tmp;
- tmp = x3 * x + y3 * y + z3 * z - x1 * x - y1 * y - z1 * z;
- x = x1 + x * tmp - x3;
- y = y1 + y * tmp - y3;
- z = z1 + z * tmp - z3;
- tmp = sqrt(x * x + y * y + z * z);
- if (tmp > len)
- len = tmp;
- }
- break;
-
- }
- if (len < tolerance)
- return (order);
- else
- return (GLint) (sqrt(len / tolerance) * (order + 2) + 1);
-}
-
-static GLenum
-calc_sampling_3D(new_ctrl_type * new_ctrl, GLfloat tolerance, GLint dim,
- GLint uorder, GLint vorder, GLint ** ufactors,
- GLint ** vfactors)
-{
- GLfloat *ctrl;
- GLint tmp_factor1, tmp_factor2;
- GLint ufactor_cnt, vfactor_cnt;
- GLint offset1, offset2, offset3;
- GLint i, j;
-
- ufactor_cnt = new_ctrl->s_bezier_cnt;
- vfactor_cnt = new_ctrl->t_bezier_cnt;
- if ((*ufactors = (GLint *) malloc(sizeof(GLint) * ufactor_cnt * 3))
- == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- if ((*vfactors = (GLint *) malloc(sizeof(GLint) * vfactor_cnt * 3))
- == NULL) {
- free(*ufactors);
- return GLU_OUT_OF_MEMORY;
- }
- ctrl = new_ctrl->geom_ctrl;
- offset1 = new_ctrl->geom_t_stride * vorder;
- offset2 = new_ctrl->geom_s_stride * uorder;
- for (j = 0; j < vfactor_cnt; j++) {
- *(*vfactors + j * 3 + 1) = tmp_factor1 = calc_factor(ctrl, vorder,
- j * offset1, dim,
- tolerance, dim);
- /* loop ufactor_cnt-1 times */
- for (i = 1; i < ufactor_cnt; i++) {
- tmp_factor2 = calc_factor(ctrl, vorder,
- j * offset1 + i * offset2, dim, tolerance,
- dim);
- if (tmp_factor2 > tmp_factor1)
- tmp_factor1 = tmp_factor2;
- }
- /* last time for the opposite edge */
- *(*vfactors + j * 3 + 2) = tmp_factor2 = calc_factor(ctrl, vorder,
- j * offset1 +
- i * offset2 -
- new_ctrl->
- geom_s_stride, dim,
- tolerance, dim);
- if (tmp_factor2 > tmp_factor1)
- *(*vfactors + j * 3) = tmp_factor2;
- else
- *(*vfactors + j * 3) = tmp_factor1;
- }
- offset3 = new_ctrl->geom_s_stride;
- offset2 = new_ctrl->geom_s_stride * uorder;
- for (j = 0; j < ufactor_cnt; j++) {
- *(*ufactors + j * 3 + 1) = tmp_factor1 = calc_factor(ctrl, uorder,
- j * offset2,
- offset3, tolerance,
- dim);
- /* loop vfactor_cnt-1 times */
- for (i = 1; i < vfactor_cnt; i++) {
- tmp_factor2 = calc_factor(ctrl, uorder,
- j * offset2 + i * offset1, offset3,
- tolerance, dim);
- if (tmp_factor2 > tmp_factor1)
- tmp_factor1 = tmp_factor2;
- }
- /* last time for the opposite edge */
- *(*ufactors + j * 3 + 2) = tmp_factor2 = calc_factor(ctrl, uorder,
- j * offset2 +
- i * offset1 -
- new_ctrl->
- geom_t_stride,
- offset3, tolerance,
- dim);
- if (tmp_factor2 > tmp_factor1)
- *(*ufactors + j * 3) = tmp_factor2;
- else
- *(*ufactors + j * 3) = tmp_factor1;
- }
- return GL_NO_ERROR;
-}
-
-static GLenum
-calc_sampling_param_3D(new_ctrl_type * new_ctrl, GLfloat tolerance, GLint dim,
- GLint uorder, GLint vorder, GLint ** ufactors,
- GLint ** vfactors)
-{
- GLfloat *ctrl;
- GLint tmp_factor1, tmp_factor2;
- GLint ufactor_cnt, vfactor_cnt;
- GLint offset1, offset2, offset3;
- GLint i, j;
-
- ufactor_cnt = new_ctrl->s_bezier_cnt;
- vfactor_cnt = new_ctrl->t_bezier_cnt;
- if ((*ufactors = (GLint *) malloc(sizeof(GLint) * ufactor_cnt * 3))
- == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- if ((*vfactors = (GLint *) malloc(sizeof(GLint) * vfactor_cnt * 3))
- == NULL) {
- free(*ufactors);
- return GLU_OUT_OF_MEMORY;
- }
- ctrl = new_ctrl->geom_ctrl;
- offset1 = new_ctrl->geom_t_stride * vorder;
- offset2 = new_ctrl->geom_s_stride * uorder;
- for (j = 0; j < vfactor_cnt; j++) {
- *(*vfactors + j * 3 + 1) = tmp_factor1 =
- calc_parametric_factor(ctrl, vorder, j * offset1, dim, tolerance,
- dim);
- /* loop ufactor_cnt-1 times */
- for (i = 1; i < ufactor_cnt; i++) {
- tmp_factor2 = calc_parametric_factor(ctrl, vorder,
- j * offset1 + i * offset2, dim,
- tolerance, dim);
- if (tmp_factor2 > tmp_factor1)
- tmp_factor1 = tmp_factor2;
- }
- /* last time for the opposite edge */
- *(*vfactors + j * 3 + 2) = tmp_factor2 =
- calc_parametric_factor(ctrl, vorder,
- j * offset1 + i * offset2 -
- new_ctrl->geom_s_stride, dim, tolerance, dim);
- if (tmp_factor2 > tmp_factor1)
- *(*vfactors + j * 3) = tmp_factor2;
- else
- *(*vfactors + j * 3) = tmp_factor1;
- }
- offset3 = new_ctrl->geom_s_stride;
- offset2 = new_ctrl->geom_s_stride * uorder;
- for (j = 0; j < ufactor_cnt; j++) {
- *(*ufactors + j * 3 + 1) = tmp_factor1 =
- calc_parametric_factor(ctrl, uorder, j * offset2, offset3, tolerance,
- dim);
- /* loop vfactor_cnt-1 times */
- for (i = 1; i < vfactor_cnt; i++) {
- tmp_factor2 = calc_parametric_factor(ctrl, uorder,
- j * offset2 + i * offset1,
- offset3, tolerance, dim);
- if (tmp_factor2 > tmp_factor1)
- tmp_factor1 = tmp_factor2;
- }
- /* last time for the opposite edge */
- *(*ufactors + j * 3 + 2) = tmp_factor2 =
- calc_parametric_factor(ctrl, uorder,
- j * offset2 + i * offset1 -
- new_ctrl->geom_t_stride, offset3, tolerance,
- dim);
- if (tmp_factor2 > tmp_factor1)
- *(*ufactors + j * 3) = tmp_factor2;
- else
- *(*ufactors + j * 3) = tmp_factor1;
- }
- return GL_NO_ERROR;
-}
-
-static GLenum
-calc_sampling_2D(GLfloat * ctrl, GLint cnt, GLint order,
- GLfloat tolerance, GLint dim, GLint ** factors)
-{
- GLint factor_cnt;
- GLint tmp_factor;
- GLint offset;
- GLint i;
-
- factor_cnt = cnt / order;
- if ((*factors = (GLint *) malloc(sizeof(GLint) * factor_cnt)) == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- offset = order * dim;
- for (i = 0; i < factor_cnt; i++) {
- tmp_factor = calc_factor(ctrl, order, i * offset, dim, tolerance, dim);
- if (tmp_factor == 0)
- (*factors)[i] = 1;
- else
- (*factors)[i] = tmp_factor;
- }
- return GL_NO_ERROR;
-}
-
-static void
-set_sampling_and_culling(GLUnurbsObj * nobj)
-{
- if (nobj->auto_load_matrix == GL_FALSE) {
- GLint i;
- GLfloat m[4];
-
- glPushAttrib((GLbitfield) (GL_VIEWPORT_BIT | GL_TRANSFORM_BIT));
- for (i = 0; i < 4; i++)
- m[i] = nobj->sampling_matrices.viewport[i];
- glViewport(m[0], m[1], m[2], m[3]);
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadMatrixf(nobj->sampling_matrices.proj);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadMatrixf(nobj->sampling_matrices.model);
- }
-}
-
-static void
-revert_sampling_and_culling(GLUnurbsObj * nobj)
-{
- if (nobj->auto_load_matrix == GL_FALSE) {
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glPopAttrib();
- }
-}
-
-GLenum
-glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- GLint ** sfactors, GLint ** tfactors)
-{
- GLint dim;
- GLenum err;
-
- *sfactors = NULL;
- *tfactors = NULL;
- dim = nobj->surface.geom.dim;
- set_sampling_and_culling(nobj);
- if ((err = calc_sampling_3D(new_ctrl, nobj->sampling_tolerance, dim,
- nobj->surface.geom.sorder,
- nobj->surface.geom.torder, sfactors,
- tfactors)) == GLU_ERROR) {
- revert_sampling_and_culling(nobj);
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- revert_sampling_and_culling(nobj);
- return GLU_NO_ERROR;
-}
-
-GLenum
-glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- GLint ** sfactors, GLint ** tfactors)
-{
- GLint s_cnt, t_cnt, i;
- GLint u_steps, v_steps;
-
- s_cnt = new_ctrl->s_bezier_cnt;
- t_cnt = new_ctrl->t_bezier_cnt;
- *sfactors = NULL;
- *tfactors = NULL;
- if ((*sfactors = (GLint *) malloc(sizeof(GLint) * s_cnt * 3))
- == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- if ((*tfactors = (GLint *) malloc(sizeof(GLint) * t_cnt * 3))
- == NULL) {
- free(*sfactors);
- return GLU_OUT_OF_MEMORY;
- }
- u_steps = nobj->u_step;
- v_steps = nobj->v_step;
- for (i = 0; i < s_cnt; i++) {
- *(*sfactors + i * 3) = u_steps;
- *(*sfactors + i * 3 + 1) = u_steps;
- *(*sfactors + i * 3 + 2) = u_steps;
- }
- for (i = 0; i < t_cnt; i++) {
- *(*tfactors + i * 3) = v_steps;
- *(*tfactors + i * 3 + 1) = v_steps;
- *(*tfactors + i * 3 + 2) = v_steps;
- }
- return GLU_NO_ERROR;
-}
-
-
-GLenum
-glu_do_sampling_param_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- GLint ** sfactors, GLint ** tfactors)
-{
- GLint dim;
- GLenum err;
-
- *sfactors = NULL;
- *tfactors = NULL;
- dim = nobj->surface.geom.dim;
- set_sampling_and_culling(nobj);
- if (
- (err =
- calc_sampling_param_3D(new_ctrl, nobj->parametric_tolerance, dim,
- nobj->surface.geom.sorder,
- nobj->surface.geom.torder, sfactors,
- tfactors)) == GLU_ERROR) {
- revert_sampling_and_culling(nobj);
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- revert_sampling_and_culling(nobj);
- return GLU_NO_ERROR;
-}
-
-
-static GLenum
-glu_do_sampling_2D(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, GLint order,
- GLint dim, GLint ** factors)
-{
- GLenum err;
-
- set_sampling_and_culling(nobj);
- err = calc_sampling_2D(ctrl, cnt, order, nobj->sampling_tolerance, dim,
- factors);
- revert_sampling_and_culling(nobj);
- return err;
-}
-
-
-static GLenum
-glu_do_sampling_u(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt, GLint order,
- GLint dim, GLint ** factors)
-{
- GLint i;
- GLint u_steps;
-
- cnt /= order;
- if ((*factors = (GLint *) malloc(sizeof(GLint) * cnt))
- == NULL) {
- return GLU_OUT_OF_MEMORY;
- }
- u_steps = nobj->u_step;
- for (i = 0; i < cnt; i++)
- (*factors)[i] = u_steps;
- return GLU_NO_ERROR;
-}
-
-
-static GLenum
-glu_do_sampling_param_2D(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt,
- GLint order, GLint dim, GLint ** factors)
-{
- GLint i;
- GLint u_steps;
- GLfloat tolerance;
-
- set_sampling_and_culling(nobj);
- tolerance = nobj->parametric_tolerance;
- cnt /= order;
- if ((*factors = (GLint *) malloc(sizeof(GLint) * cnt))
- == NULL) {
- revert_sampling_and_culling(nobj);
- return GLU_OUT_OF_MEMORY;
- }
- u_steps = nobj->u_step;
- for (i = 0; i < cnt; i++) {
- (*factors)[i] = calc_parametric_factor(ctrl, order, 0,
- dim, tolerance, dim);
-
- }
- revert_sampling_and_culling(nobj);
- return GLU_NO_ERROR;
-}
-
-GLenum
-glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * ctrl, GLint cnt,
- GLint order, GLint dim, GLint ** factors)
-{
- GLenum err;
-
- *factors = NULL;
- switch (nobj->sampling_method) {
- case GLU_PATH_LENGTH:
- if ((err = glu_do_sampling_2D(nobj, ctrl, cnt, order, dim, factors)) !=
- GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- break;
- case GLU_DOMAIN_DISTANCE:
- if ((err = glu_do_sampling_u(nobj, ctrl, cnt, order, dim, factors)) !=
- GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- break;
- case GLU_PARAMETRIC_ERROR:
- if (
- (err =
- glu_do_sampling_param_2D(nobj, ctrl, cnt, order, dim,
- factors)) != GLU_NO_ERROR) {
- call_user_error(nobj, err);
- return GLU_ERROR;
- }
- break;
- default:
- abort();
- }
-
- return GLU_NO_ERROR;
-}
-
-/* TODO - i don't like this culling - this one just tests if at least one */
-/* ctrl point lies within the viewport . Also the point_in_viewport() */
-/* should be included in the fnctions for efficiency reasons */
-
-static GLboolean
-point_in_viewport(GLfloat * pt, GLint dim)
-{
- GLdouble model[16], proj[16];
- GLint viewport[4];
- GLdouble x, y, z, w, winx, winy, winz;
-
- glGetDoublev(GL_MODELVIEW_MATRIX, model);
- glGetDoublev(GL_PROJECTION_MATRIX, proj);
- glGetIntegerv(GL_VIEWPORT, viewport);
- if (dim == 3) {
- x = (GLdouble) pt[0];
- y = (GLdouble) pt[1];
- z = (GLdouble) pt[2];
- gluProject(x, y, z, model, proj, viewport, &winx, &winy, &winz);
- }
- else {
- w = (GLdouble) pt[3];
- x = (GLdouble) pt[0] / w;
- y = (GLdouble) pt[1] / w;
- z = (GLdouble) pt[2] / w;
- gluProject(x, y, z, model, proj, viewport, &winx, &winy, &winz);
- }
- if ((GLint) winx >= viewport[0] && (GLint) winx < viewport[2] &&
- (GLint) winy >= viewport[1] && (GLint) winy < viewport[3])
- return GL_TRUE;
- return GL_FALSE;
-}
-
-GLboolean
-fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * pts, GLint s_cnt,
- GLint t_cnt, GLint s_stride, GLint t_stride, GLint dim)
-{
- GLint i, j;
-
- if (nobj->culling == GL_FALSE)
- return GL_FALSE;
- set_sampling_and_culling(nobj);
-
- if (dim == 3) {
- for (i = 0; i < s_cnt; i++)
- for (j = 0; j < t_cnt; j++)
- if (point_in_viewport(pts + i * s_stride + j * t_stride, dim)) {
- revert_sampling_and_culling(nobj);
- return GL_FALSE;
- }
- }
- else {
- for (i = 0; i < s_cnt; i++)
- for (j = 0; j < t_cnt; j++)
- if (point_in_viewport(pts + i * s_stride + j * t_stride, dim)) {
- revert_sampling_and_culling(nobj);
- return GL_FALSE;
- }
- }
- revert_sampling_and_culling(nobj);
- return GL_TRUE;
-}
-
-/*GLboolean
-fine_culling_test_3D(GLUnurbsObj *nobj,GLfloat *pts,GLint s_cnt,GLint t_cnt,
- GLint s_stride,GLint t_stride, GLint dim)
-{
- GLint visible_cnt;
- GLfloat feedback_buffer[5];
- GLsizei buffer_size;
- GLint i,j;
-
- if(nobj->culling==GL_FALSE)
- return GL_FALSE;
- buffer_size=5;
- set_sampling_and_culling(nobj);
-
- glFeedbackBuffer(buffer_size,GL_2D,feedback_buffer);
- glRenderMode(GL_FEEDBACK);
- if(dim==3)
- {
- for(i=0;i<s_cnt;i++)
- {
- glBegin(GL_LINE_LOOP);
- for(j=0;j<t_cnt;j++)
- glVertex3fv(pts+i*s_stride+j*t_stride);
- glEnd();
- }
- for(j=0;j<t_cnt;j++)
- {
- glBegin(GL_LINE_LOOP);
- for(i=0;i<s_cnt;i++)
- glVertex3fv(pts+i*s_stride+j*t_stride);
- glEnd();
- }
- }
- else
- {
- for(i=0;i<s_cnt;i++)
- {
- glBegin(GL_LINE_LOOP);
- for(j=0;j<t_cnt;j++)
- glVertex4fv(pts+i*s_stride+j*t_stride);
- glEnd();
- }
- for(j=0;j<t_cnt;j++)
- {
- glBegin(GL_LINE_LOOP);
- for(i=0;i<s_cnt;i++)
- glVertex4fv(pts+i*s_stride+j*t_stride);
- glEnd();
- }
- }
- visible_cnt=glRenderMode(GL_RENDER);
-
- revert_sampling_and_culling(nobj);
- return (GLboolean)(visible_cnt==0);
-}*/
-
-GLboolean
-fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * pts, GLint cnt,
- GLint stride, GLint dim)
-{
- GLint i;
-
- if (nobj->culling == GL_FALSE)
- return GL_FALSE;
- set_sampling_and_culling(nobj);
-
- if (dim == 3) {
- for (i = 0; i < cnt; i++)
- if (point_in_viewport(pts + i * stride, dim)) {
- revert_sampling_and_culling(nobj);
- return GL_FALSE;
- }
- }
- else {
- for (i = 0; i < cnt; i++)
- if (point_in_viewport(pts + i * stride, dim)) {
- revert_sampling_and_culling(nobj);
- return GL_FALSE;
- }
- }
- revert_sampling_and_culling(nobj);
- return GL_TRUE;
-}
-
-/*GLboolean
-fine_culling_test_2D(GLUnurbsObj *nobj,GLfloat *pts,GLint cnt,
- GLint stride, GLint dim)
-{
- GLint visible_cnt;
- GLfloat feedback_buffer[5];
- GLsizei buffer_size;
- GLint i;
-
- if(nobj->culling==GL_FALSE)
- return GL_FALSE;
- buffer_size=5;
- set_sampling_and_culling(nobj);
-
- glFeedbackBuffer(buffer_size,GL_2D,feedback_buffer);
- glRenderMode(GL_FEEDBACK);
- glBegin(GL_LINE_LOOP);
- if(dim==3)
- {
- for(i=0;i<cnt;i++)
- glVertex3fv(pts+i*stride);
- }
- else
- {
- for(i=0;i<cnt;i++)
- glVertex4fv(pts+i*stride);
- }
- glEnd();
- visible_cnt=glRenderMode(GL_RENDER);
-
- revert_sampling_and_culling(nobj);
- return (GLboolean)(visible_cnt==0);
-}*/
diff --git a/src/glu/mesa/polytest.c b/src/glu/mesa/polytest.c
deleted file mode 100644
index 1ff966f61ce..00000000000
--- a/src/glu/mesa/polytest.c
+++ /dev/null
@@ -1,937 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "tess.h"
-#endif
-
-
-
-static GLenum store_polygon_as_contour(GLUtriangulatorObj *);
-static void free_current_polygon(tess_polygon *);
-static void prepare_projection_info(GLUtriangulatorObj *);
-static GLdouble twice_the_polygon_area(tess_vertex *, tess_vertex *);
-static GLenum verify_edge_vertex_intersections(GLUtriangulatorObj *);
-void tess_find_contour_hierarchies(GLUtriangulatorObj *);
-static GLenum test_for_overlapping_contours(GLUtriangulatorObj *);
-static GLenum contours_overlap(tess_contour *, tess_polygon *);
-static GLenum is_contour_contained_in(tess_contour *, tess_contour *);
-static void add_new_exterior(GLUtriangulatorObj *, tess_contour *);
-static void add_new_interior(GLUtriangulatorObj *, tess_contour *,
- tess_contour *);
-static void add_interior_with_hierarchy_check(GLUtriangulatorObj *,
- tess_contour *, tess_contour *);
-static void reverse_hierarchy_and_add_exterior(GLUtriangulatorObj *,
- tess_contour *,
- tess_contour *);
-static GLboolean point_in_polygon(tess_contour *, GLdouble, GLdouble);
-static void shift_interior_to_exterior(GLUtriangulatorObj *, tess_contour *);
-static void add_exterior_with_check(GLUtriangulatorObj *, tess_contour *,
- tess_contour *);
-static GLenum cut_out_hole(GLUtriangulatorObj *, tess_contour *,
- tess_contour *);
-static GLenum merge_hole_with_contour(GLUtriangulatorObj *,
- tess_contour *, tess_contour *,
- tess_vertex *, tess_vertex *);
-
-static GLenum
-find_normal(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *va, *vb, *vc;
- GLdouble A, B, C;
- GLdouble A0, A1, A2, B0, B1, B2;
-
- va = polygon->vertices;
- vb = va->next;
- A0 = vb->location[0] - va->location[0];
- A1 = vb->location[1] - va->location[1];
- A2 = vb->location[2] - va->location[2];
- for (vc = vb->next; vc != va; vc = vc->next) {
- B0 = vc->location[0] - va->location[0];
- B1 = vc->location[1] - va->location[1];
- B2 = vc->location[2] - va->location[2];
- A = A1 * B2 - A2 * B1;
- B = A2 * B0 - A0 * B2;
- C = A0 * B1 - A1 * B0;
- if (fabs(A) > EPSILON || fabs(B) > EPSILON || fabs(C) > EPSILON) {
- polygon->A = A;
- polygon->B = B;
- polygon->C = C;
- polygon->D =
- -A * va->location[0] - B * va->location[1] - C * va->location[2];
- return GLU_NO_ERROR;
- }
- }
- tess_call_user_error(tobj, GLU_TESS_ERROR7);
- return GLU_ERROR;
-}
-
-void
-tess_test_polygon(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
-
- /* any vertices defined? */
- if (polygon->vertex_cnt < 3) {
- free_current_polygon(polygon);
- return;
- }
- /* wrap pointers */
- polygon->last_vertex->next = polygon->vertices;
- polygon->vertices->previous = polygon->last_vertex;
- /* determine the normal */
- if (find_normal(tobj) == GLU_ERROR)
- return;
- /* compare the normals of previously defined contours and this one */
- /* first contour define ? */
- if (tobj->contours == NULL) {
- tobj->A = polygon->A;
- tobj->B = polygon->B;
- tobj->C = polygon->C;
- tobj->D = polygon->D;
- /* determine the best projection to use */
- if (fabs(polygon->A) > fabs(polygon->B))
- if (fabs(polygon->A) > fabs(polygon->C))
- tobj->projection = OYZ;
- else
- tobj->projection = OXY;
- else if (fabs(polygon->B) > fabs(polygon->C))
- tobj->projection = OXZ;
- else
- tobj->projection = OXY;
- }
- else {
- GLdouble a[3], b[3];
- tess_vertex *vertex = polygon->vertices;
-
- a[0] = tobj->A;
- a[1] = tobj->B;
- a[2] = tobj->C;
- b[0] = polygon->A;
- b[1] = polygon->B;
- b[2] = polygon->C;
-
- /* compare the normals */
- if (fabs(a[1] * b[2] - a[2] * b[1]) > EPSILON ||
- fabs(a[2] * b[0] - a[0] * b[2]) > EPSILON ||
- fabs(a[0] * b[1] - a[1] * b[0]) > EPSILON) {
- /* not coplanar */
- tess_call_user_error(tobj, GLU_TESS_ERROR9);
- return;
- }
- /* the normals are parallel - test for plane equation */
- if (fabs(a[0] * vertex->location[0] + a[1] * vertex->location[1] +
- a[2] * vertex->location[2] + tobj->D) > EPSILON) {
- /* not the same plane */
- tess_call_user_error(tobj, GLU_TESS_ERROR9);
- return;
- }
- }
- prepare_projection_info(tobj);
- if (verify_edge_vertex_intersections(tobj) == GLU_ERROR)
- return;
- if (test_for_overlapping_contours(tobj) == GLU_ERROR)
- return;
- if (store_polygon_as_contour(tobj) == GLU_ERROR)
- return;
-}
-
-static GLenum
-test_for_overlapping_contours(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour;
- tess_polygon *polygon;
-
- polygon = tobj->current_polygon;
- for (contour = tobj->contours; contour != NULL; contour = contour->next)
- if (contours_overlap(contour, polygon) != GLU_NO_ERROR) {
- tess_call_user_error(tobj, GLU_TESS_ERROR5);
- return GLU_ERROR;
- }
- return GLU_NO_ERROR;
-}
-
-static GLenum
-store_polygon_as_contour(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_contour *contour = tobj->contours;
-
- /* the first contour defined */
- if (contour == NULL) {
- if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- free_current_polygon(polygon);
- return GLU_ERROR;
- }
- tobj->contours = tobj->last_contour = contour;
- contour->next = contour->previous = NULL;
- }
- else {
- if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- free_current_polygon(polygon);
- return GLU_ERROR;
- }
- contour->previous = tobj->last_contour;
- tobj->last_contour->next = contour;
- tobj->last_contour = contour;
- contour->next = NULL;
- }
- /* mark all vertices in new contour as not special */
- /* and all are boundary edges */
- {
- tess_vertex *vertex;
- GLuint vertex_cnt, i;
-
- for (vertex = polygon->vertices, i = 0, vertex_cnt =
- polygon->vertex_cnt; i < vertex_cnt; vertex = vertex->next, i++) {
- vertex->shadow_vertex = NULL;
- vertex->edge_flag = GL_TRUE;
- }
- }
- contour->vertex_cnt = polygon->vertex_cnt;
- contour->area = polygon->area;
- contour->orientation = polygon->orientation;
- contour->type = GLU_UNKNOWN;
- contour->vertices = polygon->vertices;
- contour->last_vertex = polygon->last_vertex;
- polygon->vertices = polygon->last_vertex = NULL;
- polygon->vertex_cnt = 0;
- ++(tobj->contour_cnt);
- return GLU_NO_ERROR;
-}
-
-static void
-free_current_polygon(tess_polygon * polygon)
-{
- tess_vertex *vertex, *vertex_tmp;
- GLuint i;
-
- /* free current_polygon structures */
- for (vertex = polygon->vertices, i = 0; i < polygon->vertex_cnt; i++) {
- vertex_tmp = vertex->next;
- free(vertex);
- vertex = vertex_tmp;
- }
- polygon->vertices = polygon->last_vertex = NULL;
- polygon->vertex_cnt = 0;
-}
-
-static void
-prepare_projection_info(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *vertex, *last_vertex_ptr;
- GLdouble area;
-
- last_vertex_ptr = polygon->last_vertex;
- switch (tobj->projection) {
- case OXY:
- for (vertex = polygon->vertices; vertex != last_vertex_ptr;
- vertex = vertex->next) {
- vertex->x = vertex->location[0];
- vertex->y = vertex->location[1];
- }
- last_vertex_ptr->x = last_vertex_ptr->location[0];
- last_vertex_ptr->y = last_vertex_ptr->location[1];
- break;
- case OXZ:
- for (vertex = polygon->vertices; vertex != last_vertex_ptr;
- vertex = vertex->next) {
- vertex->x = vertex->location[0];
- vertex->y = vertex->location[2];
- }
- last_vertex_ptr->x = last_vertex_ptr->location[0];
- last_vertex_ptr->y = last_vertex_ptr->location[2];
- break;
- case OYZ:
- for (vertex = polygon->vertices; vertex != last_vertex_ptr;
- vertex = vertex->next) {
- vertex->x = vertex->location[1];
- vertex->y = vertex->location[2];
- }
- last_vertex_ptr->x = last_vertex_ptr->location[1];
- last_vertex_ptr->y = last_vertex_ptr->location[2];
- break;
- }
- area = twice_the_polygon_area(polygon->vertices, polygon->last_vertex);
- if (area >= 0.0) {
- polygon->orientation = GLU_CCW;
- polygon->area = area;
- }
- else {
- polygon->orientation = GLU_CW;
- polygon->area = -area;
- }
-}
-
-static GLdouble
-twice_the_polygon_area(tess_vertex * vertex, tess_vertex * last_vertex)
-{
- tess_vertex *next;
- GLdouble area, x, y;
-
- area = 0.0;
- x = vertex->x;
- y = vertex->y;
- vertex = vertex->next;
- for (; vertex != last_vertex; vertex = vertex->next) {
- next = vertex->next;
- area +=
- (vertex->x - x) * (next->y - y) - (vertex->y - y) * (next->x - x);
- }
- return area;
-}
-
-/* test if edges ab and cd intersect */
-/* if not return GLU_NO_ERROR, else if cross return GLU_TESS_ERROR8, */
-/* else if adjacent return GLU_TESS_ERROR4 */
-static GLenum
-edge_edge_intersect(tess_vertex * a,
- tess_vertex * b, tess_vertex * c, tess_vertex * d)
-{
- GLdouble denom, r, s;
- GLdouble xba, ydc, yba, xdc, yac, xac;
-
- xba = b->x - a->x;
- yba = b->y - a->y;
- xdc = d->x - c->x;
- ydc = d->y - c->y;
- xac = a->x - c->x;
- yac = a->y - c->y;
- denom = xba * ydc - yba * xdc;
- r = yac * xdc - xac * ydc;
- /* parallel? */
- if (fabs(denom) < EPSILON) {
- if (fabs(r) < EPSILON) {
- /* colinear */
- if (fabs(xba) < EPSILON) {
- /* compare the Y coordinate */
- if (yba > 0.0) {
- if (
- (fabs(a->y - c->y) < EPSILON
- && fabs(c->y - b->y) < EPSILON)
- || (fabs(a->y - d->y) < EPSILON
- && fabs(d->y - b->y) <
- EPSILON)) return GLU_TESS_ERROR4;
-
- }
- else {
- if (
- (fabs(b->y - c->y) < EPSILON
- && fabs(c->y - a->y) < EPSILON)
- || (fabs(b->y - d->y) < EPSILON
- && fabs(d->y - a->y) <
- EPSILON)) return GLU_TESS_ERROR4;
- }
- }
- else {
- /* compare the X coordinate */
- if (xba > 0.0) {
- if (
- (fabs(a->x - c->x) < EPSILON
- && fabs(c->x - b->x) < EPSILON)
- || (fabs(a->x - d->x) < EPSILON
- && fabs(d->x - b->x) <
- EPSILON)) return GLU_TESS_ERROR4;
- }
- else {
- if (
- (fabs(b->x - c->x) < EPSILON
- && fabs(c->x - a->x) < EPSILON)
- || (fabs(b->x - d->x) < EPSILON
- && fabs(d->x - a->x) <
- EPSILON)) return GLU_TESS_ERROR4;
- }
- }
- }
- return GLU_NO_ERROR;
- }
- r /= denom;
- s = (yac * xba - xac * yba) / denom;
- /* test if one vertex lies on other edge */
- if (((fabs(r) < EPSILON || (r < 1.0 + EPSILON && r > 1.0 - EPSILON)) &&
- s > -EPSILON && s < 1.0 + EPSILON) ||
- ((fabs(s) < EPSILON || (s < 1.0 + EPSILON && s > 1.0 - EPSILON)) &&
- r > -EPSILON && r < 1.0 + EPSILON)) {
- return GLU_TESS_ERROR4;
- }
- /* test for crossing */
- if (r > -EPSILON && r < 1.0 + EPSILON && s > -EPSILON && s < 1.0 + EPSILON) {
- return GLU_TESS_ERROR8;
- }
- return GLU_NO_ERROR;
-}
-
-static GLenum
-verify_edge_vertex_intersections(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *vertex1, *last_vertex, *vertex2;
- GLenum test;
-
- last_vertex = polygon->last_vertex;
- vertex1 = last_vertex;
- for (vertex2 = vertex1->next->next;
- vertex2->next != last_vertex; vertex2 = vertex2->next) {
- test = edge_edge_intersect(vertex1, vertex1->next, vertex2,
- vertex2->next);
- if (test != GLU_NO_ERROR) {
- tess_call_user_error(tobj, test);
- return GLU_ERROR;
- }
- }
- for (vertex1 = polygon->vertices;
- vertex1->next->next != last_vertex; vertex1 = vertex1->next) {
- for (vertex2 = vertex1->next->next;
- vertex2 != last_vertex; vertex2 = vertex2->next) {
- test = edge_edge_intersect(vertex1, vertex1->next, vertex2,
- vertex2->next);
- if (test != GLU_NO_ERROR) {
- tess_call_user_error(tobj, test);
- return GLU_ERROR;
- }
- }
- }
- return GLU_NO_ERROR;
-}
-
-static int
-#ifdef WIN32
- __cdecl
-#endif
-area_compare(const void *a, const void *b)
-{
- GLdouble area1, area2;
-
- area1 = (*((tess_contour **) a))->area;
- area2 = (*((tess_contour **) b))->area;
- if (area1 < area2)
- return 1;
- if (area1 > area2)
- return -1;
- return 0;
-}
-
-void
-tess_find_contour_hierarchies(GLUtriangulatorObj * tobj)
-{
- tess_contour **contours; /* dinamic array of pointers */
- tess_contour *tmp_contour_ptr = tobj->contours;
- GLuint cnt, i;
- GLenum result;
- GLboolean hierarchy_changed;
-
- /* any contours? */
- if (tobj->contour_cnt < 2) {
- tobj->contours->type = GLU_EXTERIOR;
- return;
- }
- if ((contours = (tess_contour **)
- malloc(sizeof(tess_contour *) * (tobj->contour_cnt))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- for (tmp_contour_ptr = tobj->contours, cnt = 0;
- tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next)
- contours[cnt++] = tmp_contour_ptr;
- /* now sort the contours in decreasing area size order */
- qsort((void *) contours, (size_t) cnt, (size_t) sizeof(tess_contour *),
- area_compare);
- /* we leave just the first contour - remove others from list */
- tobj->contours = contours[0];
- tobj->contours->next = tobj->contours->previous = NULL;
- tobj->last_contour = tobj->contours;
- tobj->contour_cnt = 1;
- /* first contour is the one with greatest area */
- /* must be EXTERIOR */
- tobj->contours->type = GLU_EXTERIOR;
- tmp_contour_ptr = tobj->contours;
- /* now we play! */
- for (i = 1; i < cnt; i++) {
- hierarchy_changed = GL_FALSE;
- for (tmp_contour_ptr = tobj->contours;
- tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) {
- if (tmp_contour_ptr->type == GLU_EXTERIOR) {
- /* check if contour completely contained in EXTERIOR */
- result = is_contour_contained_in(tmp_contour_ptr, contours[i]);
- switch (result) {
- case GLU_INTERIOR:
- /* now we have to check if contour is inside interiors */
- /* or not */
- /* any interiors? */
- if (tmp_contour_ptr->next != NULL &&
- tmp_contour_ptr->next->type == GLU_INTERIOR) {
- /* for all interior, check if inside any of them */
- /* if not inside any of interiors, its another */
- /* interior */
- /* or it may contain some interiors, then change */
- /* the contained interiors to exterior ones */
- add_interior_with_hierarchy_check(tobj,
- tmp_contour_ptr,
- contours[i]);
- }
- else {
- /* not in interior, add as new interior contour */
- add_new_interior(tobj, tmp_contour_ptr, contours[i]);
- }
- hierarchy_changed = GL_TRUE;
- break;
- case GLU_EXTERIOR:
- /* ooops, the marked as EXTERIOR (contours[i]) is */
- /* actually an interior of tmp_contour_ptr */
- /* reverse the local hierarchy */
- reverse_hierarchy_and_add_exterior(tobj, tmp_contour_ptr,
- contours[i]);
- hierarchy_changed = GL_TRUE;
- break;
- case GLU_NO_ERROR:
- break;
- default:
- abort();
- }
- }
- if (hierarchy_changed)
- break; /* break from for loop */
- }
- if (hierarchy_changed == GL_FALSE) {
- /* disjoint with all contours, add to contour list */
- add_new_exterior(tobj, contours[i]);
- }
- }
- free(contours);
-}
-
-/* returns GLU_INTERIOR if inner is completey enclosed within outer */
-/* returns GLU_EXTERIOR if outer is completely enclosed within inner */
-/* returns GLU_NO_ERROR if contours are disjoint */
-static GLenum
-is_contour_contained_in(tess_contour * outer, tess_contour * inner)
-{
- GLenum relation_flag;
-
- /* set relation_flag to relation of containment of first inner vertex */
- /* regarding outer contour */
- if (point_in_polygon(outer, inner->vertices->x, inner->vertices->y))
- relation_flag = GLU_INTERIOR;
- else
- relation_flag = GLU_EXTERIOR;
- if (relation_flag == GLU_INTERIOR)
- return GLU_INTERIOR;
- if (point_in_polygon(inner, outer->vertices->x, outer->vertices->y))
- return GLU_EXTERIOR;
- return GLU_NO_ERROR;
-}
-
-static GLboolean
-point_in_polygon(tess_contour * contour, GLdouble x, GLdouble y)
-{
- tess_vertex *v1, *v2;
- GLuint i, vertex_cnt;
- GLdouble xp1, yp1, xp2, yp2;
- GLboolean tst;
-
- tst = GL_FALSE;
- v1 = contour->vertices;
- v2 = contour->vertices->previous;
- for (i = 0, vertex_cnt = contour->vertex_cnt; i < vertex_cnt; i++) {
- xp1 = v1->x;
- yp1 = v1->y;
- xp2 = v2->x;
- yp2 = v2->y;
- if ((((yp1 <= y) && (y < yp2)) || ((yp2 <= y) && (y < yp1))) &&
- (x < (xp2 - xp1) * (y - yp1) / (yp2 - yp1) + xp1))
- tst = (tst == GL_FALSE ? GL_TRUE : GL_FALSE);
- v2 = v1;
- v1 = v1->next;
- }
- return tst;
-}
-
-static GLenum
-contours_overlap(tess_contour * contour, tess_polygon * polygon)
-{
- tess_vertex *vertex1, *vertex2;
- GLuint vertex1_cnt, vertex2_cnt, i, j;
- GLenum test;
-
- vertex1 = contour->vertices;
- vertex2 = polygon->vertices;
- vertex1_cnt = contour->vertex_cnt;
- vertex2_cnt = polygon->vertex_cnt;
- for (i = 0; i < vertex1_cnt; vertex1 = vertex1->next, i++) {
- for (j = 0; j < vertex2_cnt; vertex2 = vertex2->next, j++)
- if ((test = edge_edge_intersect(vertex1, vertex1->next, vertex2,
- vertex2->next)) != GLU_NO_ERROR)
- return test;
- }
- return GLU_NO_ERROR;
-}
-
-static void
-add_new_exterior(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- contour->type = GLU_EXTERIOR;
- contour->next = NULL;
- contour->previous = tobj->last_contour;
- tobj->last_contour->next = contour;
- tobj->last_contour = contour;
-}
-
-static void
-add_new_interior(GLUtriangulatorObj * tobj,
- tess_contour * outer, tess_contour * contour)
-{
- contour->type = GLU_INTERIOR;
- contour->next = outer->next;
- contour->previous = outer;
- if (outer->next != NULL)
- outer->next->previous = contour;
- outer->next = contour;
- if (tobj->last_contour == outer)
- tobj->last_contour = contour;
-}
-
-static void
-add_interior_with_hierarchy_check(GLUtriangulatorObj * tobj,
- tess_contour * outer,
- tess_contour * contour)
-{
- tess_contour *ptr;
-
- /* for all interiors of outer check if they are interior of contour */
- /* if so, change that interior to exterior and move it of of the */
- /* interior sequence */
- if (outer->next != NULL && outer->next->type == GLU_INTERIOR) {
- GLenum test;
-
- for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR;
- ptr = ptr->next) {
- test = is_contour_contained_in(ptr, contour);
- switch (test) {
- case GLU_INTERIOR:
- /* contour is contained in one of the interiors */
- /* check if possibly contained in other exteriors */
- /* move ptr to first EXTERIOR */
- for (; ptr != NULL && ptr->type == GLU_INTERIOR; ptr = ptr->next);
- if (ptr == NULL)
- /* another exterior */
- add_new_exterior(tobj, contour);
- else
- add_exterior_with_check(tobj, ptr, contour);
- return;
- case GLU_EXTERIOR:
- /* one of the interiors is contained in the contour */
- /* change it to EXTERIOR, and shift it away from the */
- /* interior sequence */
- shift_interior_to_exterior(tobj, ptr);
- break;
- case GLU_NO_ERROR:
- /* disjoint */
- break;
- default:
- abort();
- }
- }
- }
- /* add contour to the interior sequence */
- add_new_interior(tobj, outer, contour);
-}
-
-static void
-reverse_hierarchy_and_add_exterior(GLUtriangulatorObj * tobj,
- tess_contour * outer,
- tess_contour * contour)
-{
- tess_contour *ptr;
-
- /* reverse INTERIORS to EXTERIORS */
- /* any INTERIORS? */
- if (outer->next != NULL && outer->next->type == GLU_INTERIOR)
- for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR;
- ptr = ptr->next) ptr->type = GLU_EXTERIOR;
- /* the outer now becomes inner */
- outer->type = GLU_INTERIOR;
- /* contour is the EXTERIOR */
- contour->next = outer;
- if (tobj->contours == outer) {
- /* first contour beeing reversed */
- contour->previous = NULL;
- tobj->contours = contour;
- }
- else {
- outer->previous->next = contour;
- contour->previous = outer->previous;
- }
- outer->previous = contour;
-}
-
-static void
-shift_interior_to_exterior(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- contour->previous->next = contour->next;
- if (contour->next != NULL)
- contour->next->previous = contour->previous;
- else
- tobj->last_contour = contour->previous;
-}
-
-static void
-add_exterior_with_check(GLUtriangulatorObj * tobj,
- tess_contour * outer, tess_contour * contour)
-{
- GLenum test;
-
- /* this contour might be interior to further exteriors - check */
- /* if not, just add as a new exterior */
- for (; outer != NULL && outer->type == GLU_EXTERIOR; outer = outer->next) {
- test = is_contour_contained_in(outer, contour);
- switch (test) {
- case GLU_INTERIOR:
- /* now we have to check if contour is inside interiors */
- /* or not */
- /* any interiors? */
- if (outer->next != NULL && outer->next->type == GLU_INTERIOR) {
- /* for all interior, check if inside any of them */
- /* if not inside any of interiors, its another */
- /* interior */
- /* or it may contain some interiors, then change */
- /* the contained interiors to exterior ones */
- add_interior_with_hierarchy_check(tobj, outer, contour);
- }
- else {
- /* not in interior, add as new interior contour */
- add_new_interior(tobj, outer, contour);
- }
- return;
- case GLU_NO_ERROR:
- /* disjoint */
- break;
- default:
- abort();
- }
- }
- /* add contour to the exterior sequence */
- add_new_exterior(tobj, contour);
-}
-
-void
-tess_handle_holes(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour, *hole;
- GLenum exterior_orientation;
-
- /* verify hole orientation */
- for (contour = tobj->contours; contour != NULL;) {
- exterior_orientation = contour->orientation;
- for (contour = contour->next;
- contour != NULL && contour->type == GLU_INTERIOR;
- contour = contour->next) {
- if (contour->orientation == exterior_orientation) {
- tess_call_user_error(tobj, GLU_TESS_ERROR5);
- return;
- }
- }
- }
- /* now cut-out holes */
- for (contour = tobj->contours; contour != NULL;) {
- hole = contour->next;
- while (hole != NULL && hole->type == GLU_INTERIOR) {
- if (cut_out_hole(tobj, contour, hole) == GLU_ERROR)
- return;
- hole = contour->next;
- }
- contour = contour->next;
- }
-}
-
-static GLenum
-cut_out_hole(GLUtriangulatorObj * tobj,
- tess_contour * contour, tess_contour * hole)
-{
- tess_contour *tmp_hole;
- tess_vertex *v1, *v2, *tmp_vertex;
- GLuint vertex1_cnt, vertex2_cnt, tmp_vertex_cnt;
- GLuint i, j, k;
- GLenum test = 0;
-
- /* find an edge connecting contour and hole not intersecting any other */
- /* edge belonging to either the contour or any of the other holes */
- for (v1 = contour->vertices, vertex1_cnt = contour->vertex_cnt, i = 0;
- i < vertex1_cnt; i++, v1 = v1->next) {
- for (v2 = hole->vertices, vertex2_cnt = hole->vertex_cnt, j = 0;
- j < vertex2_cnt; j++, v2 = v2->next) {
- /* does edge (v1,v2) intersect any edge of contour */
- for (tmp_vertex = contour->vertices, tmp_vertex_cnt =
- contour->vertex_cnt, k = 0; k < tmp_vertex_cnt;
- tmp_vertex = tmp_vertex->next, k++) {
- /* skip edge tests for edges directly connected */
- if (v1 == tmp_vertex || v1 == tmp_vertex->next)
- continue;
- test = edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next);
- if (test != GLU_NO_ERROR)
- break;
- }
- if (test == GLU_NO_ERROR) {
- /* does edge (v1,v2) intersect any edge of hole */
- for (tmp_vertex = hole->vertices,
- tmp_vertex_cnt = hole->vertex_cnt, k = 0;
- k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) {
- /* skip edge tests for edges directly connected */
- if (v2 == tmp_vertex || v2 == tmp_vertex->next)
- continue;
- test =
- edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next);
- if (test != GLU_NO_ERROR)
- break;
- }
- if (test == GLU_NO_ERROR) {
- /* does edge (v1,v2) intersect any other hole? */
- for (tmp_hole = hole->next;
- tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR;
- tmp_hole = tmp_hole->next) {
- /* does edge (v1,v2) intersect any edge of hole */
- for (tmp_vertex = tmp_hole->vertices,
- tmp_vertex_cnt = tmp_hole->vertex_cnt, k = 0;
- k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) {
- test = edge_edge_intersect(v1, v2, tmp_vertex,
- tmp_vertex->next);
- if (test != GLU_NO_ERROR)
- break;
- }
- if (test != GLU_NO_ERROR)
- break;
- }
- }
- }
- if (test == GLU_NO_ERROR) {
- /* edge (v1,v2) is good for eliminating the hole */
- if (merge_hole_with_contour(tobj, contour, hole, v1, v2)
- == GLU_NO_ERROR)
- return GLU_NO_ERROR;
- else
- return GLU_ERROR;
- }
- }
- }
- /* other holes are blocking all possible connections of hole */
- /* with contour, we shift this hole as the last hole and retry */
- for (tmp_hole = hole;
- tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR;
- tmp_hole = tmp_hole->next);
- contour->next = hole->next;
- hole->next->previous = contour;
- if (tmp_hole == NULL) {
- /* last EXTERIOR contour, shift hole as last contour */
- hole->next = NULL;
- hole->previous = tobj->last_contour;
- tobj->last_contour->next = hole;
- tobj->last_contour = hole;
- }
- else {
- tmp_hole->previous->next = hole;
- hole->previous = tmp_hole->previous;
- tmp_hole->previous = hole;
- hole->next = tmp_hole;
- }
- hole = contour->next;
- /* try once again - recurse */
- return cut_out_hole(tobj, contour, hole);
-}
-
-static GLenum
-merge_hole_with_contour(GLUtriangulatorObj * tobj,
- tess_contour * contour,
- tess_contour * hole,
- tess_vertex * v1, tess_vertex * v2)
-{
- tess_vertex *v1_new, *v2_new;
-
- /* make copies of v1 and v2, place them respectively after their originals */
- if ((v1_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- if ((v2_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- v1_new->edge_flag = GL_TRUE;
- v1_new->data = v1->data;
- v1_new->location[0] = v1->location[0];
- v1_new->location[1] = v1->location[1];
- v1_new->location[2] = v1->location[2];
- v1_new->x = v1->x;
- v1_new->y = v1->y;
- v1_new->shadow_vertex = v1;
- v1->shadow_vertex = v1_new;
- v1_new->next = v1->next;
- v1_new->previous = v1;
- v1->next->previous = v1_new;
- v1->next = v1_new;
- v2_new->edge_flag = GL_TRUE;
- v2_new->data = v2->data;
- v2_new->location[0] = v2->location[0];
- v2_new->location[1] = v2->location[1];
- v2_new->location[2] = v2->location[2];
- v2_new->x = v2->x;
- v2_new->y = v2->y;
- v2_new->shadow_vertex = v2;
- v2->shadow_vertex = v2_new;
- v2_new->next = v2->next;
- v2_new->previous = v2;
- v2->next->previous = v2_new;
- v2->next = v2_new;
- /* link together the two lists */
- v1->next = v2_new;
- v2_new->previous = v1;
- v2->next = v1_new;
- v1_new->previous = v2;
- /* update the vertex count of the contour */
- contour->vertex_cnt += hole->vertex_cnt + 2;
- /* remove the INTERIOR contour */
- contour->next = hole->next;
- if (hole->next != NULL)
- hole->next->previous = contour;
- free(hole);
- /* update tobj structure */
- --(tobj->contour_cnt);
- if (contour->last_vertex == v1)
- contour->last_vertex = v1_new;
- /* mark two vertices with edge_flag */
- v2->edge_flag = GL_FALSE;
- v1->edge_flag = GL_FALSE;
- return GLU_NO_ERROR;
-}
diff --git a/src/glu/mesa/project.c b/src/glu/mesa/project.c
deleted file mode 100644
index 6fa03267e53..00000000000
--- a/src/glu/mesa/project.c
+++ /dev/null
@@ -1,401 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "gluP.h"
-#endif
-
-
-/*
- * This code was contributed by Marc Buffat (buffat@mecaflu.ec-lyon.fr).
- * Thanks Marc!!!
- */
-
-
-
-/* implementation de gluProject et gluUnproject */
-/* M. Buffat 17/2/95 */
-
-
-
-/*
- * Transform a point (column vector) by a 4x4 matrix. I.e. out = m * in
- * Input: m - the 4x4 matrix
- * in - the 4x1 vector
- * Output: out - the resulting 4x1 vector.
- */
-static void
-transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4])
-{
-#define M(row,col) m[col*4+row]
- out[0] =
- M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3];
- out[1] =
- M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3];
- out[2] =
- M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3];
- out[3] =
- M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3];
-#undef M
-}
-
-
-
-
-/*
- * Perform a 4x4 matrix multiplication (product = a x b).
- * Input: a, b - matrices to multiply
- * Output: product - product of a and b
- */
-static void
-matmul(GLdouble * product, const GLdouble * a, const GLdouble * b)
-{
- /* This matmul was contributed by Thomas Malik */
- GLdouble temp[16];
- GLint i;
-
-#define A(row,col) a[(col<<2)+row]
-#define B(row,col) b[(col<<2)+row]
-#define T(row,col) temp[(col<<2)+row]
-
- /* i-te Zeile */
- for (i = 0; i < 4; i++) {
- T(i, 0) =
- A(i, 0) * B(0, 0) + A(i, 1) * B(1, 0) + A(i, 2) * B(2, 0) + A(i,
- 3) *
- B(3, 0);
- T(i, 1) =
- A(i, 0) * B(0, 1) + A(i, 1) * B(1, 1) + A(i, 2) * B(2, 1) + A(i,
- 3) *
- B(3, 1);
- T(i, 2) =
- A(i, 0) * B(0, 2) + A(i, 1) * B(1, 2) + A(i, 2) * B(2, 2) + A(i,
- 3) *
- B(3, 2);
- T(i, 3) =
- A(i, 0) * B(0, 3) + A(i, 1) * B(1, 3) + A(i, 2) * B(2, 3) + A(i,
- 3) *
- B(3, 3);
- }
-
-#undef A
-#undef B
-#undef T
- MEMCPY(product, temp, 16 * sizeof(GLdouble));
-}
-
-
-
-/*
- * Compute inverse of 4x4 transformation matrix.
- * Code contributed by Jacques Leroy jle@star.be
- * Return GL_TRUE for success, GL_FALSE for failure (singular matrix)
- */
-static GLboolean
-invert_matrix(const GLdouble * m, GLdouble * out)
-{
-/* NB. OpenGL Matrices are COLUMN major. */
-#define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; }
-#define MAT(m,r,c) (m)[(c)*4+(r)]
-
- GLdouble wtmp[4][8];
- GLdouble m0, m1, m2, m3, s;
- GLdouble *r0, *r1, *r2, *r3;
-
- r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
-
- r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1),
- r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3),
- r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0,
- r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1),
- r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3),
- r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0,
- r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1),
- r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3),
- r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0,
- r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1),
- r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3),
- r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0;
-
- /* choose pivot - or die */
- if (fabs(r3[0]) > fabs(r2[0]))
- SWAP_ROWS(r3, r2);
- if (fabs(r2[0]) > fabs(r1[0]))
- SWAP_ROWS(r2, r1);
- if (fabs(r1[0]) > fabs(r0[0]))
- SWAP_ROWS(r1, r0);
- if (0.0 == r0[0])
- return GL_FALSE;
-
- /* eliminate first variable */
- m1 = r1[0] / r0[0];
- m2 = r2[0] / r0[0];
- m3 = r3[0] / r0[0];
- s = r0[1];
- r1[1] -= m1 * s;
- r2[1] -= m2 * s;
- r3[1] -= m3 * s;
- s = r0[2];
- r1[2] -= m1 * s;
- r2[2] -= m2 * s;
- r3[2] -= m3 * s;
- s = r0[3];
- r1[3] -= m1 * s;
- r2[3] -= m2 * s;
- r3[3] -= m3 * s;
- s = r0[4];
- if (s != 0.0) {
- r1[4] -= m1 * s;
- r2[4] -= m2 * s;
- r3[4] -= m3 * s;
- }
- s = r0[5];
- if (s != 0.0) {
- r1[5] -= m1 * s;
- r2[5] -= m2 * s;
- r3[5] -= m3 * s;
- }
- s = r0[6];
- if (s != 0.0) {
- r1[6] -= m1 * s;
- r2[6] -= m2 * s;
- r3[6] -= m3 * s;
- }
- s = r0[7];
- if (s != 0.0) {
- r1[7] -= m1 * s;
- r2[7] -= m2 * s;
- r3[7] -= m3 * s;
- }
-
- /* choose pivot - or die */
- if (fabs(r3[1]) > fabs(r2[1]))
- SWAP_ROWS(r3, r2);
- if (fabs(r2[1]) > fabs(r1[1]))
- SWAP_ROWS(r2, r1);
- if (0.0 == r1[1])
- return GL_FALSE;
-
- /* eliminate second variable */
- m2 = r2[1] / r1[1];
- m3 = r3[1] / r1[1];
- r2[2] -= m2 * r1[2];
- r3[2] -= m3 * r1[2];
- r2[3] -= m2 * r1[3];
- r3[3] -= m3 * r1[3];
- s = r1[4];
- if (0.0 != s) {
- r2[4] -= m2 * s;
- r3[4] -= m3 * s;
- }
- s = r1[5];
- if (0.0 != s) {
- r2[5] -= m2 * s;
- r3[5] -= m3 * s;
- }
- s = r1[6];
- if (0.0 != s) {
- r2[6] -= m2 * s;
- r3[6] -= m3 * s;
- }
- s = r1[7];
- if (0.0 != s) {
- r2[7] -= m2 * s;
- r3[7] -= m3 * s;
- }
-
- /* choose pivot - or die */
- if (fabs(r3[2]) > fabs(r2[2]))
- SWAP_ROWS(r3, r2);
- if (0.0 == r2[2])
- return GL_FALSE;
-
- /* eliminate third variable */
- m3 = r3[2] / r2[2];
- r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4],
- r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7];
-
- /* last check */
- if (0.0 == r3[3])
- return GL_FALSE;
-
- s = 1.0 / r3[3]; /* now back substitute row 3 */
- r3[4] *= s;
- r3[5] *= s;
- r3[6] *= s;
- r3[7] *= s;
-
- m2 = r2[3]; /* now back substitute row 2 */
- s = 1.0 / r2[2];
- r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
- r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
- m1 = r1[3];
- r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1,
- r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
- m0 = r0[3];
- r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0,
- r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
-
- m1 = r1[2]; /* now back substitute row 1 */
- s = 1.0 / r1[1];
- r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
- r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
- m0 = r0[2];
- r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0,
- r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
-
- m0 = r0[1]; /* now back substitute row 0 */
- s = 1.0 / r0[0];
- r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
- r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
-
- MAT(out, 0, 0) = r0[4];
- MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6];
- MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4];
- MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6];
- MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4];
- MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6];
- MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4];
- MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6];
- MAT(out, 3, 3) = r3[7];
-
- return GL_TRUE;
-
-#undef MAT
-#undef SWAP_ROWS
-}
-
-
-
-/* projection du point (objx,objy,obz) sur l'ecran (winx,winy,winz) */
-GLint GLAPIENTRY
-gluProject(GLdouble objx, GLdouble objy, GLdouble objz,
- const GLdouble model[16], const GLdouble proj[16],
- const GLint viewport[4],
- GLdouble * winx, GLdouble * winy, GLdouble * winz)
-{
- /* matrice de transformation */
- GLdouble in[4], out[4];
-
- /* initilise la matrice et le vecteur a transformer */
- in[0] = objx;
- in[1] = objy;
- in[2] = objz;
- in[3] = 1.0;
- transform_point(out, model, in);
- transform_point(in, proj, out);
-
- /* d'ou le resultat normalise entre -1 et 1 */
- if (in[3] == 0.0)
- return GL_FALSE;
-
- in[0] /= in[3];
- in[1] /= in[3];
- in[2] /= in[3];
-
- /* en coordonnees ecran */
- *winx = viewport[0] + (1 + in[0]) * viewport[2] / 2;
- *winy = viewport[1] + (1 + in[1]) * viewport[3] / 2;
- /* entre 0 et 1 suivant z */
- *winz = (1 + in[2]) / 2;
- return GL_TRUE;
-}
-
-
-
-/* transformation du point ecran (winx,winy,winz) en point objet */
-GLint GLAPIENTRY
-gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz,
- const GLdouble model[16], const GLdouble proj[16],
- const GLint viewport[4],
- GLdouble * objx, GLdouble * objy, GLdouble * objz)
-{
- /* matrice de transformation */
- GLdouble m[16], A[16];
- GLdouble in[4], out[4];
-
- /* transformation coordonnees normalisees entre -1 et 1 */
- in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0;
- in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0;
- in[2] = 2 * winz - 1.0;
- in[3] = 1.0;
-
- /* calcul transformation inverse */
- matmul(A, proj, model);
- invert_matrix(A, m);
-
- /* d'ou les coordonnees objets */
- transform_point(out, m, in);
- if (out[3] == 0.0)
- return GL_FALSE;
- *objx = out[0] / out[3];
- *objy = out[1] / out[3];
- *objz = out[2] / out[3];
- return GL_TRUE;
-}
-
-
-/*
- * New in GLU 1.3
- * This is like gluUnProject but also takes near and far DepthRange values.
- */
-#ifdef GLU_VERSION_1_3
-GLint GLAPIENTRY
-gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
- const GLdouble modelMatrix[16],
- const GLdouble projMatrix[16],
- const GLint viewport[4],
- GLclampd nearZ, GLclampd farZ,
- GLdouble * objx, GLdouble * objy, GLdouble * objz,
- GLdouble * objw)
-{
- /* matrice de transformation */
- GLdouble m[16], A[16];
- GLdouble in[4], out[4];
- GLdouble z = nearZ + winz * (farZ - nearZ);
-
- /* transformation coordonnees normalisees entre -1 et 1 */
- in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0;
- in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0;
- in[2] = 2.0 * z - 1.0;
- in[3] = clipw;
-
- /* calcul transformation inverse */
- matmul(A, projMatrix, modelMatrix);
- invert_matrix(A, m);
-
- /* d'ou les coordonnees objets */
- transform_point(out, m, in);
- if (out[3] == 0.0)
- return GL_FALSE;
- *objx = out[0] / out[3];
- *objy = out[1] / out[3];
- *objz = out[2] / out[3];
- *objw = out[3];
- return GL_TRUE;
-}
-#endif
diff --git a/src/glu/mesa/quadric.c b/src/glu/mesa/quadric.c
deleted file mode 100644
index 0f6889b284f..00000000000
--- a/src/glu/mesa/quadric.c
+++ /dev/null
@@ -1,819 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1999-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/* TODO:
- * texture coordinate support
- * flip normals according to orientation
- * there's still some inside/outside orientation bugs in possibly all
- * but the sphere function
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gluP.h"
-#endif
-
-
-
-#ifndef M_PI
-# define M_PI (3.1415926)
-#endif
-
-
-/*
- * Convert degrees to radians:
- */
-#define DEG_TO_RAD(A) ((A)*(M_PI/180.0))
-
-
-/*
- * Sin and Cos for degree angles:
- */
-#define SIND( A ) sin( (A)*(M_PI/180.0) )
-#define COSD( A) cos( (A)*(M_PI/180.0) )
-
-
-/*
- * Texture coordinates if texture flag is set
- */
-#define TXTR_COORD(x,y) if (qobj->TextureFlag) glTexCoord2f(x,y);
-
-
-
-struct GLUquadric
-{
- GLenum DrawStyle; /* GLU_FILL, LINE, SILHOUETTE, or POINT */
- GLenum Orientation; /* GLU_INSIDE or GLU_OUTSIDE */
- GLboolean TextureFlag; /* Generate texture coords? */
- GLenum Normals; /* GLU_NONE, GLU_FLAT, or GLU_SMOOTH */
- void (GLCALLBACK * ErrorFunc) (GLenum err); /* Error handler callback function */
-};
-
-
-
-/*
- * Process a GLU error.
- */
-static void
-quadric_error(GLUquadricObj * qobj, GLenum error, const char *msg)
-{
- /* Call the error call back function if any */
- if (qobj->ErrorFunc) {
- (*qobj->ErrorFunc) (error);
- }
- /* Print a message to stdout if MESA_DEBUG variable is defined */
- if (getenv("MESA_DEBUG")) {
- fprintf(stderr, "GLUError: %s: %s\n", (char *) gluErrorString(error),
- msg);
- }
-}
-
-
-
-
-GLUquadricObj *GLAPIENTRY
-gluNewQuadric(void)
-{
- GLUquadricObj *q;
-
- q = (GLUquadricObj *) malloc(sizeof(struct GLUquadric));
- if (q) {
- q->DrawStyle = GLU_FILL;
- q->Orientation = GLU_OUTSIDE;
- q->TextureFlag = GL_FALSE;
- q->Normals = GLU_SMOOTH;
- q->ErrorFunc = NULL;
- }
- return q;
-}
-
-
-
-void GLAPIENTRY
-gluDeleteQuadric(GLUquadricObj * state)
-{
- if (state) {
- free((void *) state);
- }
-}
-
-
-
-/*
- * Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE,
- * or GLU_POINT.
- */
-void GLAPIENTRY
-gluQuadricDrawStyle(GLUquadricObj * quadObject, GLenum drawStyle)
-{
- if (quadObject && (drawStyle == GLU_FILL || drawStyle == GLU_LINE
- || drawStyle == GLU_SILHOUETTE
- || drawStyle == GLU_POINT)) {
- quadObject->DrawStyle = drawStyle;
- }
- else {
- quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricDrawStyle");
- }
-}
-
-
-
-/*
- * Set the orientation to GLU_INSIDE or GLU_OUTSIDE.
- */
-void GLAPIENTRY
-gluQuadricOrientation(GLUquadricObj * quadObject, GLenum orientation)
-{
- if (quadObject
- && (orientation == GLU_INSIDE || orientation == GLU_OUTSIDE)) {
- quadObject->Orientation = orientation;
- }
- else {
- quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricOrientation");
- }
-}
-
-
-
-/*
- * Set the error handler callback function.
- */
-void GLAPIENTRY
-gluQuadricCallback(GLUquadricObj * qobj,
- GLenum which, void (GLCALLBACK * fn) ())
-{
- /*
- * UGH, this is a mess! I thought ANSI was a standard.
- */
- if (qobj && which == GLU_ERROR) {
-#ifdef __CYGWIN32__
- qobj->ErrorFunc = (void (GLCALLBACKPCAST) (GLenum)) fn;
-#elif defined(OPENSTEP)
- qobj->ErrorFunc = (void (*)(GLenum)) fn;
-#elif defined(_WIN32)
- qobj->ErrorFunc = (void (GLCALLBACK *) (int)) fn;
-#elif defined(__STORM__)
- qobj->ErrorFunc = (void (GLCALLBACK *) (GLenum)) fn;
-#elif defined(__BEOS__)
- qobj->ErrorFunc = (void (*)(GLenum)) fn;
-#else
- qobj->ErrorFunc = (void (GLCALLBACK *) ()) fn;
-#endif
- }
-}
-
-
-void GLAPIENTRY
-gluQuadricNormals(GLUquadricObj * quadObject, GLenum normals)
-{
- if (quadObject
- && (normals == GLU_NONE || normals == GLU_FLAT
- || normals == GLU_SMOOTH)) {
- quadObject->Normals = normals;
- }
-}
-
-
-void GLAPIENTRY
-gluQuadricTexture(GLUquadricObj * quadObject, GLboolean textureCoords)
-{
- if (quadObject) {
- quadObject->TextureFlag = textureCoords;
- }
-}
-
-
-
-
-/*
- * Call glNormal3f after scaling normal to unit length.
- */
-static void
-normal3f(GLfloat x, GLfloat y, GLfloat z)
-{
- GLdouble mag;
-
- mag = sqrt(x * x + y * y + z * z);
- if (mag > 0.00001F) {
- x /= mag;
- y /= mag;
- z /= mag;
- }
- glNormal3f(x, y, z);
-}
-
-
-
-void GLAPIENTRY
-gluCylinder(GLUquadricObj * qobj,
- GLdouble baseRadius, GLdouble topRadius,
- GLdouble height, GLint slices, GLint stacks)
-{
- GLdouble da, r, dr, dz;
- GLfloat x, y, z, nz, nsign;
- GLint i, j;
-
- if (qobj->Orientation == GLU_INSIDE) {
- nsign = -1.0;
- }
- else {
- nsign = 1.0;
- }
-
- da = 2.0 * M_PI / slices;
- dr = (topRadius - baseRadius) / stacks;
- dz = height / stacks;
- nz = (baseRadius - topRadius) / height; /* Z component of normal vectors */
-
- if (qobj->DrawStyle == GLU_POINT) {
- glBegin(GL_POINTS);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
-
- z = 0.0;
- r = baseRadius;
- for (j = 0; j <= stacks; j++) {
- glVertex3f(x * r, y * r, z);
- z += dz;
- r += dr;
- }
- }
- glEnd();
- }
- else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) {
- /* Draw rings */
- if (qobj->DrawStyle == GLU_LINE) {
- z = 0.0;
- r = baseRadius;
- for (j = 0; j <= stacks; j++) {
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * r, y * r, z);
- }
- glEnd();
- z += dz;
- r += dr;
- }
- }
- else {
- /* draw one ring at each end */
- if (baseRadius != 0.0) {
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * baseRadius, y * baseRadius, 0.0);
- }
- glEnd();
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * topRadius, y * topRadius, height);
- }
- glEnd();
- }
- }
- /* draw length lines */
- glBegin(GL_LINES);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * baseRadius, y * baseRadius, 0.0);
- glVertex3f(x * topRadius, y * topRadius, height);
- }
- glEnd();
- }
- else if (qobj->DrawStyle == GLU_FILL) {
- GLfloat ds = 1.0 / slices;
- GLfloat dt = 1.0 / stacks;
- GLfloat t = 0.0;
- z = 0.0;
- r = baseRadius;
- for (j = 0; j < stacks; j++) {
- GLfloat s = 0.0;
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= slices; i++) {
- GLfloat x, y;
- if (i == slices) {
- x = sin(0.0);
- y = cos(0.0);
- }
- else {
- x = sin(i * da);
- y = cos(i * da);
- }
- if (nsign == 1.0) {
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t);
- glVertex3f(x * r, y * r, z);
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t + dt);
- glVertex3f(x * (r + dr), y * (r + dr), z + dz);
- }
- else {
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t);
- glVertex3f(x * r, y * r, z);
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t + dt);
- glVertex3f(x * (r + dr), y * (r + dr), z + dz);
- }
- s += ds;
- } /* for slices */
- glEnd();
- r += dr;
- t += dt;
- z += dz;
- } /* for stacks */
- }
-}
-
-
-
-
-
-void GLAPIENTRY
-gluSphere(GLUquadricObj * qobj, GLdouble radius, GLint slices, GLint stacks)
-{
- GLfloat rho, drho, theta, dtheta;
- GLfloat x, y, z;
- GLfloat s, t, ds, dt;
- GLint i, j, imin, imax;
- GLboolean normals;
- GLfloat nsign;
-
- if (qobj->Normals == GLU_NONE) {
- normals = GL_FALSE;
- }
- else {
- normals = GL_TRUE;
- }
- if (qobj->Orientation == GLU_INSIDE) {
- nsign = -1.0;
- }
- else {
- nsign = 1.0;
- }
-
- drho = M_PI / (GLfloat) stacks;
- dtheta = 2.0 * M_PI / (GLfloat) slices;
-
- /* texturing: s goes from 0.0/0.25/0.5/0.75/1.0 at +y/+x/-y/-x/+y axis */
- /* t goes from -1.0/+1.0 at z = -radius/+radius (linear along longitudes) */
- /* cannot use triangle fan on texturing (s coord. at top/bottom tip varies) */
-
- if (qobj->DrawStyle == GLU_FILL) {
- if (!qobj->TextureFlag) {
- /* draw +Z end as a triangle fan */
- glBegin(GL_TRIANGLE_FAN);
- glNormal3f(0.0, 0.0, 1.0);
- glVertex3f(0.0, 0.0, nsign * radius);
- for (j = 0; j <= slices; j++) {
- theta = (j == slices) ? 0.0 : j * dtheta;
- x = -sin(theta) * sin(drho);
- y = cos(theta) * sin(drho);
- z = nsign * cos(drho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
-
- ds = 1.0 / slices;
- dt = 1.0 / stacks;
- t = 1.0; /* because loop now runs from 0 */
- if (qobj->TextureFlag) {
- imin = 0;
- imax = stacks;
- }
- else {
- imin = 1;
- imax = stacks - 1;
- }
-
- /* draw intermediate stacks as quad strips */
- for (i = imin; i < imax; i++) {
- rho = i * drho;
- glBegin(GL_QUAD_STRIP);
- s = 0.0;
- for (j = 0; j <= slices; j++) {
- theta = (j == slices) ? 0.0 : j * dtheta;
- x = -sin(theta) * sin(rho);
- y = cos(theta) * sin(rho);
- z = nsign * cos(rho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- TXTR_COORD(s, t);
- glVertex3f(x * radius, y * radius, z * radius);
- x = -sin(theta) * sin(rho + drho);
- y = cos(theta) * sin(rho + drho);
- z = nsign * cos(rho + drho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- TXTR_COORD(s, t - dt);
- s += ds;
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- t -= dt;
- }
-
- if (!qobj->TextureFlag) {
- /* draw -Z end as a triangle fan */
- glBegin(GL_TRIANGLE_FAN);
- glNormal3f(0.0, 0.0, -1.0);
- glVertex3f(0.0, 0.0, -radius * nsign);
- rho = M_PI - drho;
- s = 1.0;
- t = dt;
- for (j = slices; j >= 0; j--) {
- theta = (j == slices) ? 0.0 : j * dtheta;
- x = -sin(theta) * sin(rho);
- y = cos(theta) * sin(rho);
- z = nsign * cos(rho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- s -= ds;
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
- }
- else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) {
- /* draw stack lines */
- for (i = 1; i < stacks; i++) { /* stack line at i==stacks-1 was missing here */
- rho = i * drho;
- glBegin(GL_LINE_LOOP);
- for (j = 0; j < slices; j++) {
- theta = j * dtheta;
- x = cos(theta) * sin(rho);
- y = sin(theta) * sin(rho);
- z = cos(rho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
- /* draw slice lines */
- for (j = 0; j < slices; j++) {
- theta = j * dtheta;
- glBegin(GL_LINE_STRIP);
- for (i = 0; i <= stacks; i++) {
- rho = i * drho;
- x = cos(theta) * sin(rho);
- y = sin(theta) * sin(rho);
- z = cos(rho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
- }
- else if (qobj->DrawStyle == GLU_POINT) {
- /* top and bottom-most points */
- glBegin(GL_POINTS);
- if (normals)
- glNormal3f(0.0, 0.0, nsign);
- glVertex3d(0.0, 0.0, radius);
- if (normals)
- glNormal3f(0.0, 0.0, -nsign);
- glVertex3d(0.0, 0.0, -radius);
-
- /* loop over stacks */
- for (i = 1; i < stacks - 1; i++) {
- rho = i * drho;
- for (j = 0; j < slices; j++) {
- theta = j * dtheta;
- x = cos(theta) * sin(rho);
- y = sin(theta) * sin(rho);
- z = cos(rho);
- if (normals)
- glNormal3f(x * nsign, y * nsign, z * nsign);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- }
- glEnd();
- }
-
-}
-
-
-
-void GLAPIENTRY
-gluDisk(GLUquadricObj * qobj,
- GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops)
-{
- GLfloat da, dr;
-#if 0
- GLdouble a, da;
- GLfloat r, dr;
- GLfloat x, y;
- GLfloat r1, r2, dtc;
- GLint s, l;
-#endif
-
- /* Normal vectors */
- if (qobj->Normals != GLU_NONE) {
- if (qobj->Orientation == GLU_OUTSIDE) {
- glNormal3f(0.0, 0.0, +1.0);
- }
- else {
- glNormal3f(0.0, 0.0, -1.0);
- }
- }
-
- da = 2.0 * M_PI / slices;
- dr = (outerRadius - innerRadius) / (GLfloat) loops;
-
- switch (qobj->DrawStyle) {
- case GLU_FILL:
- {
- /* texture of a gluDisk is a cut out of the texture unit square
- * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1]
- * (linear mapping)
- */
- GLfloat dtc = 2.0f * outerRadius;
- GLfloat sa, ca;
- GLfloat r1 = innerRadius;
- GLint l;
- for (l = 0; l < loops; l++) {
- GLfloat r2 = r1 + dr;
- if (qobj->Orientation == GLU_OUTSIDE) {
- GLint s;
- glBegin(GL_QUAD_STRIP);
- for (s = 0; s <= slices; s++) {
- GLfloat a;
- if (s == slices)
- a = 0.0;
- else
- a = s * da;
- sa = sin(a);
- ca = cos(a);
- TXTR_COORD(0.5 + sa * r2 / dtc, 0.5 + ca * r2 / dtc);
- glVertex2f(r2 * sa, r2 * ca);
- TXTR_COORD(0.5 + sa * r1 / dtc, 0.5 + ca * r1 / dtc);
- glVertex2f(r1 * sa, r1 * ca);
- }
- glEnd();
- }
- else {
- GLint s;
- glBegin(GL_QUAD_STRIP);
- for (s = slices; s >= 0; s--) {
- GLfloat a;
- if (s == slices)
- a = 0.0;
- else
- a = s * da;
- sa = sin(a);
- ca = cos(a);
- TXTR_COORD(0.5 - sa * r2 / dtc, 0.5 + ca * r2 / dtc);
- glVertex2f(r2 * sa, r2 * ca);
- TXTR_COORD(0.5 - sa * r1 / dtc, 0.5 + ca * r1 / dtc);
- glVertex2f(r1 * sa, r1 * ca);
- }
- glEnd();
- }
- r1 = r2;
- }
- break;
- }
- case GLU_LINE:
- {
- GLint l, s;
- /* draw loops */
- for (l = 0; l <= loops; l++) {
- GLfloat r = innerRadius + l * dr;
- glBegin(GL_LINE_LOOP);
- for (s = 0; s < slices; s++) {
- GLfloat a = s * da;
- glVertex2f(r * sin(a), r * cos(a));
- }
- glEnd();
- }
- /* draw spokes */
- for (s = 0; s < slices; s++) {
- GLfloat a = s * da;
- GLfloat x = sin(a);
- GLfloat y = cos(a);
- glBegin(GL_LINE_STRIP);
- for (l = 0; l <= loops; l++) {
- GLfloat r = innerRadius + l * dr;
- glVertex2f(r * x, r * y);
- }
- glEnd();
- }
- break;
- }
- case GLU_POINT:
- {
- GLint s;
- glBegin(GL_POINTS);
- for (s = 0; s < slices; s++) {
- GLfloat a = s * da;
- GLfloat x = sin(a);
- GLfloat y = cos(a);
- GLint l;
- for (l = 0; l <= loops; l++) {
- GLfloat r = innerRadius * l * dr;
- glVertex2f(r * x, r * y);
- }
- }
- glEnd();
- break;
- }
- case GLU_SILHOUETTE:
- {
- if (innerRadius != 0.0) {
- GLfloat a;
- glBegin(GL_LINE_LOOP);
- for (a = 0.0; a < 2.0 * M_PI; a += da) {
- GLfloat x = innerRadius * sin(a);
- GLfloat y = innerRadius * cos(a);
- glVertex2f(x, y);
- }
- glEnd();
- }
- {
- GLfloat a;
- glBegin(GL_LINE_LOOP);
- for (a = 0; a < 2.0 * M_PI; a += da) {
- GLfloat x = outerRadius * sin(a);
- GLfloat y = outerRadius * cos(a);
- glVertex2f(x, y);
- }
- glEnd();
- }
- break;
- }
- default:
- abort();
- }
-}
-
-
-
-void GLAPIENTRY
-gluPartialDisk(GLUquadricObj * qobj, GLdouble innerRadius,
- GLdouble outerRadius, GLint slices, GLint loops,
- GLdouble startAngle, GLdouble sweepAngle)
-{
- if (qobj->Normals != GLU_NONE) {
- if (qobj->Orientation == GLU_OUTSIDE) {
- glNormal3f(0.0, 0.0, +1.0);
- }
- else {
- glNormal3f(0.0, 0.0, -1.0);
- }
- }
-
- if (qobj->DrawStyle == GLU_POINT) {
- GLint loop, slice;
- GLdouble radius, delta_radius;
- GLdouble angle, delta_angle;
- delta_radius = (outerRadius - innerRadius) / (loops - 1);
- delta_angle = DEG_TO_RAD((sweepAngle) / (slices - 1));
- glBegin(GL_POINTS);
- radius = innerRadius;
- for (loop = 0; loop < loops; loop++) {
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice < slices; slice++) {
- glVertex2d(radius * sin(angle), radius * cos(angle));
- angle += delta_angle;
- }
- radius += delta_radius;
- }
- glEnd();
- }
- else if (qobj->DrawStyle == GLU_LINE) {
- GLint loop, slice;
- GLdouble radius, delta_radius;
- GLdouble angle, delta_angle;
- delta_radius = (outerRadius - innerRadius) / loops;
- delta_angle = DEG_TO_RAD(sweepAngle / slices);
- /* draw rings */
- radius = innerRadius;
- for (loop = 0; loop < loops; loop++) {
- angle = DEG_TO_RAD(startAngle);
- glBegin(GL_LINE_STRIP);
- for (slice = 0; slice <= slices; slice++) {
- glVertex2d(radius * sin(angle), radius * cos(angle));
- angle += delta_angle;
- }
- glEnd();
- radius += delta_radius;
- }
- /* draw spokes */
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice <= slices; slice++) {
- radius = innerRadius;
- glBegin(GL_LINE_STRIP);
- for (loop = 0; loop < loops; loop++) {
- glVertex2d(radius * sin(angle), radius * cos(angle));
- radius += delta_radius;
- }
- glEnd();
- angle += delta_angle;
- }
- }
- else if (qobj->DrawStyle == GLU_SILHOUETTE) {
- GLint slice;
- GLdouble angle, delta_angle;
- delta_angle = DEG_TO_RAD(sweepAngle / slices);
- /* draw outer ring */
- glBegin(GL_LINE_STRIP);
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice <= slices; slice++) {
- glVertex2d(outerRadius * sin(angle), outerRadius * cos(angle));
- angle += delta_angle;
- }
- glEnd();
- /* draw inner ring */
- if (innerRadius > 0.0) {
- glBegin(GL_LINE_STRIP);
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice < slices; slice++) {
- glVertex2d(innerRadius * sin(angle), innerRadius * cos(angle));
- angle += delta_angle;
- }
- glEnd();
- }
- /* draw spokes */
- if (sweepAngle < 360.0) {
- GLdouble stopAngle = startAngle + sweepAngle;
- glBegin(GL_LINES);
- glVertex2d(innerRadius * SIND(startAngle),
- innerRadius * COSD(startAngle));
- glVertex2d(outerRadius * SIND(startAngle),
- outerRadius * COSD(startAngle));
- glVertex2d(innerRadius * SIND(stopAngle),
- innerRadius * COSD(stopAngle));
- glVertex2d(outerRadius * SIND(stopAngle),
- outerRadius * COSD(stopAngle));
- glEnd();
- }
- }
- else if (qobj->DrawStyle == GLU_FILL) {
- GLint loop, slice;
- GLdouble radius, delta_radius;
- GLdouble angle, delta_angle;
- delta_radius = (outerRadius - innerRadius) / loops;
- delta_angle = DEG_TO_RAD(sweepAngle / slices);
- radius = innerRadius;
- for (loop = 0; loop < loops; loop++) {
- glBegin(GL_QUAD_STRIP);
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice <= slices; slice++) {
- if (qobj->Orientation == GLU_OUTSIDE) {
- glVertex2d((radius + delta_radius) * sin(angle),
- (radius + delta_radius) * cos(angle));
- glVertex2d(radius * sin(angle), radius * cos(angle));
- }
- else {
- glVertex2d(radius * sin(angle), radius * cos(angle));
- glVertex2d((radius + delta_radius) * sin(angle),
- (radius + delta_radius) * cos(angle));
- }
- angle += delta_angle;
- }
- glEnd();
- radius += delta_radius;
- }
- }
-}
diff --git a/src/glu/mesa/tess.c b/src/glu/mesa/tess.c
deleted file mode 100644
index 341d29bae3a..00000000000
--- a/src/glu/mesa/tess.c
+++ /dev/null
@@ -1,327 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "tess.h"
-#endif
-
-
-/*
- * This is ugly, but seems the easiest way to do things to make the
- * code work under YellowBox for Windows
- */
-#if defined(OPENSTEP) && defined(CALLBACK)
-#undef CALLBACK
-#define CALLBACK
-#endif
-
-
-static void delete_contours(GLUtriangulatorObj *);
-
-#ifdef __CYGWIN32__
-#define _CALLBACK
-#else
-#define _CALLBACK GLCALLBACK
-#endif
-
-
-static void
-init_callbacks(tess_callbacks * callbacks)
-{
- callbacks->begin = (void (_CALLBACK *) (GLenum)) 0;
- callbacks->edgeFlag = (void (_CALLBACK *) (GLboolean)) 0;
- callbacks->vertex = (void (_CALLBACK *) (void *)) 0;
- callbacks->end = (void (_CALLBACK *) (void)) 0;
- callbacks->error = (void (_CALLBACK *) (GLenum)) 0;
-}
-
-void
-tess_call_user_error(GLUtriangulatorObj * tobj, GLenum gluerr)
-{
- if (tobj->error == GLU_NO_ERROR)
- tobj->error = gluerr;
- if (tobj->callbacks.error != NULL)
- (tobj->callbacks.error) (gluerr);
-}
-
-GLUtriangulatorObj *GLAPIENTRY
-gluNewTess(void)
-{
- GLUtriangulatorObj *tobj;
-
- if ((tobj = (GLUtriangulatorObj *)
- malloc(sizeof(struct GLUtesselator))) == NULL)
- return NULL;
- tobj->contours = tobj->last_contour = NULL;
- init_callbacks(&tobj->callbacks);
- tobj->error = GLU_NO_ERROR;
- tobj->current_polygon = NULL;
- tobj->contour_cnt = 0;
- return tobj;
-}
-
-
-void GLAPIENTRY
-gluTessCallback(GLUtriangulatorObj * tobj, GLenum which,
- void (GLCALLBACK * fn) ())
-{
- switch (which) {
- case GLU_BEGIN:
- tobj->callbacks.begin = (void (_CALLBACK *) (GLenum)) fn;
- break;
- case GLU_EDGE_FLAG:
- tobj->callbacks.edgeFlag = (void (_CALLBACK *) (GLboolean)) fn;
- break;
- case GLU_VERTEX:
- tobj->callbacks.vertex = (void (_CALLBACK *) (void *)) fn;
- break;
- case GLU_END:
- tobj->callbacks.end = (void (_CALLBACK *) (void)) fn;
- break;
- case GLU_ERROR:
- tobj->callbacks.error = (void (_CALLBACK *) (GLenum)) fn;
- break;
- default:
- tobj->error = GLU_INVALID_ENUM;
- break;
- }
-}
-
-
-
-void GLAPIENTRY
-gluDeleteTess(GLUtriangulatorObj * tobj)
-{
- if (tobj->error == GLU_NO_ERROR && tobj->contour_cnt)
- /* was gluEndPolygon called? */
- tess_call_user_error(tobj, GLU_TESS_ERROR1);
- /* delete all internal structures */
- delete_contours(tobj);
- free(tobj);
-}
-
-
-void GLAPIENTRY
-gluBeginPolygon(GLUtriangulatorObj * tobj)
-{
-/*
- if(tobj->error!=GLU_NO_ERROR)
- return;
-*/
- tobj->error = GLU_NO_ERROR;
- if (tobj->current_polygon != NULL) {
- /* gluEndPolygon was not called */
- tess_call_user_error(tobj, GLU_TESS_ERROR1);
- /* delete all internal structures */
- delete_contours(tobj);
- }
- else {
- if ((tobj->current_polygon =
- (tess_polygon *) malloc(sizeof(tess_polygon))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- tobj->current_polygon->vertex_cnt = 0;
- tobj->current_polygon->vertices =
- tobj->current_polygon->last_vertex = NULL;
- }
-}
-
-
-void GLAPIENTRY
-gluEndPolygon(GLUtriangulatorObj * tobj)
-{
- /*tess_contour *contour_ptr; */
-
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- /* check if gluBeginPolygon was called */
- if (tobj->current_polygon == NULL) {
- tess_call_user_error(tobj, GLU_TESS_ERROR2);
- return;
- }
- tess_test_polygon(tobj);
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- /* any real contours? */
- if (tobj->contour_cnt == 0) {
- /* delete all internal structures */
- delete_contours(tobj);
- return;
- }
- tess_find_contour_hierarchies(tobj);
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- tess_handle_holes(tobj);
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- /* if no callbacks, nothing to do */
- if (tobj->callbacks.begin != NULL && tobj->callbacks.vertex != NULL &&
- tobj->callbacks.end != NULL) {
- if (tobj->callbacks.edgeFlag == NULL)
- tess_tesselate(tobj);
- else
- tess_tesselate_with_edge_flag(tobj);
- }
-
- end:
- /* delete all internal structures */
- delete_contours(tobj);
-}
-
-
-void GLAPIENTRY
-gluNextContour(GLUtriangulatorObj * tobj, GLenum type)
-{
- if (tobj->error != GLU_NO_ERROR)
- return;
- if (tobj->current_polygon == NULL) {
- tess_call_user_error(tobj, GLU_TESS_ERROR2);
- return;
- }
- /* first contour? */
- if (tobj->current_polygon->vertex_cnt)
- tess_test_polygon(tobj);
-}
-
-
-void GLAPIENTRY
-gluTessVertex(GLUtriangulatorObj * tobj, GLdouble v[3], void *data)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *last_vertex_ptr;
-
- if (tobj->error != GLU_NO_ERROR)
- return;
- if (polygon == NULL) {
- tess_call_user_error(tobj, GLU_TESS_ERROR2);
- return;
- }
- last_vertex_ptr = polygon->last_vertex;
- if (last_vertex_ptr == NULL) {
- if ((last_vertex_ptr = (tess_vertex *)
- malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- polygon->vertices = last_vertex_ptr;
- polygon->last_vertex = last_vertex_ptr;
- last_vertex_ptr->data = data;
- last_vertex_ptr->location[0] = v[0];
- last_vertex_ptr->location[1] = v[1];
- last_vertex_ptr->location[2] = v[2];
- last_vertex_ptr->next = NULL;
- last_vertex_ptr->previous = NULL;
- ++(polygon->vertex_cnt);
- }
- else {
- tess_vertex *vertex_ptr;
-
- /* same point twice? */
- if (fabs(last_vertex_ptr->location[0] - v[0]) < EPSILON &&
- fabs(last_vertex_ptr->location[1] - v[1]) < EPSILON &&
- fabs(last_vertex_ptr->location[2] - v[2]) < EPSILON) {
- tess_call_user_error(tobj, GLU_TESS_ERROR6);
- return;
- }
- if ((vertex_ptr = (tess_vertex *)
- malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- vertex_ptr->data = data;
- vertex_ptr->location[0] = v[0];
- vertex_ptr->location[1] = v[1];
- vertex_ptr->location[2] = v[2];
- vertex_ptr->next = NULL;
- vertex_ptr->previous = last_vertex_ptr;
- ++(polygon->vertex_cnt);
- last_vertex_ptr->next = vertex_ptr;
- polygon->last_vertex = vertex_ptr;
- }
-}
-
-
-static void
-delete_contours(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_contour *contour, *contour_tmp;
- tess_vertex *vertex, *vertex_tmp;
-
- /* remove current_polygon list - if exists due to detected error */
- if (polygon != NULL) {
- if (polygon->vertices) {
- for (vertex = polygon->vertices; vertex != polygon->last_vertex;) {
- vertex_tmp = vertex->next;
- free(vertex);
- vertex = vertex_tmp;
- }
- free(vertex);
- }
- free(polygon);
- tobj->current_polygon = NULL;
- }
- /* remove all contour data */
- for (contour = tobj->contours; contour != NULL;) {
- for (vertex = contour->vertices; vertex != contour->last_vertex;) {
- vertex_tmp = vertex->next;
- free(vertex);
- vertex = vertex_tmp;
- }
- free(vertex);
- contour_tmp = contour->next;
- free(contour);
- contour = contour_tmp;
- }
- tobj->contours = tobj->last_contour = NULL;
- tobj->contour_cnt = 0;
-}
-
-
-void GLAPIENTRY
-gluTessNormal(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ)
-{
- /* dummy function */
- (void) tess;
- (void) valueX;
- (void) valueY;
- (void) valueZ;
-}
diff --git a/src/glu/mesa/tess.h b/src/glu/mesa/tess.h
deleted file mode 100644
index 4e51dddd37d..00000000000
--- a/src/glu/mesa/tess.h
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifndef TESS_H
-#define TESS_H
-
-
-#include "gluP.h"
-
-#define EPSILON 1e-06 /* epsilon for double precision compares */
-
-typedef enum
-{
- OXY,
- OYZ,
- OXZ
-}
-projection_type;
-
-typedef struct callbacks_str
-{
- void (GLCALLBACK * begin) (GLenum mode);
- void (GLCALLBACK * edgeFlag) (GLboolean flag);
- void (GLCALLBACK * vertex) (GLvoid * v);
- void (GLCALLBACK * end) (void);
- void (GLCALLBACK * error) (GLenum err);
-}
-tess_callbacks;
-
-typedef struct vertex_str
-{
- void *data;
- GLdouble location[3];
- GLdouble x, y;
- GLboolean edge_flag;
- struct vertex_str *shadow_vertex;
- struct vertex_str *next, *previous;
-}
-tess_vertex;
-
-typedef struct contour_str
-{
- GLenum type;
- GLuint vertex_cnt;
- GLdouble area;
- GLenum orientation;
- struct vertex_str *vertices, *last_vertex;
- struct contour_str *next, *previous;
-}
-tess_contour;
-
-typedef struct polygon_str
-{
- GLuint vertex_cnt;
- GLdouble A, B, C, D;
- GLdouble area;
- GLenum orientation;
- struct vertex_str *vertices, *last_vertex;
-}
-tess_polygon;
-
-struct GLUtesselator
-{
- tess_contour *contours, *last_contour;
- GLuint contour_cnt;
- tess_callbacks callbacks;
- tess_polygon *current_polygon;
- GLenum error;
- GLdouble A, B, C, D;
- projection_type projection;
-};
-
-
-extern void tess_call_user_error(GLUtriangulatorObj *, GLenum);
-extern void tess_test_polygon(GLUtriangulatorObj *);
-extern void tess_find_contour_hierarchies(GLUtriangulatorObj *);
-extern void tess_handle_holes(GLUtriangulatorObj *);
-extern void tess_tesselate(GLUtriangulatorObj *);
-extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *);
-
-
-#endif
diff --git a/src/glu/mesa/tesselat.c b/src/glu/mesa/tesselat.c
deleted file mode 100644
index 47d230073fd..00000000000
--- a/src/glu/mesa/tesselat.c
+++ /dev/null
@@ -1,406 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <stdlib.h>
-#include <math.h>
-#include "tess.h"
-#endif
-
-
-
-static GLboolean edge_flag;
-
-static void emit_triangle(GLUtriangulatorObj *, tess_vertex *,
- tess_vertex *, tess_vertex *);
-
-static void emit_triangle_with_edge_flag(GLUtriangulatorObj *,
- tess_vertex *, GLboolean,
- tess_vertex *, GLboolean,
- tess_vertex *, GLboolean);
-
-static GLdouble
-twice_the_triangle_area(tess_vertex * va, tess_vertex * vb, tess_vertex * vc)
-{
- return (vb->x - va->x) * (vc->y - va->y) - (vb->y - va->y) * (vc->x -
- va->x);
-}
-
-static GLboolean
-left(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y)
-{
- if (A * x + B * y + C > -EPSILON)
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-
-static GLboolean
-right(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y)
-{
- if (A * x + B * y + C < EPSILON)
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-
-static GLint
-convex_ccw(tess_vertex * va,
- tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj)
-{
- GLdouble d;
-
- d = twice_the_triangle_area(va, vb, vc);
-
- if (d > EPSILON) {
- return 1;
- }
- else if (d < -EPSILON) {
- return 0;
- }
- else {
- return -1;
- }
-}
-
-static GLint
-convex_cw(tess_vertex * va,
- tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj)
-{
- GLdouble d;
-
- d = twice_the_triangle_area(va, vb, vc);
-
- if (d < -EPSILON) {
- return 1;
- }
- else if (d > EPSILON) {
- return 0;
- }
- else {
- return -1;
- }
-}
-
-static GLboolean
-diagonal_ccw(tess_vertex * va,
- tess_vertex * vb,
- GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vc = va->next, *vertex, *shadow_vertex;
- struct
- {
- GLdouble A, B, C;
- }
- ac, cb, ba;
- GLdouble x, y;
-
- GLint res = convex_ccw(va, vc, vb, tobj);
- if (res == 0)
- return GL_FALSE;
- if (res == -1)
- return GL_TRUE;
-
- ba.A = vb->y - va->y;
- ba.B = va->x - vb->x;
- ba.C = -ba.A * va->x - ba.B * va->y;
- ac.A = va->y - vc->y;
- ac.B = vc->x - va->x;
- ac.C = -ac.A * vc->x - ac.B * vc->y;
- cb.A = vc->y - vb->y;
- cb.B = vb->x - vc->x;
- cb.C = -cb.A * vb->x - cb.B * vb->y;
- for (vertex = vb->next; vertex != va; vertex = vertex->next) {
- shadow_vertex = vertex->shadow_vertex;
- if (shadow_vertex != NULL &&
- (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc))
- continue;
- x = vertex->x;
- y = vertex->y;
- if (left(ba.A, ba.B, ba.C, x, y) &&
- left(ac.A, ac.B, ac.C, x, y) && left(cb.A, cb.B, cb.C, x, y))
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-static GLboolean
-diagonal_cw(tess_vertex * va,
- tess_vertex * vb,
- GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vc = va->next, *vertex, *shadow_vertex;
- struct
- {
- GLdouble A, B, C;
- }
- ac, cb, ba;
- GLdouble x, y;
-
- GLint res = convex_cw(va, vc, vb, tobj);
- if (res == 0)
- return GL_FALSE;
- if (res == -1)
- return GL_TRUE;
-
- ba.A = vb->y - va->y;
- ba.B = va->x - vb->x;
- ba.C = -ba.A * va->x - ba.B * va->y;
- ac.A = va->y - vc->y;
- ac.B = vc->x - va->x;
- ac.C = -ac.A * vc->x - ac.B * vc->y;
- cb.A = vc->y - vb->y;
- cb.B = vb->x - vc->x;
- cb.C = -cb.A * vb->x - cb.B * vb->y;
- for (vertex = vb->next; vertex != va; vertex = vertex->next) {
- shadow_vertex = vertex->shadow_vertex;
- if (shadow_vertex != NULL &&
- (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc))
- continue;
- x = vertex->x;
- y = vertex->y;
- if (right(ba.A, ba.B, ba.C, x, y) &&
- right(ac.A, ac.B, ac.C, x, y) && right(cb.A, cb.B, cb.C, x, y))
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-static void
-clip_ear(GLUtriangulatorObj * tobj, tess_vertex * v, tess_contour * contour)
-{
- emit_triangle(tobj, v->previous, v, v->next);
- /* the first in the list */
- if (contour->vertices == v) {
- contour->vertices = v->next;
- contour->last_vertex->next = v->next;
- v->next->previous = contour->last_vertex;
- }
- else
- /* the last ? */
- if (contour->last_vertex == v) {
- contour->vertices->previous = v->previous;
- v->previous->next = v->next;
- contour->last_vertex = v->previous;
- }
- else {
- v->next->previous = v->previous;
- v->previous->next = v->next;
- }
- free(v);
- --(contour->vertex_cnt);
-}
-
-static void
-clip_ear_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_vertex * v, tess_contour * contour)
-{
- emit_triangle_with_edge_flag(tobj, v->previous, v->previous->edge_flag,
- v, v->edge_flag, v->next, GL_FALSE);
- v->previous->edge_flag = GL_FALSE;
- /* the first in the list */
- if (contour->vertices == v) {
- contour->vertices = v->next;
- contour->last_vertex->next = v->next;
- v->next->previous = contour->last_vertex;
- }
- else
- /* the last ? */
- if (contour->last_vertex == v) {
- contour->vertices->previous = v->previous;
- v->previous->next = v->next;
- contour->last_vertex = v->previous;
- }
- else {
- v->next->previous = v->previous;
- v->previous->next = v->next;
- }
- free(v);
- --(contour->vertex_cnt);
-}
-
-static void
-triangulate_ccw(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-static void
-triangulate_cw(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_cw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-static void
-triangulate_ccw_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear_with_edge_flag(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-static void
-triangulate_cw_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_cw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear_with_edge_flag(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-void
-tess_tesselate(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour;
-
- for (contour = tobj->contours; contour != NULL; contour = contour->next) {
- if (contour->orientation == GLU_CCW) {
- triangulate_ccw(tobj, contour);
- }
- else {
- triangulate_cw(tobj, contour);
- }
- if (tobj->error != GLU_NO_ERROR)
- return;
-
- /* emit the last triangle */
- emit_triangle(tobj, contour->vertices, contour->vertices->next,
- contour->vertices->next->next);
- }
-}
-
-void
-tess_tesselate_with_edge_flag(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour;
-
- edge_flag = GL_TRUE;
- /* first callback with edgeFlag set to GL_TRUE */
- (tobj->callbacks.edgeFlag) (GL_TRUE);
-
- for (contour = tobj->contours; contour != NULL; contour = contour->next) {
- if (contour->orientation == GLU_CCW)
- triangulate_ccw_with_edge_flag(tobj, contour);
- else
- triangulate_cw_with_edge_flag(tobj, contour);
- if (tobj->error != GLU_NO_ERROR)
- return;
- /* emit the last triangle */
- emit_triangle_with_edge_flag(tobj, contour->vertices,
- contour->vertices->edge_flag,
- contour->vertices->next,
- contour->vertices->next->edge_flag,
- contour->vertices->next->next,
- contour->vertices->next->next->edge_flag);
- }
-}
-
-static void
-emit_triangle(GLUtriangulatorObj * tobj,
- tess_vertex * v1, tess_vertex * v2, tess_vertex * v3)
-{
- (tobj->callbacks.begin) (GL_TRIANGLES);
- (tobj->callbacks.vertex) (v1->data);
- (tobj->callbacks.vertex) (v2->data);
- (tobj->callbacks.vertex) (v3->data);
- (tobj->callbacks.end) ();
-}
-
-static void
-emit_triangle_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_vertex * v1,
- GLboolean edge_flag1,
- tess_vertex * v2,
- GLboolean edge_flag2,
- tess_vertex * v3, GLboolean edge_flag3)
-{
- (tobj->callbacks.begin) (GL_TRIANGLES);
- if (edge_flag1 != edge_flag) {
- edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE);
- (tobj->callbacks.edgeFlag) (edge_flag);
- }
- (tobj->callbacks.vertex) (v1->data);
- if (edge_flag2 != edge_flag) {
- edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE);
- (tobj->callbacks.edgeFlag) (edge_flag);
- }
- (tobj->callbacks.vertex) (v2->data);
- if (edge_flag3 != edge_flag) {
- edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE);
- (tobj->callbacks.edgeFlag) (edge_flag);
- }
- (tobj->callbacks.vertex) (v3->data);
- (tobj->callbacks.end) ();
-}
diff --git a/src/glu/mini/all.h b/src/glu/mini/all.h
deleted file mode 100644
index c19b94c421e..00000000000
--- a/src/glu/mini/all.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $Id: all.h,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file includes all .h files needed for the GLU source code for
- * the purpose of precompiled headers.
- *
- * If the preprocessor symbol PCH is defined at compile time then each
- * of the .c files will #include "all.h" only, instead of a bunch of
- * individual .h files.
- */
-
-
-#ifndef GLU_ALL_H
-#define GLU_ALL_H
-
-
-#ifndef PC_HEADER
-This is an error. all.h should be included only if PCH is defined.
-#endif
-
-
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "GL/gl.h"
-#include "GL/glu.h"
-#include "gluP.h"
-#include "nurbs.h"
-#include "tess.h"
-
-
-#endif /*GLU_ALL_H */
diff --git a/src/glu/mini/glu.c b/src/glu/mini/glu.c
deleted file mode 100644
index 3e79aa86dee..00000000000
--- a/src/glu/mini/glu.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/* $Id: glu.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- * Copyright (C) 1995-2001 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gluP.h"
-#endif
-
-
-/*
- * Miscellaneous utility functions
- */
-
-
-#ifndef M_PI
-#define M_PI 3.1415926536
-#endif
-#define EPS 0.00001
-
-#ifndef GLU_INCOMPATIBLE_GL_VERSION
-#define GLU_INCOMPATIBLE_GL_VERSION 100903
-#endif
-
-
-void GLAPIENTRY
-gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez,
- GLdouble centerx, GLdouble centery, GLdouble centerz,
- GLdouble upx, GLdouble upy, GLdouble upz)
-{
- GLfloat m[16];
- GLfloat x[3], y[3], z[3];
- GLfloat mag;
-
- /* Make rotation matrix */
-
- /* Z vector */
- z[0] = eyex - centerx;
- z[1] = eyey - centery;
- z[2] = eyez - centerz;
- mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
- if (mag) { /* mpichler, 19950515 */
- z[0] /= mag;
- z[1] /= mag;
- z[2] /= mag;
- }
-
- /* Y vector */
- y[0] = upx;
- y[1] = upy;
- y[2] = upz;
-
- /* X vector = Y cross Z */
- x[0] = y[1] * z[2] - y[2] * z[1];
- x[1] = -y[0] * z[2] + y[2] * z[0];
- x[2] = y[0] * z[1] - y[1] * z[0];
-
- /* Recompute Y = Z cross X */
- y[0] = z[1] * x[2] - z[2] * x[1];
- y[1] = -z[0] * x[2] + z[2] * x[0];
- y[2] = z[0] * x[1] - z[1] * x[0];
-
- /* mpichler, 19950515 */
- /* cross product gives area of parallelogram, which is < 1.0 for
- * non-perpendicular unit-length vectors; so normalize x, y here
- */
-
- mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
- if (mag) {
- x[0] /= mag;
- x[1] /= mag;
- x[2] /= mag;
- }
-
- mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
- if (mag) {
- y[0] /= mag;
- y[1] /= mag;
- y[2] /= mag;
- }
-
-#define M(row,col) m[col*4+row]
- M(0, 0) = x[0];
- M(0, 1) = x[1];
- M(0, 2) = x[2];
- M(0, 3) = 0.0;
- M(1, 0) = y[0];
- M(1, 1) = y[1];
- M(1, 2) = y[2];
- M(1, 3) = 0.0;
- M(2, 0) = z[0];
- M(2, 1) = z[1];
- M(2, 2) = z[2];
- M(2, 3) = 0.0;
- M(3, 0) = 0.0;
- M(3, 1) = 0.0;
- M(3, 2) = 0.0;
- M(3, 3) = 1.0;
-#undef M
- glMultMatrixf(m);
-
- /* Translate Eye to Origin */
- glTranslatef(-eyex, -eyey, -eyez);
-
-}
-
-
-
-void GLAPIENTRY
-gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top)
-{
- glOrtho(left, right, bottom, top, -1.0, 1.0);
-}
-
-
-
-static void
-frustum(GLfloat left, GLfloat right,
- GLfloat bottom, GLfloat top,
- GLfloat nearval, GLfloat farval)
-{
- GLfloat x, y, a, b, c, d;
- GLfloat m[16];
-
- x = (2.0 * nearval) / (right - left);
- y = (2.0 * nearval) / (top - bottom);
- a = (right + left) / (right - left);
- b = (top + bottom) / (top - bottom);
- c = -(farval + nearval) / ( farval - nearval);
- d = -(2.0 * farval * nearval) / (farval - nearval);
-
-#define M(row,col) m[col*4+row]
- M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F;
- M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F;
- M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d;
- M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F;
-#undef M
-
- glMultMatrixf(m);
-}
-
-
-void GLAPIENTRY
-gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
-{
- GLfloat xmin, xmax, ymin, ymax;
-
- ymax = zNear * tan(fovy * M_PI / 360.0);
- ymin = -ymax;
- xmin = ymin * aspect;
- xmax = ymax * aspect;
-
- /* don't call glFrustum() because of error semantics (covglu) */
- frustum(xmin, xmax, ymin, ymax, zNear, zFar);
-}
-
-
-
-void GLAPIENTRY
-gluPickMatrix(GLdouble x, GLdouble y,
- GLdouble width, GLdouble height, GLint viewport[4])
-{
- GLfloat m[16];
- GLfloat sx, sy;
- GLfloat tx, ty;
-
- sx = viewport[2] / width;
- sy = viewport[3] / height;
- tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
- ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
-
-#define M(row,col) m[col*4+row]
- M(0, 0) = sx;
- M(0, 1) = 0.0;
- M(0, 2) = 0.0;
- M(0, 3) = tx;
- M(1, 0) = 0.0;
- M(1, 1) = sy;
- M(1, 2) = 0.0;
- M(1, 3) = ty;
- M(2, 0) = 0.0;
- M(2, 1) = 0.0;
- M(2, 2) = 1.0;
- M(2, 3) = 0.0;
- M(3, 0) = 0.0;
- M(3, 1) = 0.0;
- M(3, 2) = 0.0;
- M(3, 3) = 1.0;
-#undef M
-
- glMultMatrixf(m);
-}
-
-
-
-const GLubyte *GLAPIENTRY
-gluErrorString(GLenum errorCode)
-{
- static char *tess_error[] = {
- "missing gluBeginPolygon",
- "missing gluBeginContour",
- "missing gluEndPolygon",
- "missing gluEndContour",
- "misoriented or self-intersecting loops",
- "coincident vertices",
- "colinear vertices",
- "FIST recovery process fatal error"
- };
- static char *nurbs_error[] = {
- "spline order un-supported",
- "too few knots",
- "valid knot range is empty",
- "decreasing knot sequence knot",
- "knot multiplicity greater than order of spline",
- "endcurve() must follow bgncurve()",
- "bgncurve() must precede endcurve()",
- "missing or extra geometric data",
- "can't draw pwlcurves",
- "missing bgncurve()",
- "missing bgnsurface()",
- "endtrim() must precede endsurface()",
- "bgnsurface() must precede endsurface()",
- "curve of improper type passed as trim curve",
- "bgnsurface() must precede bgntrim()",
- "endtrim() must follow bgntrim()",
- "bgntrim() must precede endtrim()",
- "invalid or missing trim curve",
- "bgntrim() must precede pwlcurve()",
- "pwlcurve referenced twice",
- "pwlcurve and nurbscurve mixed",
- "improper usage of trim data type",
- "nurbscurve referenced twice",
- "nurbscurve and pwlcurve mixed",
- "nurbssurface referenced twice",
- "invalid property",
- "endsurface() must follow bgnsurface()",
- "misoriented trim curves",
- "intersecting trim curves",
- "UNUSED",
- "unconnected trim curves",
- "unknown knot error",
- "negative vertex count encountered",
- "negative byte-stride encountered",
- "unknown type descriptor",
- "null control array or knot vector",
- "duplicate point on pwlcurve"
- };
-
- /* GL Errors */
- if (errorCode == GL_NO_ERROR) {
- return (GLubyte *) "no error";
- }
- else if (errorCode == GL_INVALID_VALUE) {
- return (GLubyte *) "invalid value";
- }
- else if (errorCode == GL_INVALID_ENUM) {
- return (GLubyte *) "invalid enum";
- }
- else if (errorCode == GL_INVALID_OPERATION) {
- return (GLubyte *) "invalid operation";
- }
- else if (errorCode == GL_STACK_OVERFLOW) {
- return (GLubyte *) "stack overflow";
- }
- else if (errorCode == GL_STACK_UNDERFLOW) {
- return (GLubyte *) "stack underflow";
- }
- else if (errorCode == GL_OUT_OF_MEMORY) {
- return (GLubyte *) "out of memory";
- }
- /* GLU Errors */
- else if (errorCode == GLU_NO_ERROR) {
- return (GLubyte *) "no error";
- }
- else if (errorCode == GLU_INVALID_ENUM) {
- return (GLubyte *) "invalid enum";
- }
- else if (errorCode == GLU_INVALID_VALUE) {
- return (GLubyte *) "invalid value";
- }
- else if (errorCode == GLU_OUT_OF_MEMORY) {
- return (GLubyte *) "out of memory";
- }
- else if (errorCode == GLU_INCOMPATIBLE_GL_VERSION) {
- return (GLubyte *) "incompatible GL version";
- }
- else if (errorCode >= GLU_TESS_ERROR1 && errorCode <= GLU_TESS_ERROR8) {
- return (GLubyte *) tess_error[errorCode - GLU_TESS_ERROR1];
- }
- else if (errorCode >= GLU_NURBS_ERROR1 && errorCode <= GLU_NURBS_ERROR37) {
- return (GLubyte *) nurbs_error[errorCode - GLU_NURBS_ERROR1];
- }
- else {
- return NULL;
- }
-}
-
-
-
-/*
- * New in GLU 1.1
- */
-
-const GLubyte *GLAPIENTRY
-gluGetString(GLenum name)
-{
- static char *extensions = "GL_EXT_abgr";
- static char *version = "1.1 Mesa 3.5";
-
- switch (name) {
- case GLU_EXTENSIONS:
- return (GLubyte *) extensions;
- case GLU_VERSION:
- return (GLubyte *) version;
- default:
- return NULL;
- }
-}
-
-
-
-#if 0 /* gluGetProcAddressEXT not finalized yet! */
-
-#ifdef __cplusplus
- /* for BeOS R4.5 */
-void GLAPIENTRY(*gluGetProcAddressEXT(const GLubyte * procName)) (...)
-#else
-void (GLAPIENTRY * gluGetProcAddressEXT(const GLubyte * procName)) ()
-#endif
-{
- struct proc
- {
- const char *name;
- void *address;
- };
- static struct proc procTable[] = {
- {"gluGetProcAddressEXT", (void *) gluGetProcAddressEXT}, /* me! */
-
- /* new 1.1 functions */
- {"gluGetString", (void *) gluGetString},
-
- /* new 1.2 functions */
- {"gluTessBeginPolygon", (void *) gluTessBeginPolygon},
- {"gluTessBeginContour", (void *) gluTessBeginContour},
- {"gluTessEndContour", (void *) gluTessEndContour},
- {"gluTessEndPolygon", (void *) gluTessEndPolygon},
- {"gluGetTessProperty", (void *) gluGetTessProperty},
-
- /* new 1.3 functions */
-
- {NULL, NULL}
- };
- GLuint i;
-
- for (i = 0; procTable[i].address; i++) {
- if (strcmp((const char *) procName, procTable[i].name) == 0)
- return (void (GLAPIENTRY *) ()) procTable[i].address;
- }
-
- return NULL;
-}
-
-#endif
-
-
-
-/*
- * New in GLU 1.3
- */
-#ifdef GLU_VERSION_1_3
-GLboolean GLAPIENTRY
-gluCheckExtension(const GLubyte *extName, const GLubyte * extString)
-{
- assert(extName);
- assert(extString);
- {
- const int len = strlen((const char *) extName);
- const char *start = (const char *) extString;
-
- while (1) {
- const char *c = strstr(start, (const char *) extName);
- if (!c)
- return GL_FALSE;
-
- if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0))
- return GL_TRUE;
-
- start = c + len;
- }
- }
-}
-#endif
diff --git a/src/glu/mini/gluP.h b/src/glu/mini/gluP.h
deleted file mode 100644
index eada6bbcd1e..00000000000
--- a/src/glu/mini/gluP.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $Id: gluP.h,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file allows the GLU code to be compiled either with the Mesa
- * headers or with the real OpenGL headers.
- */
-
-
-#ifndef GLUP_H
-#define GLUP_H
-
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <string.h>
-
-
-#if defined(_WIN32) && !defined(__WIN32__)
-# define __WIN32__
-#endif
-
-#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__))
-# pragma warning( disable : 4068 ) /* unknown pragma */
-# pragma warning( disable : 4710 ) /* function 'foo' not inlined */
-# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */
-# pragma warning( disable : 4127 ) /* conditional expression is constant */
-# if defined(MESA_MINWARN)
-# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
-# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
-# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
-# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */
-# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
-# endif
-# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
-# define GLAPI __declspec(dllexport)
-# define WGLAPI __declspec(dllexport)
-# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
-# define GLAPI __declspec(dllimport)
-# define WGLAPI __declspec(dllimport)
-# else /* for use with static link lib build of Win32 edition only */
-# define GLAPI extern
-# define WGLAPI __declspec(dllimport)
-# endif /* _STATIC_MESA support */
-# define GLAPIENTRY __stdcall
-# define GLAPIENTRYP __stdcall *
-# define GLCALLBACK __stdcall
-# define GLCALLBACKP __stdcall *
-# if defined(__CYGWIN__)
-# define GLCALLBACKPCAST *
-# else
-# define GLCALLBACKPCAST __stdcall *
-# endif
-# define GLWINAPI __stdcall
-# define GLWINAPIV __cdecl
-#else
-/* non-Windows compilation */
-# define GLAPI extern
-# define GLAPIENTRY
-# define GLAPIENTRYP *
-# define GLCALLBACK
-# define GLCALLBACKP *
-# define GLCALLBACKPCAST *
-# define GLWINAPI
-# define GLWINAPIV
-#endif /* WIN32 / CYGWIN bracket */
-
-/* compatibility guard so we don't need to change client code */
-
-#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP)
-# define CALLBACK GLCALLBACK
-typedef int (GLAPIENTRY *PROC)();
-typedef void *HGLRC;
-typedef void *HDC;
-typedef unsigned long COLORREF;
-#endif
-
-#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
-# define WGL_FONT_LINES 0
-# define WGL_FONT_POLYGONS 1
-#ifndef _GNU_H_WINDOWS32_FUNCTIONS
-# ifdef UNICODE
-# define wglUseFontBitmaps wglUseFontBitmapsW
-# define wglUseFontOutlines wglUseFontOutlinesW
-# else
-# define wglUseFontBitmaps wglUseFontBitmapsA
-# define wglUseFontOutlines wglUseFontOutlinesA
-# endif /* !UNICODE */
-#endif /* _GNU_H_WINDOWS32_FUNCTIONS */
-typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
-typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
-typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
-#include <gl/mesa_wgl.h>
-#endif
-
-
-
-#ifndef GLU_TESS_ERROR9
- /* If we're using the real OpenGL header files... */
-# define GLU_TESS_ERROR9 100159
-#endif
-
-
-#define GLU_NO_ERROR GL_NO_ERROR
-
-
-/* for Sun: */
-#ifdef SUNOS4
-#define MEMCPY( DST, SRC, BYTES) \
- memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) )
-#else
-#define MEMCPY( DST, SRC, BYTES) \
- memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) )
-#endif
-
-
-#ifndef NULL
-# define NULL 0
-#endif
-
-
-#endif
diff --git a/src/glu/mini/mipmap.c b/src/glu/mini/mipmap.c
deleted file mode 100644
index 256e6e7dc1d..00000000000
--- a/src/glu/mini/mipmap.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/* $Id: mipmap.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.4
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <assert.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gluP.h"
-#endif
-
-
-/*
- * Compute ceiling of integer quotient of A divided by B:
- */
-#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
-
-#ifdef EPSILON
-#undef EPSILON
-#endif
-#define EPSILON 0.001
-
-
-/* To work around optimizer bug in MSVC4.1 */
-#if defined(__WIN32__) && !defined(OPENSTEP)
-void
-dummy(GLuint j, GLuint k)
-{
-}
-#else
-#define dummy(J, K)
-#endif
-
-
-GLint GLAPIENTRY
-gluScaleImage(GLenum format,
- GLsizei widthin, GLsizei heightin,
- GLenum typein, const void *datain,
- GLsizei widthout, GLsizei heightout,
- GLenum typeout, void *dataout)
-{
- GLint components, i, j, k;
- GLfloat *tempin, *tempout, f;
- GLfloat sx, sy;
- GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels;
- GLint packrowlength, packalignment, packskiprows, packskippixels;
- GLint sizein, sizeout;
- GLint rowstride, rowlen;
-
-
- /* Determine number of components per pixel */
- switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- components = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- components = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- components = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
-#ifdef GL_EXT_abgr
- case GL_ABGR_EXT:
-#endif
- components = 4;
- break;
- default:
- return GLU_INVALID_ENUM;
- }
-
- /* Determine bytes per input datum */
- switch (typein) {
- case GL_UNSIGNED_BYTE:
- sizein = sizeof(GLubyte);
- break;
- case GL_BYTE:
- sizein = sizeof(GLbyte);
- break;
- case GL_UNSIGNED_SHORT:
- sizein = sizeof(GLushort);
- break;
- case GL_SHORT:
- sizein = sizeof(GLshort);
- break;
- case GL_UNSIGNED_INT:
- sizein = sizeof(GLuint);
- break;
- case GL_INT:
- sizein = sizeof(GLint);
- break;
- case GL_FLOAT:
- sizein = sizeof(GLfloat);
- break;
- case GL_BITMAP:
- /* not implemented yet */
- default:
- return GL_INVALID_ENUM;
- }
-
- /* Determine bytes per output datum */
- switch (typeout) {
- case GL_UNSIGNED_BYTE:
- sizeout = sizeof(GLubyte);
- break;
- case GL_BYTE:
- sizeout = sizeof(GLbyte);
- break;
- case GL_UNSIGNED_SHORT:
- sizeout = sizeof(GLushort);
- break;
- case GL_SHORT:
- sizeout = sizeof(GLshort);
- break;
- case GL_UNSIGNED_INT:
- sizeout = sizeof(GLuint);
- break;
- case GL_INT:
- sizeout = sizeof(GLint);
- break;
- case GL_FLOAT:
- sizeout = sizeof(GLfloat);
- break;
- case GL_BITMAP:
- /* not implemented yet */
- default:
- return GL_INVALID_ENUM;
- }
-
- /* Get glPixelStore state */
- glGetFloatv(GL_UNPACK_ROW_LENGTH, &f); unpackrowlength = (int)f;
- glGetFloatv(GL_UNPACK_ALIGNMENT, &f); unpackalignment = (int)f;
- glGetFloatv(GL_UNPACK_SKIP_ROWS, &f); unpackskiprows = (int)f;
- glGetFloatv(GL_UNPACK_SKIP_PIXELS, &f); unpackskippixels = (int)f;
- glGetFloatv(GL_PACK_ROW_LENGTH, &f); packrowlength = (int)f;
- glGetFloatv(GL_PACK_ALIGNMENT, &f); packalignment = (int)f;
- glGetFloatv(GL_PACK_SKIP_ROWS, &f); packskiprows = (int)f;
- glGetFloatv(GL_PACK_SKIP_PIXELS, &f); packskippixels = (int)f;
-
- /* Allocate storage for intermediate images */
- tempin = (GLfloat *) malloc(widthin * heightin
- * components * sizeof(GLfloat));
- if (!tempin) {
- return GLU_OUT_OF_MEMORY;
- }
- tempout = (GLfloat *) malloc(widthout * heightout
- * components * sizeof(GLfloat));
- if (!tempout) {
- free(tempin);
- return GLU_OUT_OF_MEMORY;
- }
-
-
- /*
- * Unpack the pixel data and convert to floating point
- */
-
- if (unpackrowlength > 0) {
- rowlen = unpackrowlength;
- }
- else {
- rowlen = widthin;
- }
- if (sizein >= unpackalignment) {
- rowstride = components * rowlen;
- }
- else {
- rowstride = unpackalignment / sizein
- * CEILING(components * rowlen * sizein, unpackalignment);
- }
-
- switch (typein) {
- case GL_UNSIGNED_BYTE:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLubyte *ubptr = (GLubyte *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * ubptr++;
- }
- }
- break;
- case GL_BYTE:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLbyte *bptr = (GLbyte *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * bptr++;
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLushort *usptr = (GLushort *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * usptr++;
- }
- }
- break;
- case GL_SHORT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLshort *sptr = (GLshort *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * sptr++;
- }
- }
- break;
- case GL_UNSIGNED_INT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLuint *uiptr = (GLuint *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * uiptr++;
- }
- }
- break;
- case GL_INT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLint *iptr = (GLint *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = (GLfloat) * iptr++;
- }
- }
- break;
- case GL_FLOAT:
- k = 0;
- for (i = 0; i < heightin; i++) {
- GLfloat *fptr = (GLfloat *) datain
- + i * rowstride
- + unpackskiprows * rowstride + unpackskippixels * components;
- for (j = 0; j < widthin * components; j++) {
- dummy(j, k);
- tempin[k++] = *fptr++;
- }
- }
- break;
- default:
- return GLU_INVALID_ENUM;
- }
-
-
- /*
- * Scale the image!
- */
-
- if (widthout > 1)
- sx = (GLfloat) (widthin - 1) / (GLfloat) (widthout - 1);
- else
- sx = (GLfloat) (widthin - 1);
- if (heightout > 1)
- sy = (GLfloat) (heightin - 1) / (GLfloat) (heightout - 1);
- else
- sy = (GLfloat) (heightin - 1);
-
-/*#define POINT_SAMPLE*/
-#ifdef POINT_SAMPLE
- for (i = 0; i < heightout; i++) {
- GLint ii = i * sy;
- for (j = 0; j < widthout; j++) {
- GLint jj = j * sx;
-
- GLfloat *src = tempin + (ii * widthin + jj) * components;
- GLfloat *dst = tempout + (i * widthout + j) * components;
-
- for (k = 0; k < components; k++) {
- *dst++ = *src++;
- }
- }
- }
-#else
- if (sx < 1.0 && sy < 1.0) {
- /* magnify both width and height: use weighted sample of 4 pixels */
- GLint i0, i1, j0, j1;
- GLfloat alpha, beta;
- GLfloat *src00, *src01, *src10, *src11;
- GLfloat s1, s2;
- GLfloat *dst;
-
- for (i = 0; i < heightout; i++) {
- i0 = i * sy;
- i1 = i0 + 1;
- if (i1 >= heightin)
- i1 = heightin - 1;
-/* i1 = (i+1) * sy - EPSILON;*/
- alpha = i * sy - i0;
- for (j = 0; j < widthout; j++) {
- j0 = j * sx;
- j1 = j0 + 1;
- if (j1 >= widthin)
- j1 = widthin - 1;
-/* j1 = (j+1) * sx - EPSILON; */
- beta = j * sx - j0;
-
- /* compute weighted average of pixels in rect (i0,j0)-(i1,j1) */
- src00 = tempin + (i0 * widthin + j0) * components;
- src01 = tempin + (i0 * widthin + j1) * components;
- src10 = tempin + (i1 * widthin + j0) * components;
- src11 = tempin + (i1 * widthin + j1) * components;
-
- dst = tempout + (i * widthout + j) * components;
-
- for (k = 0; k < components; k++) {
- s1 = *src00++ * (1.0 - beta) + *src01++ * beta;
- s2 = *src10++ * (1.0 - beta) + *src11++ * beta;
- *dst++ = s1 * (1.0 - alpha) + s2 * alpha;
- }
- }
- }
- }
- else {
- /* shrink width and/or height: use an unweighted box filter */
- GLint i0, i1;
- GLint j0, j1;
- GLint ii, jj;
- GLfloat sum, *dst;
-
- for (i = 0; i < heightout; i++) {
- i0 = i * sy;
- i1 = i0 + 1;
- if (i1 >= heightin)
- i1 = heightin - 1;
-/* i1 = (i+1) * sy - EPSILON; */
- for (j = 0; j < widthout; j++) {
- j0 = j * sx;
- j1 = j0 + 1;
- if (j1 >= widthin)
- j1 = widthin - 1;
-/* j1 = (j+1) * sx - EPSILON; */
-
- dst = tempout + (i * widthout + j) * components;
-
- /* compute average of pixels in the rectangle (i0,j0)-(i1,j1) */
- for (k = 0; k < components; k++) {
- sum = 0.0;
- for (ii = i0; ii <= i1; ii++) {
- for (jj = j0; jj <= j1; jj++) {
- sum += *(tempin + (ii * widthin + jj) * components + k);
- }
- }
- sum /= (j1 - j0 + 1) * (i1 - i0 + 1);
- *dst++ = sum;
- }
- }
- }
- }
-#endif
-
-
- /*
- * Return output image
- */
-
- if (packrowlength > 0) {
- rowlen = packrowlength;
- }
- else {
- rowlen = widthout;
- }
- if (sizeout >= packalignment) {
- rowstride = components * rowlen;
- }
- else {
- rowstride = packalignment / sizeout
- * CEILING(components * rowlen * sizeout, packalignment);
- }
-
- switch (typeout) {
- case GL_UNSIGNED_BYTE:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLubyte *ubptr = (GLubyte *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *ubptr++ = (GLubyte) tempout[k++];
- }
- }
- break;
- case GL_BYTE:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLbyte *bptr = (GLbyte *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *bptr++ = (GLbyte) tempout[k++];
- }
- }
- break;
- case GL_UNSIGNED_SHORT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLushort *usptr = (GLushort *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *usptr++ = (GLushort) tempout[k++];
- }
- }
- break;
- case GL_SHORT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLshort *sptr = (GLshort *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *sptr++ = (GLshort) tempout[k++];
- }
- }
- break;
- case GL_UNSIGNED_INT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLuint *uiptr = (GLuint *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *uiptr++ = (GLuint) tempout[k++];
- }
- }
- break;
- case GL_INT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLint *iptr = (GLint *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *iptr++ = (GLint) tempout[k++];
- }
- }
- break;
- case GL_FLOAT:
- k = 0;
- for (i = 0; i < heightout; i++) {
- GLfloat *fptr = (GLfloat *) dataout
- + i * rowstride
- + packskiprows * rowstride + packskippixels * components;
- for (j = 0; j < widthout * components; j++) {
- dummy(j, k + i);
- *fptr++ = tempout[k++];
- }
- }
- break;
- default:
- return GLU_INVALID_ENUM;
- }
-
-
- /* free temporary image storage */
- free(tempin);
- free(tempout);
-
- return 0;
-}
-
-
-
-/*
- * Return the largest k such that 2^k <= n.
- */
-static GLint
-ilog2(GLint n)
-{
- GLint k;
-
- if (n <= 0)
- return 0;
- for (k = 0; n >>= 1; k++);
- return k;
-}
-
-
-
-/*
- * Find the value nearest to n which is also a power of two.
- */
-static GLint
-round2(GLint n)
-{
- GLint m;
-
- for (m = 1; m < n; m *= 2);
-
- /* m>=n */
- if (m - n <= n - m / 2) {
- return m;
- }
- else {
- return m / 2;
- }
-}
-
-
-/*
- * Given an pixel format and data type, return the number of bytes to
- * store one pixel.
- */
-static GLint
-bytes_per_pixel(GLenum format, GLenum type)
-{
- GLint n, m;
-
- switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- n = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- n = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- n = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
-#ifdef GL_EXT_abgr
- case GL_ABGR_EXT:
-#endif
- n = 4;
- break;
- default:
- n = 0;
- }
-
- switch (type) {
- case GL_UNSIGNED_BYTE:
- m = sizeof(GLubyte);
- break;
- case GL_BYTE:
- m = sizeof(GLbyte);
- break;
- case GL_BITMAP:
- m = 1;
- break;
- case GL_UNSIGNED_SHORT:
- m = sizeof(GLushort);
- break;
- case GL_SHORT:
- m = sizeof(GLshort);
- break;
- case GL_UNSIGNED_INT:
- m = sizeof(GLuint);
- break;
- case GL_INT:
- m = sizeof(GLint);
- break;
- case GL_FLOAT:
- m = sizeof(GLfloat);
- break;
- default:
- m = 0;
- }
-
- return n * m;
-}
-
-
-
-/*
- * WARNING: This function isn't finished and has never been tested!!!!
- */
-GLint GLAPIENTRY
-gluBuild1DMipmaps(GLenum target, GLint components,
- GLsizei width, GLenum format, GLenum type, const void *data)
-{
- return 0;
-}
-
-
-
-GLint GLAPIENTRY
-gluBuild2DMipmaps(GLenum target, GLint components,
- GLsizei width, GLsizei height, GLenum format,
- GLenum type, const void *data)
-{
- GLint w, h;
- GLint maxsize;
- void *image, *newimage;
- GLint neww, newh, level, bpp;
- int error;
- GLboolean done;
- GLint retval = 0;
- GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels;
- GLint packrowlength, packalignment, packskiprows, packskippixels;
- GLfloat f;
-
- if (width < 1 || height < 1)
- return GLU_INVALID_VALUE;
-
- glGetFloatv(GL_MAX_TEXTURE_SIZE, &f); maxsize = (int)f;
-
- w = round2(width);
- if (w > maxsize) {
- w = maxsize;
- }
- h = round2(height);
- if (h > maxsize) {
- h = maxsize;
- }
-
- bpp = bytes_per_pixel(format, type);
- if (bpp == 0) {
- /* probably a bad format or type enum */
- return GLU_INVALID_ENUM;
- }
-
- /* Get current glPixelStore values */
- glGetFloatv(GL_UNPACK_ROW_LENGTH, &f); unpackrowlength = (int)f;
- glGetFloatv(GL_UNPACK_ALIGNMENT, &f); unpackalignment = (int)f;
- glGetFloatv(GL_UNPACK_SKIP_ROWS, &f); unpackskiprows = (int)f;
- glGetFloatv(GL_UNPACK_SKIP_PIXELS, &f); unpackskippixels = (int)f;
- glGetFloatv(GL_PACK_ROW_LENGTH, &f); packrowlength = (int)f;
- glGetFloatv(GL_PACK_ALIGNMENT, &f); packalignment = (int)f;
- glGetFloatv(GL_PACK_SKIP_ROWS, &f); packskiprows = (int)f;
- glGetFloatv(GL_PACK_SKIP_PIXELS, &f); packskippixels = (int)f;
-
- /* set pixel packing */
- glPixelStorei(GL_PACK_ROW_LENGTH, 0);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glPixelStorei(GL_PACK_SKIP_ROWS, 0);
- glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
-
- done = GL_FALSE;
-
- if (w != width || h != height) {
- /* must rescale image to get "top" mipmap texture image */
- image = malloc((w + 4) * h * bpp);
- if (!image) {
- return GLU_OUT_OF_MEMORY;
- }
- error = gluScaleImage(format, width, height, type, data,
- w, h, type, image);
- if (error) {
- retval = error;
- done = GL_TRUE;
- }
- }
- else {
- image = (void *) data;
- }
-
- level = 0;
- while (!done) {
- if (image != data) {
- /* set pixel unpacking */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- }
-
- glTexImage2D(target, level, components, w, h, 0, format, type, image);
-
- if (w == 1 && h == 1)
- break;
-
- neww = (w < 2) ? 1 : w / 2;
- newh = (h < 2) ? 1 : h / 2;
- newimage = malloc((neww + 4) * newh * bpp);
- if (!newimage) {
- return GLU_OUT_OF_MEMORY;
- }
-
- error = gluScaleImage(format, w, h, type, image,
- neww, newh, type, newimage);
- if (error) {
- retval = error;
- done = GL_TRUE;
- }
-
- if (image != data) {
- free(image);
- }
- image = newimage;
-
- w = neww;
- h = newh;
- level++;
- }
-
- if (image != data) {
- free(image);
- }
-
- /* Restore original glPixelStore state */
- glPixelStorei(GL_UNPACK_ROW_LENGTH, unpackrowlength);
- glPixelStorei(GL_UNPACK_ALIGNMENT, unpackalignment);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, unpackskiprows);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, unpackskippixels);
- glPixelStorei(GL_PACK_ROW_LENGTH, packrowlength);
- glPixelStorei(GL_PACK_ALIGNMENT, packalignment);
- glPixelStorei(GL_PACK_SKIP_ROWS, packskiprows);
- glPixelStorei(GL_PACK_SKIP_PIXELS, packskippixels);
-
- return retval;
-}
diff --git a/src/glu/mini/nurbs.c b/src/glu/mini/nurbs.c
deleted file mode 100644
index 0993ab0dd58..00000000000
--- a/src/glu/mini/nurbs.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $Id: nurbs.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "nurbs.h"
-#endif
-
-
-void
-call_user_error(GLUnurbsObj * nobj, GLenum error)
-{
- nobj->error = error;
- if (nobj->error_callback != NULL) {
- (*(nobj->error_callback)) (error);
- }
- else {
- printf("NURBS error %d %s\n", error, (char *) gluErrorString(error));
- }
-}
-
-
-
-GLUnurbsObj *GLAPIENTRY
-gluNewNurbsRenderer(void)
-{
- GLUnurbsObj *n;
- GLfloat tmp_viewport[4];
- GLint i, j;
-
- n = (GLUnurbsObj *) malloc(sizeof(GLUnurbsObj));
- return n;
-}
-
-
-
-void GLAPIENTRY
-gluDeleteNurbsRenderer(GLUnurbsObj * nobj)
-{
- if (nobj) {
- free(nobj);
- }
-}
-
-
-
-void GLAPIENTRY
-gluLoadSamplingMatrices(GLUnurbsObj * nobj,
- const GLfloat modelMatrix[16],
- const GLfloat projMatrix[16], const GLint viewport[4])
-{
-}
-
-
-void GLAPIENTRY
-gluNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat value)
-{
-}
-
-
-void GLAPIENTRY
-gluGetNurbsProperty(GLUnurbsObj * nobj, GLenum property, GLfloat * value)
-{
-}
-
-
-
-void GLAPIENTRY
-gluBeginCurve(GLUnurbsObj * nobj)
-{
-}
-
-
-void GLAPIENTRY
-gluEndCurve(GLUnurbsObj * nobj)
-{
-}
-
-
-void GLAPIENTRY
-gluNurbsCurve(GLUnurbsObj * nobj, GLint nknots, GLfloat * knot,
- GLint stride, GLfloat * ctlarray, GLint order, GLenum type)
-{
-}
-
-
-void GLAPIENTRY
-gluBeginSurface(GLUnurbsObj * nobj)
-{
-}
-
-
-void GLAPIENTRY
-gluEndSurface(GLUnurbsObj * nobj)
-{
-}
-
-
-void GLAPIENTRY
-gluNurbsSurface(GLUnurbsObj * nobj,
- GLint sknot_count, GLfloat * sknot,
- GLint tknot_count, GLfloat * tknot,
- GLint s_stride, GLint t_stride,
- GLfloat * ctrlarray, GLint sorder, GLint torder, GLenum type)
-{
-}
-
-
-void GLAPIENTRY
-gluNurbsCallback(GLUnurbsObj * nobj, GLenum which, void (GLCALLBACK * fn) ())
-{
-}
-
-void GLAPIENTRY
-gluBeginTrim(GLUnurbsObj * nobj)
-{
-}
-
-void GLAPIENTRY
-gluPwlCurve(GLUnurbsObj * nobj, GLint count, GLfloat * array, GLint stride,
- GLenum type)
-{
-}
-
-void GLAPIENTRY
-gluEndTrim(GLUnurbsObj * nobj)
-{
-}
diff --git a/src/glu/mini/nurbs.h b/src/glu/mini/nurbs.h
deleted file mode 100644
index 4a3434032dd..00000000000
--- a/src/glu/mini/nurbs.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/* $Id: nurbs.h,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifndef NURBS_H
-#define NURBS_H
-
-
-#define EPSILON 1e-06 /* epsilon for double precision compares */
-
-typedef enum
-{
- GLU_NURBS_CURVE, GLU_NURBS_SURFACE, GLU_NURBS_TRIM, GLU_NURBS_NO_TRIM,
- GLU_NURBS_TRIM_DONE, GLU_NURBS_NONE
-}
-GLU_nurbs_enum;
-
-typedef enum
-{
- GLU_TRIM_NURBS, GLU_TRIM_PWL
-}
-GLU_trim_enum;
-
-typedef struct
-{
- GLint sknot_count;
- GLfloat *sknot;
- GLint tknot_count;
- GLfloat *tknot;
- GLint s_stride;
- GLint t_stride;
- GLfloat *ctrlarray;
- GLint sorder;
- GLint torder;
- GLint dim;
- GLenum type;
-}
-surface_attribs;
-
-typedef struct
-{
- surface_attribs geom;
- surface_attribs color;
- surface_attribs texture;
- surface_attribs normal;
-}
-nurbs_surface;
-
-typedef struct
-{
- GLint knot_count;
- GLfloat *knot;
- GLint stride;
- GLfloat *ctrlarray;
- GLint order;
- GLint dim;
- GLenum type;
-}
-curve_attribs;
-
-typedef struct
-{
- GLint pt_count;
- GLfloat *ctrlarray;
- GLint stride;
- GLint dim;
- GLenum type;
-}
-pwl_curve_attribs;
-
-typedef struct
-{
- curve_attribs geom;
- curve_attribs color;
- curve_attribs texture;
- curve_attribs normal;
-}
-nurbs_curve;
-
-typedef struct trim_list_str
-{
- GLU_trim_enum trim_type;
- union
- {
- pwl_curve_attribs pwl_curve;
- curve_attribs nurbs_curve;
- }
- curve;
- struct trim_list_str *next;
-}
-trim_list;
-
-typedef struct seg_trim_str
-{
- GLfloat *points;
- GLint pt_cnt, seg_array_len;
- struct seg_trim_str *next;
-}
-trim_segments;
-
-typedef struct nurbs_trim_str
-{
- trim_list *trim_loop;
- trim_segments *segments;
- struct nurbs_trim_str *next;
-}
-nurbs_trim;
-
-typedef struct
-{
- GLfloat model[16], proj[16], viewport[4];
-}
-culling_and_sampling_str;
-
-struct GLUnurbs
-{
- GLboolean culling;
- GLenum error;
- void (GLCALLBACK * error_callback) (GLenum err);
- GLenum display_mode;
- GLU_nurbs_enum nurbs_type;
- GLboolean auto_load_matrix;
- culling_and_sampling_str sampling_matrices;
- GLenum sampling_method;
- GLfloat sampling_tolerance;
- GLfloat parametric_tolerance;
- GLint u_step, v_step;
- nurbs_surface surface;
- nurbs_curve curve;
- nurbs_trim *trim;
-};
-
-typedef struct
-{
- GLfloat *knot;
- GLint nknots;
- GLfloat *unified_knot;
- GLint unified_nknots;
- GLint order;
- GLint t_min, t_max;
- GLint delta_nknots;
- GLboolean open_at_begin, open_at_end;
- GLfloat *new_knot;
- GLfloat *alpha;
-}
-knot_str_type;
-
-typedef struct
-{
- GLfloat *geom_ctrl;
- GLint geom_s_stride, geom_t_stride;
- GLfloat **geom_offsets;
- GLint geom_s_pt_cnt, geom_t_pt_cnt;
- GLfloat *color_ctrl;
- GLint color_s_stride, color_t_stride;
- GLfloat **color_offsets;
- GLint color_s_pt_cnt, color_t_pt_cnt;
- GLfloat *normal_ctrl;
- GLint normal_s_stride, normal_t_stride;
- GLfloat **normal_offsets;
- GLint normal_s_pt_cnt, normal_t_pt_cnt;
- GLfloat *texture_ctrl;
- GLint texture_s_stride, texture_t_stride;
- GLfloat **texture_offsets;
- GLint texture_s_pt_cnt, texture_t_pt_cnt;
- GLint s_bezier_cnt, t_bezier_cnt;
-}
-new_ctrl_type;
-
-extern void call_user_error(GLUnurbsObj * nobj, GLenum error);
-
-extern GLenum test_knot(GLint nknots, GLfloat * knot, GLint order);
-
-extern GLenum explode_knot(knot_str_type * the_knot);
-
-extern GLenum calc_alphas(knot_str_type * the_knot);
-
-extern GLenum calc_new_ctrl_pts(GLfloat * ctrl, GLint stride,
- knot_str_type * the_knot, GLint dim,
- GLfloat ** new_ctrl, GLint * ncontrol);
-
-extern GLenum glu_do_sampling_crv(GLUnurbsObj * nobj, GLfloat * new_ctrl,
- GLint n_ctrl, GLint order, GLint dim,
- GLint ** factors);
-
-extern GLenum glu_do_sampling_3D(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- int **sfactors, GLint ** tfactors);
-
-extern GLenum glu_do_sampling_uv(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- int **sfactors, GLint ** tfactors);
-
-extern GLenum glu_do_sampling_param_3D(GLUnurbsObj * nobj,
- new_ctrl_type * new_ctrl,
- int **sfactors, GLint ** tfactors);
-
-extern GLboolean fine_culling_test_2D(GLUnurbsObj * nobj, GLfloat * ctrl,
- GLint n_ctrl, GLint stride, GLint dim);
-
-extern GLboolean fine_culling_test_3D(GLUnurbsObj * nobj, GLfloat * ctrl,
- GLint s_n_ctrl, GLint t_n_ctrl,
- GLint s_stride, GLint t_stride,
- GLint dim);
-
-extern void do_nurbs_curve(GLUnurbsObj * nobj);
-
-extern void do_nurbs_surface(GLUnurbsObj * nobj);
-
-extern GLenum patch_trimming(GLUnurbsObj * nobj, new_ctrl_type * new_ctrl,
- GLint * sfactors, GLint * tfactors);
-
-extern void collect_unified_knot(knot_str_type * dest, knot_str_type * src,
- GLfloat maximal_min_knot,
- GLfloat minimal_max_knot);
-
-extern GLenum select_knot_working_range(GLUnurbsObj * nobj,
- knot_str_type * geom_knot,
- knot_str_type * color_knot,
- knot_str_type * normal_knot,
- knot_str_type * texture_knot);
-
-extern void free_unified_knots(knot_str_type * geom_knot,
- knot_str_type * color_knot,
- knot_str_type * normal_knot,
- knot_str_type * texture_knot);
-
-
-
-#endif
diff --git a/src/glu/mini/nurbscrv.c b/src/glu/mini/nurbscrv.c
deleted file mode 100644
index 4e2dd8e38fe..00000000000
--- a/src/glu/mini/nurbscrv.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id: nurbscrv.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * NURBS implementation written by Bogdan Sikorski (bogdan@cira.it)
- * See README2 for more info.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "nurbs.h"
-#endif
-
-
-
-/* main NURBS curve procedure */
-void
-do_nurbs_curve(GLUnurbsObj * nobj)
-{
- GLint geom_order, color_order = 0, normal_order = 0, texture_order = 0;
- GLenum geom_type;
- GLint n_ctrl;
- GLfloat *new_geom_ctrl, *new_color_ctrl, *new_normal_ctrl,
- *new_texture_ctrl;
- GLfloat *geom_ctrl = 0, *color_ctrl = 0, *normal_ctrl = 0, *texture_ctrl = 0;
- GLint *factors;
- GLint i, j;
- GLint geom_dim, color_dim = 0, normal_dim = 0, texture_dim = 0;
-
- /* test the user supplied data */
- if (test_nurbs_curves(nobj) != GLU_NO_ERROR)
- return;
-
- if (convert_curves(nobj, &new_geom_ctrl, &n_ctrl, &new_color_ctrl,
- &new_normal_ctrl, &new_texture_ctrl) != GLU_NO_ERROR)
- return;
-
- geom_order = nobj->curve.geom.order;
- geom_type = nobj->curve.geom.type;
- geom_dim = nobj->curve.geom.dim;
-
- if (glu_do_sampling_crv(nobj, new_geom_ctrl, n_ctrl, geom_order, geom_dim,
- &factors) != GLU_NO_ERROR) {
- free(new_geom_ctrl);
- if (new_color_ctrl)
- free(new_color_ctrl);
- if (new_normal_ctrl)
- free(new_normal_ctrl);
- if (new_texture_ctrl)
- free(new_texture_ctrl);
- return;
- }
- glEnable(geom_type);
- if (new_color_ctrl) {
- glEnable(nobj->curve.color.type);
- color_dim = nobj->curve.color.dim;
- color_ctrl = new_color_ctrl;
- color_order = nobj->curve.color.order;
- }
- if (new_normal_ctrl) {
- glEnable(nobj->curve.normal.type);
- normal_dim = nobj->curve.normal.dim;
- normal_ctrl = new_normal_ctrl;
- normal_order = nobj->curve.normal.order;
- }
- if (new_texture_ctrl) {
- glEnable(nobj->curve.texture.type);
- texture_dim = nobj->curve.texture.dim;
- texture_ctrl = new_texture_ctrl;
- texture_order = nobj->curve.texture.order;
- }
- for (i = 0, j = 0, geom_ctrl = new_geom_ctrl;
- i < n_ctrl; i += geom_order, j++, geom_ctrl += geom_order * geom_dim) {
- if (fine_culling_test_2D
- (nobj, geom_ctrl, geom_order, geom_dim, geom_dim)) {
- color_ctrl += color_order * color_dim;
- normal_ctrl += normal_order * normal_dim;
- texture_ctrl += texture_order * texture_dim;
- continue;
- }
- glMap1f(geom_type, 0.0, 1.0, geom_dim, geom_order, geom_ctrl);
- if (new_color_ctrl) {
- glMap1f(nobj->curve.color.type, 0.0, 1.0, color_dim,
- color_order, color_ctrl);
- color_ctrl += color_order * color_dim;
- }
- if (new_normal_ctrl) {
- glMap1f(nobj->curve.normal.type, 0.0, 1.0, normal_dim,
- normal_order, normal_ctrl);
- normal_ctrl += normal_order * normal_dim;
- }
- if (new_texture_ctrl) {
- glMap1f(nobj->curve.texture.type, 0.0, 1.0, texture_dim,
- texture_order, texture_ctrl);
- texture_ctrl += texture_order * texture_dim;
- }
- glMapGrid1f(factors[j], 0.0, 1.0);
- glEvalMesh1(GL_LINE, 0, factors[j]);
- }
- free(new_geom_ctrl);
- free(factors);
- if (new_color_ctrl)
- free(new_color_ctrl);
- if (new_normal_ctrl)
- free(new_normal_ctrl);
- if (new_texture_ctrl)
- free(new_texture_ctrl);
-}
diff --git a/src/glu/mini/polytest.c b/src/glu/mini/polytest.c
deleted file mode 100644
index 272f9848a86..00000000000
--- a/src/glu/mini/polytest.c
+++ /dev/null
@@ -1,938 +0,0 @@
-/* $Id: polytest.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "gluP.h"
-#include "tess.h"
-#endif
-
-
-
-static GLenum store_polygon_as_contour(GLUtriangulatorObj *);
-static void free_current_polygon(tess_polygon *);
-static void prepare_projection_info(GLUtriangulatorObj *);
-static GLdouble twice_the_polygon_area(tess_vertex *, tess_vertex *);
-static GLenum verify_edge_vertex_intersections(GLUtriangulatorObj *);
-void tess_find_contour_hierarchies(GLUtriangulatorObj *);
-static GLenum test_for_overlapping_contours(GLUtriangulatorObj *);
-static GLenum contours_overlap(tess_contour *, tess_polygon *);
-static GLenum is_contour_contained_in(tess_contour *, tess_contour *);
-static void add_new_exterior(GLUtriangulatorObj *, tess_contour *);
-static void add_new_interior(GLUtriangulatorObj *, tess_contour *,
- tess_contour *);
-static void add_interior_with_hierarchy_check(GLUtriangulatorObj *,
- tess_contour *, tess_contour *);
-static void reverse_hierarchy_and_add_exterior(GLUtriangulatorObj *,
- tess_contour *,
- tess_contour *);
-static GLboolean point_in_polygon(tess_contour *, GLdouble, GLdouble);
-static void shift_interior_to_exterior(GLUtriangulatorObj *, tess_contour *);
-static void add_exterior_with_check(GLUtriangulatorObj *, tess_contour *,
- tess_contour *);
-static GLenum cut_out_hole(GLUtriangulatorObj *, tess_contour *,
- tess_contour *);
-static GLenum merge_hole_with_contour(GLUtriangulatorObj *,
- tess_contour *, tess_contour *,
- tess_vertex *, tess_vertex *);
-
-static GLenum
-find_normal(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *va, *vb, *vc;
- GLdouble A, B, C;
- GLdouble A0, A1, A2, B0, B1, B2;
-
- va = polygon->vertices;
- vb = va->next;
- A0 = vb->location[0] - va->location[0];
- A1 = vb->location[1] - va->location[1];
- A2 = vb->location[2] - va->location[2];
- for (vc = vb->next; vc != va; vc = vc->next) {
- B0 = vc->location[0] - va->location[0];
- B1 = vc->location[1] - va->location[1];
- B2 = vc->location[2] - va->location[2];
- A = A1 * B2 - A2 * B1;
- B = A2 * B0 - A0 * B2;
- C = A0 * B1 - A1 * B0;
- if (fabs(A) > EPSILON || fabs(B) > EPSILON || fabs(C) > EPSILON) {
- polygon->A = A;
- polygon->B = B;
- polygon->C = C;
- polygon->D =
- -A * va->location[0] - B * va->location[1] - C * va->location[2];
- return GLU_NO_ERROR;
- }
- }
- tess_call_user_error(tobj, GLU_TESS_ERROR7);
- return GLU_ERROR;
-}
-
-void
-tess_test_polygon(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
-
- /* any vertices defined? */
- if (polygon->vertex_cnt < 3) {
- free_current_polygon(polygon);
- return;
- }
- /* wrap pointers */
- polygon->last_vertex->next = polygon->vertices;
- polygon->vertices->previous = polygon->last_vertex;
- /* determine the normal */
- if (find_normal(tobj) == GLU_ERROR)
- return;
- /* compare the normals of previously defined contours and this one */
- /* first contour define ? */
- if (tobj->contours == NULL) {
- tobj->A = polygon->A;
- tobj->B = polygon->B;
- tobj->C = polygon->C;
- tobj->D = polygon->D;
- /* determine the best projection to use */
- if (fabs(polygon->A) > fabs(polygon->B))
- if (fabs(polygon->A) > fabs(polygon->C))
- tobj->projection = OYZ;
- else
- tobj->projection = OXY;
- else if (fabs(polygon->B) > fabs(polygon->C))
- tobj->projection = OXZ;
- else
- tobj->projection = OXY;
- }
- else {
- GLdouble a[3], b[3];
- tess_vertex *vertex = polygon->vertices;
-
- a[0] = tobj->A;
- a[1] = tobj->B;
- a[2] = tobj->C;
- b[0] = polygon->A;
- b[1] = polygon->B;
- b[2] = polygon->C;
-
- /* compare the normals */
- if (fabs(a[1] * b[2] - a[2] * b[1]) > EPSILON ||
- fabs(a[2] * b[0] - a[0] * b[2]) > EPSILON ||
- fabs(a[0] * b[1] - a[1] * b[0]) > EPSILON) {
- /* not coplanar */
- tess_call_user_error(tobj, GLU_TESS_ERROR9);
- return;
- }
- /* the normals are parallel - test for plane equation */
- if (fabs(a[0] * vertex->location[0] + a[1] * vertex->location[1] +
- a[2] * vertex->location[2] + tobj->D) > EPSILON) {
- /* not the same plane */
- tess_call_user_error(tobj, GLU_TESS_ERROR9);
- return;
- }
- }
- prepare_projection_info(tobj);
- if (verify_edge_vertex_intersections(tobj) == GLU_ERROR)
- return;
- if (test_for_overlapping_contours(tobj) == GLU_ERROR)
- return;
- if (store_polygon_as_contour(tobj) == GLU_ERROR)
- return;
-}
-
-static GLenum
-test_for_overlapping_contours(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour;
- tess_polygon *polygon;
-
- polygon = tobj->current_polygon;
- for (contour = tobj->contours; contour != NULL; contour = contour->next)
- if (contours_overlap(contour, polygon) != GLU_NO_ERROR) {
- tess_call_user_error(tobj, GLU_TESS_ERROR5);
- return GLU_ERROR;
- }
- return GLU_NO_ERROR;
-}
-
-static GLenum
-store_polygon_as_contour(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_contour *contour = tobj->contours;
-
- /* the first contour defined */
- if (contour == NULL) {
- if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- free_current_polygon(polygon);
- return GLU_ERROR;
- }
- tobj->contours = tobj->last_contour = contour;
- contour->next = contour->previous = NULL;
- }
- else {
- if ((contour = (tess_contour *) malloc(sizeof(tess_contour))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- free_current_polygon(polygon);
- return GLU_ERROR;
- }
- contour->previous = tobj->last_contour;
- tobj->last_contour->next = contour;
- tobj->last_contour = contour;
- contour->next = NULL;
- }
- /* mark all vertices in new contour as not special */
- /* and all are boundary edges */
- {
- tess_vertex *vertex;
- GLuint vertex_cnt, i;
-
- for (vertex = polygon->vertices, i = 0, vertex_cnt =
- polygon->vertex_cnt; i < vertex_cnt; vertex = vertex->next, i++) {
- vertex->shadow_vertex = NULL;
- vertex->edge_flag = GL_TRUE;
- }
- }
- contour->vertex_cnt = polygon->vertex_cnt;
- contour->area = polygon->area;
- contour->orientation = polygon->orientation;
- contour->type = GLU_UNKNOWN;
- contour->vertices = polygon->vertices;
- contour->last_vertex = polygon->last_vertex;
- polygon->vertices = polygon->last_vertex = NULL;
- polygon->vertex_cnt = 0;
- ++(tobj->contour_cnt);
- return GLU_NO_ERROR;
-}
-
-static void
-free_current_polygon(tess_polygon * polygon)
-{
- tess_vertex *vertex, *vertex_tmp;
- GLuint i;
-
- /* free current_polygon structures */
- for (vertex = polygon->vertices, i = 0; i < polygon->vertex_cnt; i++) {
- vertex_tmp = vertex->next;
- free(vertex);
- vertex = vertex_tmp;
- }
- polygon->vertices = polygon->last_vertex = NULL;
- polygon->vertex_cnt = 0;
-}
-
-static void
-prepare_projection_info(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *vertex, *last_vertex_ptr;
- GLdouble area;
-
- last_vertex_ptr = polygon->last_vertex;
- switch (tobj->projection) {
- case OXY:
- for (vertex = polygon->vertices; vertex != last_vertex_ptr;
- vertex = vertex->next) {
- vertex->x = vertex->location[0];
- vertex->y = vertex->location[1];
- }
- last_vertex_ptr->x = last_vertex_ptr->location[0];
- last_vertex_ptr->y = last_vertex_ptr->location[1];
- break;
- case OXZ:
- for (vertex = polygon->vertices; vertex != last_vertex_ptr;
- vertex = vertex->next) {
- vertex->x = vertex->location[0];
- vertex->y = vertex->location[2];
- }
- last_vertex_ptr->x = last_vertex_ptr->location[0];
- last_vertex_ptr->y = last_vertex_ptr->location[2];
- break;
- case OYZ:
- for (vertex = polygon->vertices; vertex != last_vertex_ptr;
- vertex = vertex->next) {
- vertex->x = vertex->location[1];
- vertex->y = vertex->location[2];
- }
- last_vertex_ptr->x = last_vertex_ptr->location[1];
- last_vertex_ptr->y = last_vertex_ptr->location[2];
- break;
- }
- area = twice_the_polygon_area(polygon->vertices, polygon->last_vertex);
- if (area >= 0.0) {
- polygon->orientation = GLU_CCW;
- polygon->area = area;
- }
- else {
- polygon->orientation = GLU_CW;
- polygon->area = -area;
- }
-}
-
-static GLdouble
-twice_the_polygon_area(tess_vertex * vertex, tess_vertex * last_vertex)
-{
- tess_vertex *next;
- GLdouble area, x, y;
-
- area = 0.0;
- x = vertex->x;
- y = vertex->y;
- vertex = vertex->next;
- for (; vertex != last_vertex; vertex = vertex->next) {
- next = vertex->next;
- area +=
- (vertex->x - x) * (next->y - y) - (vertex->y - y) * (next->x - x);
- }
- return area;
-}
-
-/* test if edges ab and cd intersect */
-/* if not return GLU_NO_ERROR, else if cross return GLU_TESS_ERROR8, */
-/* else if adjacent return GLU_TESS_ERROR4 */
-static GLenum
-edge_edge_intersect(tess_vertex * a,
- tess_vertex * b, tess_vertex * c, tess_vertex * d)
-{
- GLdouble denom, r, s;
- GLdouble xba, ydc, yba, xdc, yac, xac;
-
- xba = b->x - a->x;
- yba = b->y - a->y;
- xdc = d->x - c->x;
- ydc = d->y - c->y;
- xac = a->x - c->x;
- yac = a->y - c->y;
- denom = xba * ydc - yba * xdc;
- r = yac * xdc - xac * ydc;
- /* parallel? */
- if (fabs(denom) < EPSILON) {
- if (fabs(r) < EPSILON) {
- /* colinear */
- if (fabs(xba) < EPSILON) {
- /* compare the Y coordinate */
- if (yba > 0.0) {
- if (
- (fabs(a->y - c->y) < EPSILON
- && fabs(c->y - b->y) < EPSILON)
- || (fabs(a->y - d->y) < EPSILON
- && fabs(d->y - b->y) <
- EPSILON)) return GLU_TESS_ERROR4;
-
- }
- else {
- if (
- (fabs(b->y - c->y) < EPSILON
- && fabs(c->y - a->y) < EPSILON)
- || (fabs(b->y - d->y) < EPSILON
- && fabs(d->y - a->y) <
- EPSILON)) return GLU_TESS_ERROR4;
- }
- }
- else {
- /* compare the X coordinate */
- if (xba > 0.0) {
- if (
- (fabs(a->x - c->x) < EPSILON
- && fabs(c->x - b->x) < EPSILON)
- || (fabs(a->x - d->x) < EPSILON
- && fabs(d->x - b->x) <
- EPSILON)) return GLU_TESS_ERROR4;
- }
- else {
- if (
- (fabs(b->x - c->x) < EPSILON
- && fabs(c->x - a->x) < EPSILON)
- || (fabs(b->x - d->x) < EPSILON
- && fabs(d->x - a->x) <
- EPSILON)) return GLU_TESS_ERROR4;
- }
- }
- }
- return GLU_NO_ERROR;
- }
- r /= denom;
- s = (yac * xba - xac * yba) / denom;
- /* test if one vertex lies on other edge */
- if (((fabs(r) < EPSILON || (r < 1.0 + EPSILON && r > 1.0 - EPSILON)) &&
- s > -EPSILON && s < 1.0 + EPSILON) ||
- ((fabs(s) < EPSILON || (s < 1.0 + EPSILON && s > 1.0 - EPSILON)) &&
- r > -EPSILON && r < 1.0 + EPSILON)) {
- return GLU_TESS_ERROR4;
- }
- /* test for crossing */
- if (r > -EPSILON && r < 1.0 + EPSILON && s > -EPSILON && s < 1.0 + EPSILON) {
- return GLU_TESS_ERROR8;
- }
- return GLU_NO_ERROR;
-}
-
-static GLenum
-verify_edge_vertex_intersections(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *vertex1, *last_vertex, *vertex2;
- GLenum test;
-
- last_vertex = polygon->last_vertex;
- vertex1 = last_vertex;
- for (vertex2 = vertex1->next->next;
- vertex2->next != last_vertex; vertex2 = vertex2->next) {
- test = edge_edge_intersect(vertex1, vertex1->next, vertex2,
- vertex2->next);
- if (test != GLU_NO_ERROR) {
- tess_call_user_error(tobj, test);
- return GLU_ERROR;
- }
- }
- for (vertex1 = polygon->vertices;
- vertex1->next->next != last_vertex; vertex1 = vertex1->next) {
- for (vertex2 = vertex1->next->next;
- vertex2 != last_vertex; vertex2 = vertex2->next) {
- test = edge_edge_intersect(vertex1, vertex1->next, vertex2,
- vertex2->next);
- if (test != GLU_NO_ERROR) {
- tess_call_user_error(tobj, test);
- return GLU_ERROR;
- }
- }
- }
- return GLU_NO_ERROR;
-}
-
-static int
-#ifdef WIN32
- __cdecl
-#endif
-area_compare(const void *a, const void *b)
-{
- GLdouble area1, area2;
-
- area1 = (*((tess_contour **) a))->area;
- area2 = (*((tess_contour **) b))->area;
- if (area1 < area2)
- return 1;
- if (area1 > area2)
- return -1;
- return 0;
-}
-
-void
-tess_find_contour_hierarchies(GLUtriangulatorObj * tobj)
-{
- tess_contour **contours; /* dinamic array of pointers */
- tess_contour *tmp_contour_ptr = tobj->contours;
- GLuint cnt, i;
- GLenum result;
- GLboolean hierarchy_changed;
-
- /* any contours? */
- if (tobj->contour_cnt < 2) {
- tobj->contours->type = GLU_EXTERIOR;
- return;
- }
- if ((contours = (tess_contour **)
- malloc(sizeof(tess_contour *) * (tobj->contour_cnt))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- for (tmp_contour_ptr = tobj->contours, cnt = 0;
- tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next)
- contours[cnt++] = tmp_contour_ptr;
- /* now sort the contours in decreasing area size order */
- qsort((void *) contours, (size_t) cnt, (size_t) sizeof(tess_contour *),
- area_compare);
- /* we leave just the first contour - remove others from list */
- tobj->contours = contours[0];
- tobj->contours->next = tobj->contours->previous = NULL;
- tobj->last_contour = tobj->contours;
- tobj->contour_cnt = 1;
- /* first contour is the one with greatest area */
- /* must be EXTERIOR */
- tobj->contours->type = GLU_EXTERIOR;
- tmp_contour_ptr = tobj->contours;
- /* now we play! */
- for (i = 1; i < cnt; i++) {
- hierarchy_changed = GL_FALSE;
- for (tmp_contour_ptr = tobj->contours;
- tmp_contour_ptr != NULL; tmp_contour_ptr = tmp_contour_ptr->next) {
- if (tmp_contour_ptr->type == GLU_EXTERIOR) {
- /* check if contour completely contained in EXTERIOR */
- result = is_contour_contained_in(tmp_contour_ptr, contours[i]);
- switch (result) {
- case GLU_INTERIOR:
- /* now we have to check if contour is inside interiors */
- /* or not */
- /* any interiors? */
- if (tmp_contour_ptr->next != NULL &&
- tmp_contour_ptr->next->type == GLU_INTERIOR) {
- /* for all interior, check if inside any of them */
- /* if not inside any of interiors, its another */
- /* interior */
- /* or it may contain some interiors, then change */
- /* the contained interiors to exterior ones */
- add_interior_with_hierarchy_check(tobj,
- tmp_contour_ptr,
- contours[i]);
- }
- else {
- /* not in interior, add as new interior contour */
- add_new_interior(tobj, tmp_contour_ptr, contours[i]);
- }
- hierarchy_changed = GL_TRUE;
- break;
- case GLU_EXTERIOR:
- /* ooops, the marked as EXTERIOR (contours[i]) is */
- /* actually an interior of tmp_contour_ptr */
- /* reverse the local hierarchy */
- reverse_hierarchy_and_add_exterior(tobj, tmp_contour_ptr,
- contours[i]);
- hierarchy_changed = GL_TRUE;
- break;
- case GLU_NO_ERROR:
- break;
- default:
- abort();
- }
- }
- if (hierarchy_changed)
- break; /* break from for loop */
- }
- if (hierarchy_changed == GL_FALSE) {
- /* disjoint with all contours, add to contour list */
- add_new_exterior(tobj, contours[i]);
- }
- }
- free(contours);
-}
-
-/* returns GLU_INTERIOR if inner is completey enclosed within outer */
-/* returns GLU_EXTERIOR if outer is completely enclosed within inner */
-/* returns GLU_NO_ERROR if contours are disjoint */
-static GLenum
-is_contour_contained_in(tess_contour * outer, tess_contour * inner)
-{
- GLenum relation_flag;
-
- /* set relation_flag to relation of containment of first inner vertex */
- /* regarding outer contour */
- if (point_in_polygon(outer, inner->vertices->x, inner->vertices->y))
- relation_flag = GLU_INTERIOR;
- else
- relation_flag = GLU_EXTERIOR;
- if (relation_flag == GLU_INTERIOR)
- return GLU_INTERIOR;
- if (point_in_polygon(inner, outer->vertices->x, outer->vertices->y))
- return GLU_EXTERIOR;
- return GLU_NO_ERROR;
-}
-
-static GLboolean
-point_in_polygon(tess_contour * contour, GLdouble x, GLdouble y)
-{
- tess_vertex *v1, *v2;
- GLuint i, vertex_cnt;
- GLdouble xp1, yp1, xp2, yp2;
- GLboolean tst;
-
- tst = GL_FALSE;
- v1 = contour->vertices;
- v2 = contour->vertices->previous;
- for (i = 0, vertex_cnt = contour->vertex_cnt; i < vertex_cnt; i++) {
- xp1 = v1->x;
- yp1 = v1->y;
- xp2 = v2->x;
- yp2 = v2->y;
- if ((((yp1 <= y) && (y < yp2)) || ((yp2 <= y) && (y < yp1))) &&
- (x < (xp2 - xp1) * (y - yp1) / (yp2 - yp1) + xp1))
- tst = (tst == GL_FALSE ? GL_TRUE : GL_FALSE);
- v2 = v1;
- v1 = v1->next;
- }
- return tst;
-}
-
-static GLenum
-contours_overlap(tess_contour * contour, tess_polygon * polygon)
-{
- tess_vertex *vertex1, *vertex2;
- GLuint vertex1_cnt, vertex2_cnt, i, j;
- GLenum test;
-
- vertex1 = contour->vertices;
- vertex2 = polygon->vertices;
- vertex1_cnt = contour->vertex_cnt;
- vertex2_cnt = polygon->vertex_cnt;
- for (i = 0; i < vertex1_cnt; vertex1 = vertex1->next, i++) {
- for (j = 0; j < vertex2_cnt; vertex2 = vertex2->next, j++)
- if ((test = edge_edge_intersect(vertex1, vertex1->next, vertex2,
- vertex2->next)) != GLU_NO_ERROR)
- return test;
- }
- return GLU_NO_ERROR;
-}
-
-static void
-add_new_exterior(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- contour->type = GLU_EXTERIOR;
- contour->next = NULL;
- contour->previous = tobj->last_contour;
- tobj->last_contour->next = contour;
- tobj->last_contour = contour;
-}
-
-static void
-add_new_interior(GLUtriangulatorObj * tobj,
- tess_contour * outer, tess_contour * contour)
-{
- contour->type = GLU_INTERIOR;
- contour->next = outer->next;
- contour->previous = outer;
- if (outer->next != NULL)
- outer->next->previous = contour;
- outer->next = contour;
- if (tobj->last_contour == outer)
- tobj->last_contour = contour;
-}
-
-static void
-add_interior_with_hierarchy_check(GLUtriangulatorObj * tobj,
- tess_contour * outer,
- tess_contour * contour)
-{
- tess_contour *ptr;
-
- /* for all interiors of outer check if they are interior of contour */
- /* if so, change that interior to exterior and move it of of the */
- /* interior sequence */
- if (outer->next != NULL && outer->next->type == GLU_INTERIOR) {
- GLenum test;
-
- for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR;
- ptr = ptr->next) {
- test = is_contour_contained_in(ptr, contour);
- switch (test) {
- case GLU_INTERIOR:
- /* contour is contained in one of the interiors */
- /* check if possibly contained in other exteriors */
- /* move ptr to first EXTERIOR */
- for (; ptr != NULL && ptr->type == GLU_INTERIOR; ptr = ptr->next);
- if (ptr == NULL)
- /* another exterior */
- add_new_exterior(tobj, contour);
- else
- add_exterior_with_check(tobj, ptr, contour);
- return;
- case GLU_EXTERIOR:
- /* one of the interiors is contained in the contour */
- /* change it to EXTERIOR, and shift it away from the */
- /* interior sequence */
- shift_interior_to_exterior(tobj, ptr);
- break;
- case GLU_NO_ERROR:
- /* disjoint */
- break;
- default:
- abort();
- }
- }
- }
- /* add contour to the interior sequence */
- add_new_interior(tobj, outer, contour);
-}
-
-static void
-reverse_hierarchy_and_add_exterior(GLUtriangulatorObj * tobj,
- tess_contour * outer,
- tess_contour * contour)
-{
- tess_contour *ptr;
-
- /* reverse INTERIORS to EXTERIORS */
- /* any INTERIORS? */
- if (outer->next != NULL && outer->next->type == GLU_INTERIOR)
- for (ptr = outer->next; ptr != NULL && ptr->type == GLU_INTERIOR;
- ptr = ptr->next) ptr->type = GLU_EXTERIOR;
- /* the outer now becomes inner */
- outer->type = GLU_INTERIOR;
- /* contour is the EXTERIOR */
- contour->next = outer;
- if (tobj->contours == outer) {
- /* first contour beeing reversed */
- contour->previous = NULL;
- tobj->contours = contour;
- }
- else {
- outer->previous->next = contour;
- contour->previous = outer->previous;
- }
- outer->previous = contour;
-}
-
-static void
-shift_interior_to_exterior(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- contour->previous->next = contour->next;
- if (contour->next != NULL)
- contour->next->previous = contour->previous;
- else
- tobj->last_contour = contour->previous;
-}
-
-static void
-add_exterior_with_check(GLUtriangulatorObj * tobj,
- tess_contour * outer, tess_contour * contour)
-{
- GLenum test;
-
- /* this contour might be interior to further exteriors - check */
- /* if not, just add as a new exterior */
- for (; outer != NULL && outer->type == GLU_EXTERIOR; outer = outer->next) {
- test = is_contour_contained_in(outer, contour);
- switch (test) {
- case GLU_INTERIOR:
- /* now we have to check if contour is inside interiors */
- /* or not */
- /* any interiors? */
- if (outer->next != NULL && outer->next->type == GLU_INTERIOR) {
- /* for all interior, check if inside any of them */
- /* if not inside any of interiors, its another */
- /* interior */
- /* or it may contain some interiors, then change */
- /* the contained interiors to exterior ones */
- add_interior_with_hierarchy_check(tobj, outer, contour);
- }
- else {
- /* not in interior, add as new interior contour */
- add_new_interior(tobj, outer, contour);
- }
- return;
- case GLU_NO_ERROR:
- /* disjoint */
- break;
- default:
- abort();
- }
- }
- /* add contour to the exterior sequence */
- add_new_exterior(tobj, contour);
-}
-
-void
-tess_handle_holes(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour, *hole;
- GLenum exterior_orientation;
-
- /* verify hole orientation */
- for (contour = tobj->contours; contour != NULL;) {
- exterior_orientation = contour->orientation;
- for (contour = contour->next;
- contour != NULL && contour->type == GLU_INTERIOR;
- contour = contour->next) {
- if (contour->orientation == exterior_orientation) {
- tess_call_user_error(tobj, GLU_TESS_ERROR5);
- return;
- }
- }
- }
- /* now cut-out holes */
- for (contour = tobj->contours; contour != NULL;) {
- hole = contour->next;
- while (hole != NULL && hole->type == GLU_INTERIOR) {
- if (cut_out_hole(tobj, contour, hole) == GLU_ERROR)
- return;
- hole = contour->next;
- }
- contour = contour->next;
- }
-}
-
-static GLenum
-cut_out_hole(GLUtriangulatorObj * tobj,
- tess_contour * contour, tess_contour * hole)
-{
- tess_contour *tmp_hole;
- tess_vertex *v1, *v2, *tmp_vertex;
- GLuint vertex1_cnt, vertex2_cnt, tmp_vertex_cnt;
- GLuint i, j, k;
- GLenum test = 0;
-
- /* find an edge connecting contour and hole not intersecting any other */
- /* edge belonging to either the contour or any of the other holes */
- for (v1 = contour->vertices, vertex1_cnt = contour->vertex_cnt, i = 0;
- i < vertex1_cnt; i++, v1 = v1->next) {
- for (v2 = hole->vertices, vertex2_cnt = hole->vertex_cnt, j = 0;
- j < vertex2_cnt; j++, v2 = v2->next) {
- /* does edge (v1,v2) intersect any edge of contour */
- for (tmp_vertex = contour->vertices, tmp_vertex_cnt =
- contour->vertex_cnt, k = 0; k < tmp_vertex_cnt;
- tmp_vertex = tmp_vertex->next, k++) {
- /* skip edge tests for edges directly connected */
- if (v1 == tmp_vertex || v1 == tmp_vertex->next)
- continue;
- test = edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next);
- if (test != GLU_NO_ERROR)
- break;
- }
- if (test == GLU_NO_ERROR) {
- /* does edge (v1,v2) intersect any edge of hole */
- for (tmp_vertex = hole->vertices,
- tmp_vertex_cnt = hole->vertex_cnt, k = 0;
- k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) {
- /* skip edge tests for edges directly connected */
- if (v2 == tmp_vertex || v2 == tmp_vertex->next)
- continue;
- test =
- edge_edge_intersect(v1, v2, tmp_vertex, tmp_vertex->next);
- if (test != GLU_NO_ERROR)
- break;
- }
- if (test == GLU_NO_ERROR) {
- /* does edge (v1,v2) intersect any other hole? */
- for (tmp_hole = hole->next;
- tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR;
- tmp_hole = tmp_hole->next) {
- /* does edge (v1,v2) intersect any edge of hole */
- for (tmp_vertex = tmp_hole->vertices,
- tmp_vertex_cnt = tmp_hole->vertex_cnt, k = 0;
- k < tmp_vertex_cnt; tmp_vertex = tmp_vertex->next, k++) {
- test = edge_edge_intersect(v1, v2, tmp_vertex,
- tmp_vertex->next);
- if (test != GLU_NO_ERROR)
- break;
- }
- if (test != GLU_NO_ERROR)
- break;
- }
- }
- }
- if (test == GLU_NO_ERROR) {
- /* edge (v1,v2) is good for eliminating the hole */
- if (merge_hole_with_contour(tobj, contour, hole, v1, v2)
- == GLU_NO_ERROR)
- return GLU_NO_ERROR;
- else
- return GLU_ERROR;
- }
- }
- }
- /* other holes are blocking all possible connections of hole */
- /* with contour, we shift this hole as the last hole and retry */
- for (tmp_hole = hole;
- tmp_hole != NULL && tmp_hole->type == GLU_INTERIOR;
- tmp_hole = tmp_hole->next);
- contour->next = hole->next;
- hole->next->previous = contour;
- if (tmp_hole == NULL) {
- /* last EXTERIOR contour, shift hole as last contour */
- hole->next = NULL;
- hole->previous = tobj->last_contour;
- tobj->last_contour->next = hole;
- tobj->last_contour = hole;
- }
- else {
- tmp_hole->previous->next = hole;
- hole->previous = tmp_hole->previous;
- tmp_hole->previous = hole;
- hole->next = tmp_hole;
- }
- hole = contour->next;
- /* try once again - recurse */
- return cut_out_hole(tobj, contour, hole);
-}
-
-static GLenum
-merge_hole_with_contour(GLUtriangulatorObj * tobj,
- tess_contour * contour,
- tess_contour * hole,
- tess_vertex * v1, tess_vertex * v2)
-{
- tess_vertex *v1_new, *v2_new;
-
- /* make copies of v1 and v2, place them respectively after their originals */
- if ((v1_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- if ((v2_new = (tess_vertex *) malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return GLU_ERROR;
- }
- v1_new->edge_flag = GL_TRUE;
- v1_new->data = v1->data;
- v1_new->location[0] = v1->location[0];
- v1_new->location[1] = v1->location[1];
- v1_new->location[2] = v1->location[2];
- v1_new->x = v1->x;
- v1_new->y = v1->y;
- v1_new->shadow_vertex = v1;
- v1->shadow_vertex = v1_new;
- v1_new->next = v1->next;
- v1_new->previous = v1;
- v1->next->previous = v1_new;
- v1->next = v1_new;
- v2_new->edge_flag = GL_TRUE;
- v2_new->data = v2->data;
- v2_new->location[0] = v2->location[0];
- v2_new->location[1] = v2->location[1];
- v2_new->location[2] = v2->location[2];
- v2_new->x = v2->x;
- v2_new->y = v2->y;
- v2_new->shadow_vertex = v2;
- v2->shadow_vertex = v2_new;
- v2_new->next = v2->next;
- v2_new->previous = v2;
- v2->next->previous = v2_new;
- v2->next = v2_new;
- /* link together the two lists */
- v1->next = v2_new;
- v2_new->previous = v1;
- v2->next = v1_new;
- v1_new->previous = v2;
- /* update the vertex count of the contour */
- contour->vertex_cnt += hole->vertex_cnt + 2;
- /* remove the INTERIOR contour */
- contour->next = hole->next;
- if (hole->next != NULL)
- hole->next->previous = contour;
- free(hole);
- /* update tobj structure */
- --(tobj->contour_cnt);
- if (contour->last_vertex == v1)
- contour->last_vertex = v1_new;
- /* mark two vertices with edge_flag */
- v2->edge_flag = GL_FALSE;
- v1->edge_flag = GL_FALSE;
- return GLU_NO_ERROR;
-}
diff --git a/src/glu/mini/project.c b/src/glu/mini/project.c
deleted file mode 100644
index 97cba892211..00000000000
--- a/src/glu/mini/project.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* $Id: project.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "gluP.h"
-#endif
-
-
-/*
- * This code was contributed by Marc Buffat (buffat@mecaflu.ec-lyon.fr).
- * Thanks Marc!!!
- */
-
-
-
-/* implementation de gluProject et gluUnproject */
-/* M. Buffat 17/2/95 */
-
-
-
-/*
- * Transform a point (column vector) by a 4x4 matrix. I.e. out = m * in
- * Input: m - the 4x4 matrix
- * in - the 4x1 vector
- * Output: out - the resulting 4x1 vector.
- */
-static void
-transform_point(GLdouble out[4], const GLdouble m[16], const GLdouble in[4])
-{
-#define M(row,col) m[col*4+row]
- out[0] =
- M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3];
- out[1] =
- M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3];
- out[2] =
- M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3];
- out[3] =
- M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3];
-#undef M
-}
-
-
-
-
-/*
- * Perform a 4x4 matrix multiplication (product = a x b).
- * Input: a, b - matrices to multiply
- * Output: product - product of a and b
- */
-static void
-matmul(GLdouble * product, const GLdouble * a, const GLdouble * b)
-{
- /* This matmul was contributed by Thomas Malik */
- GLdouble temp[16];
- GLint i;
-
-#define A(row,col) a[(col<<2)+row]
-#define B(row,col) b[(col<<2)+row]
-#define T(row,col) temp[(col<<2)+row]
-
- /* i-te Zeile */
- for (i = 0; i < 4; i++) {
- T(i, 0) =
- A(i, 0) * B(0, 0) + A(i, 1) * B(1, 0) + A(i, 2) * B(2, 0) + A(i,
- 3) *
- B(3, 0);
- T(i, 1) =
- A(i, 0) * B(0, 1) + A(i, 1) * B(1, 1) + A(i, 2) * B(2, 1) + A(i,
- 3) *
- B(3, 1);
- T(i, 2) =
- A(i, 0) * B(0, 2) + A(i, 1) * B(1, 2) + A(i, 2) * B(2, 2) + A(i,
- 3) *
- B(3, 2);
- T(i, 3) =
- A(i, 0) * B(0, 3) + A(i, 1) * B(1, 3) + A(i, 2) * B(2, 3) + A(i,
- 3) *
- B(3, 3);
- }
-
-#undef A
-#undef B
-#undef T
- MEMCPY(product, temp, 16 * sizeof(GLdouble));
-}
-
-
-
-/*
- * Compute inverse of 4x4 transformation matrix.
- * Code contributed by Jacques Leroy jle@star.be
- * Return GL_TRUE for success, GL_FALSE for failure (singular matrix)
- */
-static GLboolean
-invert_matrix(const GLdouble * m, GLdouble * out)
-{
-/* NB. OpenGL Matrices are COLUMN major. */
-#define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; }
-#define MAT(m,r,c) (m)[(c)*4+(r)]
-
- GLdouble wtmp[4][8];
- GLdouble m0, m1, m2, m3, s;
- GLdouble *r0, *r1, *r2, *r3;
-
- r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
-
- r0[0] = MAT(m, 0, 0), r0[1] = MAT(m, 0, 1),
- r0[2] = MAT(m, 0, 2), r0[3] = MAT(m, 0, 3),
- r0[4] = 1.0, r0[5] = r0[6] = r0[7] = 0.0,
- r1[0] = MAT(m, 1, 0), r1[1] = MAT(m, 1, 1),
- r1[2] = MAT(m, 1, 2), r1[3] = MAT(m, 1, 3),
- r1[5] = 1.0, r1[4] = r1[6] = r1[7] = 0.0,
- r2[0] = MAT(m, 2, 0), r2[1] = MAT(m, 2, 1),
- r2[2] = MAT(m, 2, 2), r2[3] = MAT(m, 2, 3),
- r2[6] = 1.0, r2[4] = r2[5] = r2[7] = 0.0,
- r3[0] = MAT(m, 3, 0), r3[1] = MAT(m, 3, 1),
- r3[2] = MAT(m, 3, 2), r3[3] = MAT(m, 3, 3),
- r3[7] = 1.0, r3[4] = r3[5] = r3[6] = 0.0;
-
- /* choose pivot - or die */
- if (fabs(r3[0]) > fabs(r2[0]))
- SWAP_ROWS(r3, r2);
- if (fabs(r2[0]) > fabs(r1[0]))
- SWAP_ROWS(r2, r1);
- if (fabs(r1[0]) > fabs(r0[0]))
- SWAP_ROWS(r1, r0);
- if (0.0 == r0[0])
- return GL_FALSE;
-
- /* eliminate first variable */
- m1 = r1[0] / r0[0];
- m2 = r2[0] / r0[0];
- m3 = r3[0] / r0[0];
- s = r0[1];
- r1[1] -= m1 * s;
- r2[1] -= m2 * s;
- r3[1] -= m3 * s;
- s = r0[2];
- r1[2] -= m1 * s;
- r2[2] -= m2 * s;
- r3[2] -= m3 * s;
- s = r0[3];
- r1[3] -= m1 * s;
- r2[3] -= m2 * s;
- r3[3] -= m3 * s;
- s = r0[4];
- if (s != 0.0) {
- r1[4] -= m1 * s;
- r2[4] -= m2 * s;
- r3[4] -= m3 * s;
- }
- s = r0[5];
- if (s != 0.0) {
- r1[5] -= m1 * s;
- r2[5] -= m2 * s;
- r3[5] -= m3 * s;
- }
- s = r0[6];
- if (s != 0.0) {
- r1[6] -= m1 * s;
- r2[6] -= m2 * s;
- r3[6] -= m3 * s;
- }
- s = r0[7];
- if (s != 0.0) {
- r1[7] -= m1 * s;
- r2[7] -= m2 * s;
- r3[7] -= m3 * s;
- }
-
- /* choose pivot - or die */
- if (fabs(r3[1]) > fabs(r2[1]))
- SWAP_ROWS(r3, r2);
- if (fabs(r2[1]) > fabs(r1[1]))
- SWAP_ROWS(r2, r1);
- if (0.0 == r1[1])
- return GL_FALSE;
-
- /* eliminate second variable */
- m2 = r2[1] / r1[1];
- m3 = r3[1] / r1[1];
- r2[2] -= m2 * r1[2];
- r3[2] -= m3 * r1[2];
- r2[3] -= m2 * r1[3];
- r3[3] -= m3 * r1[3];
- s = r1[4];
- if (0.0 != s) {
- r2[4] -= m2 * s;
- r3[4] -= m3 * s;
- }
- s = r1[5];
- if (0.0 != s) {
- r2[5] -= m2 * s;
- r3[5] -= m3 * s;
- }
- s = r1[6];
- if (0.0 != s) {
- r2[6] -= m2 * s;
- r3[6] -= m3 * s;
- }
- s = r1[7];
- if (0.0 != s) {
- r2[7] -= m2 * s;
- r3[7] -= m3 * s;
- }
-
- /* choose pivot - or die */
- if (fabs(r3[2]) > fabs(r2[2]))
- SWAP_ROWS(r3, r2);
- if (0.0 == r2[2])
- return GL_FALSE;
-
- /* eliminate third variable */
- m3 = r3[2] / r2[2];
- r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4],
- r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6], r3[7] -= m3 * r2[7];
-
- /* last check */
- if (0.0 == r3[3])
- return GL_FALSE;
-
- s = 1.0 / r3[3]; /* now back substitute row 3 */
- r3[4] *= s;
- r3[5] *= s;
- r3[6] *= s;
- r3[7] *= s;
-
- m2 = r2[3]; /* now back substitute row 2 */
- s = 1.0 / r2[2];
- r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
- r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
- m1 = r1[3];
- r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1,
- r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
- m0 = r0[3];
- r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0,
- r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
-
- m1 = r1[2]; /* now back substitute row 1 */
- s = 1.0 / r1[1];
- r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
- r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
- m0 = r0[2];
- r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0,
- r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
-
- m0 = r0[1]; /* now back substitute row 0 */
- s = 1.0 / r0[0];
- r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
- r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
-
- MAT(out, 0, 0) = r0[4];
- MAT(out, 0, 1) = r0[5], MAT(out, 0, 2) = r0[6];
- MAT(out, 0, 3) = r0[7], MAT(out, 1, 0) = r1[4];
- MAT(out, 1, 1) = r1[5], MAT(out, 1, 2) = r1[6];
- MAT(out, 1, 3) = r1[7], MAT(out, 2, 0) = r2[4];
- MAT(out, 2, 1) = r2[5], MAT(out, 2, 2) = r2[6];
- MAT(out, 2, 3) = r2[7], MAT(out, 3, 0) = r3[4];
- MAT(out, 3, 1) = r3[5], MAT(out, 3, 2) = r3[6];
- MAT(out, 3, 3) = r3[7];
-
- return GL_TRUE;
-
-#undef MAT
-#undef SWAP_ROWS
-}
-
-
-
-/* projection du point (objx,objy,obz) sur l'ecran (winx,winy,winz) */
-GLint GLAPIENTRY
-gluProject(GLdouble objx, GLdouble objy, GLdouble objz,
- const GLdouble model[16], const GLdouble proj[16],
- const GLint viewport[4],
- GLdouble * winx, GLdouble * winy, GLdouble * winz)
-{
- /* matrice de transformation */
- GLdouble in[4], out[4];
-
- /* initilise la matrice et le vecteur a transformer */
- in[0] = objx;
- in[1] = objy;
- in[2] = objz;
- in[3] = 1.0;
- transform_point(out, model, in);
- transform_point(in, proj, out);
-
- /* d'ou le resultat normalise entre -1 et 1 */
- if (in[3] == 0.0)
- return GL_FALSE;
-
- in[0] /= in[3];
- in[1] /= in[3];
- in[2] /= in[3];
-
- /* en coordonnees ecran */
- *winx = viewport[0] + (1 + in[0]) * viewport[2] / 2;
- *winy = viewport[1] + (1 + in[1]) * viewport[3] / 2;
- /* entre 0 et 1 suivant z */
- *winz = (1 + in[2]) / 2;
- return GL_TRUE;
-}
-
-
-
-/* transformation du point ecran (winx,winy,winz) en point objet */
-GLint GLAPIENTRY
-gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz,
- const GLdouble model[16], const GLdouble proj[16],
- const GLint viewport[4],
- GLdouble * objx, GLdouble * objy, GLdouble * objz)
-{
- /* matrice de transformation */
- GLdouble m[16], A[16];
- GLdouble in[4], out[4];
-
- /* transformation coordonnees normalisees entre -1 et 1 */
- in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0;
- in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0;
- in[2] = 2 * winz - 1.0;
- in[3] = 1.0;
-
- /* calcul transformation inverse */
- matmul(A, proj, model);
- invert_matrix(A, m);
-
- /* d'ou les coordonnees objets */
- transform_point(out, m, in);
- if (out[3] == 0.0)
- return GL_FALSE;
- *objx = out[0] / out[3];
- *objy = out[1] / out[3];
- *objz = out[2] / out[3];
- return GL_TRUE;
-}
-
-
-/*
- * New in GLU 1.3
- * This is like gluUnProject but also takes near and far DepthRange values.
- */
-#ifdef GLU_VERSION_1_3
-GLint GLAPIENTRY
-gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
- const GLdouble modelMatrix[16],
- const GLdouble projMatrix[16],
- const GLint viewport[4],
- GLclampd nearZ, GLclampd farZ,
- GLdouble * objx, GLdouble * objy, GLdouble * objz,
- GLdouble * objw)
-{
- /* matrice de transformation */
- GLdouble m[16], A[16];
- GLdouble in[4], out[4];
- GLdouble z = nearZ + winz * (farZ - nearZ);
-
- /* transformation coordonnees normalisees entre -1 et 1 */
- in[0] = (winx - viewport[0]) * 2 / viewport[2] - 1.0;
- in[1] = (winy - viewport[1]) * 2 / viewport[3] - 1.0;
- in[2] = 2.0 * z - 1.0;
- in[3] = clipw;
-
- /* calcul transformation inverse */
- matmul(A, projMatrix, modelMatrix);
- invert_matrix(A, m);
-
- /* d'ou les coordonnees objets */
- transform_point(out, m, in);
- if (out[3] == 0.0)
- return GL_FALSE;
- *objx = out[0] / out[3];
- *objy = out[1] / out[3];
- *objz = out[2] / out[3];
- *objw = out[3];
- return GL_TRUE;
-}
-#endif
diff --git a/src/glu/mini/quadric.c b/src/glu/mini/quadric.c
deleted file mode 100644
index 8a40ed7d750..00000000000
--- a/src/glu/mini/quadric.c
+++ /dev/null
@@ -1,774 +0,0 @@
-/* $Id: quadric.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1999-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/* TODO:
- * texture coordinate support
- * flip normals according to orientation
- * there's still some inside/outside orientation bugs in possibly all
- * but the sphere function
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gluP.h"
-#endif
-
-
-
-#ifndef M_PI
-# define M_PI (3.1415926)
-#endif
-
-
-/*
- * Convert degrees to radians:
- */
-#define DEG_TO_RAD(A) ((A)*(M_PI/180.0))
-
-
-/*
- * Sin and Cos for degree angles:
- */
-#define SIND( A ) sin( (A)*(M_PI/180.0) )
-#define COSD( A) cos( (A)*(M_PI/180.0) )
-
-
-/*
- * Texture coordinates if texture flag is set
- */
-#define TXTR_COORD(x,y) if (qobj->TextureFlag) glTexCoord2f(x,y);
-
-
-
-struct GLUquadric
-{
- GLenum DrawStyle; /* GLU_FILL, LINE, SILHOUETTE, or POINT */
- GLenum Orientation; /* GLU_INSIDE or GLU_OUTSIDE */
- GLboolean TextureFlag; /* Generate texture coords? */
- GLenum Normals; /* GLU_NONE, GLU_FLAT, or GLU_SMOOTH */
- void (GLCALLBACK * ErrorFunc) (GLenum err); /* Error handler callback function */
-};
-
-
-
-/*
- * Process a GLU error.
- */
-static void
-quadric_error(GLUquadricObj * qobj, GLenum error, const char *msg)
-{
- /* Call the error call back function if any */
- if (qobj->ErrorFunc) {
- (*qobj->ErrorFunc) (error);
- }
- /* Print a message to stdout if MESA_DEBUG variable is defined */
- if (getenv("MESA_DEBUG")) {
- fprintf(stderr, "GLUError: %s: %s\n", (char *) gluErrorString(error),
- msg);
- }
-}
-
-
-
-
-GLUquadricObj *GLAPIENTRY
-gluNewQuadric(void)
-{
- GLUquadricObj *q;
-
- q = (GLUquadricObj *) malloc(sizeof(struct GLUquadric));
- if (q) {
- q->DrawStyle = GLU_FILL;
- q->Orientation = GLU_OUTSIDE;
- q->TextureFlag = GL_FALSE;
- q->Normals = GLU_SMOOTH;
- q->ErrorFunc = NULL;
- }
- return q;
-}
-
-
-
-void GLAPIENTRY
-gluDeleteQuadric(GLUquadricObj * state)
-{
- if (state) {
- free((void *) state);
- }
-}
-
-
-
-/*
- * Set the drawing style to be GLU_FILL, GLU_LINE, GLU_SILHOUETTE,
- * or GLU_POINT.
- */
-void GLAPIENTRY
-gluQuadricDrawStyle(GLUquadricObj * quadObject, GLenum drawStyle)
-{
- if (quadObject && (drawStyle == GLU_FILL || drawStyle == GLU_LINE
- || drawStyle == GLU_SILHOUETTE
- || drawStyle == GLU_POINT)) {
- quadObject->DrawStyle = drawStyle;
- }
- else {
- quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricDrawStyle");
- }
-}
-
-
-
-/*
- * Set the orientation to GLU_INSIDE or GLU_OUTSIDE.
- */
-void GLAPIENTRY
-gluQuadricOrientation(GLUquadricObj * quadObject, GLenum orientation)
-{
- if (quadObject
- && (orientation == GLU_INSIDE || orientation == GLU_OUTSIDE)) {
- quadObject->Orientation = orientation;
- }
- else {
- quadric_error(quadObject, GLU_INVALID_ENUM, "qluQuadricOrientation");
- }
-}
-
-
-
-/*
- * Set the error handler callback function.
- */
-void GLAPIENTRY
-gluQuadricCallback(GLUquadricObj * qobj,
- GLenum which, void (GLCALLBACK * fn) ())
-{
- /*
- * UGH, this is a mess! I thought ANSI was a standard.
- */
- if (qobj && which == GLU_ERROR) {
-#ifdef __CYGWIN32__
- qobj->ErrorFunc = (void (GLCALLBACKPCAST) (GLenum)) fn;
-#elif defined(OPENSTEP)
- qobj->ErrorFunc = (void (*)(GLenum)) fn;
-#elif defined(_WIN32)
- qobj->ErrorFunc = (void (GLCALLBACK *) (int)) fn;
-#elif defined(__STORM__)
- qobj->ErrorFunc = (void (GLCALLBACK *) (GLenum)) fn;
-#elif defined(__BEOS__)
- qobj->ErrorFunc = (void (*)(GLenum)) fn;
-#else
- qobj->ErrorFunc = (void (GLCALLBACK *) ()) fn;
-#endif
- }
-}
-
-
-void GLAPIENTRY
-gluQuadricNormals(GLUquadricObj * quadObject, GLenum normals)
-{
- if (quadObject
- && (normals == GLU_NONE || normals == GLU_FLAT
- || normals == GLU_SMOOTH)) {
- quadObject->Normals = normals;
- }
-}
-
-
-void GLAPIENTRY
-gluQuadricTexture(GLUquadricObj * quadObject, GLboolean textureCoords)
-{
- if (quadObject) {
- quadObject->TextureFlag = textureCoords;
- }
-}
-
-
-
-
-/*
- * Call glNormal3f after scaling normal to unit length.
- */
-static void
-normal3f(GLfloat x, GLfloat y, GLfloat z)
-{
-}
-
-
-
-void GLAPIENTRY
-gluCylinder(GLUquadricObj * qobj,
- GLdouble baseRadius, GLdouble topRadius,
- GLdouble height, GLint slices, GLint stacks)
-{
- GLdouble da, r, dr, dz;
- GLfloat x, y, z, nz, nsign;
- GLint i, j;
-
- if (qobj->Orientation == GLU_INSIDE) {
- nsign = -1.0;
- }
- else {
- nsign = 1.0;
- }
-
- da = 2.0 * M_PI / slices;
- dr = (topRadius - baseRadius) / stacks;
- dz = height / stacks;
- nz = (baseRadius - topRadius) / height; /* Z component of normal vectors */
-
- if (qobj->DrawStyle == GLU_POINT) {
- glBegin(GL_POINTS);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
-
- z = 0.0;
- r = baseRadius;
- for (j = 0; j <= stacks; j++) {
- glVertex3f(x * r, y * r, z);
- z += dz;
- r += dr;
- }
- }
- glEnd();
- }
- else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) {
- /* Draw rings */
- if (qobj->DrawStyle == GLU_LINE) {
- z = 0.0;
- r = baseRadius;
- for (j = 0; j <= stacks; j++) {
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * r, y * r, z);
- }
- glEnd();
- z += dz;
- r += dr;
- }
- }
- else {
- /* draw one ring at each end */
- if (baseRadius != 0.0) {
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * baseRadius, y * baseRadius, 0.0);
- }
- glEnd();
- glBegin(GL_LINE_LOOP);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * topRadius, y * topRadius, height);
- }
- glEnd();
- }
- }
- /* draw length lines */
- glBegin(GL_LINES);
- for (i = 0; i < slices; i++) {
- x = cos(i * da);
- y = sin(i * da);
- normal3f(x * nsign, y * nsign, nz * nsign);
- glVertex3f(x * baseRadius, y * baseRadius, 0.0);
- glVertex3f(x * topRadius, y * topRadius, height);
- }
- glEnd();
- }
- else if (qobj->DrawStyle == GLU_FILL) {
- GLfloat ds = 1.0 / slices;
- GLfloat dt = 1.0 / stacks;
- GLfloat t = 0.0;
- z = 0.0;
- r = baseRadius;
- for (j = 0; j < stacks; j++) {
- GLfloat s = 0.0;
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= slices; i++) {
- GLfloat x, y;
- if (i == slices) {
- x = sin(0.0);
- y = cos(0.0);
- }
- else {
- x = sin(i * da);
- y = cos(i * da);
- }
- if (nsign == 1.0) {
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t);
- glVertex3f(x * r, y * r, z);
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t + dt);
- glVertex3f(x * (r + dr), y * (r + dr), z + dz);
- }
- else {
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t);
- glVertex3f(x * r, y * r, z);
- normal3f(x * nsign, y * nsign, nz * nsign);
- TXTR_COORD(s, t + dt);
- glVertex3f(x * (r + dr), y * (r + dr), z + dz);
- }
- s += ds;
- } /* for slices */
- glEnd();
- r += dr;
- t += dt;
- z += dz;
- } /* for stacks */
- }
-}
-
-
-
-
-
-void GLAPIENTRY
-gluSphere(GLUquadricObj * qobj, GLdouble radius, GLint slices, GLint stacks)
-{
- GLfloat rho, drho, theta, dtheta;
- GLfloat x, y, z;
- GLfloat s, t, ds, dt;
- GLint i, j, imin, imax;
- GLboolean normals;
- GLfloat nsign;
-
- if (qobj->Normals == GLU_NONE) {
- normals = GL_FALSE;
- }
- else {
- normals = GL_TRUE;
- }
- if (qobj->Orientation == GLU_INSIDE) {
- nsign = -1.0;
- }
- else {
- nsign = 1.0;
- }
-
- drho = M_PI / (GLfloat) stacks;
- dtheta = 2.0 * M_PI / (GLfloat) slices;
-
- /* texturing: s goes from 0.0/0.25/0.5/0.75/1.0 at +y/+x/-y/-x/+y axis */
- /* t goes from -1.0/+1.0 at z = -radius/+radius (linear along longitudes) */
- /* cannot use triangle fan on texturing (s coord. at top/bottom tip varies) */
-
- if (qobj->DrawStyle == GLU_FILL) {
- if (!qobj->TextureFlag) {
- /* draw +Z end as a triangle fan */
- glBegin(GL_TRIANGLE_FAN);
-/* glNormal3f(0.0, 0.0, 1.0); */
- glVertex3f(0.0, 0.0, nsign * radius);
- for (j = 0; j <= slices; j++) {
- theta = (j == slices) ? 0.0 : j * dtheta;
- x = -sin(theta) * sin(drho);
- y = cos(theta) * sin(drho);
- z = nsign * cos(drho);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
-
- ds = 1.0 / slices;
- dt = 1.0 / stacks;
- t = 1.0; /* because loop now runs from 0 */
- if (qobj->TextureFlag) {
- imin = 0;
- imax = stacks;
- }
- else {
- imin = 1;
- imax = stacks - 1;
- }
-
- /* draw intermediate stacks as quad strips */
- for (i = imin; i < imax; i++) {
- rho = i * drho;
- glBegin(GL_QUAD_STRIP);
- s = 0.0;
- for (j = 0; j <= slices; j++) {
- theta = (j == slices) ? 0.0 : j * dtheta;
- x = -sin(theta) * sin(rho);
- y = cos(theta) * sin(rho);
- z = nsign * cos(rho);
- TXTR_COORD(s, t);
- glVertex3f(x * radius, y * radius, z * radius);
- x = -sin(theta) * sin(rho + drho);
- y = cos(theta) * sin(rho + drho);
- z = nsign * cos(rho + drho);
- TXTR_COORD(s, t - dt);
- s += ds;
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- t -= dt;
- }
-
- if (!qobj->TextureFlag) {
- /* draw -Z end as a triangle fan */
- glBegin(GL_TRIANGLE_FAN);
- glVertex3f(0.0, 0.0, -radius * nsign);
- rho = M_PI - drho;
- s = 1.0;
- t = dt;
- for (j = slices; j >= 0; j--) {
- theta = (j == slices) ? 0.0 : j * dtheta;
- x = -sin(theta) * sin(rho);
- y = cos(theta) * sin(rho);
- z = nsign * cos(rho);
- s -= ds;
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
- }
- else if (qobj->DrawStyle == GLU_LINE || qobj->DrawStyle == GLU_SILHOUETTE) {
- /* draw stack lines */
- for (i = 1; i < stacks; i++) { /* stack line at i==stacks-1 was missing here */
- rho = i * drho;
- glBegin(GL_LINE_LOOP);
- for (j = 0; j < slices; j++) {
- theta = j * dtheta;
- x = cos(theta) * sin(rho);
- y = sin(theta) * sin(rho);
- z = cos(rho);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
- /* draw slice lines */
- for (j = 0; j < slices; j++) {
- theta = j * dtheta;
- glBegin(GL_LINE_STRIP);
- for (i = 0; i <= stacks; i++) {
- rho = i * drho;
- x = cos(theta) * sin(rho);
- y = sin(theta) * sin(rho);
- z = cos(rho);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- glEnd();
- }
- }
- else if (qobj->DrawStyle == GLU_POINT) {
- /* top and bottom-most points */
- glBegin(GL_POINTS);
- glVertex3f(0.0, 0.0, radius);
- glVertex3f(0.0, 0.0, -radius);
-
- /* loop over stacks */
- for (i = 1; i < stacks - 1; i++) {
- rho = i * drho;
- for (j = 0; j < slices; j++) {
- theta = j * dtheta;
- x = cos(theta) * sin(rho);
- y = sin(theta) * sin(rho);
- z = cos(rho);
- glVertex3f(x * radius, y * radius, z * radius);
- }
- }
- glEnd();
- }
-
-}
-
-
-
-void GLAPIENTRY
-gluDisk(GLUquadricObj * qobj,
- GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops)
-{
- GLfloat da, dr;
-#if 0
- GLdouble a, da;
- GLfloat r, dr;
- GLfloat x, y;
- GLfloat r1, r2, dtc;
- GLint s, l;
-#endif
-
-
- da = 2.0 * M_PI / slices;
- dr = (outerRadius - innerRadius) / (GLfloat) loops;
-
- switch (qobj->DrawStyle) {
- case GLU_FILL:
- {
- /* texture of a gluDisk is a cut out of the texture unit square
- * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1]
- * (linear mapping)
- */
- GLfloat dtc = 2.0f * outerRadius;
- GLfloat sa, ca;
- GLfloat r1 = innerRadius;
- GLint l;
- for (l = 0; l < loops; l++) {
- GLfloat r2 = r1 + dr;
- if (qobj->Orientation == GLU_OUTSIDE) {
- GLint s;
- glBegin(GL_QUAD_STRIP);
- for (s = 0; s <= slices; s++) {
- GLfloat a;
- if (s == slices)
- a = 0.0;
- else
- a = s * da;
- sa = sin(a);
- ca = cos(a);
- TXTR_COORD(0.5 + sa * r2 / dtc, 0.5 + ca * r2 / dtc);
- glVertex2f(r2 * sa, r2 * ca);
- TXTR_COORD(0.5 + sa * r1 / dtc, 0.5 + ca * r1 / dtc);
- glVertex2f(r1 * sa, r1 * ca);
- }
- glEnd();
- }
- else {
- GLint s;
- glBegin(GL_QUAD_STRIP);
- for (s = slices; s >= 0; s--) {
- GLfloat a;
- if (s == slices)
- a = 0.0;
- else
- a = s * da;
- sa = sin(a);
- ca = cos(a);
- TXTR_COORD(0.5 - sa * r2 / dtc, 0.5 + ca * r2 / dtc);
- glVertex2f(r2 * sa, r2 * ca);
- TXTR_COORD(0.5 - sa * r1 / dtc, 0.5 + ca * r1 / dtc);
- glVertex2f(r1 * sa, r1 * ca);
- }
- glEnd();
- }
- r1 = r2;
- }
- break;
- }
- case GLU_LINE:
- {
- GLint l, s;
- /* draw loops */
- for (l = 0; l <= loops; l++) {
- GLfloat r = innerRadius + l * dr;
- glBegin(GL_LINE_LOOP);
- for (s = 0; s < slices; s++) {
- GLfloat a = s * da;
- glVertex2f(r * sin(a), r * cos(a));
- }
- glEnd();
- }
- /* draw spokes */
- for (s = 0; s < slices; s++) {
- GLfloat a = s * da;
- GLfloat x = sin(a);
- GLfloat y = cos(a);
- glBegin(GL_LINE_STRIP);
- for (l = 0; l <= loops; l++) {
- GLfloat r = innerRadius + l * dr;
- glVertex2f(r * x, r * y);
- }
- glEnd();
- }
- break;
- }
- case GLU_POINT:
- {
- GLint s;
- glBegin(GL_POINTS);
- for (s = 0; s < slices; s++) {
- GLfloat a = s * da;
- GLfloat x = sin(a);
- GLfloat y = cos(a);
- GLint l;
- for (l = 0; l <= loops; l++) {
- GLfloat r = innerRadius * l * dr;
- glVertex2f(r * x, r * y);
- }
- }
- glEnd();
- break;
- }
- case GLU_SILHOUETTE:
- {
- if (innerRadius != 0.0) {
- GLfloat a;
- glBegin(GL_LINE_LOOP);
- for (a = 0.0; a < 2.0 * M_PI; a += da) {
- GLfloat x = innerRadius * sin(a);
- GLfloat y = innerRadius * cos(a);
- glVertex2f(x, y);
- }
- glEnd();
- }
- {
- GLfloat a;
- glBegin(GL_LINE_LOOP);
- for (a = 0; a < 2.0 * M_PI; a += da) {
- GLfloat x = outerRadius * sin(a);
- GLfloat y = outerRadius * cos(a);
- glVertex2f(x, y);
- }
- glEnd();
- }
- break;
- }
- default:
- abort();
- }
-}
-
-
-
-void GLAPIENTRY
-gluPartialDisk(GLUquadricObj * qobj, GLdouble innerRadius,
- GLdouble outerRadius, GLint slices, GLint loops,
- GLdouble startAngle, GLdouble sweepAngle)
-{
- if (qobj->DrawStyle == GLU_POINT) {
- GLint loop, slice;
- GLdouble radius, delta_radius;
- GLdouble angle, delta_angle;
- delta_radius = (outerRadius - innerRadius) / (loops - 1);
- delta_angle = DEG_TO_RAD((sweepAngle) / (slices - 1));
- glBegin(GL_POINTS);
- radius = innerRadius;
- for (loop = 0; loop < loops; loop++) {
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice < slices; slice++) {
- glVertex2f(radius * sin(angle), radius * cos(angle));
- angle += delta_angle;
- }
- radius += delta_radius;
- }
- glEnd();
- }
- else if (qobj->DrawStyle == GLU_LINE) {
- GLint loop, slice;
- GLdouble radius, delta_radius;
- GLdouble angle, delta_angle;
- delta_radius = (outerRadius - innerRadius) / loops;
- delta_angle = DEG_TO_RAD(sweepAngle / slices);
- /* draw rings */
- radius = innerRadius;
- for (loop = 0; loop < loops; loop++) {
- angle = DEG_TO_RAD(startAngle);
- glBegin(GL_LINE_STRIP);
- for (slice = 0; slice <= slices; slice++) {
- glVertex2f(radius * sin(angle), radius * cos(angle));
- angle += delta_angle;
- }
- glEnd();
- radius += delta_radius;
- }
- /* draw spokes */
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice <= slices; slice++) {
- radius = innerRadius;
- glBegin(GL_LINE_STRIP);
- for (loop = 0; loop < loops; loop++) {
- glVertex2f(radius * sin(angle), radius * cos(angle));
- radius += delta_radius;
- }
- glEnd();
- angle += delta_angle;
- }
- }
- else if (qobj->DrawStyle == GLU_SILHOUETTE) {
- GLint slice;
- GLdouble angle, delta_angle;
- delta_angle = DEG_TO_RAD(sweepAngle / slices);
- /* draw outer ring */
- glBegin(GL_LINE_STRIP);
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice <= slices; slice++) {
- glVertex2f(outerRadius * sin(angle), outerRadius * cos(angle));
- angle += delta_angle;
- }
- glEnd();
- /* draw inner ring */
- if (innerRadius > 0.0) {
- glBegin(GL_LINE_STRIP);
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice < slices; slice++) {
- glVertex2f(innerRadius * sin(angle), innerRadius * cos(angle));
- angle += delta_angle;
- }
- glEnd();
- }
- /* draw spokes */
- if (sweepAngle < 360.0) {
- GLdouble stopAngle = startAngle + sweepAngle;
- glBegin(GL_LINES);
- glVertex2f(innerRadius * SIND(startAngle),
- innerRadius * COSD(startAngle));
- glVertex2f(outerRadius * SIND(startAngle),
- outerRadius * COSD(startAngle));
- glVertex2f(innerRadius * SIND(stopAngle),
- innerRadius * COSD(stopAngle));
- glVertex2f(outerRadius * SIND(stopAngle),
- outerRadius * COSD(stopAngle));
- glEnd();
- }
- }
- else if (qobj->DrawStyle == GLU_FILL) {
- GLint loop, slice;
- GLdouble radius, delta_radius;
- GLdouble angle, delta_angle;
- delta_radius = (outerRadius - innerRadius) / loops;
- delta_angle = DEG_TO_RAD(sweepAngle / slices);
- radius = innerRadius;
- for (loop = 0; loop < loops; loop++) {
- glBegin(GL_QUAD_STRIP);
- angle = DEG_TO_RAD(startAngle);
- for (slice = 0; slice <= slices; slice++) {
- if (qobj->Orientation == GLU_OUTSIDE) {
- glVertex2f((radius + delta_radius) * sin(angle),
- (radius + delta_radius) * cos(angle));
- glVertex2f(radius * sin(angle), radius * cos(angle));
- }
- else {
- glVertex2f(radius * sin(angle), radius * cos(angle));
- glVertex2f((radius + delta_radius) * sin(angle),
- (radius + delta_radius) * cos(angle));
- }
- angle += delta_angle;
- }
- glEnd();
- radius += delta_radius;
- }
- }
-}
diff --git a/src/glu/mini/tess.c b/src/glu/mini/tess.c
deleted file mode 100644
index fa1c470cf52..00000000000
--- a/src/glu/mini/tess.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/* $Id: tess.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <math.h>
-#include <stdlib.h>
-#include "tess.h"
-#endif
-
-
-/*
- * This is ugly, but seems the easiest way to do things to make the
- * code work under YellowBox for Windows
- */
-#if defined(OPENSTEP) && defined(CALLBACK)
-#undef CALLBACK
-#define CALLBACK
-#endif
-
-
-static void delete_contours(GLUtriangulatorObj *);
-
-#ifdef __CYGWIN32__
-#define _CALLBACK
-#else
-#define _CALLBACK GLCALLBACK
-#endif
-
-
-static void
-init_callbacks(tess_callbacks * callbacks)
-{
- callbacks->begin = (void (_CALLBACK *) (GLenum)) 0;
- callbacks->edgeFlag = (void (_CALLBACK *) (GLboolean)) 0;
- callbacks->vertex = (void (_CALLBACK *) (void *)) 0;
- callbacks->end = (void (_CALLBACK *) (void)) 0;
- callbacks->error = (void (_CALLBACK *) (GLenum)) 0;
-}
-
-void
-tess_call_user_error(GLUtriangulatorObj * tobj, GLenum gluerr)
-{
- if (tobj->error == GLU_NO_ERROR)
- tobj->error = gluerr;
- if (tobj->callbacks.error != NULL)
- (tobj->callbacks.error) (gluerr);
-}
-
-GLUtriangulatorObj *GLAPIENTRY
-gluNewTess(void)
-{
- GLUtriangulatorObj *tobj;
-
- if ((tobj = (GLUtriangulatorObj *)
- malloc(sizeof(struct GLUtesselator))) == NULL)
- return NULL;
- tobj->contours = tobj->last_contour = NULL;
- init_callbacks(&tobj->callbacks);
- tobj->error = GLU_NO_ERROR;
- tobj->current_polygon = NULL;
- tobj->contour_cnt = 0;
- return tobj;
-}
-
-
-void GLAPIENTRY
-gluTessCallback(GLUtriangulatorObj * tobj, GLenum which,
- void (GLCALLBACK * fn) ())
-{
- switch (which) {
- case GLU_BEGIN:
- tobj->callbacks.begin = (void (_CALLBACK *) (GLenum)) fn;
- break;
- case GLU_EDGE_FLAG:
- tobj->callbacks.edgeFlag = (void (_CALLBACK *) (GLboolean)) fn;
- break;
- case GLU_VERTEX:
- tobj->callbacks.vertex = (void (_CALLBACK *) (void *)) fn;
- break;
- case GLU_END:
- tobj->callbacks.end = (void (_CALLBACK *) (void)) fn;
- break;
- case GLU_ERROR:
- tobj->callbacks.error = (void (_CALLBACK *) (GLenum)) fn;
- break;
- default:
- tobj->error = GLU_INVALID_ENUM;
- break;
- }
-}
-
-
-
-void GLAPIENTRY
-gluDeleteTess(GLUtriangulatorObj * tobj)
-{
- if (tobj->error == GLU_NO_ERROR && tobj->contour_cnt)
- /* was gluEndPolygon called? */
- tess_call_user_error(tobj, GLU_TESS_ERROR1);
- /* delete all internal structures */
- delete_contours(tobj);
- free(tobj);
-}
-
-
-void GLAPIENTRY
-gluBeginPolygon(GLUtriangulatorObj * tobj)
-{
-/*
- if(tobj->error!=GLU_NO_ERROR)
- return;
-*/
- tobj->error = GLU_NO_ERROR;
- if (tobj->current_polygon != NULL) {
- /* gluEndPolygon was not called */
- tess_call_user_error(tobj, GLU_TESS_ERROR1);
- /* delete all internal structures */
- delete_contours(tobj);
- }
- else {
- if ((tobj->current_polygon =
- (tess_polygon *) malloc(sizeof(tess_polygon))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- tobj->current_polygon->vertex_cnt = 0;
- tobj->current_polygon->vertices =
- tobj->current_polygon->last_vertex = NULL;
- }
-}
-
-
-void GLAPIENTRY
-gluEndPolygon(GLUtriangulatorObj * tobj)
-{
- /*tess_contour *contour_ptr; */
-
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- /* check if gluBeginPolygon was called */
- if (tobj->current_polygon == NULL) {
- tess_call_user_error(tobj, GLU_TESS_ERROR2);
- return;
- }
- tess_test_polygon(tobj);
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- /* any real contours? */
- if (tobj->contour_cnt == 0) {
- /* delete all internal structures */
- delete_contours(tobj);
- return;
- }
- tess_find_contour_hierarchies(tobj);
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- tess_handle_holes(tobj);
- /* there was an error */
- if (tobj->error != GLU_NO_ERROR)
- goto end;
-
- /* if no callbacks, nothing to do */
- if (tobj->callbacks.begin != NULL && tobj->callbacks.vertex != NULL &&
- tobj->callbacks.end != NULL) {
- if (tobj->callbacks.edgeFlag == NULL)
- tess_tesselate(tobj);
- else
- tess_tesselate_with_edge_flag(tobj);
- }
-
- end:
- /* delete all internal structures */
- delete_contours(tobj);
-}
-
-
-void GLAPIENTRY
-gluNextContour(GLUtriangulatorObj * tobj, GLenum type)
-{
- if (tobj->error != GLU_NO_ERROR)
- return;
- if (tobj->current_polygon == NULL) {
- tess_call_user_error(tobj, GLU_TESS_ERROR2);
- return;
- }
- /* first contour? */
- if (tobj->current_polygon->vertex_cnt)
- tess_test_polygon(tobj);
-}
-
-
-void GLAPIENTRY
-gluTessVertex(GLUtriangulatorObj * tobj, GLdouble v[3], void *data)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_vertex *last_vertex_ptr;
-
- if (tobj->error != GLU_NO_ERROR)
- return;
- if (polygon == NULL) {
- tess_call_user_error(tobj, GLU_TESS_ERROR2);
- return;
- }
- last_vertex_ptr = polygon->last_vertex;
- if (last_vertex_ptr == NULL) {
- if ((last_vertex_ptr = (tess_vertex *)
- malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- polygon->vertices = last_vertex_ptr;
- polygon->last_vertex = last_vertex_ptr;
- last_vertex_ptr->data = data;
- last_vertex_ptr->location[0] = v[0];
- last_vertex_ptr->location[1] = v[1];
- last_vertex_ptr->location[2] = v[2];
- last_vertex_ptr->next = NULL;
- last_vertex_ptr->previous = NULL;
- ++(polygon->vertex_cnt);
- }
- else {
- tess_vertex *vertex_ptr;
-
- /* same point twice? */
- if (fabs(last_vertex_ptr->location[0] - v[0]) < EPSILON &&
- fabs(last_vertex_ptr->location[1] - v[1]) < EPSILON &&
- fabs(last_vertex_ptr->location[2] - v[2]) < EPSILON) {
- tess_call_user_error(tobj, GLU_TESS_ERROR6);
- return;
- }
- if ((vertex_ptr = (tess_vertex *)
- malloc(sizeof(tess_vertex))) == NULL) {
- tess_call_user_error(tobj, GLU_OUT_OF_MEMORY);
- return;
- }
- vertex_ptr->data = data;
- vertex_ptr->location[0] = v[0];
- vertex_ptr->location[1] = v[1];
- vertex_ptr->location[2] = v[2];
- vertex_ptr->next = NULL;
- vertex_ptr->previous = last_vertex_ptr;
- ++(polygon->vertex_cnt);
- last_vertex_ptr->next = vertex_ptr;
- polygon->last_vertex = vertex_ptr;
- }
-}
-
-
-static void
-delete_contours(GLUtriangulatorObj * tobj)
-{
- tess_polygon *polygon = tobj->current_polygon;
- tess_contour *contour, *contour_tmp;
- tess_vertex *vertex, *vertex_tmp;
-
- /* remove current_polygon list - if exists due to detected error */
- if (polygon != NULL) {
- if (polygon->vertices) {
- for (vertex = polygon->vertices; vertex != polygon->last_vertex;) {
- vertex_tmp = vertex->next;
- free(vertex);
- vertex = vertex_tmp;
- }
- free(vertex);
- }
- free(polygon);
- tobj->current_polygon = NULL;
- }
- /* remove all contour data */
- for (contour = tobj->contours; contour != NULL;) {
- for (vertex = contour->vertices; vertex != contour->last_vertex;) {
- vertex_tmp = vertex->next;
- free(vertex);
- vertex = vertex_tmp;
- }
- free(vertex);
- contour_tmp = contour->next;
- free(contour);
- contour = contour_tmp;
- }
- tobj->contours = tobj->last_contour = NULL;
- tobj->contour_cnt = 0;
-}
-
-
-void GLAPIENTRY
-gluTessNormal(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ)
-{
- /* dummy function */
- (void) tess;
- (void) valueX;
- (void) valueY;
- (void) valueZ;
-}
diff --git a/src/glu/mini/tess.h b/src/glu/mini/tess.h
deleted file mode 100644
index 87f036ae9ea..00000000000
--- a/src/glu/mini/tess.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $Id: tess.h,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifndef TESS_H
-#define TESS_H
-
-
-#include "gluP.h"
-
-#define EPSILON 1e-06 /* epsilon for double precision compares */
-
-typedef enum
-{
- OXY,
- OYZ,
- OXZ
-}
-projection_type;
-
-typedef struct callbacks_str
-{
- void (GLCALLBACK * begin) (GLenum mode);
- void (GLCALLBACK * edgeFlag) (GLboolean flag);
- void (GLCALLBACK * vertex) (GLvoid * v);
- void (GLCALLBACK * end) (void);
- void (GLCALLBACK * error) (GLenum err);
-}
-tess_callbacks;
-
-typedef struct vertex_str
-{
- void *data;
- GLdouble location[3];
- GLdouble x, y;
- GLboolean edge_flag;
- struct vertex_str *shadow_vertex;
- struct vertex_str *next, *previous;
-}
-tess_vertex;
-
-typedef struct contour_str
-{
- GLenum type;
- GLuint vertex_cnt;
- GLdouble area;
- GLenum orientation;
- struct vertex_str *vertices, *last_vertex;
- struct contour_str *next, *previous;
-}
-tess_contour;
-
-typedef struct polygon_str
-{
- GLuint vertex_cnt;
- GLdouble A, B, C, D;
- GLdouble area;
- GLenum orientation;
- struct vertex_str *vertices, *last_vertex;
-}
-tess_polygon;
-
-struct GLUtesselator
-{
- tess_contour *contours, *last_contour;
- GLuint contour_cnt;
- tess_callbacks callbacks;
- tess_polygon *current_polygon;
- GLenum error;
- GLdouble A, B, C, D;
- projection_type projection;
-};
-
-
-extern void tess_call_user_error(GLUtriangulatorObj *, GLenum);
-extern void tess_test_polygon(GLUtriangulatorObj *);
-extern void tess_find_contour_hierarchies(GLUtriangulatorObj *);
-extern void tess_handle_holes(GLUtriangulatorObj *);
-extern void tess_tesselate(GLUtriangulatorObj *);
-extern void tess_tesselate_with_edge_flag(GLUtriangulatorObj *);
-
-
-#endif
diff --git a/src/glu/mini/tesselat.c b/src/glu/mini/tesselat.c
deleted file mode 100644
index a2160755013..00000000000
--- a/src/glu/mini/tesselat.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/* $Id: tesselat.c,v 1.2 2003-08-22 20:11:43 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.3
- * Copyright (C) 1995-2000 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This file is part of the polygon tesselation code contributed by
- * Bogdan Sikorski
- */
-
-
-#ifdef PC_HEADER
-#include "all.h"
-#else
-#include <stdlib.h>
-#include <math.h>
-#include "tess.h"
-#endif
-
-
-
-static GLboolean edge_flag;
-
-static void emit_triangle(GLUtriangulatorObj *, tess_vertex *,
- tess_vertex *, tess_vertex *);
-
-static void emit_triangle_with_edge_flag(GLUtriangulatorObj *,
- tess_vertex *, GLboolean,
- tess_vertex *, GLboolean,
- tess_vertex *, GLboolean);
-
-static GLdouble
-twice_the_triangle_area(tess_vertex * va, tess_vertex * vb, tess_vertex * vc)
-{
- return (vb->x - va->x) * (vc->y - va->y) - (vb->y - va->y) * (vc->x -
- va->x);
-}
-
-static GLboolean
-left(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y)
-{
- if (A * x + B * y + C > -EPSILON)
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-
-static GLboolean
-right(GLdouble A, GLdouble B, GLdouble C, GLdouble x, GLdouble y)
-{
- if (A * x + B * y + C < EPSILON)
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-
-static GLint
-convex_ccw(tess_vertex * va,
- tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj)
-{
- GLdouble d;
-
- d = twice_the_triangle_area(va, vb, vc);
-
- if (d > EPSILON) {
- return 1;
- }
- else if (d < -EPSILON) {
- return 0;
- }
- else {
- return -1;
- }
-}
-
-static GLint
-convex_cw(tess_vertex * va,
- tess_vertex * vb, tess_vertex * vc, GLUtriangulatorObj * tobj)
-{
- GLdouble d;
-
- d = twice_the_triangle_area(va, vb, vc);
-
- if (d < -EPSILON) {
- return 1;
- }
- else if (d > EPSILON) {
- return 0;
- }
- else {
- return -1;
- }
-}
-
-static GLboolean
-diagonal_ccw(tess_vertex * va,
- tess_vertex * vb,
- GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vc = va->next, *vertex, *shadow_vertex;
- struct
- {
- GLdouble A, B, C;
- }
- ac, cb, ba;
- GLdouble x, y;
-
- GLint res = convex_ccw(va, vc, vb, tobj);
- if (res == 0)
- return GL_FALSE;
- if (res == -1)
- return GL_TRUE;
-
- ba.A = vb->y - va->y;
- ba.B = va->x - vb->x;
- ba.C = -ba.A * va->x - ba.B * va->y;
- ac.A = va->y - vc->y;
- ac.B = vc->x - va->x;
- ac.C = -ac.A * vc->x - ac.B * vc->y;
- cb.A = vc->y - vb->y;
- cb.B = vb->x - vc->x;
- cb.C = -cb.A * vb->x - cb.B * vb->y;
- for (vertex = vb->next; vertex != va; vertex = vertex->next) {
- shadow_vertex = vertex->shadow_vertex;
- if (shadow_vertex != NULL &&
- (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc))
- continue;
- x = vertex->x;
- y = vertex->y;
- if (left(ba.A, ba.B, ba.C, x, y) &&
- left(ac.A, ac.B, ac.C, x, y) && left(cb.A, cb.B, cb.C, x, y))
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-static GLboolean
-diagonal_cw(tess_vertex * va,
- tess_vertex * vb,
- GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vc = va->next, *vertex, *shadow_vertex;
- struct
- {
- GLdouble A, B, C;
- }
- ac, cb, ba;
- GLdouble x, y;
-
- GLint res = convex_cw(va, vc, vb, tobj);
- if (res == 0)
- return GL_FALSE;
- if (res == -1)
- return GL_TRUE;
-
- ba.A = vb->y - va->y;
- ba.B = va->x - vb->x;
- ba.C = -ba.A * va->x - ba.B * va->y;
- ac.A = va->y - vc->y;
- ac.B = vc->x - va->x;
- ac.C = -ac.A * vc->x - ac.B * vc->y;
- cb.A = vc->y - vb->y;
- cb.B = vb->x - vc->x;
- cb.C = -cb.A * vb->x - cb.B * vb->y;
- for (vertex = vb->next; vertex != va; vertex = vertex->next) {
- shadow_vertex = vertex->shadow_vertex;
- if (shadow_vertex != NULL &&
- (shadow_vertex == va || shadow_vertex == vb || shadow_vertex == vc))
- continue;
- x = vertex->x;
- y = vertex->y;
- if (right(ba.A, ba.B, ba.C, x, y) &&
- right(ac.A, ac.B, ac.C, x, y) && right(cb.A, cb.B, cb.C, x, y))
- return GL_FALSE;
- }
- return GL_TRUE;
-}
-
-static void
-clip_ear(GLUtriangulatorObj * tobj, tess_vertex * v, tess_contour * contour)
-{
- emit_triangle(tobj, v->previous, v, v->next);
- /* the first in the list */
- if (contour->vertices == v) {
- contour->vertices = v->next;
- contour->last_vertex->next = v->next;
- v->next->previous = contour->last_vertex;
- }
- else
- /* the last ? */
- if (contour->last_vertex == v) {
- contour->vertices->previous = v->previous;
- v->previous->next = v->next;
- contour->last_vertex = v->previous;
- }
- else {
- v->next->previous = v->previous;
- v->previous->next = v->next;
- }
- free(v);
- --(contour->vertex_cnt);
-}
-
-static void
-clip_ear_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_vertex * v, tess_contour * contour)
-{
- emit_triangle_with_edge_flag(tobj, v->previous, v->previous->edge_flag,
- v, v->edge_flag, v->next, GL_FALSE);
- v->previous->edge_flag = GL_FALSE;
- /* the first in the list */
- if (contour->vertices == v) {
- contour->vertices = v->next;
- contour->last_vertex->next = v->next;
- v->next->previous = contour->last_vertex;
- }
- else
- /* the last ? */
- if (contour->last_vertex == v) {
- contour->vertices->previous = v->previous;
- v->previous->next = v->next;
- contour->last_vertex = v->previous;
- }
- else {
- v->next->previous = v->previous;
- v->previous->next = v->next;
- }
- free(v);
- --(contour->vertex_cnt);
-}
-
-static void
-triangulate_ccw(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-static void
-triangulate_cw(GLUtriangulatorObj * tobj, tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_cw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-static void
-triangulate_ccw_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_ccw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear_with_edge_flag(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-static void
-triangulate_cw_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_contour * contour)
-{
- tess_vertex *vertex;
- GLuint vertex_cnt = contour->vertex_cnt;
-
- while (vertex_cnt > 3) {
- vertex = contour->vertices;
- while (diagonal_cw(vertex, vertex->next->next, tobj, contour) ==
- GL_FALSE && tobj->error == GLU_NO_ERROR)
- vertex = vertex->next;
- if (tobj->error != GLU_NO_ERROR)
- return;
- clip_ear_with_edge_flag(tobj, vertex->next, contour);
- --vertex_cnt;
- }
-}
-
-void
-tess_tesselate(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour;
-
- for (contour = tobj->contours; contour != NULL; contour = contour->next) {
- if (contour->orientation == GLU_CCW) {
- triangulate_ccw(tobj, contour);
- }
- else {
- triangulate_cw(tobj, contour);
- }
- if (tobj->error != GLU_NO_ERROR)
- return;
-
- /* emit the last triangle */
- emit_triangle(tobj, contour->vertices, contour->vertices->next,
- contour->vertices->next->next);
- }
-}
-
-void
-tess_tesselate_with_edge_flag(GLUtriangulatorObj * tobj)
-{
- tess_contour *contour;
-
- edge_flag = GL_TRUE;
- /* first callback with edgeFlag set to GL_TRUE */
- (tobj->callbacks.edgeFlag) (GL_TRUE);
-
- for (contour = tobj->contours; contour != NULL; contour = contour->next) {
- if (contour->orientation == GLU_CCW)
- triangulate_ccw_with_edge_flag(tobj, contour);
- else
- triangulate_cw_with_edge_flag(tobj, contour);
- if (tobj->error != GLU_NO_ERROR)
- return;
- /* emit the last triangle */
- emit_triangle_with_edge_flag(tobj, contour->vertices,
- contour->vertices->edge_flag,
- contour->vertices->next,
- contour->vertices->next->edge_flag,
- contour->vertices->next->next,
- contour->vertices->next->next->edge_flag);
- }
-}
-
-static void
-emit_triangle(GLUtriangulatorObj * tobj,
- tess_vertex * v1, tess_vertex * v2, tess_vertex * v3)
-{
- (tobj->callbacks.begin) (GL_TRIANGLES);
- (tobj->callbacks.vertex) (v1->data);
- (tobj->callbacks.vertex) (v2->data);
- (tobj->callbacks.vertex) (v3->data);
- (tobj->callbacks.end) ();
-}
-
-static void
-emit_triangle_with_edge_flag(GLUtriangulatorObj * tobj,
- tess_vertex * v1,
- GLboolean edge_flag1,
- tess_vertex * v2,
- GLboolean edge_flag2,
- tess_vertex * v3, GLboolean edge_flag3)
-{
- (tobj->callbacks.begin) (GL_TRIANGLES);
- if (edge_flag1 != edge_flag) {
- edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE);
- (tobj->callbacks.edgeFlag) (edge_flag);
- }
- (tobj->callbacks.vertex) (v1->data);
- if (edge_flag2 != edge_flag) {
- edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE);
- (tobj->callbacks.edgeFlag) (edge_flag);
- }
- (tobj->callbacks.vertex) (v2->data);
- if (edge_flag3 != edge_flag) {
- edge_flag = (edge_flag == GL_TRUE ? GL_FALSE : GL_TRUE);
- (tobj->callbacks.edgeFlag) (edge_flag);
- }
- (tobj->callbacks.vertex) (v3->data);
- (tobj->callbacks.end) ();
-}
diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile
deleted file mode 100644
index cb823849411..00000000000
--- a/src/glut/mini/Makefile
+++ /dev/null
@@ -1,80 +0,0 @@
-# subset glut
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-MARK = $(TOP)/src/glut/glx
-
-GLUT_MAJOR = 3
-GLUT_MINOR = 7
-GLUT_TINY = 1
-
-INCLUDES = -I$(TOP)/include -I$(MARK)
-
-CORE_SOURCES = \
- bitmap.c \
- callback.c \
- color.c \
- globals.c \
- init.c \
- menu.c \
- models.c \
- overlay.c \
- state.c \
- teapot.c \
- window.c
-
-
-MARK_SOURCES = \
- $(MARK)/glut_8x13.c \
- $(MARK)/glut_9x15.c \
- $(MARK)/glut_hel10.c \
- $(MARK)/glut_hel12.c \
- $(MARK)/glut_hel18.c \
- $(MARK)/glut_tr10.c \
- $(MARK)/glut_tr24.c
-
-SOURCES = $(CORE_SOURCES) $(MARK_SOURCES)
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(LIB_DIR)/$(GLUT_LIB_NAME)
-
-
-# Make the library
-$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
- -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
- $(GLUT_LIB_DEPS) -install $(LIB_DIR) \
- $(MKLIB_OPTIONS) $(OBJECTS)
-
-
-# Run 'make -f Makefile.solo dep' to update the dependencies if you change
-# what's included by any source file.
-depend: $(SOURCES)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean: depend
- -rm -f depend
- -rm -f *.o *~ *.o *~ *.so libglut.so.3.7
-
-include depend
diff --git a/src/glx/mini/Makefile b/src/glx/mini/Makefile
deleted file mode 100644
index 9503192274c..00000000000
--- a/src/glx/mini/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
-# Build a subset DRI-based libGL.so library.
-# Indirect rendering not supported, etc.
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-
-DEFINES += -DGLX_DIRECT_RENDERING -DIN_MINI_GLX -UIN_DRI_DRIVER
-
-C_SOURCES = \
- $(TOP)/src/mesa/main/dispatch.c \
- $(TOP)/src/mesa/glapi/glapi.c \
- $(TOP)/src/mesa/glapi/glthread.c \
- $(TOP)/src/mesa/drivers/dri/common/glcontextmodes.c \
- miniglx.c \
- miniglx_events.c
-
-X86_SOURCES = $(TOP)/src/mesa/x86/glapi_x86.S
-
-OBJECTS = $(C_SOURCES:.c=.o) \
- $(ASM_SOURCES:.S=.o)
-
-INCLUDES = -I. $(INCLUDE_DIRS)
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/transform \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup \
- -I$(TOP)/src/mesa/drivers/dri/common \
- `pkg-config --cflags libdrm`
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(LIB_DIR)/$(GL_LIB_NAME)
-
-
-# Make libGL
-$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
- $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
- -major 1 -minor 2 $(MKLIB_OPTIONS) \
- -install $(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) `/usr/bin/pkg-config --libs libdrm` `/usr/bin/pkg-config --libs pciaccess`
- rm -f $(LIB_DIR)/miniglx.conf
- install example.miniglx.conf $(LIB_DIR)/miniglx.conf
-
-
-drmtest: xf86drm.o drmtest.o
- rm -f drmtest && $(CC) -o drmtest xf86drm.o drmtest.o
-
-
-depend: $(C_SOURCES) $(ASM_SOURCES)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) \
- > /dev/null
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean:
- -rm -f drmtest $(LIB_DIR)/libGL.so*
- -rm -f *.o *~
- -rm -f depend
-
-include depend
diff --git a/src/glx/mini/NOTES b/src/glx/mini/NOTES
deleted file mode 100644
index 1774107d634..00000000000
--- a/src/glx/mini/NOTES
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-Getting MiniGLX up and running
-------------------------------
-
-It's necessary to do a bit of work to set up an environment to run miniglx.
-
-For the radeon driver, it's necessary to get the right set of kernel
-modules installed before attempting to run any programs:
-
- rmmod radeon agpgart;
- insmod agpgart;
- insmod $(MESA)/src/kernel/radeonfb/radeonfb.o;
- insmod $(MESA)/src/kernel/radeon/radeon.o;
-
-For all drivers, its necessary to reach the compiled libraries, and
-tell MiniGLX where to find it's configuration file:
-
- export LD_LIBRARY_PATH=$(MESA)/lib;
- export MINIGLX_CONF=$(MESA)/lib/miniglx.conf
-
-------------------------------------------------------------
-
-MiniGLX Example Programs
-------------------------
-
-The following programs will work with miniglx:
-
- $(MESA)/tests/miniglx
- $(MESA)/xdemos/glxgears
-
-Thanks to the miniglut stub library, most of the mesa glut demos will
-work. In particular, the following have been tested. (Note there is
-no keyboard or mouse interaction with these demos).
-
- $(MESA)/demos/gears
- $(MESA)/demos/geartrain
- $(MESA)/demos/morph3d
- $(MESA)/demos/isosurf
- $(MESA)/demos/texobj
- $(MESA)/demos/texcyl
- $(MESA)/demos/gloss
- $(MESA)/demos/fire
- $(MESA)/demos/tunnel
- $(MESA)/demos/teapot
- $(MESA)/samples/prim
- $(MESA)/samples/olympic
- $(MESA)/samples/star
- $(MESA)/samples/wave
- ...etc
-
-In fact most of the glut demos seem to work within the constraints of
-having no keyboard/mouse interactivity. Furthermore, the use of the
-glut wrapper means that these programs don't require recompilation to
-run under MiniGLX -- the same binary works with both regular GLX and
-MiniGLX.
-
-
-------------------------------------------------------------
-
-Porting GLX apps to MiniGLX
----------------------------
-
-A quick list of issues encountered in porting existing GLX apps to
-MiniGLX. Listed in no particular order.
-
-1) No input events
-
-MiniGLX doesn't provide an input layer, so any X11 input event
-handling in the existing app will have to be redone for whatever
-input devices exist on the target.
-
-2) No configuration, expose events
-
-Many GLX and Xlib programs wait on an event to ensure the window has
-become visible after being mapped. MiniGLX provides no equivalent
-facility.
-
-3) Different headers
-
-X11/Xlib.h, GL/GLX.h, etc must not be used if the program is being
-compiled against MiniGLX.
-
-The equivalent header is GL/MiniGLX.h.
-
-4) Different library
-
-It may be necessary to link directly against the minGLX libGL.so.
-
-5) Reduced number of Xlib and GLX entrypoints.
-
-By definition (MiniGLX is a subset of GLX), many Xlib and GLX
-entrypoints, structures and macros are not present in MiniGLX. It
-will be necessary to find and eliminate all references to
-non-supported entrypoints.
-
-
----------------------------------------------------------------
-
-Bugs in radeonfb.o -- the radeon framebuffer driver.
-----------------------------------------------------
-
-Several bugs have been found in the radeonfb.o framebuffer driver.
-Most of these are resolved in the version included in the MiniGLX
-sources, but some remain:
-
-1) Occasionally, after entering graphics mode, colors appear 'shifted'
-or 'translated', particularly in higher resolution modes. This is
-definitely a bug in radeonfb.o as this can be provoked even when using
-the software dri driver (fb_dri.so). Importance: High. Workaround:
-Use 800x600 as it seems to be less frequent at this resolution,
-otherwise, restart the application.
-
-
-
diff --git a/src/glx/mini/dispatch.c b/src/glx/mini/dispatch.c
deleted file mode 100644
index ac24df9e7d4..00000000000
--- a/src/glx/mini/dispatch.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * \file miniglx/dispatch.c
- *
- * \brief C-based dispatch of the OpenGL entry points (glAccum(), glBegin(),
- * etc).
- *
- * \author Brian Paul <brian@precisioninsight.com>
- *
- * \note This code IS NOT USED if we're compiling on an x86 system and using
- * the glapi_x86.S assembly code.
- */
-
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "glheader.h"
-#include "glapi.h"
-#include "glapitable.h"
-
-
-#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM))
-
-#define KEYWORD1
-
-#define KEYWORD2
-
-#define NAME(func) gl##func
-
-#define DISPATCH(func, args, msg) \
- const struct _glapi_table *dispatch; \
- dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
- (dispatch->func) args
-
-#define RETURN_DISPATCH(func, args, msg) \
- const struct _glapi_table *dispatch; \
- dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\
- return (dispatch->func) args
-
-
-#include "glapitemp.h"
-
-#endif /* USE_X86_ASM */
diff --git a/src/glx/mini/driver.h b/src/glx/mini/driver.h
deleted file mode 100644
index 9e8bf6fa7cf..00000000000
--- a/src/glx/mini/driver.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * \file driver.h
- * \brief DRI utility functions definitions.
- *
- * This module acts as glue between GLX and the actual hardware driver. A DRI
- * driver doesn't really \e have to use any of this - it's optional. But, some
- * useful stuff is done here that otherwise would have to be duplicated in most
- * drivers.
- *
- * Basically, these utility functions take care of some of the dirty details of
- * screen initialization, context creation, context binding, DRM setup, etc.
- *
- * These functions are compiled into each DRI driver so libGL.so knows nothing
- * about them.
- *
- * Look for more comments in the dri_util.c file.
- *
- * \author Kevin E. Martin <kevin@precisioninsight.com>
- * \author Brian Paul <brian@precisioninsight.com>
- */
-
-/*
- * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _driver_H_
-#define _driver_H_
-
-#define CAPI /* XXX this should be globally defined somewhere */
-
-#include "GL/gl.h"
-#include "GL/internal/glcore.h"
-
-#include "drm.h"
-#include "drm_sarea.h"
-
-/**
- * \brief DRIDriverContext type.
- */
-typedef struct DRIDriverContextRec {
- const char *pciBusID;
- int pciBus;
- int pciDevice;
- int pciFunc;
- int chipset;
- int bpp;
- int cpp;
- int agpmode;
- int isPCI;
-
- int colorTiling; /**< \brief color tiling is enabled */
-
- unsigned long FBStart; /**< \brief physical address of the framebuffer */
- unsigned long MMIOStart; /**< \brief physical address of the MMIO region */
-
- int FBSize; /**< \brief size of the mmap'd framebuffer in bytes */
- int MMIOSize; /**< \brief size of the mmap'd MMIO region in bytes */
-
- void *FBAddress; /**< \brief start of the mmap'd framebuffer */
- void *MMIOAddress; /**< \brief start of the mmap'd MMIO region */
-
- /**
- * \brief Client configuration details
- *
- * These are computed on the server and sent to clients as part of
- * the initial handshaking.
- */
- struct {
- drm_handle_t hSAREA;
- int SAREASize;
- drm_handle_t hFrameBuffer;
- int fbOrigin;
- int fbSize;
- int fbStride;
- int virtualWidth;
- int virtualHeight;
- int Width;
- } shared;
-
- /**
- * \name From DRIInfoRec
- */
- /*@{*/
- int drmFD; /**< \brief DRM device file descriptor */
- drm_sarea_t *pSAREA;
- unsigned int serverContext; /**< \brief DRM context only active on server */
- /*@}*/
-
-
- /**
- * \name Driver private
- *
- * Populated by __driInitFBDev()
- */
- /*@{*/
- void *driverPrivate;
- void *driverClientMsg;
- int driverClientMsgSize;
- /*@}*/
-} DRIDriverContext;
-
-/**
- * \brief Interface to the DRI driver.
- *
- * This structure is retrieved from the loadable driver by the \e
- * __driDriver symbol to access the Mini GLX specific hardware
- * initialization and take down routines.
- */
-typedef struct DRIDriverRec {
- /**
- * \brief Validate the framebuffer device mode
- */
- int (*validateMode)( const DRIDriverContext *context );
-
- /**
- * \brief Examine mode returned by fbdev (may differ from the one
- * requested), restore any hw regs clobbered by fbdev.
- */
- int (*postValidateMode)( const DRIDriverContext *context );
-
- /**
- * \brief Initialize the framebuffer device.
- */
- int (*initFBDev)( DRIDriverContext *context );
-
- /**
- * \brief Halt the framebuffer device.
- */
- void (*haltFBDev)( DRIDriverContext *context );
-
-
- /**
- * \brief Idle and shutdown hardware in preparation for a VT switch.
- */
- int (*shutdownHardware)( const DRIDriverContext *context );
-
- /**
- * \brief Restore hardware state after regaining the VT.
- */
- int (*restoreHardware)( const DRIDriverContext *context );
-
- /**
- * \brief Notify hardware driver of gain/loose focus. May be zero
- * as this is of limited utility for most drivers.
- */
- void (*notifyFocus)( int have_focus );
-} DRIDriver;
-
-#endif /* _driver_H_ */
diff --git a/src/glx/mini/example.miniglx.conf b/src/glx/mini/example.miniglx.conf
deleted file mode 100644
index 62dd4f65ec4..00000000000
--- a/src/glx/mini/example.miniglx.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-# Example miniglx configuration file (/etc/miniglx.conf)
-#
-
-# Framebuffer device to open: Might need to change this on dual-head
-# systems.
-fbdevDevice=/dev/fb0
-
-# Which driver?
-# radeon_dri.so -- HW accelerated radeon driver
-# fb_dri.so -- Software rasterizer
-clientDriverName=radeon_dri.so
-
-# The pci bus id of the video card. Find this with scanpci, lspci or
-# look in /proc/pci.
-pciBusID=PCI:1:0:0
-
-# Is the card PCI or AGP ?
-isPCI=0
-
-# Virtual screen dimensions. Can reduce this to save videocard memory
-# at the expense of maximum window size available.
-virtualWidth=1280
-virtualHeight=1024
-
-# Screen depth. Only 16 & 32bpp supported.
-bpp=32
-
-# AGP Mode. Not all cards supported (1, 2 or 4)
-agpmode=1
-
-# Rotated monitor? -- NOTE: only works with subsetted radeon driver!
-rotateMode=0
-
-# Do we want to use color tiling ?
-colorTiling=0
-
diff --git a/src/glx/mini/miniglx.c b/src/glx/mini/miniglx.c
deleted file mode 100644
index d4b29508632..00000000000
--- a/src/glx/mini/miniglx.c
+++ /dev/null
@@ -1,2567 +0,0 @@
-/**
- * \file miniglx.c
- * \brief Mini GLX interface functions.
- * \author Brian Paul
- *
- * The Mini GLX interface is a subset of the GLX interface, plus a
- * minimal set of Xlib functions.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 6.0.1
- *
- * Copyright (C) 1999-2004 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.
- */
-
-
-/**
- * \mainpage Mini GLX
- *
- * \section miniglxIntro Introduction
- *
- * The Mini GLX interface facilitates OpenGL rendering on embedded devices. The
- * interface is a subset of the GLX interface, plus a minimal set of Xlib-like
- * functions.
- *
- * Programs written to the Mini GLX specification should run unchanged
- * on systems with the X Window System and the GLX extension (after
- * recompilation). The intention is to allow flexibility for
- * prototyping and testing.
- *
- * The files in the src/miniglx/ directory are compiled to build the
- * libGL.so library. This is the library which applications link with.
- * libGL.so in turn, loads the hardware-specific device driver.
- *
- *
- * \section miniglxDoxygen About Doxygen
- *
- * For a list of all files, select <b>File List</b>. Choose a file from
- * the list for a list of all functions in the file.
- *
- * For a list of all functions, types, constants, etc.
- * select <b>File Members</b>.
- *
- *
- * \section miniglxReferences References
- *
- * - <A HREF="file:../../docs/MiniGLX.html">Mini GLX Specification</A>,
- * Tungsten Graphics, Inc.
- * - OpenGL Graphics with the X Window System, Silicon Graphics, Inc.,
- * ftp://ftp.sgi.com/opengl/doc/opengl1.2/glx1.3.ps
- * - Xlib - C Language X Interface, X Consortium Standard, X Version 11,
- * Release 6.4, ftp://ftp.x.org/pub/R6.4/xc/doc/hardcopy/X11/xlib.PS.gz
- * - XFree86 Man pages, The XFree86 Project, Inc.,
- * http://www.xfree86.org/current/manindex3.html
- *
- */
-
-/**
- * \page datatypes Notes on the XVisualInfo, Visual, and __GLXvisualConfig data types
- *
- * -# X (unfortunately) has two (or three) data types which
- * describe visuals. Ideally, there would just be one.
- * -# We need the #__GLXvisualConfig type to augment #XVisualInfo and #Visual
- * because we need to describe the GLX-specific attributes of visuals.
- * -# In this interface there is a one-to-one-to-one correspondence between
- * the three types and they're all interconnected.
- * -# The #XVisualInfo type has a pointer to a #Visual. The #Visual structure
- * (aka MiniGLXVisualRec) has a pointer to the #__GLXvisualConfig. The
- * #Visual structure also has a pointer pointing back to the #XVisualInfo.
- * -# The #XVisualInfo structure is the only one who's contents are public.
- * -# The glXChooseVisual() and XGetVisualInfo() are the only functions that
- * return #XVisualInfo structures. They can be freed with XFree(), though
- * there is a small memory leak.
- */
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/time.h> /* for gettimeofday */
-#include <linux/kd.h>
-#include <linux/vt.h>
-
-#include "miniglxP.h"
-#include "dri_util.h"
-
-#include "imports.h"
-#include "glcontextmodes.h"
-#include "glapi.h"
-
-#include "pciaccess.h"
-
-static GLboolean __glXCreateContextWithConfig(__DRInativeDisplay *dpy,
- int screen, int fbconfigID, void *contextID,
- drm_context_t *hHWContext);
-
-static GLboolean __glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
- __DRIid draw, unsigned int * index, unsigned int * stamp,
- int * x, int * y, int * width, int * height,
- int * numClipRects, drm_clip_rect_t ** pClipRects,
- int * backX, int * backY,
- int * numBackClipRects, drm_clip_rect_t ** pBackClipRects);
-
-static __DRIscreen * __glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn);
-
-static GLboolean __glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw);
-
-static int __glXGetUST( int64_t * ust );
-
-static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable,
- int32_t * numerator, int32_t * denominator);
-
-static GLboolean xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen,
- __DRIid context_id );
-
-static GLboolean xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen,
- __DRIid drawable, drm_drawable_t *hHWDrawable );
-
-static GLboolean xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen,
- __DRIid drawable);
-
-
-/** Wrapper around either malloc() */
-void *
-_mesa_malloc(size_t bytes)
-{
- return malloc(bytes);
-}
-
-/** Wrapper around either calloc() */
-void *
-_mesa_calloc(size_t bytes)
-{
- return calloc(1, bytes);
-}
-
-/** Wrapper around either free() */
-void
-_mesa_free(void *ptr)
-{
- free(ptr);
-}
-
-
-/**
- * \brief Current GLX context.
- *
- * \sa glXGetCurrentContext().
- */
-static GLXContext CurrentContext = NULL;
-
-
-
-static Display *SignalDisplay = 0;
-
-static void SwitchVT(int sig)
-{
- fprintf(stderr, "SwitchVT %d dpy %p\n", sig, SignalDisplay);
-
- if (SignalDisplay) {
- SignalDisplay->vtSignalFlag = 1;
- switch( sig )
- {
- case SIGUSR1: /* vt has been released */
- SignalDisplay->haveVT = 0;
- break;
- case SIGUSR2: /* vt has been acquired */
- SignalDisplay->haveVT = 1;
- break;
- }
- }
-}
-
-/**********************************************************************/
-/** \name Framebuffer device functions */
-/**********************************************************************/
-/*@{*/
-
-/**
- * \brief Do the first part of setting up the framebuffer device.
- *
- * \param dpy the display handle.
- * \param use_vt use a VT for display or not
- *
- * \return GL_TRUE on success, or GL_FALSE on failure.
- *
- * \sa This is called during XOpenDisplay().
- *
- * \internal
- * Gets the VT number, opens the respective console TTY device. Saves its state
- * to restore when exiting and goes into graphics mode.
- *
- * Opens the framebuffer device and make a copy of the original variable screen
- * information and gets the fixed screen information. Maps the framebuffer and
- * MMIO region into the process address space.
- */
-static GLboolean
-OpenFBDev( Display *dpy, int use_vt )
-{
- char ttystr[1000];
- int fd, vtnumber, ttyfd;
-
- assert(dpy);
-
- if (geteuid()) {
- fprintf(stderr, "error: you need to be root\n");
- return GL_FALSE;
- }
-
- if (use_vt) {
-
- /* open /dev/tty0 and get the VT number */
- if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) {
- fprintf(stderr, "error opening /dev/tty0\n");
- return GL_FALSE;
- }
- if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) {
- fprintf(stderr, "error: couldn't get a free vt\n");
- return GL_FALSE;
- }
-
- fprintf(stderr, "*** got vt nr: %d\n", vtnumber);
- close(fd);
-
- /* open the console tty */
- sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */
- dpy->ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0);
- if (dpy->ConsoleFD < 0) {
- fprintf(stderr, "error couldn't open console fd\n");
- return GL_FALSE;
- }
-
- /* save current vt number */
- {
- struct vt_stat vts;
- if (ioctl(dpy->ConsoleFD, VT_GETSTATE, &vts) == 0)
- dpy->OriginalVT = vts.v_active;
- }
-
- /* disconnect from controlling tty */
- ttyfd = open("/dev/tty", O_RDWR);
- if (ttyfd >= 0) {
- ioctl(ttyfd, TIOCNOTTY, 0);
- close(ttyfd);
- }
-
- /* some magic to restore the vt when we exit */
- {
- struct vt_mode vt;
- struct sigaction sig_tty;
-
- /* Set-up tty signal handler to catch the signal we request below */
- SignalDisplay = dpy;
- memset( &sig_tty, 0, sizeof( sig_tty ) );
- sig_tty.sa_handler = SwitchVT;
- sigemptyset( &sig_tty.sa_mask );
- if( sigaction( SIGUSR1, &sig_tty, &dpy->OrigSigUsr1 ) ||
- sigaction( SIGUSR2, &sig_tty, &dpy->OrigSigUsr2 ) )
- {
- fprintf(stderr, "error: can't set up signal handler (%s)",
- strerror(errno) );
- return GL_FALSE;
- }
-
-
-
- vt.mode = VT_PROCESS;
- vt.waitv = 0;
- vt.relsig = SIGUSR1;
- vt.acqsig = SIGUSR2;
- if (ioctl(dpy->ConsoleFD, VT_SETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
-
- if (ioctl(dpy->ConsoleFD, VT_ACTIVATE, vtnumber) != 0)
- printf("ioctl VT_ACTIVATE: %s\n", strerror(errno));
- if (ioctl(dpy->ConsoleFD, VT_WAITACTIVE, vtnumber) != 0)
- printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno));
-
- if (ioctl(dpy->ConsoleFD, VT_GETMODE, &vt) < 0) {
- fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno));
- return GL_FALSE;
- }
-
-
-
- }
-
- /* go into graphics mode */
- if (ioctl(dpy->ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) {
- fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
- }
-
- /* open the framebuffer device */
- dpy->FrameBufferFD = open(dpy->fbdevDevice, O_RDWR);
- if (dpy->FrameBufferFD < 0) {
- fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno));
- return GL_FALSE;
- }
-
- /* get the original variable screen info */
- if (ioctl(dpy->FrameBufferFD, FBIOGET_VSCREENINFO, &dpy->OrigVarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
- /* make copy */
- dpy->VarInfo = dpy->OrigVarInfo; /* structure copy */
-
- /* Turn off hw accels (otherwise mmap of mmio region will be
- * refused)
- */
- dpy->VarInfo.accel_flags = 0;
- if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
-
-
- /* Get the fixed screen info */
- if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
-
-
- /* mmap the framebuffer into our address space */
- dpy->driverContext.FBStart = dpy->FixedInfo.smem_start;
- dpy->driverContext.FBSize = dpy->FixedInfo.smem_len;
- dpy->driverContext.shared.fbSize = dpy->FixedInfo.smem_len;
- dpy->driverContext.FBAddress = (caddr_t) mmap(0, /* start */
- dpy->driverContext.shared.fbSize, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- dpy->FrameBufferFD, /* fd */
- 0 /* offset */);
- if (dpy->driverContext.FBAddress == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
- /* mmap the MMIO region into our address space */
- dpy->driverContext.MMIOStart = dpy->FixedInfo.mmio_start;
- dpy->driverContext.MMIOSize = dpy->FixedInfo.mmio_len;
- dpy->driverContext.MMIOAddress = (caddr_t) mmap(0, /* start */
- dpy->driverContext.MMIOSize, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- dpy->FrameBufferFD, /* fd */
- dpy->FixedInfo.smem_len /* offset */);
- if (dpy->driverContext.MMIOAddress == (caddr_t) - 1) {
- fprintf(stderr, "error: unable to mmap mmio region: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
- fprintf(stderr, "got MMIOAddress %p offset %d\n",
- dpy->driverContext.MMIOAddress,
- dpy->FixedInfo.smem_len);
-
- return GL_TRUE;
-}
-
-
-
-
-/**
- * \brief Setup up the desired framebuffer device mode.
- *
- * \param dpy the display handle.
- *
- * \return GL_TRUE on success, or GL_FALSE on failure.
- *
- * \sa This is called during __miniglx_StartServer().
- *
- * \internal
- *
- * Bumps the size of the window the the next supported mode. Sets the
- * variable screen information according to the desired mode and asks
- * the driver to validate the mode. Certifies that a DirectColor or
- * TrueColor visual is used from the updated fixed screen information.
- * In the case of DirectColor visuals, sets up an 'identity' colormap to
- * mimic a TrueColor visual.
- *
- * Calls the driver hooks 'ValidateMode' and 'PostValidateMode' to
- * allow the driver to make modifications to the chosen mode according
- * to hardware constraints, or to save and restore videocard registers
- * that may be clobbered by the fbdev driver.
- *
- * \todo Timings are hard-coded in the source for a set of supported modes.
- */
-static GLboolean
-SetupFBDev( Display *dpy )
-{
- int width, height;
-
- assert(dpy);
-
- width = dpy->driverContext.shared.virtualWidth;
- height = dpy->driverContext.shared.virtualHeight;
-
- if (width==832)
- width=800;
-#if 0
- /* Bump size up to next supported mode.
- */
- if (width <= 720 && height <= 480) {
- width = 720; height = 480;
- }
- else if (width <= 960 && height <= 540) {
- width = 960; height = 540;
- }
- else if (width <= 800 && height <= 600) {
- width = 800; height = 600;
- }
- else if (width <= 1024 && height <= 768) {
- width = 1024; height = 768;
- }
- else if (width <= 768 && height <= 1024) {
- width = 768; height = 1024;
- }
- else if (width <= 1280 && height <= 1024) {
- width = 1280; height = 1024;
- }
-#endif
-
- dpy->driverContext.shared.fbStride = width * (dpy->driverContext.bpp / 8);
-
- /* set the depth, resolution, etc */
- dpy->VarInfo = dpy->OrigVarInfo;
- dpy->VarInfo.bits_per_pixel = dpy->driverContext.bpp;
- dpy->VarInfo.xres_virtual = dpy->driverContext.shared.virtualWidth;
- dpy->VarInfo.yres_virtual = dpy->driverContext.shared.virtualHeight;
- dpy->VarInfo.xres = dpy->driverContext.shared.Width;
- dpy->VarInfo.yres = height;
- dpy->VarInfo.xoffset = 0;
- dpy->VarInfo.yoffset = 0;
- dpy->VarInfo.nonstd = 0;
- dpy->VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */
-
- if (dpy->VarInfo.bits_per_pixel == 32) {
- dpy->VarInfo.red.offset = 16;
- dpy->VarInfo.green.offset = 8;
- dpy->VarInfo.blue.offset = 0;
- dpy->VarInfo.transp.offset = 24;
- dpy->VarInfo.red.length = 8;
- dpy->VarInfo.green.length = 8;
- dpy->VarInfo.blue.length = 8;
- dpy->VarInfo.transp.length = 8;
- }
- else if (dpy->VarInfo.bits_per_pixel == 16) {
- dpy->VarInfo.red.offset = 11;
- dpy->VarInfo.green.offset = 5;
- dpy->VarInfo.blue.offset = 0;
- dpy->VarInfo.red.length = 5;
- dpy->VarInfo.green.length = 6;
- dpy->VarInfo.blue.length = 5;
- dpy->VarInfo.transp.offset = 0;
- dpy->VarInfo.transp.length = 0;
- }
- else {
- fprintf(stderr, "Only 32bpp and 16bpp modes supported at the moment\n");
- return 0;
- }
-
- if (!dpy->driver->validateMode( &dpy->driverContext )) {
- fprintf(stderr, "Driver validateMode() failed\n");
- return 0;
- }
-
- /* These should be calculated with the gtf.c program, and then we could
- remove all this... AlanH. */
- if (dpy->VarInfo.xres == 1280 &&
- dpy->VarInfo.yres == 1024) {
- /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
- dpy->VarInfo.pixclock = 7408;
- dpy->VarInfo.left_margin = 248;
- dpy->VarInfo.right_margin = 16;
- dpy->VarInfo.upper_margin = 38;
- dpy->VarInfo.lower_margin = 1;
- dpy->VarInfo.hsync_len = 144;
- dpy->VarInfo.vsync_len = 3;
- }
- else if (dpy->VarInfo.xres == 1024 &&
- dpy->VarInfo.yres == 768) {
- /* timing values taken from /etc/fb.modes (1024x768 @ 75Hz) */
- dpy->VarInfo.pixclock = 12699;
- dpy->VarInfo.left_margin = 176;
- dpy->VarInfo.right_margin = 16;
- dpy->VarInfo.upper_margin = 28;
- dpy->VarInfo.lower_margin = 1;
- dpy->VarInfo.hsync_len = 96;
- dpy->VarInfo.vsync_len = 3;
- }
- else if (dpy->VarInfo.xres == 800 &&
- dpy->VarInfo.yres == 600) {
- /* timing values taken from /etc/fb.modes (800x600 @ 75Hz) */
- dpy->VarInfo.pixclock = 27778;
- dpy->VarInfo.left_margin = 128;
- dpy->VarInfo.right_margin = 24;
- dpy->VarInfo.upper_margin = 22;
- dpy->VarInfo.lower_margin = 1;
- dpy->VarInfo.hsync_len = 72;
- dpy->VarInfo.vsync_len = 2;
- }
- else if (dpy->VarInfo.xres == 720 &&
- dpy->VarInfo.yres == 480) {
- dpy->VarInfo.pixclock = 37202;
- dpy->VarInfo.left_margin = 88;
- dpy->VarInfo.right_margin = 16;
- dpy->VarInfo.upper_margin = 14;
- dpy->VarInfo.lower_margin = 1;
- dpy->VarInfo.hsync_len = 72;
- dpy->VarInfo.vsync_len = 3;
- }
- else if (dpy->VarInfo.xres == 960 &&
- dpy->VarInfo.yres == 540) {
- dpy->VarInfo.pixclock = 24273;
- dpy->VarInfo.left_margin = 128;
- dpy->VarInfo.right_margin = 32;
- dpy->VarInfo.upper_margin = 16;
- dpy->VarInfo.lower_margin = 1;
- dpy->VarInfo.hsync_len = 96;
- dpy->VarInfo.vsync_len = 3;
- }
- else if (dpy->VarInfo.xres == 768 &&
- dpy->VarInfo.yres == 1024) {
- /* timing values for 768x1024 @ 75Hz */
- dpy->VarInfo.pixclock = 11993;
- dpy->VarInfo.left_margin = 136;
- dpy->VarInfo.right_margin = 32;
- dpy->VarInfo.upper_margin = 41;
- dpy->VarInfo.lower_margin = 1;
- dpy->VarInfo.hsync_len = 80;
- dpy->VarInfo.vsync_len = 3;
- }
- else {
- /* XXX need timings for other screen sizes */
- fprintf(stderr, "XXXX screen size %d x %d not supported at this time!\n",
- dpy->VarInfo.xres, dpy->VarInfo.yres);
- return GL_FALSE;
- }
-
- fprintf(stderr, "[miniglx] Setting mode: visible %dx%d virtual %dx%dx%d\n",
- dpy->VarInfo.xres, dpy->VarInfo.yres,
- dpy->VarInfo.xres_virtual, dpy->VarInfo.yres_virtual,
- dpy->VarInfo.bits_per_pixel);
-
- /* set variable screen info */
- if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
- /* get the variable screen info, in case it has been modified */
- if (ioctl(dpy->FrameBufferFD, FBIOGET_VSCREENINFO, &dpy->VarInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
-
- fprintf(stderr, "[miniglx] Readback mode: visible %dx%d virtual %dx%dx%d\n",
- dpy->VarInfo.xres, dpy->VarInfo.yres,
- dpy->VarInfo.xres_virtual, dpy->VarInfo.yres_virtual,
- dpy->VarInfo.bits_per_pixel);
-
- /* Get the fixed screen info */
- if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- return GL_FALSE;
- }
-
- if (dpy->FixedInfo.visual != FB_VISUAL_TRUECOLOR &&
- dpy->FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) {
- fprintf(stderr, "non-TRUECOLOR visuals not supported.\n");
- return GL_FALSE;
- }
-
- if (dpy->FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
- struct fb_cmap cmap;
- unsigned short red[256], green[256], blue[256];
- int rcols = 1 << dpy->VarInfo.red.length;
- int gcols = 1 << dpy->VarInfo.green.length;
- int bcols = 1 << dpy->VarInfo.blue.length;
- int i;
-
- cmap.start = 0;
- cmap.len = gcols;
- cmap.red = red;
- cmap.green = green;
- cmap.blue = blue;
- cmap.transp = NULL;
-
- for (i = 0; i < rcols ; i++)
- red[i] = (65536/(rcols-1)) * i;
-
- for (i = 0; i < gcols ; i++)
- green[i] = (65536/(gcols-1)) * i;
-
- for (i = 0; i < bcols ; i++)
- blue[i] = (65536/(bcols-1)) * i;
-
- if (ioctl(dpy->FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) {
- fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
- exit(1);
- }
- }
-
- /* May need to restore regs fbdev has clobbered:
- */
- if (!dpy->driver->postValidateMode( &dpy->driverContext )) {
- fprintf(stderr, "Driver postValidateMode() failed\n");
- return 0;
- }
-
- return GL_TRUE;
-}
-
-
-/**
- * \brief Restore the framebuffer device to state it was in before we started
- *
- * Undoes the work done by SetupFBDev().
- *
- * \param dpy the display handle.
- *
- * \return GL_TRUE on success, or GL_FALSE on failure.
- *
- * \sa Called from XDestroyWindow().
- *
- * \internal
- * Restores the original variable screen info.
- */
-static GLboolean
-RestoreFBDev( Display *dpy )
-{
- /* restore original variable screen info */
- if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->OrigVarInfo)) {
- fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n",
- strerror(errno));
- return GL_FALSE;
- }
- dpy->VarInfo = dpy->OrigVarInfo;
-
- return GL_TRUE;
-}
-
-
-/**
- * \brief Close the framebuffer device.
- *
- * \param dpy the display handle.
- *
- * \sa Called from XCloseDisplay().
- *
- * \internal
- * Unmaps the framebuffer and MMIO region. Restores the text mode and the
- * original virtual terminal. Closes the console and framebuffer devices.
- */
-static void
-CloseFBDev( Display *dpy )
-{
- struct vt_mode VT;
-
- munmap(dpy->driverContext.FBAddress, dpy->driverContext.FBSize);
- munmap(dpy->driverContext.MMIOAddress, dpy->driverContext.MMIOSize);
-
- if (dpy->ConsoleFD) {
- /* restore text mode */
- ioctl(dpy->ConsoleFD, KDSETMODE, KD_TEXT);
-
- /* set vt */
- if (ioctl(dpy->ConsoleFD, VT_GETMODE, &VT) != -1) {
- VT.mode = VT_AUTO;
- ioctl(dpy->ConsoleFD, VT_SETMODE, &VT);
- }
-
- /* restore original vt */
- if (dpy->OriginalVT >= 0) {
- ioctl(dpy->ConsoleFD, VT_ACTIVATE, dpy->OriginalVT);
- dpy->OriginalVT = -1;
- }
-
- close(dpy->ConsoleFD);
- }
- close(dpy->FrameBufferFD);
-}
-
-/*@}*/
-
-
-/**********************************************************************/
-/** \name Misc functions needed for DRI drivers */
-/**********************************************************************/
-/*@{*/
-
-/**
- * \brief Find the DRI screen dependent methods associated with the display.
- *
- * \param dpy a display handle, as returned by XOpenDisplay().
- * \param scrn the screen number. Not referenced.
- *
- * \returns a pointer to a __DRIscreenRec structure.
- *
- * \internal
- * Returns the MiniGLXDisplayRec::driScreen attribute.
- */
-static __DRIscreen *
-__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn)
-{
- (void) scrn;
- return &((Display*)dpy)->driScreen;
-}
-
-/**
- * \brief Validate a drawable.
- *
- * \param dpy a display handle, as returned by XOpenDisplay().
- * \param draw drawable to validate.
- *
- * \internal
- * Since Mini GLX only supports one window, compares the specified drawable with
- * the MiniGLXDisplayRec::TheWindow attribute.
- */
-static GLboolean
-__glXWindowExists(__DRInativeDisplay *dpy, __DRIid draw)
-{
- const Display * const display = (Display*)dpy;
- if (display->TheWindow == (Window) draw)
- return True;
- else
- return False;
-}
-
-/**
- * \brief Get current thread ID.
- *
- * \return thread ID.
- *
- * \internal
- * Always returns 0.
- */
-/*unsigned long
-_glthread_GetID(void)
-{
- return 0;
-}*/
-
-/*@}*/
-
-
-/**
- * \brief Scan Linux /prog/bus/pci/devices file to determine hardware
- * chipset based on supplied bus ID.
- *
- * \return probed chipset (non-zero) on success, zero otherwise.
- *
- * \internal
- */
-static int get_chipset_from_busid( Display *dpy )
-{
- char buf[0x200];
- FILE *file;
- const char *fname = "/proc/bus/pci/devices";
- int retval = 0;
-
- if (!(file = fopen(fname,"r"))) {
- fprintf(stderr, "couldn't open %s: %s\n", fname, strerror(errno));
- return 0;
- }
-
- while (fgets(buf, sizeof(buf)-1, file)) {
- unsigned int nr, bus, dev, fn, vendor, device, encode;
- nr = sscanf(buf, "%04x\t%04x%04x", &encode,
- &vendor, &device);
-
- bus = encode >> 8;
- dev = (encode & 0xFF) >> 3;
- fn = encode & 0x7;
-
- if (nr != 3)
- break;
-
- if (bus == dpy->driverContext.pciBus &&
- dev == dpy->driverContext.pciDevice &&
- fn == dpy->driverContext.pciFunc) {
- retval = device;
- break;
- }
- }
-
- fclose(file);
-
- if (retval)
- fprintf(stderr, "[miniglx] probed chipset 0x%x\n", retval);
- else
- fprintf(stderr, "[miniglx] failed to probe chipset\n");
-
- return retval;
-}
-
-
-/**
- * \brief Read settings from a configuration file.
- *
- * The configuration file is usually "/etc/miniglx.conf", but can be overridden
- * with the MINIGLX_CONF environment variable.
- *
- * The format consists in \code option = value \endcode lines. The option names
- * corresponds to the fields in MiniGLXDisplayRec.
- *
- * \param dpy the display handle as.
- *
- * \return non-zero on success, zero otherwise.
- *
- * \internal
- * Sets some defaults. Opens and parses the the Mini GLX configuration file and
- * fills in the MiniGLXDisplayRec field that corresponds for each option.
- */
-static int __read_config_file( Display *dpy )
-{
- FILE *file;
- const char *fname;
-
- /* Fallback/defaults
- */
- dpy->fbdevDevice = "/dev/fb0";
- dpy->clientDriverName = "fb_dri.so";
- dpy->driverContext.pciBus = 0;
- dpy->driverContext.pciDevice = 0;
- dpy->driverContext.pciFunc = 0;
- dpy->driverContext.chipset = 0;
- dpy->driverContext.pciBusID = 0;
- dpy->driverContext.shared.virtualWidth = 1280;
- dpy->driverContext.shared.virtualHeight = 1024;
- dpy->driverContext.bpp = 32;
- dpy->driverContext.cpp = 4;
- dpy->rotateMode = 0;
- dpy->driverContext.agpmode = 1;
- dpy->driverContext.isPCI = 0;
- dpy->driverContext.colorTiling = 0;
-
- fname = getenv("MINIGLX_CONF");
- if (!fname) fname = "/etc/miniglx.conf";
-
- file = fopen(fname, "r");
- if (!file) {
- fprintf(stderr, "couldn't open config file %s: %s\n", fname, strerror(errno));
- return 0;
- }
-
-
- while (!feof(file)) {
- char buf[81], *opt = buf, *val, *tmp1, *tmp2;
- fgets(buf, sizeof(buf), file);
-
- /* Parse 'opt = val' -- must be easier ways to do this.
- */
- while (isspace(*opt)) opt++;
- val = opt;
- if (*val == '#') continue; /* comment */
- while (!isspace(*val) && *val != '=' && *val) val++;
- tmp1 = val;
- while (isspace(*val)) val++;
- if (*val != '=') continue;
- *tmp1 = 0;
- val++;
- while (isspace(*val)) val++;
- tmp2 = val;
- while (!isspace(*tmp2) && *tmp2 != '\n' && *tmp2) tmp2++;
- *tmp2 = 0;
-
-
- if (strcmp(opt, "fbdevDevice") == 0)
- dpy->fbdevDevice = strdup(val);
- else if (strcmp(opt, "clientDriverName") == 0)
- dpy->clientDriverName = strdup(val);
- else if (strcmp(opt, "rotateMode") == 0)
- dpy->rotateMode = atoi(val) ? 1 : 0;
- else if (strcmp(opt, "pciBusID") == 0) {
- if (sscanf(val, "PCI:%d:%d:%d",
- &dpy->driverContext.pciBus,
- &dpy->driverContext.pciDevice,
- &dpy->driverContext.pciFunc) != 3) {
- fprintf(stderr, "malformed bus id: %s\n", val);
- continue;
- }
- dpy->driverContext.pciBusID = strdup(val);
- }
- else if (strcmp(opt, "chipset") == 0) {
- if (sscanf(val, "0x%x", &dpy->driverContext.chipset) != 1)
- fprintf(stderr, "malformed chipset: %s\n", opt);
- }
- else if (strcmp(opt, "virtualWidth") == 0) {
- if (sscanf(val, "%d", &dpy->driverContext.shared.virtualWidth) != 1)
- fprintf(stderr, "malformed virtualWidth: %s\n", opt);
- }
- else if (strcmp(opt, "virtualHeight") == 0) {
- if (sscanf(val, "%d", &dpy->driverContext.shared.virtualHeight) != 1)
- fprintf(stderr, "malformed virutalHeight: %s\n", opt);
- }
- else if (strcmp(opt, "bpp") == 0) {
- if (sscanf(val, "%d", &dpy->driverContext.bpp) != 1)
- fprintf(stderr, "malformed bpp: %s\n", opt);
- dpy->driverContext.cpp = dpy->driverContext.bpp / 8;
- }
- else if (strcmp(opt, "agpmode") == 0) {
- if (sscanf(val, "%d", &dpy->driverContext.agpmode) != 1)
- fprintf(stderr, "malformed agpmode: %s\n", opt);
- }
- else if (strcmp(opt, "isPCI") == 0) {
- dpy->driverContext.isPCI = atoi(val) ? 1 : 0;
- }
- else if (strcmp(opt, "colorTiling") == 0) {
- dpy->driverContext.colorTiling = atoi(val) ? 1 : 0;
- }
- }
-
- fclose(file);
-
- if (dpy->driverContext.chipset == 0 && dpy->driverContext.pciBusID != 0)
- dpy->driverContext.chipset = get_chipset_from_busid( dpy );
-
- return 1;
-}
-
-/**
- * Versioned name of the expected \c __driCreateNewScreen function.
- *
- * The version of the last incompatible loader/driver inteface change is
- * appended to the name of the \c __driCreateNewScreen function. This
- * prevents loaders from trying to load drivers that are too old.
- *
- * \todo
- * Create a macro or something so that this is automatically updated.
- */
-static const char createNewScreenName[] = "__driCreateNewScreen_20050727";
-
-
-static int InitDriver( Display *dpy )
-{
- /*
- * Begin DRI setup.
- * We're kind of combining the per-display and per-screen information
- * which was kept separate in XFree86/DRI's libGL.
- */
- dpy->dlHandle = dlopen(dpy->clientDriverName, RTLD_NOW | RTLD_GLOBAL);
- if (!dpy->dlHandle) {
- fprintf(stderr, "Unable to open %s: %s\n", dpy->clientDriverName,
- dlerror());
- goto failed;
- }
-
- /* Pull in Mini GLX specific hooks:
- */
- dpy->driver = (struct DRIDriverRec *) dlsym(dpy->dlHandle,
- "__driDriver");
- if (!dpy->driver) {
- fprintf(stderr, "Couldn't find __driDriver in %s\n",
- dpy->clientDriverName);
- goto failed;
- }
-
- /* Pull in standard DRI client-side driver hooks:
- */
- dpy->createNewScreen = (PFNCREATENEWSCREENFUNC)
- dlsym(dpy->dlHandle, createNewScreenName);
- if (!dpy->createNewScreen) {
- fprintf(stderr, "Couldn't find %s in %s\n", createNewScreenName,
- dpy->clientDriverName);
- goto failed;
- }
-
- return GL_TRUE;
-
-failed:
- if (dpy->dlHandle) {
- dlclose(dpy->dlHandle);
- dpy->dlHandle = 0;
- }
- return GL_FALSE;
-}
-
-
-/**********************************************************************/
-/** \name Public API functions (Xlib and GLX) */
-/**********************************************************************/
-/*@{*/
-
-
-/**
- * \brief Initialize the graphics system.
- *
- * \param display_name currently ignored. It is recommended to pass it as NULL.
- * \return a pointer to a #Display if the function is able to initialize
- * the graphics system, NULL otherwise.
- *
- * Allocates a MiniGLXDisplayRec structure and fills in with information from a
- * configuration file.
- *
- * Calls OpenFBDev() to open the framebuffer device and calls
- * DRIDriverRec::initFBDev to do the client-side initialization on it.
- *
- * Loads the DRI driver and pulls in Mini GLX specific hooks into a
- * DRIDriverRec structure, and the standard DRI \e __driCreateScreen hook.
- * Asks the driver for a list of supported visuals. Performs the per-screen
- * client-side initialization. Also setups the callbacks in the screen private
- * information.
- *
- * Does the framebuffer device setup. Calls __miniglx_open_connections() to
- * serve clients.
- */
-Display *
-__miniglx_StartServer( const char *display_name )
-{
- Display *dpy;
- int use_vt = 0;
-
- pci_system_init();
-
- dpy = (Display *)calloc(1, sizeof(Display));
- if (!dpy)
- return NULL;
-
- dpy->IsClient = False;
-
- if (!__read_config_file( dpy )) {
- fprintf(stderr, "Couldn't get configuration details\n");
- free(dpy);
- return NULL;
- }
-
- /* Open the fbdev device
- */
- if (!OpenFBDev(dpy, use_vt)) {
- fprintf(stderr, "OpenFBDev failed\n");
- free(dpy);
- return NULL;
- }
-
- if (!InitDriver(dpy)) {
- fprintf(stderr, "InitDriver failed\n");
- free(dpy);
- return NULL;
- }
-
- /* Perform the initialization normally done in the X server
- */
- if (!dpy->driver->initFBDev( &dpy->driverContext )) {
- fprintf(stderr, "%s: __driInitFBDev failed\n", __FUNCTION__);
- dlclose(dpy->dlHandle);
- return GL_FALSE;
- }
-
- /* do fbdev setup
- */
- if (!SetupFBDev(dpy)) {
- fprintf(stderr, "SetupFBDev failed\n");
- free(dpy);
- return NULL;
- }
-
- /* unlock here if not using VT -- JDS */
- if (!use_vt) {
- if (dpy->driver->restoreHardware)
- dpy->driver->restoreHardware( &dpy->driverContext );
- DRM_UNLOCK( dpy->driverContext.drmFD,
- dpy->driverContext.pSAREA,
- dpy->driverContext.serverContext );
- dpy->hwActive = 1;
- }
-
- /* Ready for clients:
- */
- if (!__miniglx_open_connections(dpy)) {
- free(dpy);
- return NULL;
- }
-
- return dpy;
-}
-
-
-/**
- * Implement \c __DRIinterfaceMethods::getProcAddress.
- */
-static __DRIfuncPtr get_proc_address( const char * proc_name )
-{
- (void) proc_name;
- return NULL;
-}
-
-
-/**
- * Table of functions exported by the loader to the driver.
- */
-static const __DRIinterfaceMethods interface_methods = {
- get_proc_address,
-
- _gl_context_modes_create,
- _gl_context_modes_destroy,
-
- __glXFindDRIScreen,
- __glXWindowExists,
-
- __glXCreateContextWithConfig,
- xf86DRI_DestroyContext,
-
- xf86DRI_CreateDrawable,
- xf86DRI_DestroyDrawable,
- __glXGetDrawableInfo,
-
- __glXGetUST,
- __glXGetMscRate,
-};
-
-
-static void *
-CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
-{
- void *psp = NULL;
- drm_handle_t hSAREA;
- drmAddress pSAREA;
- const char *BusID;
- int i;
- __DRIversion ddx_version;
- __DRIversion dri_version;
- __DRIversion drm_version;
- __DRIframebuffer framebuffer;
- int fd = -1;
- int status;
- const char * err_msg;
- const char * err_extra;
- drmVersionPtr version;
- drm_handle_t hFB;
- drm_magic_t magic;
-
-
- hSAREA = dpy->driverContext.shared.hSAREA;
- BusID = dpy->driverContext.pciBusID;
-
- fd = drmOpen(NULL, BusID);
-
- err_msg = "open DRM";
- err_extra = strerror( -fd );
-
- if (fd < 0) goto done;
-
- err_msg = "drmGetMagic";
- err_extra = NULL;
-
- if (drmGetMagic(fd, &magic)) goto done;
-
- dpy->authorized = False;
- send_char_msg( dpy, 0, _Authorize );
- send_msg( dpy, 0, &magic, sizeof(magic));
-
- /* force net buffer flush */
- while (!dpy->authorized)
- handle_fd_events( dpy, 0 );
-
- version = drmGetVersion(fd);
- if (version) {
- drm_version.major = version->version_major;
- drm_version.minor = version->version_minor;
- drm_version.patch = version->version_patchlevel;
- drmFreeVersion(version);
- }
- else {
- drm_version.major = -1;
- drm_version.minor = -1;
- drm_version.patch = -1;
- }
-
- /*
- * Get device name (like "tdfx") and the ddx version numbers.
- * We'll check the version in each DRI driver's "createScreen"
- * function.
- */
- ddx_version.major = -1;
- ddx_version.minor = 0;
- ddx_version.patch = 0;
-
- /*
- * Get the DRI X extension version.
- */
- dri_version.major = 4;
- dri_version.minor = 0;
- dri_version.patch = 0;
-
- /*
- * Get device-specific info. pDevPriv will point to a struct
- * (such as DRIRADEONRec in xfree86/driver/ati/radeon_dri.h)
- * that has information about the screen size, depth, pitch,
- * ancilliary buffers, DRM mmap handles, etc.
- */
- hFB = dpy->driverContext.shared.hFrameBuffer;
- framebuffer.size = dpy->driverContext.shared.fbSize;
- framebuffer.stride = dpy->driverContext.shared.fbStride;
- framebuffer.dev_priv_size = dpy->driverContext.driverClientMsgSize;
- framebuffer.dev_priv = dpy->driverContext.driverClientMsg;
- framebuffer.width = dpy->driverContext.shared.virtualWidth;
- framebuffer.height = dpy->driverContext.shared.virtualHeight;
-
- /*
- * Map the framebuffer region.
- */
- status = drmMap(fd, hFB, framebuffer.size,
- (drmAddressPtr)&framebuffer.base);
-
- err_msg = "drmMap of framebuffer";
- err_extra = strerror( -status );
-
- if ( status != 0 ) goto done;
-
- /*
- * Map the SAREA region. Further mmap regions may be setup in
- * each DRI driver's "createScreen" function.
- */
- status = drmMap(fd, hSAREA, SAREA_MAX, &pSAREA);
-
- err_msg = "drmMap of sarea";
- err_extra = strerror( -status );
-
- if ( status == 0 ) {
- err_msg = "InitDriver";
- err_extra = NULL;
- psp = dpy->createNewScreen(dpy, scrn, psc, NULL,
- & ddx_version,
- & dri_version,
- & drm_version,
- & framebuffer,
- pSAREA,
- fd,
- 20050727,
- & interface_methods,
- (__GLcontextModes **) &dpy->driver_modes);
-
- /* fill in dummy visual ids */
- {
- __GLcontextModes *temp;
- temp = (__GLcontextModes *)dpy->driver_modes;
- i = 1;
- while (temp)
- {
- temp->visualID = i++;
- temp=temp->next;
- }
- }
- }
-
-done:
- if ( psp == NULL ) {
- if ( pSAREA != MAP_FAILED ) {
- (void)drmUnmap(pSAREA, SAREA_MAX);
- }
-
- if ( framebuffer.base != MAP_FAILED ) {
- (void)drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
- }
-
- if ( framebuffer.dev_priv != NULL ) {
- free(framebuffer.dev_priv);
- }
-
- if ( fd >= 0 ) {
- (void)drmClose(fd);
- }
-
- if ( err_extra != NULL ) {
- fprintf(stderr, "libGL error: %s failed (%s)\n", err_msg,
- err_extra);
- }
- else {
- fprintf(stderr, "libGL error: %s failed\n", err_msg );
- }
-
- fprintf(stderr, "libGL error: reverting to (slow) indirect rendering\n");
- }
-
- return psp;
-}
-
-/**
- * \brief Initialize the graphics system.
- *
- * \param display_name currently ignored. It is recommended to pass it as NULL.
- * \return a pointer to a #Display if the function is able to initialize
- * the graphics system, NULL otherwise.
- *
- * Allocates a MiniGLXDisplayRec structure and fills in with information from a
- * configuration file.
- *
- * Calls __miniglx_open_connections() to connect to the server.
- *
- * Loads the DRI driver and pulls in Mini GLX specific hooks into a
- * DRIDriverRec structure, and the standard DRI \e __driCreateScreen hook.
- * Asks the driver for a list of supported visuals. Performs the per-screen
- * client-side initialization. Also setups the callbacks in the screen private
- * information.
- *
- * \todo
- * - read config file
- * - what about virtualWidth, etc?
- * - determine dpy->driverClientMsgSize,
- * - allocate dpy->driverClientMsg
- */
-Display *
-XOpenDisplay( const char *display_name )
-{
- Display *dpy;
-
- dpy = (Display *)calloc(1, sizeof(Display));
- if (!dpy)
- return NULL;
-
- dpy->IsClient = True;
-
- /* read config file
- */
- if (!__read_config_file( dpy )) {
- fprintf(stderr, "Couldn't get configuration details\n");
- free(dpy);
- return NULL;
- }
-
- /* Connect to the server and receive driverClientMsg
- */
- if (!__miniglx_open_connections(dpy)) {
- free(dpy);
- return NULL;
- }
-
- /* dlopen the driver .so file
- */
- if (!InitDriver(dpy)) {
- fprintf(stderr, "InitDriver failed\n");
- free(dpy);
- return NULL;
- }
-
- /* Perform the client-side initialization.
- *
- * Clearly there is a limit of one on the number of windows in
- * existence at any time.
- *
- * Need to shut down DRM and free DRI data in XDestroyWindow(), too.
- */
- dpy->driScreen.private = CallCreateNewScreen(dpy, 0, &dpy->driScreen);
- if (!dpy->driScreen.private) {
- fprintf(stderr, "%s: __driCreateScreen failed\n", __FUNCTION__);
- dlclose(dpy->dlHandle);
- free(dpy);
- return NULL;
- }
-
- /* Anything more to do?
- */
- return dpy;
-}
-
-
-/**
- * \brief Release display resources.
- *
- * When the application is about to exit, the resources associated with the
- * graphics system can be released by calling this function.
- *
- * \param dpy display handle. It becomes invalid at this point.
- *
- * Destroys the window if any, and destroys the per-screen
- * driver private information.
- * Calls __miniglx_close_connections().
- *
- * If a server, puts the the framebuffer back into the initial state.
- *
- * Finally frees the display structure.
- */
-void
-XCloseDisplay( Display *dpy )
-{
- glXMakeCurrent( dpy, NULL, NULL);
-
- if (dpy->NumWindows)
- XDestroyWindow( dpy, dpy->TheWindow );
-
- /* As this is done in XOpenDisplay, need to undo it here:
- */
- dpy->driScreen.destroyScreen(dpy, 0, dpy->driScreen.private);
-
- __miniglx_close_connections( dpy );
-
- if (!dpy->IsClient) {
- /* put framebuffer back to initial state
- */
- (*dpy->driver->haltFBDev)( &dpy->driverContext );
- RestoreFBDev(dpy);
- CloseFBDev(dpy);
- }
-
- dlclose(dpy->dlHandle);
- free(dpy);
-}
-
-
-/**
- * \brief Window creation.
- *
- * \param display a display handle, as returned by XOpenDisplay().
- * \param parent the parent window for the new window. For Mini GLX this should
- * be
- * \code RootWindow(display, 0) \endcode
- * \param x the window abscissa. For Mini GLX, it should be zero.
- * \param y the window ordinate. For Mini GLX, it should be zero.
- * \param width the window width. For Mini GLX, this specifies the desired
- * screen width such as 1024 or 1280.
- * \param height the window height. For Mini GLX, this specifies the desired
- * screen height such as 768 or 1024.
- * \param border_width the border width. For Mini GLX, it should be zero.
- * \param depth the window pixel depth. For Mini GLX, this should be the depth
- * found in the #XVisualInfo object returned by glXChooseVisual()
- * \param winclass the window class. For Mini GLX this value should be
- * #InputOutput.
- * \param visual the visual type. It should be the visual field of the
- * #XVisualInfo object returned by glXChooseVisual().
- * \param valuemask which fields of the XSetWindowAttributes() are to be used.
- * For Mini GLX this is typically the bitmask
- * \code CWBackPixel | CWBorderPixel | CWColormap \endcode
- * \param attributes initial window attributes. The
- * XSetWindowAttributes::background_pixel, XSetWindowAttributes::border_pixel
- * and XSetWindowAttributes::colormap fields should be set.
- *
- * \return a window handle if it succeeds or zero if it fails.
- *
- * \note For Mini GLX, windows are full-screen; they cover the entire frame
- * buffer. Also, Mini GLX imposes a limit of one window. A second window
- * cannot be created until the first one is destroyed.
- *
- * This function creates and initializes a ::MiniGLXWindowRec structure after
- * ensuring that there is no other window created. Performs the per-drawable
- * client-side initialization calling the __DRIscreenRec::createDrawable
- * method.
- *
- */
-Window
-XCreateWindow( Display *dpy, Window parent, int x, int y,
- unsigned int width, unsigned int height,
- unsigned int border_width, int depth, unsigned int winclass,
- Visual *visual, unsigned long valuemask,
- XSetWindowAttributes *attributes )
-{
- const int empty_attribute_list[1] = { None };
-
- Window win;
-
- /* ignored */
- (void) x;
- (void) y;
- (void) border_width;
- (void) depth;
- (void) winclass;
- (void) valuemask;
- (void) attributes;
-
- if (!dpy->IsClient) {
- fprintf(stderr, "Server process may not create windows (currently)\n");
- return NULL;
- }
-
- if (dpy->NumWindows > 0)
- return NULL; /* only allow one window */
-
- assert(dpy->TheWindow == NULL);
-
- win = malloc(sizeof(struct MiniGLXWindowRec));
- if (!win)
- return NULL;
-
- /* In rotated mode, translate incoming x,y,width,height into
- * 'normal' coordinates.
- */
- if (dpy->rotateMode) {
- int tmp;
- tmp = width; width = height; height = tmp;
- tmp = x; x = y; y = tmp;
- }
-
- /* init other per-window fields */
- win->x = 0;
- win->y = 0;
- win->w = width;
- win->h = height;
- win->visual = visual; /* ptr assignment */
-
- win->bytesPerPixel = dpy->driverContext.cpp;
- win->rowStride = dpy->driverContext.shared.virtualWidth * win->bytesPerPixel;
- win->size = win->rowStride * height;
- win->frontStart = dpy->driverContext.FBAddress;
- win->frontBottom = (GLubyte *) win->frontStart + (height-1) * win->rowStride;
-
- /* This is incorrect: the hardware driver could put the backbuffer
- * just about anywhere. These fields, including the above are
- * hardware dependent & don't really belong here.
- */
- if (visual->mode->doubleBufferMode) {
- win->backStart = (GLubyte *) win->frontStart +
- win->rowStride * dpy->driverContext.shared.virtualHeight;
- win->backBottom = (GLubyte *) win->backStart
- + (height - 1) * win->rowStride;
- win->curBottom = win->backBottom;
- }
- else {
- /* single buffered */
- win->backStart = NULL;
- win->backBottom = NULL;
- win->curBottom = win->frontBottom;
- }
-
- dpy->driScreen.createNewDrawable(dpy, visual->mode, (int) win,
- &win->driDrawable, GLX_WINDOW_BIT, empty_attribute_list);
-
- if (!win->driDrawable.private) {
- fprintf(stderr, "%s: dri.createDrawable failed\n", __FUNCTION__);
- free(win);
- return NULL;
- }
-
- dpy->NumWindows++;
- dpy->TheWindow = win;
-
- return win;
-}
-
-
-/**
- * \brief Destroy window.
- *
- * \param display display handle.
- * \param w window handle.
- *
- * This function calls XUnmapWindow() and frees window \p w.
- *
- * In case of destroying the current buffer first unbinds the GLX context
- * by calling glXMakeCurrent() with no drawable.
- */
-void
-XDestroyWindow( Display *display, Window win )
-{
- if (display && display->IsClient && win) {
- /* check if destroying the current buffer */
- Window curDraw = glXGetCurrentDrawable();
- if (win == curDraw) {
- glXMakeCurrent( display, NULL, NULL);
- }
-
- XUnmapWindow( display, win );
-
- /* Destroy the drawable. */
- win->driDrawable.destroyDrawable(display, win->driDrawable.private);
- free(win);
-
- /* unlink window from display */
- display->NumWindows--;
- assert(display->NumWindows == 0);
- display->TheWindow = NULL;
- }
-}
-
-
-
-
-/**
- * \brief Create color map structure.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param w the window on whose screen you want to create a color map. This
- * parameter is ignored by Mini GLX but should be the value returned by the
- * \code RootWindow(display, 0) \endcode macro.
- * \param visual a visual type supported on the screen. This parameter is
- * ignored by Mini GLX but should be the XVisualInfo::visual returned by
- * glXChooseVisual().
- * \param alloc the color map entries to be allocated. This parameter is ignored
- * by Mini GLX but should be set to #AllocNone.
- *
- * \return the color map.
- *
- * This function is only provided to ease porting. Practically a no-op -
- * returns a pointer to a dynamically allocated chunk of memory (one byte).
- */
-Colormap
-XCreateColormap( Display *dpy, Window w, Visual *visual, int alloc )
-{
- (void) dpy;
- (void) w;
- (void) visual;
- (void) alloc;
- return (Colormap) malloc(1);
-}
-
-
-/**
- * \brief Destroy color map structure.
- *
- * \param display The display handle as returned by XOpenDisplay().
- * \param colormap the color map to destroy.
- *
- * This function is only provided to ease porting. Practically a no-op.
- *
- * Frees the memory pointed by \p colormap.
- */
-void
-XFreeColormap( Display *display, Colormap colormap )
-{
- (void) display;
- (void) colormap;
- free(colormap);
-}
-
-
-/**
- * \brief Free client data.
- *
- * \param data the data that is to be freed.
- *
- * Frees the memory pointed by \p data.
- */
-void
-XFree( void *data )
-{
- free(data);
-}
-
-
-/**
- * \brief Query available visuals.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param vinfo_mask a bitmask indicating which fields of the \p vinfo_template
- * are to be matched. The value must be \c VisualScreenMask.
- * \param vinfo_template a template whose fields indicate which visual
- * attributes must be matched by the results. The XVisualInfo::screen field of
- * this structure must be zero.
- * \param nitens_return will hold the number of visuals returned.
- *
- * \return the address of an array of all available visuals.
- *
- * An example of using XGetVisualInfo() to get all available visuals follows:
- *
- * \code
- * XVisualInfo vinfo_template, *results;
- * int nitens_return;
- * Display *dpy = XOpenDisplay(NULL);
- * vinfo_template.screen = 0;
- * results = XGetVisualInfo(dpy, VisualScreenMask, &vinfo_template, &nitens_return);
- * \endcode
- *
- * Returns the list of all ::XVisualInfo available, one per
- * ::__GLcontextMode stored in MiniGLXDisplayRec::modes.
- */
-XVisualInfo *
-XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int *nitens_return )
-{
- const __GLcontextModes *mode;
- XVisualInfo *results;
- Visual *visResults;
- int i, n=0;
-
- // ASSERT(vinfo_mask == VisualScreenMask);
- ASSERT(vinfo_template.screen == 0);
-
- if (vinfo_mask == VisualIDMask)
- {
- for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
- if (mode->visualID == vinfo_template->visualid)
- n=1;
-
- if (n==0)
- return NULL;
-
- results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
- if (!results) {
- *nitens_return = 0;
- return NULL;
- }
-
- visResults = (Visual *)calloc(1, n * sizeof(Visual));
- if (!results) {
- free(results);
- *nitens_return = 0;
- return NULL;
- }
-
- for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
- if (mode->visualID == vinfo_template->visualid)
- {
- visResults[0].mode=mode;
- visResults[0].visInfo = results;
- visResults[0].dpy = dpy;
- if (dpy->driverContext.bpp == 32)
- visResults[0].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
- else
- visResults[0].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
-
- results[0].visual = visResults;
- results[0].visualid = mode->visualID;
-#if defined(__cplusplus) || defined(c_plusplus)
- results[0].c_class = TrueColor;
-#else
- results[0].class = TrueColor;
-#endif
- results[0].depth = mode->redBits +
- mode->redBits +
- mode->redBits +
- mode->redBits;
- results[0].bits_per_rgb = dpy->driverContext.bpp;
-
- }
-
- }
- else // if (vinfo_mask == VisualScreenMask)
- {
- n = 0;
- for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
- n++;
-
- results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
- if (!results) {
- *nitens_return = 0;
- return NULL;
- }
-
- visResults = (Visual *)calloc(1, n * sizeof(Visual));
- if (!results) {
- free(results);
- *nitens_return = 0;
- return NULL;
- }
-
- for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
- visResults[i].mode = mode;
- visResults[i].visInfo = results + i;
- visResults[i].dpy = dpy;
-
- if (dpy->driverContext.bpp == 32)
- visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
- else
- visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
-
- results[i].visual = visResults + i;
- results[i].visualid = mode->visualID;
-#if defined(__cplusplus) || defined(c_plusplus)
- results[i].c_class = TrueColor;
-#else
- results[i].class = TrueColor;
-#endif
- results[i].depth = mode->redBits +
- mode->redBits +
- mode->redBits +
- mode->redBits;
- results[i].bits_per_rgb = dpy->driverContext.bpp;
- }
- }
- *nitens_return = n;
- return results;
-}
-
-
-/**
- * \brief Return a visual that matches specified attributes.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param screen the screen number. It is currently ignored by Mini GLX and
- * should be zero.
- * \param attribList a list of GLX attributes which describe the desired pixel
- * format. It is terminated by the token \c None.
- *
- * The attributes are as follows:
- * \arg GLX_USE_GL:
- * This attribute should always be present in order to maintain compatibility
- * with GLX.
- * \arg GLX_RGBA:
- * If present, only RGBA pixel formats will be considered. Otherwise, only
- * color index formats are considered.
- * \arg GLX_DOUBLEBUFFER:
- * if present, only double-buffered pixel formats will be chosen.
- * \arg GLX_RED_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per red pixel component that is acceptable.
- * \arg GLX_GREEN_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per green pixel component that is acceptable.
- * \arg GLX_BLUE_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per blue pixel component that is acceptable.
- * \arg GLX_ALPHA_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per alpha pixel component that is acceptable.
- * \arg GLX_STENCIL_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per stencil value that is acceptable.
- * \arg GLX_DEPTH_SIZE \e n:
- * Must be followed by a non-negative integer indicating the minimum number of
- * bits per depth component that is acceptable.
- * \arg None:
- * This token is used to terminate the attribute list.
- *
- * \return a pointer to an #XVisualInfo object which most closely matches the
- * requirements of the attribute list. If there is no visual which matches the
- * request, \c NULL will be returned.
- *
- * \note Visuals with accumulation buffers are not available.
- *
- * This function searches the list of available visual configurations in
- * MiniGLXDisplayRec::configs for a configuration which best matches the GLX
- * attribute list parameter. A new ::XVisualInfo object is created which
- * describes the visual configuration. The match criteria is described in the
- * specification.
- */
-XVisualInfo*
-glXChooseVisual( Display *dpy, int screen, int *attribList )
-{
- const __GLcontextModes *mode;
- Visual *vis;
- XVisualInfo *visInfo;
- const int *attrib;
- GLboolean rgbFlag = GL_FALSE, dbFlag = GL_FALSE, stereoFlag = GL_FALSE;
- GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits = 0;
- GLint indexBits = 0, depthBits = 0, stencilBits = 0;
- GLint numSamples = 0;
- int i=0;
-
- /*
- * XXX in the future, <screen> might be interpreted as a VT
- */
- ASSERT(dpy);
- ASSERT(screen == 0);
-
- vis = (Visual *)calloc(1, sizeof(Visual));
- if (!vis)
- return NULL;
-
- visInfo = (XVisualInfo *)malloc(sizeof(XVisualInfo));
- if (!visInfo) {
- free(vis);
- return NULL;
- }
-
- visInfo->visual = vis;
- vis->visInfo = visInfo;
- vis->dpy = dpy;
-
- /* parse the attribute list */
- for (attrib = attribList; attrib && *attrib != None; attrib++) {
- switch (attrib[0]) {
- case GLX_DOUBLEBUFFER:
- dbFlag = GL_TRUE;
- break;
- case GLX_RGBA:
- rgbFlag = GL_TRUE;
- break;
- case GLX_RED_SIZE:
- redBits = attrib[1];
- attrib++;
- break;
- case GLX_GREEN_SIZE:
- greenBits = attrib[1];
- attrib++;
- break;
- case GLX_BLUE_SIZE:
- blueBits = attrib[1];
- attrib++;
- break;
- case GLX_ALPHA_SIZE:
- alphaBits = attrib[1];
- attrib++;
- break;
- case GLX_STENCIL_SIZE:
- stencilBits = attrib[1];
- attrib++;
- break;
- case GLX_DEPTH_SIZE:
- depthBits = attrib[1];
- attrib++;
- break;
-#if 0
- case GLX_ACCUM_RED_SIZE:
- accumRedBits = attrib[1];
- attrib++;
- break;
- case GLX_ACCUM_GREEN_SIZE:
- accumGreenBits = attrib[1];
- attrib++;
- break;
- case GLX_ACCUM_BLUE_SIZE:
- accumBlueBits = attrib[1];
- attrib++;
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- accumAlphaBits = attrib[1];
- attrib++;
- break;
- case GLX_LEVEL:
- /* ignored for now */
- break;
-#endif
- default:
- /* unexpected token */
- fprintf(stderr, "unexpected token in glXChooseVisual attrib list\n");
- free(vis);
- free(visInfo);
- return NULL;
- }
- }
-
- /* search screen configs for suitable visual */
- (void) numSamples;
- (void) indexBits;
- (void) redBits;
- (void) greenBits;
- (void) blueBits;
- (void) alphaBits;
- (void) stereoFlag;
- for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next ) {
- i++;
- if (mode->rgbMode == rgbFlag &&
- mode->doubleBufferMode == dbFlag &&
- mode->redBits >= redBits &&
- mode->greenBits >= greenBits &&
- mode->blueBits >= blueBits &&
- mode->alphaBits >= alphaBits &&
- mode->depthBits >= depthBits &&
- mode->stencilBits >= stencilBits) {
- /* found it */
- visInfo->visualid = i;
- vis->mode = mode;
- break;
- }
- }
- if (!vis->mode)
- return NULL;
-
- /* compute depth and bpp */
- if (rgbFlag) {
- /* XXX maybe support depth 16 someday */
-#if defined(__cplusplus) || defined(c_plusplus)
- visInfo->c_class = TrueColor;
-#else
- visInfo->class = TrueColor;
-#endif
- visInfo->depth = dpy->driverContext.bpp;
- visInfo->bits_per_rgb = dpy->driverContext.bpp;
- if (dpy->driverContext.bpp == 32)
- vis->pixelFormat = PF_B8G8R8A8;
- else
- vis->pixelFormat = PF_B5G6R5;
- }
- else {
- /* color index mode */
-#if defined(__cplusplus) || defined(c_plusplus)
- visInfo->c_class = PseudoColor;
-#else
- visInfo->class = PseudoColor;
-#endif
- visInfo->depth = 8;
- visInfo->bits_per_rgb = 8; /* bits/pixel */
- vis->pixelFormat = PF_CI8;
- }
-
- return visInfo;
-}
-
-
-/**
- * \brief Return information about GLX visuals.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param vis the visual to be queried, as returned by glXChooseVisual().
- * \param attrib the visual attribute to be returned.
- * \param value pointer to an integer in which the result of the query will be
- * stored.
- *
- * \return zero if no error occurs, \c GLX_INVALID_ATTRIBUTE if the attribute
- * parameter is invalid, or \c GLX_BAD_VISUAL if the \p vis parameter is
- * invalid.
- *
- * Returns the appropriate attribute of ::__GLXvisualConfig pointed by
- * MiniGLXVisualRec::glxConfig of XVisualInfo::visual.
- *
- * \sa data types.
- */
-int
-glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value )
-{
- const __GLcontextModes *mode = vis->visual->mode;
- if (!mode) {
- *value = 0;
- return GLX_BAD_VISUAL;
- }
-
- switch (attrib) {
- case GLX_USE_GL:
- *value = True;
- return 0;
- case GLX_RGBA:
- *value = mode->rgbMode;
- return 0;
- case GLX_DOUBLEBUFFER:
- *value = mode->doubleBufferMode;
- return 0;
- case GLX_RED_SIZE:
- *value = mode->redBits;
- return 0;
- case GLX_GREEN_SIZE:
- *value = mode->greenBits;
- return 0;
- case GLX_BLUE_SIZE:
- *value = mode->blueBits;
- return 0;
- case GLX_ALPHA_SIZE:
- *value = mode->alphaBits;
- return 0;
- case GLX_DEPTH_SIZE:
- *value = mode->depthBits;
- return 0;
- case GLX_STENCIL_SIZE:
- *value = mode->stencilBits;
- return 0;
- default:
- *value = 0;
- return GLX_BAD_ATTRIBUTE;
- }
- return 0;
-}
-
-
-/**
- * \brief Create a new GLX rendering context.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param vis the visual that defines the frame buffer resources available to
- * the rendering context, as returned by glXChooseVisual().
- * \param shareList If non-zero, texture objects and display lists are shared
- * with the named rendering context. If zero, texture objects and display lists
- * will (initially) be private to this context. They may be shared when a
- * subsequent context is created.
- * \param direct whether direct or indirect rendering is desired. For Mini GLX
- * this value is ignored but it should be set to \c True.
- *
- * \return a ::GLXContext handle if it succeeds or zero if it fails due to
- * invalid parameter or insufficient resources.
- *
- * This function creates and initializes a ::MiniGLXContextRec structure and
- * calls the __DRIscreenRec::createContext method to initialize the client
- * private data.
- */
-GLXContext
-glXCreateContext( Display *dpy, XVisualInfo *vis,
- GLXContext shareList, Bool direct )
-{
- GLXContext ctx;
- void *sharePriv;
-
- ASSERT(vis);
-
- ctx = (struct MiniGLXContextRec *)calloc(1, sizeof(struct MiniGLXContextRec));
- if (!ctx)
- return NULL;
-
- ctx->vid = vis->visualid;
-
- if (shareList)
- sharePriv = shareList->driContext.private;
- else
- sharePriv = NULL;
-
- ctx->driContext.mode = vis->visual->mode;
- ctx->driContext.private = dpy->driScreen.createNewContext(dpy, vis->visual->mode,
- GLX_WINDOW_BIT, sharePriv, &ctx->driContext);
-
- if (!ctx->driContext.private) {
- free(ctx);
- return NULL;
- }
-
- return ctx;
-}
-
-
-/**
- * \brief Destroy a GLX context.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param ctx the GLX context to be destroyed.
- *
- * This function frees the \p ctx parameter after unbinding the current context
- * by calling the __DRIcontextRec::bindContext method with zeros and calling
- * the __DRIcontextRec::destroyContext method.
- */
-void
-glXDestroyContext( Display *dpy, GLXContext ctx )
-{
- GLXContext glxctx = glXGetCurrentContext();
-
- if (ctx) {
- if (glxctx == ctx) {
- /* destroying current context */
- ctx->driContext.bindContext(dpy, 0, 0, 0, 0);
- CurrentContext = 0;
- }
- ctx->driContext.destroyContext(dpy, 0, ctx->driContext.private);
- free(ctx);
- }
-}
-
-
-/**
- * \brief Bind a GLX context to a window or a pixmap.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param drawable the window or drawable to bind to the rendering context.
- * This should be the value returned by XCreateWindow().
- * \param ctx the GLX context to be destroyed.
- *
- * \return \c True if it succeeds, \c False otherwise to indicate an invalid
- * display, window or context parameter.
- *
- * The current rendering context may be unbound by calling glXMakeCurrent()
- * with the window and context parameters set to zero.
- *
- * An application may create any number of rendering contexts and bind them as
- * needed. Note that binding a rendering context is generally not a
- * light-weight operation. Most simple OpenGL applications create only one
- * rendering context.
- *
- * This function first unbinds any old context via
- * __DRIcontextRec::unbindContext and binds the new one via
- * __DRIcontextRec::bindContext.
- *
- * If \p drawable is zero it unbinds the GLX context by calling
- * __DRIcontextRec::bindContext with zeros.
- */
-Bool
-glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx)
-{
- if (dpy && drawable && ctx) {
- GLXContext oldContext = glXGetCurrentContext();
- GLXDrawable oldDrawable = glXGetCurrentDrawable();
- /* unbind old */
- if (oldContext) {
- oldContext->driContext.unbindContext(dpy, 0,
- (__DRIid) oldDrawable, (__DRIid) oldDrawable,
- &oldContext->driContext);
- }
- /* bind new */
- CurrentContext = ctx;
- ctx->driContext.bindContext(dpy, 0, (__DRIid) drawable,
- (__DRIid) drawable, &ctx->driContext);
- ctx->drawBuffer = drawable;
- ctx->curBuffer = drawable;
- }
- else if (ctx && dpy) {
- /* unbind */
- ctx->driContext.bindContext(dpy, 0, 0, 0, 0);
- }
- else if (dpy) {
- CurrentContext = 0; /* kw: this seems to be intended??? */
- }
-
- return True;
-}
-
-
-/**
- * \brief Exchange front and back buffers.
- *
- * \param dpy the display handle, as returned by XOpenDisplay().
- * \param drawable the drawable whose buffers are to be swapped.
- *
- * Any pending rendering commands will be completed before the buffer swap
- * takes place.
- *
- * Calling glXSwapBuffers() on a window which is single-buffered has no effect.
- *
- * This function just calls the __DRIdrawableRec::swapBuffers method to do the
- * work.
- */
-void
-glXSwapBuffers( Display *dpy, GLXDrawable drawable )
-{
- if (!dpy || !drawable)
- return;
-
- drawable->driDrawable.swapBuffers(dpy, drawable->driDrawable.private);
-}
-
-
-/**
- * \brief Return the current context
- *
- * \return the current context, as specified by glXMakeCurrent(), or zero if no
- * context is currently bound.
- *
- * \sa glXCreateContext(), glXMakeCurrent()
- *
- * Returns the value of the ::CurrentContext global variable.
- */
-GLXContext
-glXGetCurrentContext( void )
-{
- return CurrentContext;
-}
-
-
-/**
- * \brief Return the current drawable.
- *
- * \return the current drawable, as specified by glXMakeCurrent(), or zero if
- * no drawable is currently bound.
- *
- * This function gets the current context via glXGetCurrentContext() and
- * returns the MiniGLXContextRec::drawBuffer attribute.
- */
-GLXDrawable
-glXGetCurrentDrawable( void )
-{
- GLXContext glxctx = glXGetCurrentContext();
- if (glxctx)
- return glxctx->drawBuffer;
- else
- return NULL;
-}
-
-
-static GLboolean
-__glXCreateContextWithConfig(__DRInativeDisplay *dpy, int screen,
- int fbconfigID, void *contextID, drm_context_t *hHWContext)
-{
- __DRIscreen *pDRIScreen;
- __DRIscreenPrivate *psp;
-
- pDRIScreen = __glXFindDRIScreen(dpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
-
- psp = (__DRIscreenPrivate *) pDRIScreen->private;
-
- if (psp->fd) {
- if (drmCreateContext(psp->fd, hHWContext)) {
- fprintf(stderr, ">>> drmCreateContext failed\n");
- return GL_FALSE;
- }
- *(void**)contextID = (void*) *hHWContext;
- }
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-__glXGetDrawableInfo(__DRInativeDisplay *dpy, int scrn,
- __DRIid draw, unsigned int * index, unsigned int * stamp,
- int * x, int * y, int * width, int * height,
- int * numClipRects, drm_clip_rect_t ** pClipRects,
- int * backX, int * backY,
- int * numBackClipRects, drm_clip_rect_t ** pBackClipRects)
-{
- GLXDrawable drawable = (GLXDrawable) draw;
- drm_clip_rect_t * cliprect;
- Display* display = (Display*)dpy;
- __DRIcontextPrivate *pcp = (__DRIcontextPrivate *)CurrentContext->driContext.private;
- if (drawable == 0) {
- return GL_FALSE;
- }
-
- cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t));
- cliprect->x1 = drawable->x;
- cliprect->y1 = drawable->y;
- cliprect->x2 = drawable->x + drawable->w;
- cliprect->y2 = drawable->y + drawable->h;
-
- /* the drawable index is by client id */
- *index = display->clientID;
-
- *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp;
- *x = drawable->x;
- *y = drawable->y;
- *width = drawable->w;
- *height = drawable->h;
- *numClipRects = 1;
- *pClipRects = cliprect;
-
- *backX = drawable->x;
- *backY = drawable->y;
- *numBackClipRects = 0;
- *pBackClipRects = 0;
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-xf86DRI_DestroyContext(__DRInativeDisplay *dpy, int screen, __DRIid context_id )
-{
- return GL_TRUE;
-}
-
-
-static GLboolean
-xf86DRI_CreateDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable,
- drm_drawable_t *hHWDrawable )
-{
- return GL_TRUE;
-}
-
-
-static GLboolean
-xf86DRI_DestroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
-{
- return GL_TRUE;
-}
-
-
-/**
- * \brief Query function address.
- *
- * The glXGetProcAddress() function will return the address of any available
- * OpenGL or Mini GLX function.
- *
- * \param procName name of the function to be returned.
- *
- * \return If \p procName is a valid function name, a pointer to that function
- * will be returned. Otherwise, \c NULL will be returned.
- *
- * The purpose of glXGetProcAddress() is to facilitate using future extensions
- * to OpenGL or Mini GLX. If a future version of the library adds new extension
- * functions they'll be accessible via glXGetProcAddress(). The alternative is
- * to hard-code calls to the new functions in the application but doing so will
- * prevent linking the application with older versions of the library.
- *
- * Returns the function address by looking up its name in a static (name,
- * address) pair list.
- */
-void (*glXGetProcAddress(const GLubyte *procname))( void )
-{
- struct name_address {
- const char *name;
- const void *func;
- };
- static const struct name_address functions[] = {
- { "glXChooseVisual", (void *) glXChooseVisual },
- { "glXCreateContext", (void *) glXCreateContext },
- { "glXDestroyContext", (void *) glXDestroyContext },
- { "glXMakeCurrent", (void *) glXMakeCurrent },
- { "glXSwapBuffers", (void *) glXSwapBuffers },
- { "glXGetCurrentContext", (void *) glXGetCurrentContext },
- { "glXGetCurrentDrawable", (void *) glXGetCurrentDrawable },
- { "glXGetProcAddress", (void *) glXGetProcAddress },
- { "XOpenDisplay", (void *) XOpenDisplay },
- { "XCloseDisplay", (void *) XCloseDisplay },
- { "XCreateWindow", (void *) XCreateWindow },
- { "XDestroyWindow", (void *) XDestroyWindow },
- { "XMapWindow", (void *) XMapWindow },
- { "XCreateColormap", (void *) XCreateColormap },
- { "XFreeColormap", (void *) XFreeColormap },
- { "XFree", (void *) XFree },
- { "XGetVisualinfo", (void *) XGetVisualInfo },
- { "glXCreatePbuffer", (void *) glXCreatePbuffer },
- { "glXDestroyPbuffer", (void *) glXDestroyPbuffer },
- { "glXChooseFBConfig", (void *) glXChooseFBConfig },
- { "glXGetVisualFromFBConfig", (void *) glXGetVisualFromFBConfig },
- { NULL, NULL }
- };
- const struct name_address *entry;
- for (entry = functions; entry->name; entry++) {
- if (strcmp(entry->name, (const char *) procname) == 0) {
- return entry->func;
- }
- }
- return _glapi_get_proc_address((const char *) procname);
-}
-
-
-/**
- * \brief Query the Mini GLX version.
- *
- * \param dpy the display handle. It is currently ignored, but should be the
- * value returned by XOpenDisplay().
- * \param major receives the major version number of Mini GLX.
- * \param minor receives the minor version number of Mini GLX.
- *
- * \return \c True if the function succeeds, \c False if the function fails due
- * to invalid parameters.
- *
- * \sa #MINI_GLX_VERSION_1_0.
- *
- * Returns the hard-coded Mini GLX version.
- */
-Bool
-glXQueryVersion( Display *dpy, int *major, int *minor )
-{
- (void) dpy;
- *major = 1;
- *minor = 0;
- return True;
-}
-
-
-/**
- * \brief Create a new pbuffer.
- */
-GLXPbuffer
-glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList )
-{
- return NULL;
-}
-
-
-void
-glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
-{
- free(pbuf);
-}
-
-
-GLXFBConfig *
-glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
- int *nitems )
-{
- GLXFBConfig *f = (GLXFBConfig *) malloc(sizeof(GLXFBConfig));
- f->visInfo = glXChooseVisual( dpy, screen, (int *) attribList );
- if (f->visInfo) {
- *nitems = 1;
- return f;
- }
- else {
- *nitems = 0;
- free(f);
- return NULL;
- }
-}
-
-
-XVisualInfo *
-glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
-{
- /* XVisualInfo and GLXFBConfig are the same structure */
- (void) dpy;
- return config.visInfo;
-}
-
-void *glXAllocateMemoryMESA(Display *dpy, int scrn,
- size_t size, float readFreq,
- float writeFreq, float priority)
-{
- if (dpy->driScreen.private && dpy->driScreen.allocateMemory) {
- return (*dpy->driScreen.allocateMemory)( dpy, scrn, size,
- readFreq, writeFreq,
- priority );
- }
-
- return NULL;
-}
-
-void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
-{
- if (dpy->driScreen.private && dpy->driScreen.freeMemory) {
- (*dpy->driScreen.freeMemory)( dpy, scrn, pointer );
- }
-}
-
-GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
- const void *pointer )
-{
- if (dpy->driScreen.private && dpy->driScreen.memoryOffset) {
- return (*dpy->driScreen.memoryOffset)( dpy, scrn, pointer );
- }
-
- return 0;
-}
-
-
-/**
- * Get the unadjusted system time (UST). Currently, the UST is measured in
- * microseconds since Epoc. The actual resolution of the UST may vary from
- * system to system, and the units may vary from release to release.
- * Drivers should not call this function directly. They should instead use
- * \c glXGetProcAddress to obtain a pointer to the function.
- *
- * \param ust Location to store the 64-bit UST
- * \returns Zero on success or a negative errno value on failure.
- *
- * \note
- * This function was copied directly from src/glx/x11/glxcmds.c.
- */
-static int __glXGetUST( int64_t * ust )
-{
- struct timeval tv;
-
- if ( ust == NULL ) {
- return -EFAULT;
- }
-
- if ( gettimeofday( & tv, NULL ) == 0 ) {
- ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
- return 0;
- } else {
- return -errno;
- }
-}
-
-
-/**
- *
- * \bug
- * This needs to be implemented for miniGlx.
- */
-static GLboolean __glXGetMscRate(__DRInativeDisplay * dpy, __DRIid drawable,
- int32_t * numerator, int32_t * denominator)
-{
- *numerator = 0;
- *denominator = 0;
- return False;
-}
-/*@}*/
diff --git a/src/glx/mini/miniglxP.h b/src/glx/mini/miniglxP.h
deleted file mode 100644
index 96ed0e81cd7..00000000000
--- a/src/glx/mini/miniglxP.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * \file miniglxP.h
- * \brief Define replacements for some X data types and define the DRI-related
- * data structures.
- *
- * \note Cut down version of glxclient.h.
- *
- */
-
-#ifndef _mini_GLX_client_h_
-#define _mini_GLX_client_h_
-
-#include <signal.h>
-#include <linux/fb.h>
-
-#include <GL/miniglx.h>
-#include "glheader.h"
-#include "mtypes.h"
-
-#include "driver.h"
-#include "GL/internal/dri_interface.h"
-
-/**
- * \brief Supported pixel formats.
- */
-enum PixelFormat {
- PF_B8G8R8, /**< \brief 24-bit BGR */
- PF_B8G8R8A8, /**< \brief 32-bit BGRA */
- PF_B5G6R5, /**< \brief 16-bit BGR */
- PF_B5G5R5, /**< \brief 15-bit BGR */
- PF_CI8 /**< \brief 8-bit color index */
-};
-
-/**
- * \brief X Visual type.
- *
- * \sa ::Visual, \ref datatypes.
- */
-struct MiniGLXVisualRec {
- /** \brief GLX visual information */
- const __GLcontextModes *mode;
-
- /** \brief pointer back to corresponding ::XVisualInfo */
- XVisualInfo *visInfo;
-
- /** \brief display handle */
- Display *dpy;
-
- /** \brief pixel format */
- enum PixelFormat pixelFormat;
-};
-
-
-
-/**
- * \brief X Window type.
- *
- * \sa ::Window, \ref datatypes.
- */
-struct MiniGLXWindowRec {
- Visual *visual;
- /** \brief position (always 0,0) */
- int x, y;
- /** \brief size */
- unsigned int w, h;
- void *frontStart; /**< \brief start of front color buffer */
- void *backStart; /**< \brief start of back color buffer */
- size_t size; /**< \brief color buffer size, in bytes */
- GLuint bytesPerPixel;
- GLuint rowStride; /**< \brief in bytes */
- GLubyte *frontBottom; /**< \brief pointer to last row */
- GLubyte *backBottom; /**< \brief pointer to last row */
- GLubyte *curBottom; /**< = frontBottom or backBottom */
- __DRIdrawable driDrawable;
- GLuint ismapped;
-};
-
-
-/**
- * \brief GLXContext type.
- *
- * \sa ::GLXContext, \ref datatypes.
- */
-struct MiniGLXContextRec {
- Window drawBuffer; /**< \brief drawing buffer */
- Window curBuffer; /**< \brief current buffer */
- VisualID vid; /**< \brief visual ID */
- __DRIcontext driContext; /**< \brief context dependent methods */
-};
-
-#define MINIGLX_BUF_SIZE 512
-#define MINIGLX_MAX_SERVER_FDS 10
-#define MINIGLX_MAX_CLIENT_FDS 1
-#define MINIGLX_EVENT_QUEUE_SZ 16
-#define MINIGLX_EVENT_QUEUE_MASK (MINIGLX_EVENT_QUEUE_SZ-1)
-
-/**
- * A connection to/from the server
- *
- * All information is to/from the server is buffered and then dispatched by
- * __miniglx_Select() to avoid blocking the server.
- */
-struct MiniGLXConnection {
- int fd; /**< \brief file descriptor */
- char readbuf[MINIGLX_BUF_SIZE]; /**< \brief read buffer */
- char writebuf[MINIGLX_BUF_SIZE]; /**< \brief write buffer */
- int readbuf_count; /**< \brief count of bytes waiting to be read */
- int writebuf_count; /**< \brief count of bytes waiting to be written */
-};
-
-
-/**
- * \brief X Display type
- *
- * \sa ::Display, \ref datatypes.
- */
-struct MiniGLXDisplayRec {
- /** \brief fixed framebuffer screen info */
- struct fb_fix_screeninfo FixedInfo;
- /** \brief original and current variable framebuffer screen info */
- struct fb_var_screeninfo OrigVarInfo, VarInfo;
- struct sigaction OrigSigUsr1;
- struct sigaction OrigSigUsr2;
- int OriginalVT;
- int ConsoleFD; /**< \brief console TTY device file descriptor */
- int FrameBufferFD; /**< \brief framebuffer device file descriptor */
- int NumWindows; /**< \brief number of open windows */
- Window TheWindow; /**< \brief open window - only allow one window for now */
- int rotateMode;
-
-
- volatile int vtSignalFlag;
- volatile int haveVT; /**< \brief whether the VT is hold */
- int hwActive; /**< \brief whether the hardware is active -- mimics
- the variations of MiniGLXDisplayRec::haveVT */
-
-
- int IsClient; /**< \brief whether it's a client or the server */
- int clientID;
- int nrFds; /**< \brief number of connections (usually just one for the clients) */
- struct MiniGLXConnection *fd; /**< \brief connections */
- int drmFd; /**< \brief handle to drm device */
- int authorized; /**< \brief has server authorized this process? */
-
- struct {
- int nr, head, tail;
- XEvent queue[MINIGLX_EVENT_QUEUE_SZ];
- } eventqueue;
-
- /**
- * \name Visuals
- *
- * Visuals (configs) in this screen.
- */
- /*@{*/
- const __GLcontextModes *driver_modes; /**< \brief Modes filtered by driver. */
- /*@}*/
-
- /**
- * \name From __GLXdisplayPrivate
- */
- /*@{*/
- PFNCREATENEWSCREENFUNC createNewScreen; /**< \brief \e __driCreateScreen hook */
- __DRIscreen driScreen; /**< \brief Screen dependent methods */
- void *dlHandle; /**<
- * \brief handle to the client dynamic
- * library
- */
- /*@}*/
-
- /**
- * \brief Mini GLX specific driver hooks
- */
- struct DRIDriverRec *driver;
- struct DRIDriverContextRec driverContext;
-
- /**
- * \name Configuration details
- *
- * They are read from a configuration file by __read_config_file().
- */
- /*@{*/
- const char *fbdevDevice;
- const char *clientDriverName;
- /*@}*/
-};
-
-/** Character messages. */
-enum msgs {
- _CanIHaveFocus,
- _IDontWantFocus,
- _YouveGotFocus,
- _YouveLostFocus,
- _RepaintPlease,
- _Authorize,
-};
-extern int send_msg( Display *dpy, int i, const void *msg, size_t sz );
-extern int send_char_msg( Display *dpy, int i, char msg );
-extern int blocking_read( Display *dpy, int connection, char *msg, size_t msg_size );
-extern int handle_fd_events( Display *dpy, int nonblock );
-
-extern int __miniglx_open_connections( Display *dpy );
-extern void __miniglx_close_connections( Display *dpy );
-
-#endif /* !_mini_GLX_client_h_ */
diff --git a/src/glx/mini/miniglx_events.c b/src/glx/mini/miniglx_events.c
deleted file mode 100644
index c885da9dfbd..00000000000
--- a/src/glx/mini/miniglx_events.c
+++ /dev/null
@@ -1,984 +0,0 @@
-/**
- * \file miniglx_events.c
- * \brief Mini GLX client/server communication functions.
- * \author Keith Whitwell
- *
- * The Mini GLX interface is a subset of the GLX interface, plus a
- * minimal set of Xlib functions. This file adds interfaces to
- * arbitrate a single cliprect between multiple direct rendering
- * clients.
- *
- * A fairly complete client/server non-blocking communication
- * mechanism. Probably overkill given that none of our messages
- * currently exceed 1 byte in length and take place over the
- * relatively benign channel provided by a Unix domain socket.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 5.0
- *
- * Copyright (C) 1999-2003 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.
- */
-
-/* $Id: miniglx_events.c,v 1.6 2006-04-03 07:31:27 airlied Exp $ */
-
-
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-
-#include <linux/kd.h>
-#include <linux/vt.h>
-
-#include "xf86drm.h"
-#include "miniglxP.h"
-
-
-#define MINIGLX_FIFO_NAME "/tmp/miniglx.fifo"
-
-/**
- * \brief Allocate an XEvent structure on the event queue.
- *
- * \param dpy the display handle.
- *
- * \return Pointer to the queued event structure or NULL on failure.
- *
- * \internal
- * If there is space on the XEvent queue, return a pointer
- * to the next free event and increment the eventqueue tail value.
- * Otherwise return null.
- */
-static XEvent *queue_event( Display *dpy )
-{
- int incr = (dpy->eventqueue.tail + 1) & MINIGLX_EVENT_QUEUE_MASK;
- if (incr == dpy->eventqueue.head) {
- return 0;
- }
- else {
- XEvent *ev = &dpy->eventqueue.queue[dpy->eventqueue.tail];
- dpy->eventqueue.tail = incr;
- return ev;
- }
-}
-
-/**
- * \brief Dequeue an XEvent and copy it into provided storage.
- *
- * \param dpy the display handle.
- * \param event_return pointer to copy the queued event to.
- *
- * \return True or False depending on success.
- *
- * \internal
- * If there is a queued XEvent on the queue, copy it to the provided
- * pointer and increment the eventqueue head value. Otherwise return
- * null.
- */
-static int dequeue_event( Display *dpy, XEvent *event_return )
-{
- if (dpy->eventqueue.tail == dpy->eventqueue.head) {
- return False;
- }
- else {
- *event_return = dpy->eventqueue.queue[dpy->eventqueue.head];
- dpy->eventqueue.head += 1;
- dpy->eventqueue.head &= MINIGLX_EVENT_QUEUE_MASK;
- return True;
- }
-}
-
-/**
- * \brief Shutdown a socket connection.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- *
- * \internal
- * Shutdown and close the file descriptor. If this is the special
- * connection in fd[0], issue an error message and exit - there's been
- * some sort of failure somewhere. Otherwise, let the application
- * know about whats happened by issuing a DestroyNotify event.
- */
-static void shut_fd( Display *dpy, int i )
-{
- if (dpy->fd[i].fd < 0)
- return;
-
- shutdown (dpy->fd[i].fd, SHUT_RDWR);
- close (dpy->fd[i].fd);
- dpy->fd[i].fd = -1;
- dpy->fd[i].readbuf_count = 0;
- dpy->fd[i].writebuf_count = 0;
-
- if (i == 0) {
- fprintf(stderr, "server connection lost\n");
- exit(1);
- }
- else {
- /* Pass this to the application as a DestroyNotify event.
- */
- XEvent *er = queue_event(dpy);
- if (!er) return;
- er->xdestroywindow.type = DestroyNotify;
- er->xdestroywindow.serial = 0;
- er->xdestroywindow.send_event = 0;
- er->xdestroywindow.display = dpy;
- er->xdestroywindow.window = (Window)i;
-
- drmGetLock(dpy->driverContext.drmFD, 1, 0);
- drmUnlock(dpy->driverContext.drmFD, 1);
- }
-}
-
-/**
- * \brief Send a message to a socket connection.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- * \param msg the message to send.
- * \param sz the size of the message
- *
- * \internal
- * Copy the message to the write buffer for the nominated connection.
- * This will be actually sent to that file descriptor from
- * __miniglx_Select().
- */
-int send_msg( Display *dpy, int i,
- const void *msg, size_t sz )
-{
- int cnt = dpy->fd[i].writebuf_count;
- if (MINIGLX_BUF_SIZE - cnt < sz) {
- fprintf(stderr, "client %d: writebuf overflow\n", i);
- return False;
- }
-
- memcpy( dpy->fd[i].writebuf + cnt, msg, sz ); cnt += sz;
- dpy->fd[i].writebuf_count = cnt;
- return True;
-}
-
-/**
- * \brief Send a message to a socket connection.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- * \param msg the message to send.
- *
- * \internal
- * Use send_msg() to send a one-byte message to a socket.
- */
-int send_char_msg( Display *dpy, int i, char msg )
-{
- return send_msg( dpy, i, &msg, sizeof(char));
-}
-
-
-/**
- * \brief Block and receive a message from a socket connection.
- *
- * \param dpy the display handle.
- * \param connection the index in dpy->fd of the socket connection.
- * \param msg storage for the received message.
- * \param msg_size the number of bytes to read.
- *
- * \internal
- * Block and read from the connection's file descriptor
- * until msg_size bytes have been received.
- *
- * Only called from welcome_message_part().
- */
-int blocking_read( Display *dpy, int connection,
- char *msg, size_t msg_size )
-{
- int i, r;
-
- for (i = 0 ; i < msg_size ; i += r) {
- r = read(dpy->fd[connection].fd, msg + i, msg_size - i);
- if (r < 1) {
- fprintf(stderr, "blocking_read: %d %s\n", r, strerror(errno));
- shut_fd(dpy,connection);
- return False;
- }
- }
-
- return True;
-}
-
-/**
- * \brief Send/receive a part of the welcome message.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- * \param msg storage for the sent/received message.
- * \param sz the number of bytes to write/read.
- *
- * \return True on success, or False on failure.
- *
- * This function is called by welcome_message_part(), to either send or receive
- * (via blocking_read()) part of the welcome message, according to whether
- * Display::IsClient is set.
- *
- * Each part of the welcome message on the wire consists of a count and then the
- * actual message data with that number of bytes.
- */
-static int welcome_message_part( Display *dpy, int i, void **msg, int sz )
-{
- if (dpy->IsClient) {
- int sz;
- if (!blocking_read( dpy, i, (char *)&sz, sizeof(sz))) return False;
- if (!*msg) *msg = malloc(sz);
- if (!*msg) return False;
- if (!blocking_read( dpy, i, *msg, sz )) return False;
- return sz;
- }
- else {
- if (!send_msg( dpy, i, &sz, sizeof(sz))) return False;
- if (!send_msg( dpy, i, *msg, sz )) return False;
- }
-
- return True;
-}
-
-/**
- * \brief Send/receive the welcome message.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- *
- * \return True on success, or False on failure.
- *
- * Using welcome_message_part(), sends/receives the client ID, the client
- * configuration details in DRIDriverContext::shared, and the driver private
- * message in DRIDriverContext::driverClientMsg.
- */
-static int welcome_message( Display *dpy, int i )
-{
- void *tmp = &dpy->driverContext.shared;
- int *clientid = dpy->IsClient ? &dpy->clientID : &i;
- int size;
-
- if (!welcome_message_part( dpy, i, (void **)&clientid, sizeof(*clientid)))
- return False;
-
- if (!welcome_message_part( dpy, i, &tmp, sizeof(dpy->driverContext.shared)))
- return False;
-
- size=welcome_message_part( dpy, i,
- (void **)&dpy->driverContext.driverClientMsg,
- dpy->driverContext.driverClientMsgSize );
-
- if (!size)
- return False;
-
- if (dpy->IsClient) {
- dpy->driverContext.driverClientMsgSize = size;
- }
- return True;
-}
-
-
-/**
- * \brief Handle a new client connection.
- *
- * \param dpy the display handle.
- *
- * \return True on success or False on failure.
- *
- * Accepts the connection, sets it in non-blocking operation, and finds a free
- * slot in Display::fd for it.
- */
-static int handle_new_client( Display *dpy )
-{
- struct sockaddr_un client_address;
- unsigned int l = sizeof(client_address);
- int r, i;
-
- r = accept(dpy->fd[0].fd, (struct sockaddr *) &client_address, &l);
- if (r < 0) {
- perror ("accept()");
- shut_fd(dpy,0);
- return False;
- }
-
- if (fcntl(r, F_SETFL, O_NONBLOCK) != 0) {
- perror("fcntl");
- close(r);
- return False;
- }
-
-
- /* Some rough & ready adaption of the XEvent semantics.
- */
- for (i = 1 ; i < dpy->nrFds ; i++) {
- if (dpy->fd[i].fd < 0) {
- XEvent *er = queue_event(dpy);
- if (!er) {
- close(r);
- return False;
- }
-
- dpy->fd[i].fd = r;
- er->xcreatewindow.type = CreateNotify;
- er->xcreatewindow.serial = 0;
- er->xcreatewindow.send_event = 0;
- er->xcreatewindow.display = dpy;
- er->xcreatewindow.window = (Window)i; /* fd slot == window, now? */
-
- /* Send the driver client message - this is expected as the
- * first message on a new connection. The recpient already
- * knows the size of the message.
- */
- welcome_message( dpy, i );
- return True;
- }
- }
-
-
- fprintf(stderr, "[miniglx] %s: Max nr clients exceeded\n", __FUNCTION__);
- close(r);
- return False;
-}
-
-/**
- * This routine "puffs out" the very basic communications between
- * client and server to full-sized X Events that can be handled by the
- * application.
- *
- * \param dpy the display handle.
- * \param i the index in dpy->fd of the socket connection.
- *
- * \return True on success or False on failure.
- *
- * \internal
- * Interprets the message (see msg) into a XEvent and advances the file FIFO
- * buffer.
- */
-static int
-handle_fifo_read( Display *dpy, int i )
-{
- drm_magic_t magic;
- int err;
-
- while (dpy->fd[i].readbuf_count) {
- char id = dpy->fd[i].readbuf[0];
- XEvent *er;
- int count = 1;
-
- if (dpy->IsClient) {
- switch (id) {
- /* The server has called XMapWindow on a client window */
- case _YouveGotFocus:
- er = queue_event(dpy);
- if (!er) return False;
- er->xmap.type = MapNotify;
- er->xmap.serial = 0;
- er->xmap.send_event = False;
- er->xmap.display = dpy;
- er->xmap.event = dpy->TheWindow;
- er->xmap.window = dpy->TheWindow;
- er->xmap.override_redirect = False;
- if (dpy->driver->notifyFocus)
- dpy->driver->notifyFocus( 1 );
- break;
-
- /* The server has called XMapWindow on a client window */
- case _RepaintPlease:
- er = queue_event(dpy);
- if (!er) return False;
- er->xexpose.type = Expose;
- er->xexpose.serial = 0;
- er->xexpose.send_event = False;
- er->xexpose.display = dpy;
- er->xexpose.window = dpy->TheWindow;
- if (dpy->rotateMode) {
- er->xexpose.x = dpy->TheWindow->y;
- er->xexpose.y = dpy->TheWindow->x;
- er->xexpose.width = dpy->TheWindow->h;
- er->xexpose.height = dpy->TheWindow->w;
- }
- else {
- er->xexpose.x = dpy->TheWindow->x;
- er->xexpose.y = dpy->TheWindow->y;
- er->xexpose.width = dpy->TheWindow->w;
- er->xexpose.height = dpy->TheWindow->h;
- }
- er->xexpose.count = 0;
- break;
-
- /* The server has called 'XUnmapWindow' on a client
- * window.
- */
- case _YouveLostFocus:
- er = queue_event(dpy);
- if (!er) return False;
- er->xunmap.type = UnmapNotify;
- er->xunmap.serial = 0;
- er->xunmap.send_event = False;
- er->xunmap.display = dpy;
- er->xunmap.event = dpy->TheWindow;
- er->xunmap.window = dpy->TheWindow;
- er->xunmap.from_configure = False;
- if (dpy->driver->notifyFocus)
- dpy->driver->notifyFocus( 0 );
- break;
-
- case _Authorize:
- dpy->authorized = True;
- break;
-
- default:
- fprintf(stderr, "Client received unhandled message type %d\n", id);
- shut_fd(dpy, i); /* Actually shuts down the client */
- return False;
- }
- }
- else {
- switch (id) {
- /* Lets the server know that the client is ready to render
- * (having called 'XMapWindow' locally).
- */
- case _CanIHaveFocus:
- er = queue_event(dpy);
- if (!er) return False;
- er->xmaprequest.type = MapRequest;
- er->xmaprequest.serial = 0;
- er->xmaprequest.send_event = False;
- er->xmaprequest.display = dpy;
- er->xmaprequest.parent = 0;
- er->xmaprequest.window = (Window)i;
- break;
-
- /* Both _YouveLostFocus and _IDontWantFocus generate unmap
- * events. The idea is that _YouveLostFocus lets the client
- * know that it has had focus revoked by the server, whereas
- * _IDontWantFocus lets the server know that the client has
- * unmapped its own window.
- */
- case _IDontWantFocus:
- er = queue_event(dpy);
- if (!er) return False;
- er->xunmap.type = UnmapNotify;
- er->xunmap.serial = 0;
- er->xunmap.send_event = False;
- er->xunmap.display = dpy;
- er->xunmap.event = (Window)i;
- er->xunmap.window = (Window)i;
- er->xunmap.from_configure = False;
- break;
-
- case _Authorize:
- /* is full message here yet? */
- if (dpy->fd[i].readbuf_count < count + sizeof(magic)) {
- count = 0;
- break;
- }
- memcpy(&magic, dpy->fd[i].readbuf + count, sizeof(magic));
- fprintf(stderr, "Authorize - magic %d\n", magic);
-
- err = drmAuthMagic(dpy->driverContext.drmFD, magic);
- count += sizeof(magic);
-
- send_char_msg( dpy, i, _Authorize );
- break;
-
- default:
- fprintf(stderr, "Server received unhandled message type %d\n", id);
- shut_fd(dpy, i); /* Generates DestroyNotify event */
- return False;
- }
- }
-
- dpy->fd[i].readbuf_count -= count;
-
- if (dpy->fd[i].readbuf_count) {
- memmove(dpy->fd[i].readbuf,
- dpy->fd[i].readbuf + count,
- dpy->fd[i].readbuf_count);
- }
- }
-
- return True;
-}
-
-/**
- * Handle a VT signal
- *
- * \param dpy display handle.
- *
- * The VT switches is detected by comparing Display::haveVT and
- * Display::hwActive. When loosing the VT the hardware lock is acquired, the
- * hardware is shutdown via a call to DRIDriverRec::shutdownHardware(), and the
- * VT released. When acquiring the VT back the hardware state is restored via a
- * call to DRIDriverRec::restoreHardware() and the hardware lock released.
- */
-static void __driHandleVtSignals( Display *dpy )
-{
- dpy->vtSignalFlag = 0;
-
- fprintf(stderr, "%s: haveVT %d hwActive %d\n", __FUNCTION__,
- dpy->haveVT, dpy->hwActive);
-
- if (!dpy->haveVT && dpy->hwActive) {
- /* Need to get lock and shutdown hardware */
- DRM_LIGHT_LOCK( dpy->driverContext.drmFD,
- dpy->driverContext.pSAREA,
- dpy->driverContext.serverContext );
- dpy->driver->shutdownHardware( &dpy->driverContext );
-
- /* Can now give up control of the VT */
- ioctl( dpy->ConsoleFD, VT_RELDISP, 1 );
- dpy->hwActive = 0;
- }
- else if (dpy->haveVT && !dpy->hwActive) {
- /* Get VT (wait??) */
- ioctl( dpy->ConsoleFD, VT_RELDISP, VT_ACTIVATE );
-
- /* restore HW state, release lock */
- dpy->driver->restoreHardware( &dpy->driverContext );
- DRM_UNLOCK( dpy->driverContext.drmFD,
- dpy->driverContext.pSAREA,
- dpy->driverContext.serverContext );
- dpy->hwActive = 1;
- }
-}
-
-
-#undef max
-#define max(x,y) ((x) > (y) ? (x) : (y))
-
-/**
- * Logic for the select() call.
- *
- * \param dpy display handle.
- * \param n highest fd in any set plus one.
- * \param rfds fd set to be watched for reading, or NULL to create one.
- * \param wfds fd set to be watched for writing, or NULL to create one.
- * \param xfds fd set to be watched for exceptions or error, or NULL to create one.
- * \param tv timeout value, or NULL for no timeout.
- *
- * \return number of file descriptors contained in the sets, or a negative number on failure.
- *
- * \note
- * This all looks pretty complex, but is necessary especially on the
- * server side to prevent a poorly-behaved client from causing the
- * server to block in a read or write and hence not service the other
- * clients.
- *
- * \sa
- * See select_tut in the Linux manual pages for more discussion.
- *
- * \internal
- * Creates and initializes the file descriptor sets by inspecting Display::fd
- * if these aren't passed in the function call. Calls select() and fulfill the
- * demands by trying to fill MiniGLXConnection::readbuf and draining
- * MiniGLXConnection::writebuf.
- * The server fd[0] is handled specially for new connections, by calling
- * handle_new_client().
- *
- */
-int
-__miniglx_Select( Display *dpy, int n, fd_set *rfds, fd_set *wfds, fd_set *xfds,
- struct timeval *tv )
-{
- int i;
- int retval;
- fd_set my_rfds, my_wfds;
- struct timeval my_tv;
-
- if (!rfds) {
- rfds = &my_rfds;
- FD_ZERO(rfds);
- }
-
- if (!wfds) {
- wfds = &my_wfds;
- FD_ZERO(wfds);
- }
-
- /* Don't block if there are events queued. Review this if the
- * flush in XMapWindow is changed to blocking. (Test case:
- * miniglxtest).
- */
- if (dpy->eventqueue.head != dpy->eventqueue.tail) {
- my_tv.tv_sec = my_tv.tv_usec = 0;
- tv = &my_tv;
- }
-
- for (i = 0 ; i < dpy->nrFds; i++) {
- if (dpy->fd[i].fd < 0)
- continue;
-
- if (dpy->fd[i].writebuf_count)
- FD_SET(dpy->fd[i].fd, wfds);
-
- if (dpy->fd[i].readbuf_count < MINIGLX_BUF_SIZE)
- FD_SET(dpy->fd[i].fd, rfds);
-
- n = max(n, dpy->fd[i].fd + 1);
- }
-
- if (dpy->vtSignalFlag)
- __driHandleVtSignals( dpy );
-
- retval = select( n, rfds, wfds, xfds, tv );
-
- if (dpy->vtSignalFlag) {
- int tmp = errno;
- __driHandleVtSignals( dpy );
- errno = tmp;
- }
-
- if (retval < 0) {
- FD_ZERO(rfds);
- FD_ZERO(wfds);
- return retval;
- }
-
- /* Handle server fd[0] specially on the server - accept new client
- * connections.
- */
- if (!dpy->IsClient) {
- if (FD_ISSET(dpy->fd[0].fd, rfds)) {
- FD_CLR(dpy->fd[0].fd, rfds);
- handle_new_client( dpy );
- }
- }
-
- /* Otherwise, try and fill readbuffer and drain writebuffer:
- */
- for (i = 0 ; i < dpy->nrFds ; i++) {
- if (dpy->fd[i].fd < 0)
- continue;
-
- /* If there aren't any event slots left, don't examine
- * any more file events. This will prevent lost events.
- */
- if (dpy->eventqueue.head ==
- ((dpy->eventqueue.tail + 1) & MINIGLX_EVENT_QUEUE_MASK)) {
- fprintf(stderr, "leaving event loop as event queue is full\n");
- return retval;
- }
-
- if (FD_ISSET(dpy->fd[i].fd, wfds)) {
- int r = write(dpy->fd[i].fd,
- dpy->fd[i].writebuf,
- dpy->fd[i].writebuf_count);
-
- if (r < 1)
- shut_fd(dpy,i);
- else {
- dpy->fd[i].writebuf_count -= r;
- if (dpy->fd[i].writebuf_count) {
- memmove(dpy->fd[i].writebuf,
- dpy->fd[i].writebuf + r,
- dpy->fd[i].writebuf_count);
- }
- }
- }
-
- if (FD_ISSET(dpy->fd[i].fd, rfds)) {
- int r = read(dpy->fd[i].fd,
- dpy->fd[i].readbuf + dpy->fd[i].readbuf_count,
- MINIGLX_BUF_SIZE - dpy->fd[i].readbuf_count);
-
- if (r < 1)
- shut_fd(dpy,i);
- else {
- dpy->fd[i].readbuf_count += r;
-
- handle_fifo_read( dpy, i );
- }
- }
- }
-
- return retval;
-}
-
-/**
- * \brief Handle socket events.
- *
- * \param dpy the display handle.
- * \param nonblock whether to return immediately or wait for an event.
- *
- * \return True on success, False on failure. Aborts on critical error.
- *
- * \internal
- * This function is the select() main loop.
- */
-int handle_fd_events( Display *dpy, int nonblock )
-{
- while (1) {
- struct timeval tv = {0, 0};
- int r = __miniglx_Select( dpy, 0, 0, 0, 0, nonblock ? &tv : 0 );
- if (r >= 0)
- return True;
- if (errno == EINTR || errno == EAGAIN)
- continue;
- perror ("select()");
- exit (1);
- }
-}
-
-/**
- * Initializes the connections.
- *
- * \param dpy the display handle.
- *
- * \return True on success or False on failure.
- *
- * Allocates and initializes the Display::fd array and create a Unix socket on
- * the first entry. For a server binds the socket to a filename and listen for
- * connections. For a client connects to the server and waits for a welcome
- * message. Sets the socket in nonblocking mode.
- */
-int __miniglx_open_connections( Display *dpy )
-{
- struct sockaddr_un sa;
- int i;
-
- dpy->nrFds = dpy->IsClient ? 1 : MINIGLX_MAX_SERVER_FDS;
- dpy->fd = calloc(1, dpy->nrFds * sizeof(struct MiniGLXConnection));
- if (!dpy->fd)
- return False;
-
- for (i = 0 ; i < dpy->nrFds ; i++)
- dpy->fd[i].fd = -1;
-
- if (!dpy->IsClient) {
- if (unlink(MINIGLX_FIFO_NAME) != 0 && errno != ENOENT) {
- perror("unlink " MINIGLX_FIFO_NAME);
- return False;
- }
-
- }
-
- /* Create a Unix socket -- Note this is *not* a network connection!
- */
- dpy->fd[0].fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if (dpy->fd[0].fd < 0) {
- perror("socket " MINIGLX_FIFO_NAME);
- return False;
- }
-
- memset(&sa, 0, sizeof(sa));
- sa.sun_family = AF_UNIX;
- strcpy(sa.sun_path, MINIGLX_FIFO_NAME);
-
- if (dpy->IsClient) {
- /* Connect to server
- */
- if (connect(dpy->fd[0].fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) {
- perror("connect");
- shut_fd(dpy,0);
- return False;
- }
-
- /* Wait for configuration messages from the server.
- */
- welcome_message( dpy, 0 );
- }
- else {
- mode_t tmp = umask( 0000 ); /* open to everybody ? */
-
- /* Bind socket to our filename
- */
- if (bind(dpy->fd[0].fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) {
- perror("bind");
- shut_fd(dpy,0);
- return False;
- }
-
- umask( tmp );
-
- /* Listen for connections
- */
- if (listen(dpy->fd[0].fd, 5) != 0) {
- perror("listen");
- shut_fd(dpy,0);
- return False;
- }
- }
-
- if (fcntl(dpy->fd[0].fd, F_SETFL, O_NONBLOCK) != 0) {
- perror("fcntl");
- shut_fd(dpy,0);
- return False;
- }
-
-
- return True;
-}
-
-
-/**
- * Frees the connections initialized by __miniglx_open_connections().
- *
- * \param dpy the display handle.
- */
-void __miniglx_close_connections( Display *dpy )
-{
- int i;
-
- for (i = 0 ; i < dpy->nrFds ; i++) {
- if (dpy->fd[i].fd >= 0) {
- shutdown (dpy->fd[i].fd, SHUT_RDWR);
- close (dpy->fd[i].fd);
- }
- }
-
- dpy->nrFds = 0;
- free(dpy->fd);
-}
-
-
-/**
- * Set a drawable flag.
- *
- * \param dpy the display handle.
- * \param w drawable (window).
- * \param flag flag.
- *
- * Sets the specified drawable flag in the SAREA and increment its stamp while
- * holding the light hardware lock.
- */
-static void set_drawable_flag( Display *dpy, int w, int flag )
-{
- if (dpy->driverContext.pSAREA) {
- if (dpy->hwActive)
- DRM_LIGHT_LOCK( dpy->driverContext.drmFD,
- dpy->driverContext.pSAREA,
- dpy->driverContext.serverContext );
-
- dpy->driverContext.pSAREA->drawableTable[w].stamp++;
- dpy->driverContext.pSAREA->drawableTable[w].flags = flag;
-
- if (dpy->hwActive)
- DRM_UNLOCK( dpy->driverContext.drmFD,
- dpy->driverContext.pSAREA,
- dpy->driverContext.serverContext );
- }
-}
-
-
-
-/**
- * \brief Map Window.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param w the window handle.
- *
- * If called by a client, sends a request for focus to the server. If
- * called by the server, will generate a MapNotify and Expose event at
- * the client.
- *
- */
-void
-XMapWindow( Display *dpy, Window w )
-{
- if (dpy->IsClient)
- send_char_msg( dpy, 0, _CanIHaveFocus );
- else {
- set_drawable_flag( dpy, (int)w, 1 );
- send_char_msg( dpy, (int)w, _YouveGotFocus );
- send_char_msg( dpy, (int)w, _RepaintPlease );
- dpy->TheWindow = w;
- }
- handle_fd_events( dpy, 0 ); /* flush write queue */
-}
-
-/**
- * \brief Unmap Window.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param w the window handle.
- *
- * Called from the client: Lets the server know that the window won't
- * be updated anymore.
- *
- * Called from the server: Tells the specified client that it no longer
- * holds the focus.
- */
-void
-XUnmapWindow( Display *dpy, Window w )
-{
- if (dpy->IsClient) {
- send_char_msg( dpy, 0, _IDontWantFocus );
- }
- else {
- dpy->TheWindow = 0;
- set_drawable_flag( dpy, (int)w, 0 );
- send_char_msg( dpy, (int)w, _YouveLostFocus );
- }
- handle_fd_events( dpy, 0 ); /* flush write queue */
-}
-
-
-/**
- * \brief Block and wait for next X event.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param event_return a pointer to an XEvent structure for the returned data.
- *
- * Wait until there is a new XEvent pending.
- */
-int XNextEvent(Display *dpy, XEvent *event_return)
-{
- for (;;) {
- if ( dpy->eventqueue.head != dpy->eventqueue.tail )
- return dequeue_event( dpy, event_return );
-
- handle_fd_events( dpy, 0 );
- }
-}
-
-/**
- * \brief Non-blocking check for next X event.
- *
- * \param dpy the display handle as returned by XOpenDisplay().
- * \param event_mask ignored.
- * \param event_return a pointer to an XEvent structure for the returned data.
- *
- * Check if there is a new XEvent pending. Note that event_mask is
- * ignored and any pending event will be returned.
- */
-Bool XCheckMaskEvent(Display *dpy, long event_mask, XEvent *event_return)
-{
- if ( dpy->eventqueue.head != dpy->eventqueue.tail )
- return dequeue_event( dpy, event_return );
-
- handle_fd_events( dpy, 1 );
-
- return dequeue_event( dpy, event_return );
-}
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 5b756c26aff..d208fd80a88 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -1016,11 +1016,11 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
/* Something is busted. Punt. */
UnlockDisplay(dpy);
+ SyncHandle();
FreeScreenConfigs(priv);
return GL_FALSE;
}
- UnlockDisplay(dpy);
if (!reply.numVisuals) {
/* This screen does not support GL rendering */
UnlockDisplay(dpy);
diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c
deleted file mode 100644
index cb46efa56ac..00000000000
--- a/src/mesa/drivers/allegro/amesa.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <allegro.h>
-#include "buffers.h"
-#include "context.h"
-#include "imports.h"
-#include "matrix.h"
-#include "mtypes.h"
-#include "GL/amesa.h"
-
-
-struct amesa_visual
- {
- GLvisual *GLVisual; /* inherit from GLvisual */
- GLboolean DBFlag; /* double buffered? */
- GLuint Depth; /* bits per pixel ( >= 15 ) */
- };
-
-
-struct amesa_buffer
- {
- GLframebuffer *GLBuffer; /* inherit from GLframebuffer */
- GLuint Width, Height;
- BITMAP *Screen;
- BITMAP *Background;
- BITMAP *Active;
- };
-
-
-struct amesa_context
- {
- GLcontext *GLContext; /* inherit from GLcontext */
- AMesaVisual Visual;
- AMesaBuffer Buffer;
- GLuint ClearColor;
- GLuint CurrentColor;
- };
-
-
-static void setup_dd_pointers(GLcontext *ctx);
-
-
-/**********************************************************************/
-/***** drawing functions *****/
-/**********************************************************************/
-
-#define FLIP(context, y) (context->Buffer->Height - (y) - 1)
-
-#include "allegro/generic.h"
-#include "allegro/direct.h"
-
-
-/**********************************************************************/
-/***** 15-bit accelerated drawing funcs *****/
-/**********************************************************************/
-
-IMPLEMENT_WRITE_RGBA_SPAN(15, unsigned short)
-IMPLEMENT_WRITE_RGB_SPAN(15, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_SPAN(15, unsigned short)
-IMPLEMENT_READ_RGBA_SPAN(15, unsigned short)
-IMPLEMENT_WRITE_RGBA_PIXELS(15, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_PIXELS(15, unsigned short)
-IMPLEMENT_READ_RGBA_PIXELS(15, unsigned short)
-
-
-/**********************************************************************/
-/***** 16-bit accelerated drawing funcs *****/
-/**********************************************************************/
-
-IMPLEMENT_WRITE_RGBA_SPAN(16, unsigned short)
-IMPLEMENT_WRITE_RGB_SPAN(16, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_SPAN(16, unsigned short)
-IMPLEMENT_READ_RGBA_SPAN(16, unsigned short)
-IMPLEMENT_WRITE_RGBA_PIXELS(16, unsigned short)
-IMPLEMENT_WRITE_MONO_RGBA_PIXELS(16, unsigned short)
-IMPLEMENT_READ_RGBA_PIXELS(16, unsigned short)
-
-
-/**********************************************************************/
-/***** 32-bit accelerated drawing funcs *****/
-/**********************************************************************/
-
-IMPLEMENT_WRITE_RGBA_SPAN(32, unsigned long)
-IMPLEMENT_WRITE_RGB_SPAN(32, unsigned long)
-IMPLEMENT_WRITE_MONO_RGBA_SPAN(32, unsigned long)
-IMPLEMENT_READ_RGBA_SPAN(32, unsigned long)
-IMPLEMENT_WRITE_RGBA_PIXELS(32, unsigned long)
-IMPLEMENT_WRITE_MONO_RGBA_PIXELS(32, unsigned long)
-IMPLEMENT_READ_RGBA_PIXELS(32, unsigned long)
-
-
-/**********************************************************************/
-/***** Miscellaneous device driver funcs *****/
-/**********************************************************************/
-
-static GLboolean set_buffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bit)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- GLboolean ok = GL_TRUE;
-
- if (bit == DD_FRONT_LEFT_BIT)
- context->Buffer->Active = context->Buffer->Screen;
-
- else if (bit == DD_BACK_LEFT)
- {
- if (context->Buffer->Background)
- context->Buffer->Active = context->Buffer->Background;
- else
- ok = GL_FALSE;
- }
-
- else
- ok = GL_FALSE;
-
- return ok;
- }
-
-
-static void get_buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- *width = context->Buffer->Width;
- *height = context->Buffer->Height;
- }
-
-
-static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- /* poll for window size change and realloc software Z/stencil/etc if needed */
- _mesa_ResizeBuffersMESA();
-}
-
-
-/**********************************************************************/
-/**********************************************************************/
-
-static void setup_dd_pointers(GLcontext *ctx)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- /* Initialize all the pointers in the driver struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
-
- ctx->Driver.UpdateState = setup_dd_pointers;
- ctx->Driver.SetBuffer = set_buffer;
- ctx->Driver.GetBufferSize = get_buffer_size;
- ctx->Driver.Viewport = viewport;
-
- ctx->Driver.Color = set_color_generic;
- ctx->Driver.ClearColor = clear_color_generic;
- ctx->Driver.Clear = clear_generic;
- ctx->Driver.WriteRGBASpan = write_rgba_span_generic;
- ctx->Driver.WriteRGBSpan = write_rgb_span_generic;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_generic;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_generic;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_generic;
- ctx->Driver.ReadRGBASpan = read_rgba_span_generic;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_generic;
-
- if (context->Buffer->Active != screen)
- {
- switch (context->Visual->Depth)
- {
- case 15:
- ctx->Driver.WriteRGBASpan = write_rgba_span_15;
- ctx->Driver.WriteRGBSpan = write_rgb_span_15;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_15;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_15;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_15;
- ctx->Driver.ReadRGBASpan = read_rgba_span_15;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_15;
- break;
-
- case 16:
- ctx->Driver.WriteRGBASpan = write_rgba_span_16;
- ctx->Driver.WriteRGBSpan = write_rgb_span_16;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_16;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_16;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_16;
- ctx->Driver.ReadRGBASpan = read_rgba_span_16;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_16;
- break;
-
- case 32:
- ctx->Driver.WriteRGBASpan = write_rgba_span_32;
- ctx->Driver.WriteRGBSpan = write_rgb_span_32;
- ctx->Driver.WriteMonoRGBASpan = write_mono_rgba_span_32;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_32;
- ctx->Driver.WriteMonoRGBAPixels = write_mono_rgba_pixels_32;
- ctx->Driver.ReadRGBASpan = read_rgba_span_32;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels_32;
- break;
- }
- }
- }
-
-
-/**********************************************************************/
-/***** AMesa Public API Functions *****/
-/**********************************************************************/
-
-
-AMesaVisual AMesaCreateVisual(GLboolean dbFlag, GLint depth,
- GLint depthSize, GLint stencilSize, GLint accumSize)
- {
- AMesaVisual visual;
- GLbyte redBits, greenBits, blueBits;
-
- visual = (AMesaVisual)calloc(1, sizeof(struct amesa_visual));
- if (!visual)
- return NULL;
-
- switch (depth)
- {
- case 15:
- redBits = 5;
- greenBits = 5;
- blueBits = 5;
- break;
-
- case 16:
- redBits = 5;
- greenBits = 6;
- blueBits = 5;
- break;
-
- case 24: case 32:
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- break;
-
- default:
- free(visual);
- return NULL;
- }
-
- visual->DBFlag = dbFlag;
- visual->Depth = depth;
- visual->GLVisual = _mesa_create_visual(GL_TRUE, /* rgb mode */
- dbFlag, /* db_flag */
- GL_FALSE, /* stereo */
- redBits, greenBits, blueBits, 8,
- 0, /* index bits */
- depthSize, /* depth bits */
- stencilSize,/* stencil bits */
- accumSize, /* accum bits */
- accumSize, /* accum bits */
- accumSize, /* accum bits */
- accumSize, /* accum bits */
- 1 );
- if (!visual->GLVisual)
- {
- free(visual);
- return NULL;
- }
-
- return visual;
- }
-
-
-void AMesaDestroyVisual(AMesaVisual visual)
- {
- _mesa_destroy_visual(visual->GLVisual);
- free(visual);
- }
-
-
-AMesaBuffer AMesaCreateBuffer(AMesaVisual visual,
- GLint width, GLint height)
- {
- AMesaBuffer buffer;
-
- buffer = (AMesaBuffer)calloc(1, sizeof(struct amesa_buffer));
- if (!buffer)
- return NULL;
-
- buffer->Screen = NULL;
- buffer->Background = NULL;
- buffer->Active = NULL;
- buffer->Width = width;
- buffer->Height = height;
-
- if (visual->DBFlag)
- {
- buffer->Background = create_bitmap_ex(visual->Depth, width, height);
- if (!buffer->Background)
- {
- free(buffer);
- return NULL;
- }
- }
-
- buffer->GLBuffer = _mesa_create_framebuffer(visual->GLVisual);
- if (!buffer->GLBuffer)
- {
- if (buffer->Background) destroy_bitmap(buffer->Background);
- free(buffer);
- return NULL;
- }
-
- return buffer;
- }
-
-
-void AMesaDestroyBuffer(AMesaBuffer buffer)
-{
- if (buffer->Screen) destroy_bitmap(buffer->Screen);
- if (buffer->Background) destroy_bitmap(buffer->Background);
- _mesa_destroy_framebuffer(buffer->GLBuffer);
- free(buffer);
-}
-
-
-AMesaContext AMesaCreateContext(AMesaVisual visual,
- AMesaContext share)
-{
- AMesaContext context;
- GLboolean direct = GL_FALSE;
-
- context = (AMesaContext)calloc(1, sizeof(struct amesa_context));
- if (!context)
- return NULL;
-
- context->Visual = visual;
- context->Buffer = NULL;
- context->ClearColor = 0;
- context->CurrentColor = 0;
- context->GLContext = _mesa_create_context(visual->GLVisual,
- share ? share->GLContext : NULL,
- (void *) context, GL_FALSE );
- if (!context->GLContext)
- {
- free(context);
- return NULL;
- }
-
- return context;
-}
-
-
-void AMesaDestroyContext(AMesaContext context)
-{
- _mesa_destroy_context(context->GLContext);
- free(context);
-}
-
-
-GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer)
-{
- if (context && buffer) {
- set_color_depth(context->Visual->Depth);
- if (set_gfx_mode(GFX_AUTODETECT, buffer->Width, buffer->Height, 0, 0) != 0)
- return GL_FALSE;
-
- context->Buffer = buffer;
- buffer->Screen = screen;
- buffer->Active = buffer->Background ? buffer->Background : screen;
-
- setup_dd_pointers(context->GLContext);
- _mesa_make_current(context->GLContext, buffer->GLBuffer);
- }
- else {
- /* XXX I don't think you want to destroy anything here! */
- destroy_bitmap(context->Buffer->Screen);
- context->Buffer->Screen = NULL;
- context->Buffer->Active = NULL;
- context->Buffer = NULL;
- _mesa_make_current(NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-
-void AMesaSwapBuffers(AMesaBuffer buffer)
-{
- if (buffer->Background) {
- blit(buffer->Background, buffer->Screen,
- 0, 0, 0, 0,
- buffer->Width, buffer->Height);
- }
-}
diff --git a/src/mesa/drivers/allegro/direct.h b/src/mesa/drivers/allegro/direct.h
deleted file mode 100644
index 3998fc19d7b..00000000000
--- a/src/mesa/drivers/allegro/direct.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#define DESTINATION(BMP, X, Y, TYPE) \
- ({ \
- BITMAP *_bmp = BMP; \
- \
- (TYPE*)(_bmp->line[_bmp->h - (Y) - 1]) + (X); \
- })
-
-
-#define IMPLEMENT_WRITE_RGBA_SPAN(DEPTH, TYPE) \
-static void write_rgba_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLubyte rgba[][4], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \
- \
- if (mask) \
- { \
- while (n--) \
- { \
- if (mask[0]) d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \
- d++; rgba++; mask++; \
- } \
- } \
- else \
- { \
- while (n--) \
- { \
- d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \
- d++; rgba++; \
- } \
- } \
- }
-
-
-#define IMPLEMENT_WRITE_RGB_SPAN(DEPTH, TYPE) \
-static void write_rgb_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLubyte rgb[][3], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \
- \
- if (mask) \
- { \
- while (n--) \
- { \
- if (mask[0]) d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]); \
- d++; rgb++; mask++; \
- } \
- } \
- else \
- { \
- while (n--) \
- { \
- d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]); \
- d++; rgb++; \
- } \
- } \
- }
-
-
-#define IMPLEMENT_WRITE_MONO_RGBA_SPAN(DEPTH, TYPE) \
-static void write_mono_rgba_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE color = context->CurrentColor; \
- TYPE *d = DESTINATION(context->Buffer->Active, x, y, TYPE); \
- \
- while (n--) \
- { \
- if (mask[0]) d[0] = color; \
- d++; mask++; \
- } \
- }
-
-
-#define IMPLEMENT_READ_RGBA_SPAN(DEPTH, TYPE) \
-static void read_rgba_span_##DEPTH (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- GLubyte rgba[][4]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- BITMAP *bmp = context->Buffer->Active; \
- TYPE *d = DESTINATION(bmp, x, y, TYPE); \
- \
- while (n--) \
- { \
- rgba[0][RCOMP] = getr##DEPTH(d[0]); \
- rgba[0][GCOMP] = getg##DEPTH(d[0]); \
- rgba[0][BCOMP] = getb##DEPTH(d[0]); \
- rgba[0][ACOMP] = 255; \
- \
- d++; rgba++; \
- } \
- }
-
-
-#define IMPLEMENT_WRITE_RGBA_PIXELS(DEPTH, TYPE) \
-static void write_rgba_pixels_##DEPTH (const GLcontext *ctx, \
- GLuint n, \
- const GLint x[], \
- const GLint y[], \
- const GLubyte rgba[][4], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- BITMAP *bmp = context->Buffer->Active; \
- \
- while (n--) \
- { \
- if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]); \
- rgba++; x++; y++; mask++; \
- } \
- }
-
-
-
-#define IMPLEMENT_WRITE_MONO_RGBA_PIXELS(DEPTH, TYPE) \
-static void write_mono_rgba_pixels_##DEPTH (const GLcontext *ctx, \
- GLuint n, \
- const GLint x[], \
- const GLint y[], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- TYPE color = context->CurrentColor; \
- BITMAP *bmp = context->Buffer->Active; \
- \
- while (n--) \
- { \
- if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = color; \
- x++; y++; mask++; \
- } \
- }
-
-
-#define IMPLEMENT_READ_RGBA_PIXELS(DEPTH, TYPE) \
-static void read_rgba_pixels_##DEPTH (const GLcontext *ctx, \
- GLuint n, \
- const GLint x[], \
- const GLint y[], \
- GLubyte rgba[][4], \
- const GLubyte mask[]) \
- { \
- AMesaContext context = (AMesaContext)(ctx->DriverCtx); \
- BITMAP *bmp = context->Buffer->Active; \
- \
- while (n--) \
- { \
- if (mask[0]) \
- { \
- int color = *DESTINATION(bmp, x[0], y[0], TYPE); \
- \
- rgba[0][RCOMP] = getr##DEPTH(color); \
- rgba[0][GCOMP] = getg##DEPTH(color); \
- rgba[0][BCOMP] = getb##DEPTH(color); \
- rgba[0][ACOMP] = 255; \
- } \
- \
- x++; y++; rgba++; mask++; \
- } \
- }
-
diff --git a/src/mesa/drivers/allegro/generic.h b/src/mesa/drivers/allegro/generic.h
deleted file mode 100644
index cbdf5ff2b3a..00000000000
--- a/src/mesa/drivers/allegro/generic.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 3.0
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-static void clear_color_generic(GLcontext *ctx, const GLfloat color[4])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- GLubyte r, g, b;
- CLAMPED_FLOAT_TO_UBYTE(r, color[0]);
- CLAMPED_FLOAT_TO_UBYTE(g, color[1]);
- CLAMPED_FLOAT_TO_UBYTE(b, color[2]);
- context->ClearColor = makecol(r, g, b);
- }
-
-
-static void set_color_generic(GLcontext *ctx,
- GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- context->CurrentColor = makecol(red, green, blue);
- }
-
-
-static GLbitfield clear_generic(GLcontext *ctx,
- GLbitfield mask, GLboolean all,
- GLint x, GLint y,
- GLint width, GLint height)
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- if (mask & GL_COLOR_BUFFER_BIT)
- {
- if (all)
- clear_to_color(context->Buffer->Active, context->ClearColor);
- else
- rect(context->Buffer->Active,
- x, y, x+width-1, y+height-1,
- context->ClearColor);
- }
-
- return mask & (~GL_COLOR_BUFFER_BIT);
- }
-
-
-static void write_rgba_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- y = FLIP(context, y);
-
- if (mask)
- {
- while (n--)
- {
- if (mask[0]) putpixel(bmp, x, y, makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]));
- x++; mask++; rgba++;
- }
- }
- else
- {
- while (n--)
- {
- putpixel(bmp, x, y, makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]));
- x++; rgba++;
- }
- }
- }
-
-
-static void write_rgb_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- y = FLIP(context, y);
-
- if (mask)
- {
- while(n--)
- {
- if (mask[0]) putpixel(bmp, x, y, makecol(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]));
- x++; mask++; rgb++;
- }
- }
- else
- {
- while (n--)
- {
- putpixel(bmp, x, y, makecol(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]));
- x++; rgb++;
- }
- }
- }
-
-
-static void write_mono_rgba_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
- int color = context->CurrentColor;
-
- y = FLIP(context, y);
-
- if (mask)
- {
- while(n--)
- {
- if (mask[0]) putpixel(bmp, x, y, color);
- x++; mask++;
- }
- }
- else
- {
- while(n--)
- {
- putpixel(bmp, x, y, color);
- x++;
- }
- }
- }
-
-
-static void read_rgba_span_generic(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- y = FLIP(context, y);
-
- while (n--)
- {
- int color = getpixel(bmp, x, y);
-
- rgba[0][RCOMP] = getr(color);
- rgba[0][GCOMP] = getg(color);
- rgba[0][BCOMP] = getb(color);
- rgba[0][ACOMP] = 255;
-
- x++; rgba++;
- }
- }
-
-
-static void write_rgba_pixels_generic(const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- while (n--)
- {
- if (mask[0]) putpixel(bmp, x[0], FLIP(context, y[0]), makecol(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]));
- x++; y++; mask++;
- }
- }
-
-
-static void write_mono_rgba_pixels_generic(const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
- int color = context->CurrentColor;
-
- while (n--)
- {
- if (mask[0]) putpixel(bmp, x[0], FLIP(context, y[0]), color);
- x++; y++; mask++;
- }
- }
-
-
-static void read_rgba_pixels_generic(const GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- GLubyte rgba[][4],
- const GLubyte mask[])
- {
- AMesaContext context = (AMesaContext)(ctx->DriverCtx);
- BITMAP *bmp = context->Buffer->Active;
-
- while (n--)
- {
- if (mask[0])
- {
- int color = getpixel(bmp, x[0], FLIP(context, y[0]));
-
- rgba[0][RCOMP] = getr(color);
- rgba[0][GCOMP] = getg(color);
- rgba[0][BCOMP] = getb(color);
- rgba[0][ACOMP] = 255;
- }
-
- x++; y++; mask++; rgba++;
- }
- }
-
diff --git a/src/mesa/drivers/d3d/D3DCAPS.CPP b/src/mesa/drivers/d3d/D3DCAPS.CPP
deleted file mode 100644
index cd95ef0f1ee..00000000000
--- a/src/mesa/drivers/d3d/D3DCAPS.CPP
+++ /dev/null
@@ -1,250 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver Build 5 */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-#define SRCBLEND_MAP(gl,d3d,fall) if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwSrcBlendCaps & d3d ) \
- { \
- sprintf( buffer, "SRC Blend: %s -> %s", # gl, # d3d ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwSrcBlendCaps[index] = d3d; \
- } \
- else \
- { \
- sprintf( buffer, "SRC Blend: %s -> %s", # gl, # fall ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwSrcBlendCaps[index] = fall; \
- }
-#define DSTBLEND_MAP(gl,d3d,fall) if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwDestBlendCaps & d3d ) \
- { \
- sprintf( buffer, "DST Blend: %s -> %s", # gl, # d3d ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwDestBlendCaps[index] = d3d; \
- } \
- else \
- { \
- sprintf( buffer, "DST Blend: %s -> %s", # gl, # fall ); \
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), buffer )); \
- pShared->dwDestBlendCaps[index] = fall; \
- }
-
-/*===========================================================================*/
-/* I use this function to handle the fact that the D3D texture blending and */
-/* OpenGL texture blending functions don't map one to one. Also there is the*/
-/* problem with cards not supporting all the D3D functions. So I use the CAPS*/
-/* of the card to make a table of functions that will have defaults for the */
-/* unsupported functions. */
-/* So first I fill the table with the fallback function then I check to see */
-/* if the card supports the requested function. If it does I replace the */
-/* default thats already in the array. Now order does matter as I used an */
-/* enum type in D3DShared.h so that the mapping would be a little easier. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void AlphaBlendTableHAL( PMESAD3DHAL pHAL )
-{
- PMESAD3DSHARED pShared = &pHAL->shared;
- int index;
- char buffer[128];
-
- DPF(( DBG_FUNC, "AlphaBlendTableHAL();" ));
-
- /* Make the fallback for the Source blend. */
- for( index = 0; index < 14; index++ )
- {
- switch( index )
- {
- case s_zero:
- SRCBLEND_MAP( GL_ZERO, D3DBLEND_ZERO, D3DBLEND_ONE );
- break;
- case s_one:
- SRCBLEND_MAP( GL_ONE, D3DBLEND_ONE, D3DBLEND_ONE );
- break;
- case s_dst_color:
- SRCBLEND_MAP( GL_DST_COLOR, D3DBLEND_DESTCOLOR, D3DBLEND_ONE );
- break;
- case s_one_minus_dst_color:
- SRCBLEND_MAP( GL_ONE_MINUS_DST_COLOR, D3DBLEND_INVDESTCOLOR, D3DBLEND_ONE );
- break;
- case s_src_alpha:
- SRCBLEND_MAP( GL_SRC_ALPHA, D3DBLEND_SRCALPHA, D3DBLEND_ONE );
- break;
- case s_one_minus_src_alpha:
- SRCBLEND_MAP( GL_ONE_MINUS_SRC_ALPHA, D3DBLEND_INVSRCALPHA, D3DBLEND_ONE );
- break;
- case s_dst_alpha:
- SRCBLEND_MAP( GL_DST_ALPHA, D3DBLEND_DESTALPHA, D3DBLEND_ONE );
- break;
- case s_one_minus_dst_alpha:
- SRCBLEND_MAP( GL_ONE_MINUS_DST_ALPHA, D3DBLEND_INVDESTALPHA, D3DBLEND_ONE );
- break;
- case s_src_alpha_saturate:
- SRCBLEND_MAP( GL_SRC_ALPHA_SATURATE, D3DBLEND_SRCALPHASAT, D3DBLEND_ONE );
- break;
- case s_constant_color:
- SRCBLEND_MAP( GL_CONSTANT_COLOR, D3DBLEND_SRCCOLOR, D3DBLEND_ONE );
- break;
- case s_one_minus_constant_color:
- SRCBLEND_MAP( GL_ONE_MINUS_CONSTANT_COLOR, D3DBLEND_INVSRCCOLOR, D3DBLEND_ONE );
- break;
- case s_constant_alpha:
- SRCBLEND_MAP( GL_CONSTANT_ALPHA, D3DBLEND_BOTHSRCALPHA, D3DBLEND_ONE );
- break;
- case s_one_minus_constant_alpha:
- SRCBLEND_MAP( GL_ONE_MINUS_CONSTANT_ALPHA, D3DBLEND_BOTHINVSRCALPHA, D3DBLEND_ONE );
- break;
- }
- }
-
- /* Make the fallback for the Destination blend. */
- for( index = 0; index < 14; index++ )
- {
- switch( index )
- {
- case d_zero:
- DSTBLEND_MAP( GL_ZERO, D3DBLEND_ZERO, D3DBLEND_ONE );
- break;
- case d_one:
- DSTBLEND_MAP( GL_ONE, D3DBLEND_ONE, D3DBLEND_ONE );
- break;
- case d_src_color:
- DSTBLEND_MAP( GL_SRC_COLOR, D3DBLEND_SRCCOLOR, D3DBLEND_ONE );
- break;
- case d_one_minus_src_color:
- DSTBLEND_MAP( GL_ONE_MINUS_SRC_COLOR, D3DBLEND_INVSRCCOLOR, D3DBLEND_ONE );
- break;
- case d_src_alpha:
- DSTBLEND_MAP( GL_SRC_ALPHA, D3DBLEND_SRCALPHA, D3DBLEND_ONE );
- break;
- case d_one_minus_src_alpha:
- DSTBLEND_MAP( GL_ONE_MINUS_SRC_ALPHA, D3DBLEND_INVSRCALPHA, D3DBLEND_ONE );
- break;
- case d_dst_alpha:
- DSTBLEND_MAP( GL_DST_ALPHA, D3DBLEND_DESTALPHA, D3DBLEND_ONE );
- break;
- case d_one_minus_dst_alpha:
- DSTBLEND_MAP( GL_ONE_MINUS_DST_ALPHA, D3DBLEND_INVDESTALPHA, D3DBLEND_ONE );
- break;
- case d_constant_color:
- DSTBLEND_MAP( GL_CONSTANT_COLOR, D3DBLEND_DESTCOLOR, D3DBLEND_ONE );
- break;
- case d_one_minus_constant_color:
- DSTBLEND_MAP( GL_ONE_MINUS_CONSTANT_COLOR, D3DBLEND_INVDESTCOLOR, D3DBLEND_ONE );
- break;
- case d_constant_alpha:
- DSTBLEND_MAP( GL_CONSTANT_ALPHAR, D3DBLEND_BOTHSRCALPHA, D3DBLEND_ONE );
- break;
- case d_one_minus_constant_alpha:
- DSTBLEND_MAP( GL_ONE_MINUS_CONSTANT_ALPHA, D3DBLEND_BOTHINVSRCALPHA, D3DBLEND_ONE );
- break;
- }
- }
-
- /* Make the fallbacks for the texture functions. */
- for( index = 0; index < 4; index++ )
- {
- switch( index )
- {
- case d3dtblend_decal:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_DECAL" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_MODULATE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATE;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECAL -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- case d3dtblend_decalalpha:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECALALPHA )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPHA -> D3DTBLEND_DECALALPHA" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECALALPHA;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPA -> D3DTBLEND_DECAL" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_DECALALPHA -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- case d3dtblend_modulate:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_MODULATE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATE;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATEALPHA )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_MODULATEALPHA" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATEALPHA;
- }
- else if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_DECAL" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATE -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- case d3dtblend_modulatealpha:
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATEALPHA )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_MODULATEALPHA" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATEALPHA;
- }
- else
- {
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_MODULATE )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_MODULATE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_MODULATE;
- }
- else if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureBlendCaps & D3DTBLEND_DECAL )
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_DECALE" ));
- pShared->dwTexFunc[index] = D3DTBLEND_DECAL;
- }
- else
- {
- DPF(( (DBG_CNTX_INFO|DBG_TXT_INFO), "D3DTBLEND_MODULATEALPHA -> D3DTBLEND_ADD" ));
- pShared->dwTexFunc[index] = D3DTBLEND_ADD;
- }
- }
- break;
- }
- }
-}
-
diff --git a/src/mesa/drivers/d3d/D3DHAL.H b/src/mesa/drivers/d3d/D3DHAL.H
deleted file mode 100644
index 5295520d7be..00000000000
--- a/src/mesa/drivers/d3d/D3DHAL.H
+++ /dev/null
@@ -1,68 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef _D3D_HAL_INC
-#define _D3D_HAL_INC
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include <stdlib.h>
-#include <time.h>
-#include "D3DShared.h"
-#include "D3DTextureMgr.h"
-#include "Debug.h"
-/*===========================================================================*/
-/* Defines. */
-/*===========================================================================*/
-#define DX_RESTORE(ps) if ( (ps) && (ps)->IsLost() ) (ps)->Restore();
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-typedef struct _d3d_hal_struct
-{
- MESAD3DSHARED shared;
-
- GUID guid;
- LPDIRECTDRAW lpDD;
- LPDIRECTDRAW4 lpDD4;
- LPDIRECT3D3 lpD3D3;
- LPDIRECT3DDEVICE3 lpD3DDevice;
- D3DDEVICEDESC D3DHWDevDesc;
- LPDIRECTDRAWSURFACE4 lpDDSPrimary,
- lpDDSRender,
- lpDDSZbuffer;
- LPDIRECT3DVIEWPORT3 lpViewport;
- LPDIRECTDRAWCLIPPER lpClipper;
- DDPIXELFORMAT ddpf,
- ddpfZBuffer;
- PTM_OBJECT pTMList;
-
-} MESAD3DHAL, *PMESAD3DHAL;
-/*===========================================================================*/
-/* External function prototypes. */
-/*===========================================================================*/
-extern BOOL InitTMgrHAL( PMESAD3DHAL pHAL );
-extern void TermTMgrHAL( PMESAD3DHAL pHAL );
-extern void AlphaBlendTableHAL( PMESAD3DHAL pHAL );
-
-extern void Solve8BitChannelPixelFormat( DDPIXELFORMAT *pddpf, PPIXELINFO pPixel );
-extern char *ErrorStringD3D( HRESULT hr );
-extern void FatalShutDown( PMESAD3DHAL pHAL );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern char *errorMsg;
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/D3DInit.cpp b/src/mesa/drivers/d3d/D3DInit.cpp
deleted file mode 100644
index ba7891612e4..00000000000
--- a/src/mesa/drivers/d3d/D3DInit.cpp
+++ /dev/null
@@ -1,891 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver Build 5 */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Local function prototypes. */
-/*===========================================================================*/
-static void DestroyAllSurfaces( PMESAD3DHAL pHAL );
-static void DestroyDevice( PMESAD3DHAL pHAL );
-static void DestroyInterfaces( PMESAD3DHAL pHAL );
-
-HRESULT WINAPI EnumSurfacesHook( LPDIRECTDRAWSURFACE4 lpDDS, LPDDSURFACEDESC2 lpDDSDesc, LPVOID pVoid );
-HRESULT CALLBACK EnumZBufferHook( DDPIXELFORMAT* pddpf, VOID *pVoid );
-HRESULT CALLBACK EnumDeviceHook( GUID FAR* lpGuid, LPSTR lpDesc, LPSTR lpName, LPD3DDEVICEDESC lpD3DHWDesc, LPD3DDEVICEDESC lpD3DHELDesc, void *pVoid );
-/*===========================================================================*/
-/* Globals. */
-/*===========================================================================*/
-//char *errorMsg;
-/*===========================================================================*/
-/* This function is responable for allocating the actual MESAD3DHAL struct. */
-/* Each Mesa context will have its own MESAD3DHAL struct so its like a mini */
-/* context to some extent. All one time allocations/operations get done here.*/
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" PMESAD3DSHARED InitHAL( HWND hwnd )
-{
- PMESAD3DHAL pHAL;
- ULONG rc;
-
- DPF(( DBG_FUNC, "InitHAL();" ));
- DPF(( DBG_CNTX_INFO, "hwnd: %d", hwnd ));
-
- /* Allocate the structure and zero it out. */
- pHAL = (PMESAD3DHAL)ALLOC( sizeof(MESAD3DHAL) );
- if ( pHAL == NULL )
- {
- RIP( pHAL, "InitHAL->", "Memory Allocation" );
- return (PMESAD3DSHARED)NULL;
- }
- memset( pHAL, 0, sizeof(MESAD3DHAL) );
-
- /* Get the texture manager going. */
- rc = InitTMgrHAL( pHAL );
- if ( rc == FALSE )
- {
- RIP( pHAL, "InitTMgrHAL->", "Failed" );
- return (PMESAD3DSHARED)NULL;
- }
-
- /* Fill in the window parameters if we can. */
- pHAL->shared.hwnd = hwnd;
-
- /* Parse the user's enviroment variables to generate a debug mask. */
- ReadDBGEnv();
-
- return (PMESAD3DSHARED)pHAL;
-}
-/*===========================================================================*/
-/* This function will unload all the resources that the MESAD3DHAL struct */
-/* has bound to it. The actual structure itself will be freed. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void TermHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
- DPF(( DBG_FUNC, "TermHAL();" ));
-
- /* Check for an empty wrapper structure. */
- if ( pHAL == NULL )
- return;
-
- /* Kill this texture manager. */
- TermTMgrHAL( pHAL );
-
- /* Kill any DDraw stuff if exists. */
- DestroyDevice( pHAL );
- DestroyAllSurfaces( pHAL );
- DestroyInterfaces( pHAL );
-
- FREE( pHAL );
-}
-/*===========================================================================*/
-/* This function is used to init and resize the rendering surface as the two*/
-/* are almost the same. First the device and all the surfaces are destoryed */
-/* if they already exist. Next we create a OffScreen rendering surface and */
-/* save some pixelformat info to do color convertions. Next we start to take */
-/* care of getting the most out of the hardware. I use bHardware to determine*/
-/* the state of the device we found in the device enumeration. The enum proc*/
-/* will try for hardware first. I next use a bForceSW to make the enum proc */
-/* choose a software device. So I will try some combinations with HW first */
-/* until I feel I have to set the bForceSW and call this function again. If */
-/* this function is called with no width or height then use the internals. */
-/* NOTE: The worst case is that all will be in SW (RGBDevice) and really */
-/* I should forget the whole thing and fall back to a DDraw span type*/
-/* rendering but what is the point. This way I always know I have a */
-/* D3DDevice and that makes things easier. I do impliment the span */
-/* rendering function for stuff that I haven't done support for such */
-/* as points and lines. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE */
-/*===========================================================================*/
-extern "C" BOOL CreateHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- DDSURFACEDESC2 ddsd2;
- D3DDEVICEDESC D3DSWDevDesc;
- DDSCAPS2 ddscaps;
- DWORD dwCoopFlags,
- dwWidth,
- dwHeight;
- ULONG rc;
-
- DPF(( DBG_FUNC, "CreateHAL();" ));
-
-#define InitDDSD2(f) memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) ); \
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 ); \
- ddsd2.dwFlags = f;
-
- if ( pHAL == NULL )
- return FALSE;
-
- /* Use the internal rectangle struct. */
- dwWidth = pShared->rectW.right - pShared->rectW.left;
- dwHeight = pShared->rectW.bottom - pShared->rectW.top;
-
- DPF(( DBG_CNTX_INFO, "Width: %d Height: %d", dwWidth, dwHeight ));
-
- /* The dimensions might still be the same so just leave. */
- if ( (dwWidth == pShared->dwWidth) && (dwHeight == pShared->dwHeight) )
- {
- DPF(( DBG_CNTX_WARN, "Context size hasn't changed" ));
- return TRUE;
- }
-
- /* If one of the dimensions are zero then leave. WM_SIZE should get us back here. */
- if ( (dwWidth == 0) || (dwHeight == 0) )
- return TRUE;
-
- /* Save the renders dimensions. */
- pShared->dwWidth = dwWidth;
- pShared->dwHeight = dwHeight;
-
- DPF(( DBG_CNTX_INFO, "Creating Context:\n cx:%d cy:%d", pShared->dwWidth, pShared->dwHeight ));
-
- /*=================================*/
- /* Create all required interfaces. */
- /*=================================*/
-
- /* Kill any DDraw stuff if exists. */
- DestroyDevice( pHAL );
- DestroyAllSurfaces( pHAL );
- DestroyInterfaces( pHAL );
-
- /* Create a instance of DDraw using the Primary display driver. */
- rc = DirectDrawCreate( NULL, &pHAL->lpDD, NULL );
- if( FAILED(rc) )
- {
- RIP( pHAL, "DirectDrawCreate->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get the DDraw4 interface. */
- rc = pHAL->lpDD->QueryInterface( IID_IDirectDraw4, (void **)&pHAL->lpDD4 );
- if( FAILED(rc) )
- {
- RIP( pHAL, "QueryInterface (IID_IDirectDraw4) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get the Direct3D3 interface. */
- rc = pHAL->lpDD4->QueryInterface( IID_IDirect3D3, (void **)&pHAL->lpD3D3 );
- if( FAILED(rc) )
- {
- RIP( pHAL, "QueryInterface (IID_IDirect3D3) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Set the Cooperative level. NOTE: we need to know if we are FS at this point.*/
- dwCoopFlags = (pShared->bWindow == TRUE) ? DDSCL_NORMAL : (DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
- rc = pHAL->lpDD4->SetCooperativeLevel( pShared->hwnd, dwCoopFlags );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "SetCooperativeLevel->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /*==================================================================*/
- /* Get the best device we can and note whether its hardware or not. */
- /*==================================================================*/
- pShared->bForceSW = FALSE;
- pHAL->lpD3D3->EnumDevices( EnumDeviceHook, (void *)pHAL );
- pShared->bHardware = IsEqualIID( pHAL->guid, IID_IDirect3DHALDevice );
- DPF(( DBG_CNTX_INFO, "bHardware: %s", (pShared->bHardware) ? "TRUE" : "FALSE" ));
- DPF(( DBG_CNTX_INFO, "bWindowed: %s", (pShared->bWindow) ? "TRUE" : "FALSE" ));
-
- /*========================================================================*/
- /* HARDWARE was found. */
- /*========================================================================*/
- if ( pShared->bHardware == TRUE )
- {
- /*===================================*/
- /* HARDWARE -> Z-BUFFER. */
- /*===================================*/
-
- /* Get a Z-Buffer pixelformat. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- rc = pHAL->lpD3D3->EnumZBufferFormats( pHAL->guid, EnumZBufferHook, (VOID*)&ddsd2.ddpfPixelFormat );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EnumZBufferFormatsl->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Setup our request structure for the Z-buffer surface. */
- ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY;
- ddsd2.dwWidth = dwWidth;
- ddsd2.dwHeight = dwHeight;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSZbuffer, NULL );
- if ( !FAILED(rc) )
- {
- DPF(( DBG_CNTX_INFO, "HW ZBuffer" ));
-
- /*===================================*/
- /* HARDWARE -> Z-BUFFER -> FLIPABLE */
- /*===================================*/
- if ( pShared->bWindow == FALSE )
- {
- InitDDSD2( DDSD_CAPS | DDSD_BACKBUFFERCOUNT );
- ddsd2.dwBackBufferCount = 1;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- /* Make sure we try the next fall back. */
- DPF(( DBG_CNTX_WARN, "HW Flip/Complex not available" ));
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- /* Get the back buffer that was created. */
- ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
- rc = pHAL->lpDDSPrimary->GetAttachedSurface( &ddscaps, &pHAL->lpDDSRender );
- if ( FAILED(rc) )
- {
- DPF(( DBG_CNTX_WARN, "GetAttachedSurface failed -> HW Flip/Complex" ));
-
- /* Make sure we try the next fall back. */
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- /* I have had problems when a complex surface comes back */
- /* with the back buffer being created in SW. Not sure why */
- /* or how this is possable but I'm checking for it here. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- DX_RESTORE( pHAL->lpDDSRender );
- rc = pHAL->lpDDSRender->GetSurfaceDesc( &ddsd2 );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetSurfaceDesc (RENDER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* If the surface is in VID then we are happy with are Flipable. */
- if ( ddsd2.ddsCaps.dwCaps & DDSCAPS_LOCALVIDMEM )
- {
- pShared->bFlipable = TRUE;
- DPF(( DBG_CNTX_INFO, "HW Flip/Complex!" ));
- }
- else
- {
- /* Kill this setup. */
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- }
- }
- }
-
- /*===================================*/
- /* HARDWARE -> Z-BUFFER -> BLT */
- /*===================================*/
- if ( pHAL->lpDDSPrimary == NULL )
- {
- pShared->bFlipable = FALSE;
-
- /* Create the Primary (front buffer). */
- InitDDSD2( DDSD_CAPS );
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- /* This is an error as we should be able to do this at minimum. */
- RIP( pHAL, "CreateSurface (PRIMARY) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Create the Render (back buffer). */
- InitDDSD2( DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT );
- ddsd2.dwWidth = dwWidth;
- ddsd2.dwHeight = dwHeight;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSRender, NULL );
- if ( FAILED(rc) )
- {
- DPF(( DBG_CNTX_WARN, "Failed HW Offscreen surface" ));
-
- /* Make sure we try the next fall back. */
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- /* Might as well check here too see if this surface is in */
- /* hardware. If nothing else just to be consistant. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- DX_RESTORE( pHAL->lpDDSRender );
- rc = pHAL->lpDDSRender->GetSurfaceDesc( &ddsd2 );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetSurfaceDesc (RENDER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* If the surface is in VID then we are happy. */
- if ( ddsd2.ddsCaps.dwCaps & DDSCAPS_LOCALVIDMEM )
- {
- /* Create a clipper object so that DDraw will be able to blt windows that */
- /* have been clipped by the screen or other windows. */
- pHAL->lpDD4->CreateClipper( 0, &pHAL->lpClipper, NULL );
- pHAL->lpClipper->SetHWnd( 0, pShared->hwnd );
- pHAL->lpDDSPrimary->SetClipper( pHAL->lpClipper );
- pHAL->lpClipper->Release();
- DPF(( DBG_CNTX_INFO, "HW RENDER surface" ));
- }
- else
- {
- /* Kill this setup. */
- pHAL->lpDDSRender->Release();
- pHAL->lpDDSRender = NULL;
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- }
- }
-
- /*===================================*/
- /* Create D3DDEVICE -> HARDWARE. */
- /*===================================*/
- if ( pHAL->lpDDSZbuffer && pHAL->lpDDSPrimary && pHAL->lpDDSRender )
- {
- DX_RESTORE( pHAL->lpDDSRender );
- DX_RESTORE( pHAL->lpDDSZbuffer );
-
- rc = pHAL->lpDDSRender->AddAttachedSurface( pHAL->lpDDSZbuffer );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "AddAttachedSurface (ZBUFFER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- rc = pHAL->lpD3D3->CreateDevice( IID_IDirect3DHALDevice, pHAL->lpDDSRender, &pHAL->lpD3DDevice, NULL );
- if ( rc != D3D_OK )
- {
- DPF(( DBG_CNTX_WARN, "Failed HW Device" ));
- pHAL->lpD3DDevice = NULL;
- }
- else
- {
- DPF(( DBG_CNTX_INFO, "HW Device" ));
- }
- }
- }
- }
-
- /*========================================================================*/
- /* SOFTWARE fallback. */
- /*========================================================================*/
- if ( pHAL->lpD3DDevice == NULL )
- {
- DPF(( DBG_CNTX_INFO, "SW fallback :(" ));
-
- /* Make sure we have no surfaces allocated. Just incase. */
- DestroyAllSurfaces( pHAL );
-
- /* Get a software device. */
- pShared->bFlipable = FALSE;
- pShared->bForceSW = TRUE;
- pHAL->lpD3D3->EnumDevices( EnumDeviceHook, (void *)pHAL );
- pShared->bHardware = IsEqualIID( pHAL->guid, IID_IDirect3DHALDevice );
-
- /*===================================*/
- /* SOFTWARE -> Z-BUFFER. */
- /*===================================*/
-
- /*===================================*/
- /* SOFTWARE -> Z-BUFFER -> FLIPABLE */
- /*===================================*/
- if ( pShared->bWindow == FALSE )
- {
- InitDDSD2( DDSD_CAPS | DDSD_BACKBUFFERCOUNT );
- ddsd2.dwBackBufferCount = 1;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = (DDPF_RGB | DDPF_ALPHAPIXELS);
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- DPF(( DBG_CNTX_WARN, "Failed SW Flip/Complex" ));
-
- /* Make sure we try the next fall back. */
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
- rc = pHAL->lpDDSPrimary->GetAttachedSurface( &ddscaps, &pHAL->lpDDSRender );
- if ( FAILED(rc) )
- {
- /* Make sure we try the next fall back. */
- DPF(( DBG_CNTX_WARN, "GetAttachedSurface failed -> SW Flip/Complex" ));
- pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
- else
- {
- DPF(( DBG_CNTX_INFO, "SW Flip/Complex" ));
- pShared->bFlipable = TRUE;
- }
- }
- }
-
- /*===================================*/
- /* SOFTWARE -> Z-BUFFER -> BLT */
- /*===================================*/
- if ( pHAL->lpDDSPrimary == NULL )
- {
- /* Create the Primary (front buffer). */
- InitDDSD2( DDSD_CAPS );
- ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSPrimary, NULL );
- if ( FAILED(rc) )
- {
- /* This is an error as we should be able to do this at minimum. */
- RIP( pHAL, "CreateSurface (PRIMARY) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Create the Render (back buffer). */
- InitDDSD2( DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT );
- ddsd2.dwWidth = dwWidth;
- ddsd2.dwHeight = dwHeight;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = (DDPF_RGB | DDPF_ALPHAPIXELS);
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pHAL->lpDDSRender, NULL );
- if ( FAILED(rc) )
- {
- /* That was our last hope. */
- RIP( pHAL, "CreateSurface (RENDER) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
- else
- {
- DPF(( DBG_CNTX_INFO, "SW RENDER surface" ));
-
- /* Create a clipper object so that DDraw will be able to blt windows that */
- /* have been clipped by the screen or other windows. */
- pHAL->lpDD4->CreateClipper( 0, &pHAL->lpClipper, NULL );
- pHAL->lpClipper->SetHWnd( 0, pShared->hwnd );
- pHAL->lpDDSPrimary->SetClipper( pHAL->lpClipper );
- pHAL->lpClipper->Release();
- }
- }
-
- /*===================================*/
- /* Create D3DDEVICE -> SOFTWARE. */
- /*===================================*/
- if ( pHAL->lpDDSPrimary && pHAL->lpDDSRender )
- {
- DX_RESTORE( pHAL->lpDDSRender );
- rc = pHAL->lpD3D3->CreateDevice( IID_IDirect3DRGBDevice, pHAL->lpDDSRender, &pHAL->lpD3DDevice, NULL );
- if ( rc != D3D_OK )
- {
- /* That was our last hope. */
- RIP( pHAL, "CreateDevice (IID_IDirect3DRGBDevice) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- DPF(( DBG_CNTX_INFO, "SW Device" ));
- }
- }
-
- /*==============================================================================*/
- /* Get a copy of the render pixelformat so that wgl.c can call GetPixelInfoD3D. */
- /*==============================================================================*/
- memset( &pHAL->ddpf, 0, sizeof(DDPIXELFORMAT) );
- pHAL->ddpf.dwSize = sizeof( DDPIXELFORMAT );
- rc = pHAL->lpDDSRender->GetPixelFormat( &pHAL->ddpf );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetPixelFormat ->", ErrorStringD3D(rc) );
- return FALSE;
- }
- DebugPixelFormat( "Using OFFSCREEN", &pHAL->ddpf );
- DebugPixelFormat( "Using ZBUFFER", &ddsd2.ddpfPixelFormat );
-
- /* Get a copy of what the D3DDevice supports for later use. */
- memset( &D3DSWDevDesc, 0, sizeof(D3DDEVICEDESC) );
- memset( &pHAL->D3DHWDevDesc, 0, sizeof(D3DDEVICEDESC) );
- D3DSWDevDesc.dwSize = sizeof( D3DDEVICEDESC );
- pHAL->D3DHWDevDesc.dwSize = sizeof( D3DDEVICEDESC );
- rc = pHAL->lpD3DDevice->GetCaps( &pHAL->D3DHWDevDesc, &D3DSWDevDesc );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "GetCaps ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get a copy of the pixel convertion stuff for direct buffer access. */
- Solve8BitChannelPixelFormat( &pHAL->ddpf, &pShared->pixel );
- AlphaBlendTableHAL( pHAL );
-
- /* We must prime the Begin/End scene for SwapBuffers to work. */
- rc = pHAL->lpD3DDevice->BeginScene();
- if ( FAILED(rc) )
- {
- RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
-#undef InitDDSD2
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will make sure a viewport is created and set for the device*/
-/* in the supplied structure. If a rect is supplied then it will be used for*/
-/* the viewport otherwise the current setting in the strucute will be used. */
-/* Note that the rect is relative to the window. So left/top must be 0,0 to */
-/* use the whole window else there is scissoring going down. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" BOOL SetViewportHAL( PMESAD3DSHARED pShared, RECT *pRect, float minZ, float maxZ )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- D3DVIEWPORT2 vdData;
- ULONG rc;
- POINT pt;
-
- DPF(( DBG_FUNC, "SetViewportHAL();" ));
-
- /* Make sure we have enough info. */
- if ( !pHAL || !pHAL->lpDDSPrimary || !pHAL->lpD3DDevice )
- {
- DPF(( DBG_CNTX_WARN, "SetViewport() -> NULL Pointer" ));
- return FALSE;
- }
-
- /* TODO: this is just a temp fix to stop redundant changes. */
- if ( pRect &&
- (pShared->rectV.left == pRect->left) &&
- (pShared->rectV.right == pRect->right) &&
- (pShared->rectV.top == pRect->top) &&
- (pShared->rectV.bottom == pRect->bottom) )
- {
- DPF(( DBG_CNTX_WARN, "Redundant viewport" ));
- return TRUE;
- }
-
- DPF(( DBG_CNTX_INFO, "Current Viewport:" ));
- DPF(( DBG_CNTX_INFO, "x: %d y: %d", pShared->rectV.left, pShared->rectV.top ));
- DPF(( DBG_CNTX_INFO, "cx: %d cy: %d", (pShared->rectV.right-pShared->rectV.left), (pShared->rectV.bottom-pShared->rectV.top) ));
- DPF(( DBG_CNTX_INFO, "New Viewport:" ));
- DPF(( DBG_CNTX_INFO, "x: %d y: %d", pRect->left, pRect->top ));
- DPF(( DBG_CNTX_INFO, "cx: %d cy: %d", (pRect->right-pRect->left), (pRect->bottom-pRect->top) ));
-
- /* Update the current viewport rect if one is supplied. */
- if ( pRect )
- memcpy( &pShared->rectV, pRect, sizeof(RECT) );
-
- /* Build the request structure. */
- memset( &vdData, 0, sizeof(D3DVIEWPORT2) );
- vdData.dwSize = sizeof(D3DVIEWPORT2);
- vdData.dwX = pShared->rectV.left;
- vdData.dwY = pShared->rectV.top;
- vdData.dwWidth = (pShared->rectV.right - pShared->rectV.left);
- vdData.dwHeight = (pShared->rectV.bottom - pShared->rectV.top);
-
- if ( !vdData.dwWidth || !vdData.dwHeight )
- {
- GetClientRect( pShared->hwnd, &pShared->rectW );
- pt.x = pt.y = 0;
- ClientToScreen( pShared->hwnd, &pt );
- OffsetRect( &pShared->rectW, pt.x, pt.y);
- vdData.dwX = pShared->rectW.left;
- vdData.dwY = pShared->rectW.top;
- vdData.dwWidth = (pShared->rectW.right - pShared->rectW.left);
- vdData.dwHeight = (pShared->rectW.bottom - pShared->rectW.top);
- memcpy( &pShared->rectV, &pShared->rectW, sizeof(RECT) );
- }
-
- // The dvClipX, dvClipY, dvClipWidth, dvClipHeight, dvMinZ,
- // and dvMaxZ members define the non-normalized post-perspective
- // 3-D view volume which is visible to the viewer. In most cases,
- // dvClipX is set to -1.0 and dvClipY is set to the inverse of
- // the viewport's aspect ratio on the target surface, which can be
- // calculated by dividing the dwHeight member by dwWidth. Similarly,
- // the dvClipWidth member is typically 2.0 and dvClipHeight is set
- // to twice the aspect ratio set in dwClipY. The dvMinZ and dvMaxZ
- // are usually set to 0.0 and 1.0.
- vdData.dvClipX = -1.0f;
- vdData.dvClipWidth = 2.0f;
- vdData.dvClipY = 1.0f;
- vdData.dvClipHeight = 2.0f;
- vdData.dvMaxZ = maxZ;
- vdData.dvMinZ = minZ;
-
- DPF(( DBG_CNTX_INFO, "zMin: %f zMax: %f", minZ, maxZ ));
-
- /* I'm going to destroy the viewport everytime as when we size we will */
- /* have a new D3DDevice. As this area doesn't need to be fast... */
- if ( pHAL->lpViewport )
- {
- DPF(( DBG_CNTX_INFO, "DeleteViewport" ));
-
- pHAL->lpD3DDevice->DeleteViewport( pHAL->lpViewport );
- rc = pHAL->lpViewport->Release();
- pHAL->lpViewport = NULL;
- }
-
- rc = pHAL->lpD3D3->CreateViewport( &pHAL->lpViewport, NULL );
- if ( rc != D3D_OK )
- {
- DPF(( DBG_CNTX_ERROR, "CreateViewport Failed" ));
- return FALSE;
- }
-
- /* Update the device with the new viewport. */
- pHAL->lpD3DDevice->AddViewport( pHAL->lpViewport );
- pHAL->lpViewport->SetViewport2( &vdData );
- pHAL->lpD3DDevice->SetCurrentViewport( pHAL->lpViewport );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* */
-/* */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-HRESULT WINAPI EnumSurfacesHook( LPDIRECTDRAWSURFACE4 lpDDS, LPDDSURFACEDESC2 lpDDSDesc, LPVOID pVoid )
-{
- DDSURFACEDESC2 *pddsd2 = (DDSURFACEDESC2 *)pVoid;
-
- DPF(( DBG_FUNC, "EnumSurfacesHook();" ));
-
- if ( (lpDDSDesc->ddpfPixelFormat.dwFlags == pddsd2->ddpfPixelFormat.dwFlags) && (lpDDSDesc->ddsCaps.dwCaps == pddsd2->ddsCaps.dwCaps) )
- {
- /* Save the pixelformat now so that we know we have one. */
- memcpy( pddsd2, lpDDSDesc, sizeof(DDSURFACEDESC2) );
-
- return D3DENUMRET_CANCEL;
- }
-
- return D3DENUMRET_OK;
-}
-/*===========================================================================*/
-/* This is the callback proc to get a Z-Buffer. Thats it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-HRESULT CALLBACK EnumZBufferHook( DDPIXELFORMAT* pddpf, VOID *pVoid )
-{
- DDPIXELFORMAT *pddpfChoice = (DDPIXELFORMAT *)pVoid;
-
- DPF(( DBG_FUNC, "EnumZBufferHook();" ));
-
- /* If this is ANY type of depth-buffer, stop. */
- if( pddpf->dwFlags == DDPF_ZBUFFER )
- {
- /* Save the pixelformat now so that we know we have one. */
- memcpy( pddpfChoice, pddpf, sizeof(DDPIXELFORMAT) );
-
- /* I feel if the hardware supports this low then lets use it. Could get ugly. */
- if( pddpf->dwZBufferBitDepth >= 8 )
- {
- return D3DENUMRET_CANCEL;
- }
- }
-
- return D3DENUMRET_OK;
-}
-/*===========================================================================*/
-/* This function handles the callback for the D3DDevice enumeration. Good */
-/* god who's idea was this? The D3D wrapper has two variable related to what*/
-/* kind of device we want and have. First we have a Bool that is set if we */
-/* have allocated a HW device. We always look for the HW device first. The */
-/* other variable is used to force SW. If we have run into a case that we */
-/* want to fallback to SW then we set this. We will fallback if we cannot */
-/* texture in video memory (among others). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-HRESULT CALLBACK EnumDeviceHook( GUID FAR* lpGuid, LPSTR lpDesc, LPSTR lpName, LPD3DDEVICEDESC lpD3DHWDesc, LPD3DDEVICEDESC lpD3DHELDesc, void *pVoid )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pVoid;
- LPD3DDEVICEDESC pChoice = lpD3DHWDesc;
-
- DPF(( DBG_FUNC, "EnumDeviceHook();" ));
-
- /* Determine if which device description is valid. */
- if ( pChoice->dcmColorModel == 0 )
- pChoice = lpD3DHELDesc;
-
- /* Make sure we always have a GUID. */
- memcpy( &pHAL->guid, lpGuid, sizeof(GUID) );
-
- /* This controls whether we will except HW or not. */
- if ( pHAL->shared.bForceSW == TRUE )
- {
- return (pChoice == lpD3DHELDesc) ? D3DENUMRET_CANCEL : D3DENUMRET_OK;
- }
-
- /* Always try for hardware. */
- if ( pChoice == lpD3DHWDesc )
- {
- return D3DENUMRET_CANCEL;
- }
-
- return D3DENUMRET_OK;
-}
-/*===========================================================================*/
-/* This function will destroy any and all surfaces that this context has */
-/* allocated. If there is a clipper object then it will also be destoryed as*/
-/* it is part of the Primary Surface. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DestroyAllSurfaces( PMESAD3DHAL pHAL )
-{
- LONG refCount;
-
- DPF(( DBG_FUNC, "DestroyAllSurfaces();" ));
-
- DX_RESTORE( pHAL->lpDDSPrimary );
- DX_RESTORE( pHAL->lpDDSRender );
- DX_RESTORE( pHAL->lpDDSZbuffer);
-
- if ( pHAL->lpDDSRender )
- {
- pHAL->lpDDSRender->Unlock( NULL );
-
- /* If this isn't a Flipable surface then we must clean up the render. */
- if ( pHAL->shared.bFlipable == FALSE)
- {
- if ( pHAL->lpDDSZbuffer )
- {
- DPF(( DBG_CNTX_INFO, "Remove attached surfaces from RENDER" ));
- pHAL->lpDDSRender->DeleteAttachedSurface( 0, NULL );
- }
-
- DPF(( DBG_CNTX_INFO, "Release RENDER" ));
- refCount = pHAL->lpDDSRender->Release();
- pHAL->lpDDSRender = NULL;
- }
- }
-
- if ( pHAL->lpDDSZbuffer )
- {
- DPF(( DBG_CNTX_INFO, "Release ZBuffer" ));
- pHAL->lpDDSZbuffer->Unlock( NULL );
- refCount = pHAL->lpDDSZbuffer->Release();
- pHAL->lpDDSZbuffer = NULL;
- }
-
- if ( pHAL->lpClipper )
- {
- DPF(( DBG_CNTX_INFO, "Release Clipper" ));
- refCount = pHAL->lpClipper->Release();
- pHAL->lpClipper = NULL;
- }
-
- if ( pHAL->lpDDSPrimary )
- {
- pHAL->lpDDSPrimary->Unlock( NULL );
-
- DPF(( DBG_CNTX_INFO, "Release PRIMARY" ));
- refCount = pHAL->lpDDSPrimary->Release();
- pHAL->lpDDSPrimary = NULL;
- }
-}
-/*===========================================================================*/
-/* This function will destroy the current D3DDevice and any resources that */
-/* belong to it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DestroyDevice( PMESAD3DHAL pHAL )
-{
- LONG refCount;
-
- DPF(( DBG_FUNC, "DestroyDevice();" ));
-
- /* Kill the D3D stuff if exists. */
- if ( pHAL->lpViewport )
- {
- DPF(( DBG_CNTX_INFO, "Delete Viewport" ));
- pHAL->lpD3DDevice->DeleteViewport( pHAL->lpViewport );
-
- DPF(( DBG_CNTX_INFO, "Release Viewport" ));
- refCount = pHAL->lpViewport->Release();
- pHAL->lpViewport = NULL;
- }
-
- if ( pHAL->lpD3DDevice != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release D3DDevice" ));
- refCount = pHAL->lpD3DDevice->EndScene();
- refCount = pHAL->lpD3DDevice->Release();
- pHAL->lpD3DDevice = NULL;
- }
-}
-/*===========================================================================*/
-/* This function will destroy the current D3DDevice and any resources that */
-/* belong to it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DestroyInterfaces( PMESAD3DHAL pHAL )
-{
- LONG refCount;
-
- DPF(( DBG_FUNC, "DestroyInterfaces();" ));
-
- if ( pHAL->lpD3D3 != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release Direct3D3" ));
- refCount = pHAL->lpD3D3->Release();
- pHAL->lpD3D3 = NULL;
- }
-
- if ( pHAL->lpDD4 != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release DDraw4" ));
- refCount = pHAL->lpDD4->Release();
- pHAL->lpDD4 = NULL;
- }
-
- if ( pHAL->lpDD != NULL )
- {
- DPF(( DBG_CNTX_INFO, "Release DDraw" ));
- refCount = pHAL->lpDD->Release();
- pHAL->lpDD = NULL;
- }
-}
-/*===========================================================================*/
-/* This function will first send (not post) a message to the client window */
-/* that this context is using. The client will respond by unbinding itself */
-/* and binding the 'default' context. This allows the API to be supported */
-/* until the window can be destroyed. Finally we post the quit message to */
-/* the client in hopes to end the application. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void FatalShutDown( PMESAD3DHAL pHAL )
-{
- /* Whip this baby in too try and support the API until we die... */
- if ( pHAL )
- SendMessage( pHAL->shared.hwnd, UM_FATALSHUTDOWN, 0L, 0L );
-
- /* Close the client application down. */
- PostQuitMessage( 0 );
-}
-
diff --git a/src/mesa/drivers/d3d/D3DMESA.H b/src/mesa/drivers/d3d/D3DMESA.H
deleted file mode 100644
index 074ceca816a..00000000000
--- a/src/mesa/drivers/d3d/D3DMESA.H
+++ /dev/null
@@ -1,84 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef D3D_MESA_H
-#define D3D_MESA_H
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include "matrix.h"
-#include "context.h"
-#include "mtypes.h"
-#include "vb.h"
-#include "D3DShared.h"
-#include "Debug.h"
-#include "NULLProcs.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-#define FLIP(h,y) (h-y)
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-struct __extensions__
-{
- PROC proc;
- char *name;
-};
-
-typedef GLbitfield (*ClearPROC)( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-typedef void (*WSpanRGBPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] );
-typedef void (*WSpanRGBAPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-typedef void (*WSpanRGBAMonoPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] );
-typedef void (*WPixelsRGBAPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-typedef void (*WPixelsRGBAMonoPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
-typedef void (*RSpanRGBAPROC)( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-typedef void (*RPixelsRGBAPROC)( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-
-typedef struct D3D_mesa_context
-{
- PMESAD3DSHARED pShared;
-
- GLcontext *gl_ctx; /* The core GL/Mesa context */
- GLvisual *gl_visual; /* Describes the buffers */
- GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */
-
- HDC hdc;
- WNDPROC hOldProc;
-
- UCHAR rClear, /* Current clear colors. */
- gClear,
- bClear,
- aClear,
- rCurrent, /* Current rendering colors. */
- gCurrent,
- bCurrent,
- aCurrent;
-
- struct D3D_mesa_context *next;
-
-} D3DMESACONTEXT, *PD3DMESACONTEXT;
-/*===========================================================================*/
-/* Extern function prototypes. */
-/*===========================================================================*/
-extern void gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern D3DTLVERTEX D3DTLVertices[(VB_MAX*6)];
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/D3DRaster.cpp b/src/mesa/drivers/d3d/D3DRaster.cpp
deleted file mode 100644
index 004bb773603..00000000000
--- a/src/mesa/drivers/d3d/D3DRaster.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* This function clears the context bound to the supplied shared context. */
-/* The function takes the D3D flags D3DCLEAR_TARGET, D3DCLEAR_STENCIL and */
-/* D3DCLEAR_ZBUFFER. Set bAll to TRUE for a full clear else supply the coord*/
-/* of the rect to be cleared relative to the window. The color is always a */
-/* 32bit value (RGBA). Fill in the z-value and stencil if needed. */
-/* */
-/* TODO: this can be redone to be called by Mesa directly. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void ClearHAL( PMESAD3DSHARED pShared, DWORD dwFlags, BOOL bAll, int x, int y, int cx, int cy, DWORD dwColor, float zv, DWORD dwStencil )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- D3DRECT d3dRect;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "CleaHAL();" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpViewport == NULL) )
- return;
-#endif
-
- if ( bAll )
- {
- /* I assume my viewport is valid. */
- d3dRect.lX1 = pShared->rectV.left;
- d3dRect.lY1 = pShared->rectV.top;
- d3dRect.lX2 = pShared->rectV.right;
- d3dRect.lY2 = pShared->rectV.bottom;
- }
- else
- {
- d3dRect.lX1 = pShared->rectV.left + x;
- d3dRect.lY1 = pShared->rectV.top + y;
- d3dRect.lX2 = d3dRect.lX1 + cx;
- d3dRect.lY2 = d3dRect.lY1 + cy;
- }
-
-#ifdef D3D_DEBUG
- rc = pHAL->lpViewport->Clear2( 1, &d3dRect, dwFlags, dwColor, zv, dwStencil );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Clear2 ->", ErrorStringD3D(rc) );
- }
-#else
- pHAL->lpViewport->Clear2( 1, &d3dRect, dwFlags, dwColor, zv, dwStencil );
-#endif
-}
-/*===========================================================================*/
-/* Well this is the guts of it all. Here we rasterize the primitives that */
-/* are in their final form. OpenGL has done all the lighting, transfomations*/
-/* and clipping at this point. */
-/* */
-/* TODO: I'm not sure if I want to bother to check for errors on this call. */
-/* The overhead kills me... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "DrawPrimitveHAL();" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) )
- return;
-
- DPF(( DBG_PRIM_INFO, "DP( %d )", dwCount ));
-
- rc = pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType,
- D3DFVF_TLVERTEX,
- (LPVOID)pVertices,
- dwCount,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "DrawPrimitive ->", ErrorStringD3D(rc) );
- }
-#else
- pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType,
- D3DFVF_TLVERTEX,
- (LPVOID)pVertices,
- dwCount,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
-#endif
-}
-/*===========================================================================*/
-/* This call will handle the swapping of the buffers. Now I didn't bother */
-/* to support single buffered so this will be used for glFlush() as its all */
-/* the same. So first we do an EndScene as we are always considered to be in*/
-/* a BeginScene because when we leave we do a BeginScene. Now note that when*/
-/* the context is created in the first place we do a BeginScene also just to */
-/* get things going. The call will use either Flip/blt based on the type of */
-/* surface was created for rendering. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void SwapBuffersHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "SwapBuffersHAL();" ));
- DPF(( DBG_ALL_PROFILE, "=================SWAP===================" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) )
- return;
-
- /* Make sure we have enough info. */
- if ( pHAL->lpDDSPrimary != NULL )
- {
- rc = pHAL->lpD3DDevice->EndScene();
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EndScene ->", ErrorStringD3D(rc) );
- }
-
- if ( pShared->bFlipable )
- {
- DPF(( DBG_CNTX_PROFILE, "Swap->FLIP" ));
- rc = pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT );
- }
- else
- {
- DPF(( DBG_CNTX_PROFILE, "Swap->Blt" ));
- rc = pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL );
- }
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Blt (RENDER/PRIMARY) ->", ErrorStringD3D(rc) );
- }
-
- rc = pHAL->lpD3DDevice->BeginScene();
- if ( FAILED(rc) )
- {
- RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) );
- }
- }
-#else
- pHAL->lpD3DDevice->EndScene();
-
- if ( pShared->bFlipable )
- pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT );
- else
- pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL );
-
- pHAL->lpD3DDevice->BeginScene();
-
-#endif
-}
-/*===========================================================================*/
-/* This function is a very thin wrapper for the D3D call 'SetRenderState'. */
-/* Using this function requires all the types to be defined by including the */
-/* D3D header file. */
-/* */
-/* TODO: would be much better to get ride of all these calls per VBRender. */
-/* I feel I should get this call into SetRenderStates() the RenderVB. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void SetStateHAL( PMESAD3DSHARED pShared, DWORD dwType, DWORD dwState )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
-#ifdef D3D_DEBUG
- HRESULT rc;
-
- DPF(( DBG_FUNC, "SetStateHAL();" ));
-
- /* Make sure we have enough info. */
- if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) )
- return;
-
- rc = pHAL->lpD3DDevice->SetRenderState( (D3DRENDERSTATETYPE)dwType, dwState );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "SetRenderState ->", ErrorStringD3D(rc) );
- }
-
-#else
- pHAL->lpD3DDevice->SetRenderState( (D3DRENDERSTATETYPE)dwType, dwState );
-#endif
-}
-
-
-
-
-
-
-
-
diff --git a/src/mesa/drivers/d3d/D3DShared.h b/src/mesa/drivers/d3d/D3DShared.h
deleted file mode 100644
index cc629e21111..00000000000
--- a/src/mesa/drivers/d3d/D3DShared.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef D3D_MESA_ALL_H
-#define D3D_MESA_ALL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <stdio.h>
-#include <string.h>
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-#define TM_ACTION_LOAD 0x01
-#define TM_ACTION_BIND 0x02
-#define TM_ACTION_UPDATE 0x04
-
-#define UM_FATALSHUTDOWN (WM_USER+42)
-/*===========================================================================*/
-/* Macros defines. */
-/*===========================================================================*/
-#define ALLOC(cb) malloc( (cb) )
-#define FREE(p) { free( (p) ); (p) = NULL; }
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-typedef struct _pixel_convert
-{
- int cb, /* Count in bytes of one pixel. */
- rShift, /* Shift count that postions each componet. */
- gShift,
- bShift,
- aShift;
- float rScale, /* Value that scales a color that ranges 0.0 -> 1.0 */
- gScale, /* to this pixel format. */
- bScale,
- aScale;
- DWORD dwRMask, /* Color mask per component. */
- dwGMask,
- dwBMask,
- dwAMask;
-
-} PIXELINFO, *PPIXELINFO;
-
-
-typedef struct _d3d_shared_info
-{
- HWND hwnd;
- BOOL bWindow,
- bFlipable,
- bForceSW,
- bHardware;
- RECT rectW, /* Window size and postion in screen space. */
- rectV; /* Viewport size and postion. */
- DWORD dwWidth, /* Current render size for quick checks. */
- dwHeight;
-
- PIXELINFO pixel;
- DWORD dwSrcBlendCaps[14], /* See D3DCAPS.CPP */
- dwDestBlendCaps[14],
- dwTexFunc[4];
-
-} MESAD3DSHARED, *PMESAD3DSHARED;
-
-typedef struct _render_options
-{
- BOOL bForceSoftware, /* TODO: Add user switches. */
- bStretchtoPrimary;
-
-} USER_CTRL, *PUSER_CRTL;
-
-enum { s_zero = 0,
- s_one,
- s_dst_color,
- s_one_minus_dst_color,
- s_src_alpha,
- s_one_minus_src_alpha,
- s_dst_alpha,
- s_one_minus_dst_alpha,
- s_src_alpha_saturate,
- s_constant_color,
- s_one_minus_constant_color,
- s_constant_alpha,
- s_one_minus_constant_alpha };
-
-enum { d_zero = 0,
- d_one,
- d_src_color,
- d_one_minus_src_color,
- d_src_alpha,
- d_one_minus_src_alpha,
- d_dst_alpha,
- d_one_minus_dst_alpha,
- d_constant_color,
- d_one_minus_constant_color,
- d_constant_alpha,
- d_one_minus_constant_alpha };
-
-enum { d3dtblend_decal = 0,
- d3dtblend_decalalpha,
- d3dtblend_modulate,
- d3dtblend_modulatealpha };
-
-/*===========================================================================*/
-/* Function prototypes. */
-/*===========================================================================*/
-PMESAD3DSHARED InitHAL( HWND hwnd );
-void TermHAL( PMESAD3DSHARED pShared );
-BOOL CreateHAL( PMESAD3DSHARED pShared );
-BOOL SetViewportHAL( PMESAD3DSHARED pShared, RECT *pRect, float minZ, float maxZ );
-
-void ClearHAL( PMESAD3DSHARED pShared, DWORD dwFlags, BOOL bAll, int x, int y, int cx, int cy, DWORD dwColor, float zv, DWORD dwStencil );
-void SetStateHAL( PMESAD3DSHARED pShared, DWORD dwType, DWORD dwState );
-void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount );
-
-void SwapBuffersHAL( PMESAD3DSHARED pShared );
-DDSURFACEDESC2 *LockHAL( PMESAD3DSHARED pShared, BOOL bBack );
-void UnlockHAL( PMESAD3DSHARED pShared, BOOL bBack );
-void UpdateScreenPosHAL( PMESAD3DSHARED pShared );
-void GetPixelInfoHAL( PMESAD3DSHARED pShared, PPIXELINFO pPixel );
-BOOL CreateTMgrHAL( PMESAD3DSHARED pShared, DWORD dwName, int level, DWORD dwRequestFlags, RECT *rectDirty, DWORD dwWidth, DWORD dwHeight, DWORD dwAction, void *pPixels );
-void DisableTMgrHAL( PMESAD3DSHARED pShared );
-
-
-int SaveDIBitmap( char *filename, BITMAPINFO *info, void *bits );
-int ARGB_SaveBitmap( char *filename, int width, int height, unsigned char *pARGB );
-int BGRA_SaveBitmap( char *filename, int width, int height, unsigned char *pBGRA );
-int BGR_SaveBitmap( char *filename, int width, int height, unsigned char *pBGR );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern float g_DepthScale, /* Mesa needs to scale Z in SW. The HAL */
- g_MaxDepth; /* doesn't but I wanted SW still to work.*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/src/mesa/drivers/d3d/D3DTEXT.CPP b/src/mesa/drivers/d3d/D3DTEXT.CPP
deleted file mode 100644
index e6ff8645611..00000000000
--- a/src/mesa/drivers/d3d/D3DTEXT.CPP
+++ /dev/null
@@ -1,576 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "d3dText.h"
-
-/*=============================================================================
-
- 1
- ------
- | |
- 6 | | 2
- | 7 |
- ------
- | |
- 5 | | 3
- | |
- ------
- 4
-
- TL_0 TR_0
-TLL TL_1 TR_1 TRR
-
-MLL_0 ML_0 MR_0 MRR_0
-MLL_1 ML_1 MR_1 MRR_1
-
-BLL BL_0 BR_0 BRR
- BL_1 BR_1
-
-=============================================================================*/
-
-#define TLL 0
-#define TRR 1
-#define TL_0 2
-#define TL_1 3
-#define TR_0 4
-#define TR_1 5
-
-#define MLL_0 6
-#define MLL_1 7
-#define MRR_0 8
-#define MRR_1 9
-
-#define ML_0 10
-#define ML_1 11
-#define MR_0 12
-#define MR_1 13
-
-#define BL_0 14
-#define BL_1 15
-#define BR_0 16
-#define BR_1 17
-#define BLL 18
-#define BRR 19
-
-#define BIT1 0x00000001
-#define BIT2 0x00000002
-#define BIT3 0x00000004
-#define BIT4 0x00000008
-#define BIT5 0x00000010
-#define BIT6 0x00000020
-#define BIT7 0x00000040
-
-#define TOP BIT4
-#define MIDDLE BIT7
-#define BOTTOM BIT1
-#define TLEFT BIT5
-#define BLEFT BIT6
-#define LEFT (TLEFT|BLEFT)
-#define TRIGHT BIT3
-#define BRIGHT BIT2
-#define RIGHT (TRIGHT|BRIGHT)
-#define ALL 0xFFFFFFFF
-
-/*===========================================================================*/
-/* This is the static array that will map the ASCII value of the character */
-/* being draw to the bit mask that will be scan converted to the LED display.*/
-/*===========================================================================*/
-DWORD textBitMasks[] =
-{
- 0xFFFFFFFF, // 000
- 0xFFFFFFFF, // 001
- 0xFFFFFFFF, // 002
- 0xFFFFFFFF, // 003
- 0xFFFFFFFF, // 004
- 0xFFFFFFFF, // 005
- 0xFFFFFFFF, // 006
- 0xFFFFFFFF, // 007
- 0xFFFFFFFF, // 008
- 0xFFFFFFFF, // 009
- 0xFFFFFFFF, // 010
- 0xFFFFFFFF, // 011
- 0xFFFFFFFF, // 012
- 0xFFFFFFFF, // 013
- 0xFFFFFFFF, // 014
- 0xFFFFFFFF, // 015
- 0xFFFFFFFF, // 016
- 0xFFFFFFFF, // 017
- 0xFFFFFFFF, // 018
- 0xFFFFFFFF, // 019
- 0xFFFFFFFF, // 020
- 0xFFFFFFFF, // 021
- 0xFFFFFFFF, // 022
- 0xFFFFFFFF, // 023
- 0xFFFFFFFF, // 024
- 0xFFFFFFFF, // 025
- 0xFFFFFFFF, // 026
- 0xFFFFFFFF, // 027
- 0xFFFFFFFF, // 028
- 0xFFFFFFFF, // 029
- 0xFFFFFFFF, // 030
- 0XFFFFFFFF, // 031
- 0x00000000, // 032 'SPC'
- 0xFFFFFFFF, // 033
- 0xFFFFFFFF, // 034
- 0xFFFFFFFF, // 035
- 0xFFFFFFFF, // 036
- 0xFFFFFFFF, // 037
- 0xFFFFFFFF, // 038
- 0xFFFFFFFF, // 039
- 0xFFFFFFFF, // 040
- 0xFFFFFFFF, // 041
- 0xFFFFFFFF, // 042
- 0xFFFFFFFF, // 043
- 0xFFFFFFFF, // 044
- 0xFFFFFFFF, // 045
- 0xFFFFFFFF, // 046
- 0xFFFFFFFF, // 047
- (ALL &~ MIDDLE), // 048 '0'
- (RIGHT), // 049 '1'
- (ALL &~ TLEFT &~ BRIGHT), // 050 '2'
- (ALL &~ LEFT), // 051 '3'
- (TLEFT | MIDDLE | RIGHT), // 052 '4'
- (ALL &~ TRIGHT &~ BLEFT), // 053 '5'
- (ALL &~ TRIGHT), // 054 '6'
- (TOP | RIGHT), // 055 '7'
- (ALL), // 056 '8'
- (ALL &~ BOTTOM &~ BLEFT), // 057 '9'
- 0xFFFFFFFF, // 058
- 0xFFFFFFFF, // 059
- 0xFFFFFFFF, // 060
- 0XFFFFFFFF, // 061
- 0xFFFFFFFF, // 062
- 0xFFFFFFFF, // 063
- 0xFFFFFFFF, // 064
- (ALL &~ BOTTOM), // 065 'A'
- (ALL), // 066 'B'
- (TOP | LEFT | BOTTOM), // 067 'C'
- (ALL &~ MIDDLE), // 068 'D'
- (ALL &~ RIGHT), // 069 'E'
- (LEFT | TOP | MIDDLE), // 070 'F'
- 0x00000000, // 071 'G'
- (ALL &~ TOP &~ BOTTOM), // 072 'H'
- (RIGHT), // 073 'I'
- (RIGHT | BOTTOM), // 074 'J'
- 0x00000000, // 075 'K'
- (LEFT | BOTTOM), // 076 'L'
- 0x00000000, // 088 'M'
- 0x00000000, // 089 'N'
- (ALL &~ MIDDLE), // 090 'O'
- (ALL &~ BRIGHT &~ BOTTOM),// 091 'P'
- 0x00000000, // 092 'Q'
- 0x00000000, // 093 'R'
- (ALL &~ TRIGHT &~ BLEFT), // 094 'S'
- 0X00000000, // 095 'T'
- (LEFT | RIGHT | BOTTOM), // 096 'U'
- 0x00000000, // 097 'V'
- 0x00000000, // 098 'W'
- 0x00000000, // 099 'X'
- 0x00000000, // 1000 'Z'
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 100
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 104
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 108
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 112
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 116
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 120
- 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF // 124
-};
-
-#define CT 1.0f
-#define CX 7.0f
-#define CY 13.0f
-#define CM ((CY-(CT*3.0f))/2.0f)
-
-float lCoords[][2] =
-{
- /* Top outsides. */
- { 0, (CY-CT) },
- { CX, (CY-CT) },
-
- /* Top Line. */
- { CT, CY },
- { CT, (CY-CT) },
- { (CX-CT), CY },
- { (CX-CT), (CY-CT) },
-
- /* Middle outsides. */
- { 0.0f, (CT+CM+CT) },
- { 0.0f, (CT+CM) },
- { CX, (CT+CM+CT) },
- { CX, (CT+CM) },
-
- /* Middle Line. */
- { CT, (CT+CM+CT) },
- { CT, (CT+CM) },
- { (CX-CT), (CT+CM+CT) },
- { (CX-CT), (CT+CM) },
-
- /* Bottom line. */
- { CT, CT },
- { CT, 0.0f },
- { (CX-CT), CT },
- { (CX-CT), 0.0f },
-
- /* Bottom outsides. */
- { 0.0f, CT},
- { CX, CT }
-};
-
-static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics );
-
-D3DTLVERTEX TextVertices[MAX_VERTICES];
-/*===========================================================================*/
-/* When we attach I will zero out the whole D3D vertex buffer I'm using for */
-/* the text. This way I don't need to set all the redundant values. I also */
-/* set all the oow values to 1 as I will be doing direct rendering. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" BOOL InitD3DText( void )
-{
- int index;
-
- /* Set the D3D Vertex Buffer up once so we don't do redundant changes. */
- memset( &TextVertices[0], 0, sizeof(TextVertices) );
- for( index = 0; index < MAX_VERTICES; index++ )
- TextVertices[index].rhw = D3DVAL( 1.0 );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function takes a single character and draw it using the supplied */
-/* fontmetrics structure. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics )
-{
- int cIndex,
- nIndex,
- index;
- float cWidth = CX,
- cHeight = CY;
-
- /* Find the max width/height of a character and add the spacing so */
- /* that we can use this value to calculate the x,y of the character.*/
- cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing;
- cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing;
-
- /* Walk the string. This must be NULL terminated. */
- for( cIndex = 0, nIndex = 0; *pszString; pszString++, cIndex = nIndex, x++ )
- {
- /* Convert the character and get the index into the text vertex buffer. */
- nIndex = ConvertCharacter( &pszString[0], cIndex, pfntMetrics );
- if ( (nIndex - cIndex) > 2 )
- {
- /* Modify the text vertex buffer based on the fntMetrics structure. */
- for( index = cIndex; index < nIndex; index++ )
- {
- /* Scale the character. */
- TextVertices[index].sx *= pfntMetrics->fntXScale;
- TextVertices[index].sy *= pfntMetrics->fntYScale;
-
- /* Move the character. */
- TextVertices[index].sx += (cWidth*x);
- TextVertices[index].sy += (cHeight*y);
-
- /* Set the color. */
- TextVertices[index].color = pfntMetrics->dwColor;
- }
- }
- }
-
- if ( nIndex < 3 )
- return;
-
- /* Set the states that slim things down. */
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
-
- /* Blast them baby... */
- pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST,
- D3DFVF_TLVERTEX,
- (LPVOID)&TextVertices[0],
- nIndex,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
-}
-/*===========================================================================*/
-/* This function takes a single character and draw it directly to the screen*/
-/* unsing the supplied fntMetrics structure. The character will be drawn at */
-/* the supplied x,y. The x,y position is relative to the top left and uses */
-/* the spacing in the fntMetrics structure. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics )
-{
- int cIndex = 0,
- index;
- float cWidth = CX,
- cHeight = CY;
-
- /* Convert the character and get the index into the text vertex buffer. */
- cIndex = ConvertCharacter( c, 0, pfntMetrics );
- if ( cIndex < 3 )
- return;
-
- /* Find the max width/height of a character and add the spacing so */
- /* that we can use this value to calculate the x,y of the character.*/
- cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing;
- cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing;
-
- /* Modify the text vertex buffer based on the fntMetrics structure. */
- for( index = 0; index < cIndex; index++ )
- {
- /* Scale the character. */
- TextVertices[index].sx *= pfntMetrics->fntXScale;
- TextVertices[index].sy *= pfntMetrics->fntYScale;
-
- /* Move the character. */
- TextVertices[index].sx += (cWidth*x);
- TextVertices[index].sy += (cHeight*y);
-
- /* Set the color. */
- TextVertices[index].color = pfntMetrics->dwColor;
- }
-
-
- /* Set the states that slim things down. */
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
- pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
-
- /* Blast them baby... */
- pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST,
- D3DFVF_TLVERTEX,
- (LPVOID)&TextVertices[0],
- cIndex,
- (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
-}
-/*===========================================================================*/
-/* This function takes a single character and draw it using the supplied */
-/* fontmetrics structure. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics )
-{
- DWORD asciiChar = (int)(*c);
-
- /* Handle the TOP line. */
- if ( textBitMasks[asciiChar] & BIT1 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] );
- }
-
- /* Handle the TOP/BOTTOM RIGHT lines. */
- // if ( textBitMasks[index] & (BIT2|BIT3) )
- if ( 1 == 0 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
- }
- else
- {
- if ( textBitMasks[asciiChar] & BIT2 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] );
- }
- if ( textBitMasks[asciiChar] & BIT3 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] );
- }
- }
-
- /* Handle the TOP/BOTTOM LEFT lines. */
- // if ( textBitMasks[asciiChar] & (BIT5|BIT6) )
- if ( 1 == 0 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] );
- }
- else
- {
- if ( textBitMasks[asciiChar] & BIT5 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[BLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] );
- }
- if ( textBitMasks[asciiChar] & BIT6 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_0][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
- TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] );
- }
- }
-
- /* Handle the MIDDLE line. */
- if ( textBitMasks[asciiChar] & BIT7 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] );
- }
-
- /* Handle the BOTTOM line. */
- if ( textBitMasks[asciiChar] & BIT4 )
- {
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_1][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_1][1] );
- TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
- TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
- }
-
- return cIndex;
-}
-
-#undef CM
-#undef CY
-#undef CX
-#undef CT
-
-#undef TLL
-#undef TRR
-#undef TL_0
-#undef TL_1
-#undef TR_0
-#undef TR_1
-
-#undef MLL_0
-#undef MLL_1
-#undef MRR_0
-#undef MRR_1
-
-#undef ML_0
-#undef ML_1
-#undef MR_0
-#undef MR_1
-
-#undef BL_0
-#undef BL_1
-#undef BR_0
-#undef BR_1
-#undef BLL
-#undef BRR
-
-#undef BIT1
-#undef BIT2
-#undef BIT3
-#undef BIT4
-#undef BIT5
-#undef BIT6
-#undef BIT7
-
-#undef TOP
-#undef MIDDLE
-#undef BOTTOM
-#undef TLEFT
-#undef BLEFT
-#undef LEFT
-#undef TRIGHT
-#undef BRIGHT
-#undef RIGHT
-#undef ALL
diff --git a/src/mesa/drivers/d3d/D3DTextureMgr.cpp b/src/mesa/drivers/d3d/D3DTextureMgr.cpp
deleted file mode 100644
index ac9d2621fcc..00000000000
--- a/src/mesa/drivers/d3d/D3DTextureMgr.cpp
+++ /dev/null
@@ -1,947 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Local function prototypes. */
-/*===========================================================================*/
-static void UpdateTexture( PTM_OBJECT pTMObj, BOOL bVideo, RECT *pRect, UCHAR *pixels );
-static BOOL LoadTextureInVideo( PMESAD3DHAL pHAL, PTM_OBJECT pTMObj );
-static BOOL FreeTextureMemory( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject );
-static BOOL DestroyTextureObject( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject );
-HRESULT CALLBACK EnumPFHook( LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext );
-/*===========================================================================*/
-/* This function will simply set the top of stack to NULL. I only used it */
-/* just incase I want to add something later. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-BOOL InitTMgrHAL( PMESAD3DHAL pHAL )
-{
- DPF(( DBG_FUNC, "InitTMgrHAL();" ));
-
- /* Be clean my friend. */
- pHAL->pTMList = NULL;
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will walk the Texture Managers linked list and destroy all */
-/* surfaces (SYSTEM/VIDEO). The texture objects themselves also will be */
-/* freed. */
-/* NOTE: this is per/context. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void TermTMgrHAL( PMESAD3DHAL pHAL )
-{
- DPF(( DBG_FUNC, "TermTMgrHAL();" ));
-
- if ( pHAL && pHAL->pTMList )
- {
- /* Destroy the surface and remove the TMO from the stack. */
- while( DestroyTextureObject(pHAL,NULL) );
-
- /* Be clean my friend. */
- pHAL->pTMList = NULL;
- }
-}
-/*===========================================================================*/
-/* This function is a HACK as I don't know how I can disable a texture with-*/
-/* out booting it out. Is there know state change? */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void DisableTMgrHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
-
- DPF(( DBG_FUNC, "DisableTMgrHAL();" ));
-
- /* Check too see that we have a valid context. */
- if ( (pHAL == NULL) && (pHAL->lpD3DDevice != NULL) )
- {
- DPF(( DBG_TXT_WARN, "Null HAL/Direct3D Device!" ));
- return;
- }
-
- // TODO: This is a hack to shut off textures.
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
-}
-/*===========================================================================*/
-/* This function is the only entry into the TextureManager that Mesa/wgl */
-/* will see. It uses a dwAction to specify what we are doing. I did this as*/
-/* depending on the cards resources the action taken can change. */
-/* When this function is called we will always search the Texture Managers */
-/* linked list (per context remember) and try and find a structure that has */
-/* the same dwName. If we have a match we pull it out of the list and put it*/
-/* at the top of the list (TOL). If we don't find one then we create a struc*/
-/* and put it a TOL. This TOL idea makes for some caching as we will always */
-/* destroy Texture Surfaces from the bottom up... */
-/* All texture objects at this point will create a texture surface in System*/
-/* memory (SMEM). Then we will copy the Mesa texture into the surface using */
-/* the 'pixel' struc to get the translation info. So now this means that all*/
-/* textures that Mesa gives me I will have a Surface with a copy. If Mesa */
-/* changes the texture the I update the surface in (SMEM). */
-/* Now we have a texture struc and a Texture Surface in SMEM. At this point*/
-/* we create another surface on the card (VMEM). Finally we blt from the */
-/* SMEM to the VMEM and set the texture as current. Why do I need two? First*/
-/* this solves square textures. If the cards CAPS is square textures only */
-/* then I change the dimensions of the VMEM surface and the blt solves it for*/
-/* me. Second it saves me from filling D3D textures over and over if the */
-/* card needs to be creating and destroying surfaces because of low memory. */
-/* The surface in SMEM is expected to work always. When a surface has to be*/
-/* created in VMEM then we put it in a loop that tries to create the surface.*/
-/* If we create the surface ok then we brake from the loop. If we fail then */
-/* we will call 'FreeTextureMemory' that will return TRUE/FALSE as to whether*/
-/* memory was freed. If memory was freed then we can try again. If no memory*/
-/* was freed then it just can't fit. */
-/* 'FreeTextureMemory' will find the end of the list and start freeing VMEM */
-/* (never SMEM) surfaces that are not locked. */
-/* BIND - when we bind and there is a texture struct with a texture surface */
-/* in VMEM then we just make it current. If we have a struct and a surface */
-/* in SMEM but no VMEM surface then we create the surface in VMEM and blt */
-/* from the SMEM surface. If we have nothing its just like a creation... */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-extern "C" BOOL CreateTMgrHAL( PMESAD3DSHARED pShared, DWORD dwName, int level, DWORD dwRequestFlags,
- RECT *rectDirty, DWORD dwWidth, DWORD dwHeight, DWORD dwAction, void *pPixels )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- PTM_OBJECT pTMObj,
- pTemp;
- DDSURFACEDESC2 ddsd2;
- HRESULT rc;
-
-
- DPF(( DBG_FUNC, "CreateTMgrHAL();" ));
-
- DPF(( DBG_TXT_INFO, "Texture:" ));
- DPF(( DBG_TXT_INFO, "cx: %d cy: %d", dwWidth, dwHeight ));
- DPF(( DBG_TXT_INFO, "Rect:" ));
- if ( rectDirty )
- {
- DPF(( DBG_TXT_INFO, "x0: %d y0: %d", rectDirty->left, rectDirty->top ));
- DPF(( DBG_TXT_INFO, "x1: %d y1: %d", rectDirty->right, rectDirty->bottom ));
- }
-
- /* Check too see that we have a valid context. */
- if ( (pHAL == NULL) && (pHAL->lpD3DDevice != NULL) )
- {
- DPF(( DBG_TXT_WARN, "Null HAL/Direct3D Device!" ));
- return FALSE;
- }
-
- /*=================================================*/
- /* See if we can find this texture object by name. */
- /*=================================================*/
- for( pTMObj = pHAL->pTMList; pTMObj && (pTMObj->dwName != dwName); pTMObj = pTMObj->next );
-
- /*=========================================================*/
- /* Allocate a new object if we didn't get a matching name. */
- /*=========================================================*/
- if ( pTMObj == NULL )
- {
- pTMObj = (PTM_OBJECT)ALLOC( sizeof(TM_OBJECT) );
- if ( pTMObj == NULL )
- return FALSE;
- memset( pTMObj, 0, sizeof(TM_OBJECT) );
-
- /* Put the object at the beginning of the list. */
- pTMObj->next = pHAL->pTMList;
- if ( pTMObj->next )
- {
- pTemp = pTMObj->next;
- pTemp->prev = pTMObj;
- }
- pHAL->pTMList = pTMObj;
- }
- else
- {
- /*===============================================================*/
- /* Make some caching happen by pulling this object to the front. */
- /*===============================================================*/
- if ( pHAL->pTMList != pTMObj )
- {
- /* Pull the object out of the list. */
- if ( pTMObj->prev )
- {
- pTemp = pTMObj->prev;
- pTemp->next = pTMObj->next;
- }
- if ( pTMObj->next )
- {
- pTemp = pTMObj->next;
- pTemp->prev = pTMObj->prev;
- }
-
- pTMObj->prev = NULL;
- pTMObj->next = NULL;
-
- /* Put the object at the front of the list. */
- pTMObj->next = pHAL->pTMList;
- if ( pTMObj->next )
- {
- pTemp = pTMObj->next;
- pTemp->prev = pTMObj;
- }
- pHAL->pTMList = pTMObj;
- }
- }
-
- /*========================================================*/
- /* If we are doing BIND and the texture is in VID memory. */
- /*========================================================*/
- if ( (dwAction == TM_ACTION_BIND) && pTMObj->lpDDS_Video )
- {
- DPF(( DBG_TXT_PROFILE, "Cache HIT (%d)", dwName ));
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /*=================================================================*/
- /* If we are doing BIND and the texture is at least in SYS memory. */
- /*=================================================================*/
- if ( (dwAction == TM_ACTION_BIND) && pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_PROFILE, "Cache MISS (%d)", dwName ));
-
- /* Create the texture on the card. */
- rc = LoadTextureInVideo( pHAL, pTMObj );
- if ( rc == FALSE )
- return FALSE;
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /*=========================================================*/
- /* If we are doing UPDATE then try in VID first for speed. */
- /*=========================================================*/
- if ( (dwAction == TM_ACTION_UPDATE) && pTMObj->lpDDS_Video &&
- !(pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY) )
- {
- DPF(( DBG_TXT_INFO, "Fix the SubTexture update Leigh!" ));
-
- /* Update the texture on the card. */
- UpdateTexture( pTMObj, TRUE, rectDirty, (UCHAR *)pPixels );
-
- /* We updated the texture in VID so kill the SYS so we know its dirty. */
- if ( pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Release texture (SYS)" ));
- DX_RESTORE( pTMObj->lpDDS_System );
- pTMObj->lpDDS_System->Release();
- pTMObj->lpDDS_System = NULL;
- }
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /*===========================================================*/
- /* If we are doing UPDATE then try in SYS still gives speed. */
- /*===========================================================*/
- if ( (dwAction == TM_ACTION_UPDATE) && pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Fix the SubTexture update Leigh!" ));
-
- /* Update the texture in SYS. */
- UpdateTexture( pTMObj, FALSE, NULL, (UCHAR *)pPixels );
-
- /* We updated the SYS texture only so now blt to the VID. */
- rc = LoadTextureInVideo( pHAL, pTMObj );
- if ( rc == FALSE )
- return FALSE;
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
- }
-
- /* At this point we have a valid Texture Manager Object with updated */
- /* links. We now need to create or update a texture surface that is */
- /* in system memory. Every texture has a copy in system so we can use*/
- /* blt to solve problems with textures allocated on the card (square */
- /* only textures, pixelformats...). */
-
- // TODO: make support for update also. Dirty rectangle basicly...
-
- /* Kill the interface if we have one no matter what. */
- if ( pTMObj->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pTMObj->lpD3DTexture2->Release();
- pTMObj->lpD3DTexture2 = NULL;
- }
-
- /* Kill the system surface. TODO: should try to get the SubIMage going again */
- if ( pTMObj->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Release texture (SYS)" ));
- DX_RESTORE( pTMObj->lpDDS_System );
- pTMObj->lpDDS_System->Release();
- pTMObj->lpDDS_System = NULL;
- }
-
- /* Kill the Video surface. TODO: need some reuse system... */
- if ( pTMObj->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID)" ));
- DX_RESTORE( pTMObj->lpDDS_Video );
- pTMObj->lpDDS_Video->Release();
- pTMObj->lpDDS_Video = NULL;
- }
-
- /*================================================================*/
- /* Translate the the Mesa/OpenGL pixel channels to the D3D flags. */
- /*================================================================*/
- switch( dwRequestFlags )
- {
- case GL_ALPHA:
- dwRequestFlags = DDPF_ALPHA;
- DPF(( DBG_TXT_WARN, "GL_ALPHA not supported!)" ));
- return FALSE;
-
- case GL_INTENSITY:
- case GL_LUMINANCE:
- DPF(( DBG_TXT_WARN, "GL_INTENSITY/GL_LUMINANCE not supported!)" ));
- dwRequestFlags = DDPF_LUMINANCE;
- return FALSE;
-
- case GL_LUMINANCE_ALPHA:
- DPF(( DBG_TXT_WARN, "GL_LUMINANCE_ALPHA not supported!)" ));
- dwRequestFlags = DDPF_LUMINANCE | DDPF_ALPHAPIXELS;
- return FALSE;
-
- case GL_RGB:
- DPF(( DBG_TXT_INFO, "Texture -> GL_RGB" ));
- dwRequestFlags = DDPF_RGB;
- break;
-
- case GL_RGBA:
- DPF(( DBG_TXT_INFO, "Texture -> GL_RGBA" ));
- dwRequestFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
- break;
- }
-
- /*==============================*/
- /* Populate the texture object. */
- /*==============================*/
- pTMObj->dwName = dwName;
- pTMObj->lpD3DDevice = pHAL->lpD3DDevice;
- pTMObj->dwFlags = dwRequestFlags;
- if ( pHAL->D3DHWDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY )
- {
- DPF(( DBG_TXT_INFO, "Convert to Square..." ));
- pTMObj->dwSHeight = dwHeight;
- pTMObj->dwSWidth = dwWidth;
-
- /* Shrink non-square textures. */
- pTMObj->dwVHeight = (dwHeight > dwWidth) ? dwWidth : dwHeight;
- pTMObj->dwVWidth = (dwHeight > dwWidth) ? dwWidth : dwHeight;
- }
- else
- {
- pTMObj->dwSHeight = dwHeight;
- pTMObj->dwSWidth = dwWidth;
- pTMObj->dwVHeight = dwHeight;
- pTMObj->dwVWidth = dwWidth;
- }
-
- /*========================*/
- /* Create SYSTEM surface. */
- /*========================*/
-
- /* Request a surface in system memory. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- ddsd2.dwWidth = pTMObj->dwSWidth;
- ddsd2.dwHeight = pTMObj->dwSHeight;
- ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY;
- ddsd2.ddsCaps.dwCaps2 = 0L;
- memset( &ddsd2.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT) );
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = dwRequestFlags;
- rc = pHAL->lpD3DDevice->EnumTextureFormats( EnumPFHook, &ddsd2.ddpfPixelFormat );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EnumerTextureFormats (SYSTEM)->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Create the surface using the enumerated pixelformat. */
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pTMObj->lpDDS_System, NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "CreateSurface (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Solve the pixel mapping info using the surface pixelformat. */
- Solve8BitChannelPixelFormat( &ddsd2.ddpfPixelFormat, &pTMObj->pixel );
-
- /*===================================================================*/
- /* Fill the texture using the PixelInfo structure to do the mapping. */
- /*===================================================================*/
- UpdateTexture( pTMObj, FALSE, NULL, (UCHAR *)pPixels );
-
- /*=======================*/
- /* Create VIDEO surface. */
- /*=======================*/
- rc = LoadTextureInVideo( pHAL, pTMObj );
- if ( rc == FALSE )
- return FALSE;
-
- /* Make this the current texture. */
- rc = pHAL->lpD3DDevice->SetTexture( 0, pTMObj->lpD3DTexture2 );
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed SetTexture() (%s)", ErrorStringD3D(rc) ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will handle the creation and destruction of the texture */
-/* surfaces on the card. Using the dw'V'Width/Height dimensions the call */
-/* try and create the texture on the card and keep using FreeTextureMemory */
-/* until the surace can be created. Once the surface is created we get the */
-/* interface that we will use to make it the current texture. I didn't put */
-/* the code to make the texture current in this function as BIND needs to */
-/* use the same code and this function doesn't always get called when we do a*/
-/* bind. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL LoadTextureInVideo( PMESAD3DHAL pHAL, PTM_OBJECT pTMObj )
-{
- DDSURFACEDESC2 ddsd2;
- HRESULT rc;
-
- DPF(( DBG_FUNC, "LoadTextureInVideo();" ));
-
- /* Kill the interface if we have one no matter what. */
- if ( pTMObj->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pTMObj->lpD3DTexture2->Release();
- pTMObj->lpD3DTexture2 = NULL;
- }
-
- /* Kill the Video surface. TODO: need some reuse system... */
- if ( pTMObj->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID)" ));
- DX_RESTORE( pTMObj->lpDDS_Video );
- pTMObj->lpDDS_Video->Release();
- pTMObj->lpDDS_Video = NULL;
- }
-
- /* Request a surface in Video memory. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof( DDSURFACEDESC2 );
- ddsd2.dwWidth = pTMObj->dwVWidth;
- ddsd2.dwHeight = pTMObj->dwVHeight;
- ddsd2.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
- ddsd2.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY;
- ddsd2.ddsCaps.dwCaps2 = 0L;
- memset( &ddsd2.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT) );
- ddsd2.ddpfPixelFormat.dwSize = sizeof( DDPIXELFORMAT );
- ddsd2.ddpfPixelFormat.dwFlags = pTMObj->dwFlags;
- rc = pHAL->lpD3DDevice->EnumTextureFormats( EnumPFHook, &ddsd2.ddpfPixelFormat );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "EnumerTextureFormats ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Make sure we lock so we don't nuke this texture trying to free memory for it. */
- pTMObj->bLock = TRUE;
-
- /* Start a loop that will free all textures until we have created the texture */
- /* surface or we can't free up more memory. */
- do
- {
- /* Try to create the texture surface. */
- rc = pHAL->lpDD4->CreateSurface( &ddsd2, &pTMObj->lpDDS_Video, NULL );
- if ( !FAILED(rc) )
- break;
-
- DPF(( DBG_TXT_INFO, "Free Texture Memory" ));
-
- /* DestroyTexture will return TRUE if a surface was freed. */
- } while( FreeTextureMemory(pHAL,NULL) );
-
- /* Make sure we unlock or we won't be able to nuke the TMO later. */
- pTMObj->bLock = FALSE;
-
- /* Did we create a valid texture surface? */
- if ( FAILED(rc) )
- {
- DPF(( DBG_TXT_WARN, "Failed to load texture" ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- DX_RESTORE( pTMObj->lpDDS_System );
- DX_RESTORE( pTMObj->lpDDS_Video );
-
- DPF(( DBG_TXT_INFO, "Texture Blt SYSTEM -> VID" ));
-
- /* Now blt the texture in system memory to the card. */
- rc = pTMObj->lpDDS_Video->Blt( NULL, pTMObj->lpDDS_System, NULL, DDBLT_WAIT, NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Blt (TEXTURE) ->", ErrorStringD3D(rc) );
- return FALSE;
- }
-
- /* Get the Texture interface that is used to render with. */
- pTMObj->lpDDS_Video->QueryInterface( IID_IDirect3DTexture2, (void **)&pTMObj->lpD3DTexture2 );
- if ( pTMObj->lpD3DTexture2 == NULL )
- {
- DPF(( DBG_TXT_WARN, "Failed QueryTextureInterface" ));
- pHAL->lpD3DDevice->SetTexture( 0, NULL );
- return FALSE;
- }
-
- return TRUE;
-}
-/*===========================================================================*/
-/* If this function gets a texture object struc then we will try and free */
-/* it. If we get a NULL then we will search from the bottom up and free one */
-/* VMEM surface. I can only free when the surface isn't locked and of course*/
-/* there must be a VMEM surface. We never free SMEM surfaces as that isn't */
-/* the point. */
-/* TODO: should have a pointer to the bottom of the stack really. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static BOOL FreeTextureMemory( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject )
-{
- PTM_OBJECT pCurrent;
- BOOL bFreed = FALSE;
-
- DPF(( DBG_FUNC, "FreeTextureMemory();" ));
- DPF(( DBG_TXT_WARN, "FREE TEXTURE!" ));
-
- /* Just to be safe. */
- if ( !pHAL || !pHAL->pTMList )
- {
- DPF(( DBG_TXT_WARN, "FreeTextureMemory() -> NULL pHAL/pHAL->pTMList" ));
- return FALSE;
- }
-
- /* Free the last texture in the list. */
- if ( pTMObject == NULL )
- {
- DPF(( DBG_TXT_INFO, "Free Last texture in cache" ));
-
- /* Find the last texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent->next; pCurrent = pCurrent->next );
-
- /* Now backup until we find a texture on the card. */
- while( pCurrent && (pCurrent->lpDDS_Video == NULL) && (pCurrent->bLock == FALSE) )
- pCurrent = pCurrent->prev;
-
- /* Didn't find anything. */
- if ( pCurrent == NULL )
- {
- DPF(( DBG_TXT_INFO, "No texture memory freed" ));
- return FALSE;
- }
- }
- else
- {
- /* See if we can find this texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent && (pCurrent != pTMObject); pCurrent = pCurrent->next );
-
- /* Didn't find anything. */
- if ( pCurrent == NULL )
- {
- DPF(( DBG_TXT_INFO, "Requested texture to be freed NOT FOUND" ));
- return FALSE;
- }
- }
-
- /* Can't free this baby. */
- if ( pCurrent->bLock == TRUE )
- {
- DPF(( DBG_TXT_WARN, "Requested texture LOCKED" ));
- return FALSE;
- }
-
- /* Free the texture memory. */
- if ( pCurrent->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pCurrent->lpD3DTexture2->Release();
- pCurrent->lpD3DTexture2 = NULL;
- bFreed = TRUE;
- }
- if ( pCurrent->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID):" ));
- DPF(( DBG_TXT_INFO, "dwName: %d", pCurrent->dwName ));
- DPF(( DBG_TXT_INFO, "cx: %d, cy: %d", pCurrent->dwVWidth, pCurrent->dwVHeight ));
- pCurrent->lpDDS_Video->Release();
- pCurrent->lpDDS_Video = NULL;
- bFreed = TRUE;
- }
-
- return bFreed;
-}
-/*===========================================================================*/
-/* This function searches the linked list of texture objects in the supplied*/
-/* D3Dwrapper structure. If it finds a match it will free it and pull it out*/
-/* of the linked list. The function works on the bases of a matching pointer*/
-/* to the object (not matching content). */
-/* If the function gets passed a NULL then we want to free the last texture */
-/* object in the list. Used in a loop to destory all. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL DestroyTextureObject( PMESAD3DHAL pHAL, PTM_OBJECT pTMObject )
-{
- PTM_OBJECT pCurrent;
-
- DPF(( DBG_FUNC, "DestoryTextureObject();" ));
-
- /* Just to be safe. */
- if ( !pHAL || !pHAL->pTMList )
- {
- DPF(( DBG_TXT_WARN, "DestroyTextureObject() -> NULL pHAL/pHAL->pTMList" ));
- return FALSE;
- }
-
- /* Free the last texture in the list. */
- if ( pTMObject == NULL )
- {
- /* Find the last texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent->next; pCurrent = pCurrent->next );
- }
- else
- {
- /* See if we can find this texture object. */
- for( pCurrent = pHAL->pTMList; pCurrent && (pCurrent != pTMObject); pCurrent = pCurrent->next );
-
- /* Didn't find anything. */
- if ( pCurrent == NULL )
- {
- DPF(( DBG_TXT_WARN, "No textures to be freed" ));
- return FALSE;
- }
- }
-
- /* Can't free this baby. */
- if ( pCurrent->bLock == TRUE )
- {
- DPF(( DBG_TXT_WARN, "Requested texture to be freed LOCKED" ));
- return FALSE;
- }
-
- /* Free the texture memory. */
- if ( pCurrent->lpD3DTexture2 )
- {
- DPF(( DBG_TXT_INFO, "Release Texture2" ));
- pCurrent->lpD3DTexture2->Release();
- pCurrent->lpD3DTexture2 = NULL;
- }
- if ( pCurrent->lpDDS_Video )
- {
- DPF(( DBG_TXT_INFO, "Release texture (VID):" ));
- pCurrent->lpDDS_Video->Release();
- pCurrent->lpDDS_Video = NULL;
- }
- if ( pCurrent->lpDDS_System )
- {
- DPF(( DBG_TXT_INFO, "Release texture (SYS):" ));
- pCurrent->lpDDS_System->Release();
- pCurrent->lpDDS_System = NULL;
- }
-
- /* Pull this texture out of the list. */
- if ( pCurrent == pHAL->pTMList )
- pHAL->pTMList = NULL;
- if ( pCurrent->prev )
- (pCurrent->prev)->next = pCurrent->next;
- if ( pCurrent->next )
- (pCurrent->next)->prev = pCurrent->prev;
- FREE( pCurrent );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function is the callback function that gets called when we are doing*/
-/* an enumeration of the texture formats supported by this device. The choice*/
-/* is made by checking to see if we have a match with the supplied D3D pixel-*/
-/* format. So the enumeration has to pass a desired D3D PF as the user var. */
-/*===========================================================================*/
-/* RETURN: D3DENUMRET_OK, D3DENUMRET_CANCEL. */
-/*===========================================================================*/
-static void UpdateTexture( PTM_OBJECT pTMObj, BOOL bVideo, RECT *pRect, UCHAR *pixels )
-{
- LPDIRECTDRAWSURFACE4 lpDDS;
- DDSURFACEDESC2 ddsd2;
- DWORD srcPitch,
- dwHeight,
- dwWidth,
- dwCol,
- dwColor;
- UCHAR *pSrc,
- *pSrcRow,
- *pDest,
- *pDestRow;
- int rc;
-
- // TODO: Do I need to pass the h/w when its in the object!
- DPF(( DBG_FUNC, "UpdateTexture();" ));
-
- /* Get the surface pointer we are looking for. */
- lpDDS = (bVideo) ? pTMObj->lpDDS_Video : pTMObj->lpDDS_System;
-
- /*===================================================================*/
- /* Fill the texture using the PixelInfo structure to do the mapping. */
- /*===================================================================*/
-
- /* Get the surface pointer. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof(DDSURFACEDESC2);
- rc = lpDDS->Lock( NULL, &ddsd2, DDLOCK_WAIT, NULL );
- if ( FAILED(rc) )
- {
- RIP( NULL, "Lock (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) );
- return;
- }
-
- /* For now we are only updating the system surface so use its dimensions. */
- dwWidth = (bVideo) ? pTMObj->dwVWidth : pTMObj->dwSWidth;
- dwHeight = (bVideo) ? pTMObj->dwVHeight : pTMObj->dwSHeight;
-
- /* If we are updating the whole surface then the pDest/pSrc will */
- /* always be the same. */
- if ( pRect == NULL )
- {
- pDest = (UCHAR *)ddsd2.lpSurface;
- pSrc = pixels;
- }
-
- /* Fill the texture surface based on the pixelformat flags. */
- if ( pTMObj->dwFlags == (DDPF_RGB | DDPF_ALPHAPIXELS) )
- {
- srcPitch = dwWidth * 4;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth * 4) + (pRect->left * 4);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.gScale)) << pTMObj->pixel.gShift );
- dwColor |= ( ((DWORD)(*(pSrc+2) * pTMObj->pixel.bScale)) << pTMObj->pixel.bShift );
- if ( pTMObj->pixel.aScale == -1.0 )
- dwColor |= ( (*(pSrc+3) & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 );
- else
- dwColor |= ( ((DWORD)(*(pSrc+3) * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc += 4;
- }
- }
- }
- else if ( pTMObj->dwFlags == DDPF_RGB )
- {
- srcPitch = dwWidth * 3;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth * 3) + (pRect->left * 3);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.gScale)) << pTMObj->pixel.gShift );
- dwColor |= ( ((DWORD)(*(pSrc+2) * pTMObj->pixel.bScale)) << pTMObj->pixel.bShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc += 3;
- }
- }
- }
- else if ( pTMObj->dwFlags == (DDPF_LUMINANCE | DDPF_ALPHAPIXELS) )
- {
- srcPitch = dwWidth * 2;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth * 2) + (pRect->left * 2);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*(pSrc ) * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- if ( pTMObj->pixel.aScale == -1.0 )
- dwColor |= ( (*(pSrc+1) & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 );
- else
- dwColor |= ( ((DWORD)(*(pSrc+1) * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc += 2;
- }
- }
- }
- else if ( pTMObj->dwFlags == DDPF_LUMINANCE )
- {
- srcPitch = dwWidth;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth) + (pRect->left);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- dwColor = ( ((DWORD)(*pSrc * pTMObj->pixel.rScale)) << pTMObj->pixel.rShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc++;
- }
- }
- }
- else if ( pTMObj->dwFlags == DDPF_ALPHAPIXELS )
- {
- srcPitch = dwWidth;
- if ( pRect )
- {
- pDest = ((UCHAR *)ddsd2.lpSurface) + (pRect->top * ddsd2.lPitch) + (pRect->left * pTMObj->pixel.cb);
- pSrc = pixels + (pRect->top * dwWidth) + (pRect->left);
- dwHeight = (pRect->bottom - pRect->top);
- dwWidth = (pRect->right - pRect->left);
- }
-
- for( pDestRow = pDest, pSrcRow = pSrc; dwHeight > 0; dwHeight--, pDestRow += ddsd2.lPitch, pSrcRow += srcPitch )
- {
- for( dwCol = 0, pDest = pDestRow, pSrc = pSrcRow; dwCol < dwWidth; dwCol++ )
- {
- if ( pTMObj->pixel.aScale == -1.0 )
- dwColor = ( (*pSrc & 0x80) ? (1 << pTMObj->pixel.aShift) : 0 );
- else
- dwColor = ( ((DWORD)(*pSrc * pTMObj->pixel.aScale)) << pTMObj->pixel.aShift );
- memcpy( pDest, &dwColor, pTMObj->pixel.cb );
- pDest += pTMObj->pixel.cb;
- pSrc++;
- }
- }
- }
-
- /* Unlock the surface. */
- rc = lpDDS->Unlock( NULL );
- if ( FAILED(rc) )
- {
- RIP( NULL, "Unlock (TEXTURE/SYSTEM)->", ErrorStringD3D(rc) );
- }
-}
-/*===========================================================================*/
-/* This function is the callback function that gets called when we are doing*/
-/* an enumeration of the texture formats supported by this device. The choice*/
-/* is made by checking to see if we have a match with the supplied D3D pixel-*/
-/* format. So the enumeration has to pass a desired D3D PF as the user var. */
-/*===========================================================================*/
-/* RETURN: D3DENUMRET_OK, D3DENUMRET_CANCEL. */
-/*===========================================================================*/
-HRESULT CALLBACK EnumPFHook( LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext )
-{
- LPDDPIXELFORMAT lpDDPixFmtRequest = (LPDDPIXELFORMAT)lpContext;
- PIXELINFO pixel;
-
- DPF(( DBG_FUNC, "EnumPFHook();" ));
-
- if ( lpDDPixFmt->dwFlags == lpDDPixFmtRequest->dwFlags )
- {
- /* Are we looking for an alpha channel? */
- if ( lpDDPixFmtRequest->dwFlags & DDPF_ALPHAPIXELS )
- {
- /* Try for something that has more then 1bits of Alpha. */
- Solve8BitChannelPixelFormat( lpDDPixFmt, &pixel );
- if ( pixel.aScale == -1.0 )
- {
- /* Save this format no matter what as its a match of sorts. */
- memcpy( lpDDPixFmtRequest, lpDDPixFmt, sizeof(DDPIXELFORMAT) );
- return D3DENUMRET_OK;
- }
- }
-
- /* Save this format as its a good match. */
- memcpy( lpDDPixFmtRequest, lpDDPixFmt, sizeof(DDPIXELFORMAT) );
-
- /* We are happy at this point so lets leave. */
- return D3DENUMRET_CANCEL;
- }
-
- return D3DENUMRET_OK;
-}
-
-
diff --git a/src/mesa/drivers/d3d/D3DTextureMgr.h b/src/mesa/drivers/d3d/D3DTextureMgr.h
deleted file mode 100644
index f4a4154917a..00000000000
--- a/src/mesa/drivers/d3d/D3DTextureMgr.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef _TEXTURE_MGR_INC
-#define _TEXTURE_MGR_INC
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include <stdlib.h>
-#include <stdlib.h>
-#include "GL/gl.h"
-/*========================================================================*/
-/* Defines. */
-/*========================================================================*/
-/*========================================================================*/
-/* Type defines. */
-/*========================================================================*/
-typedef struct _local_texture_object
-{
- DWORD dwName,
- dwPriority,
- dwFlags,
- dwSWidth,
- dwSHeight,
- dwVWidth,
- dwVHeight;
- BOOL bLock,
- bDirty; /* I only update VID on SubImage calls so the system */
- /* texture can get invalid. */
-
- LPDIRECT3DDEVICE3 lpD3DDevice; /* If the device changes we must get new handles... */
- LPDIRECTDRAWSURFACE4 lpDDS_System,
- lpDDS_Video;
- LPDIRECT3DTEXTURE2 lpD3DTexture2;
-
- PIXELINFO pixel;
-
- struct _local_texture_object *next;
- struct _local_texture_object *prev;
-
-} TM_OBJECT, *PTM_OBJECT;
-/*========================================================================*/
-/* Function prototypes. */
-/*========================================================================*/
-void APIENTRY InitTMD3D( void *pVoid );
-void APIENTRY TermTMD3D( void *pVoid );
-/*========================================================================*/
-/* Global variables declaration. */
-/*========================================================================*/
-
-#endif
diff --git a/src/mesa/drivers/d3d/D3DUTILS.CPP b/src/mesa/drivers/d3d/D3DUTILS.CPP
deleted file mode 100644
index c13d89cd711..00000000000
--- a/src/mesa/drivers/d3d/D3DUTILS.CPP
+++ /dev/null
@@ -1,638 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DHAL.h"
-/*===========================================================================*/
-/* Local only functions. */
-/*===========================================================================*/
-static int CountTrailingZeros( DWORD dwMask );
-/*===========================================================================*/
-/* This function is used to get the pointer to the surface and the pitch for*/
-/* the scanline rendering functions. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" DDSURFACEDESC2 *LockHAL( PMESAD3DSHARED pShared, BOOL bBack )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- static DDSURFACEDESC2 ddsd2;
- HRESULT rc;
-
- DPF(( DBG_FUNC, "LockHAL();" ));
-
- /* Set the request structure up first. */
- memset( &ddsd2, 0, sizeof(DDSURFACEDESC2) );
- ddsd2.dwSize = sizeof(DDSURFACEDESC2);
-
- /* Make sure we have enough info. */
- if ( pHAL )
- {
- rc = pHAL->lpDDSRender->Lock( NULL, &ddsd2, DDLOCK_WAIT, NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Lock (RENDER) ->", ErrorStringD3D(rc) );
- }
- }
-
- return &ddsd2;
-}
-/*===========================================================================*/
-/* This is just a simple wrapper. I probably don't need to do any error */
-/* checking as the Lock must have worked inorder to get here... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void UnlockHAL( PMESAD3DSHARED pShared, BOOL bBack )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- HRESULT rc;
-
- DPF(( DBG_FUNC, "UnlockHAL();" ));
-
- /* Make sure we have enough info. */
- if ( pHAL )
- {
- rc = pHAL->lpDDSRender->Unlock( NULL );
- if ( FAILED(rc) )
- {
- RIP( pHAL, "Unlock (RENDER) ->", ErrorStringD3D(rc) );
- }
- }
-}
-/*===========================================================================*/
-/* This function will track the main/Primary window that will be used as the*/
-/* target for the Blt in SwapBuffers. As a side effect the call will check */
-/* to see if the primary surface is the same size and position as the screen.*/
-/* If they are the same size we will call it fullscreen... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-extern "C" void UpdateScreenPosHAL( PMESAD3DSHARED pShared )
-{
- PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared;
- POINT pt;
- DWORD dwWidth, dwHeight;
-
- DPF(( DBG_FUNC, "UpdateScreenPosHAL();" ));
-
- /* Make sure we have enough info. */
- if ( pHAL != NULL )
- {
- /* Update the windows screen position. */
- GetClientRect( pShared->hwnd, &pShared->rectW );
- pt.x = pt.y = 0;
- ClientToScreen( pShared->hwnd, &pt );
- OffsetRect( &pShared->rectW, pt.x, pt.y);
-
- /* Compare the primary to the screen. */
- dwWidth = GetSystemMetrics( SM_CXSCREEN );
- dwHeight = GetSystemMetrics( SM_CYSCREEN );
- if ( (pShared->rectW.left > 0) || (pShared->rectW.top > 0) ||
- (pShared->rectW.right > dwWidth) || (pShared->rectW.bottom > dwHeight) )
- pShared->bWindow = TRUE;
- else
- pShared->bWindow = FALSE;
- }
-}
-/*===========================================================================*/
-/* This function will fill in the pixel info structure defined in D3Dshared.*/
-/* Basicly it will take a DirectDraw pixelformat structure and make scaling */
-/* values that will convert from 8bit channels to whatever the supplied ddpf */
-/* uses. Also we will generate shift values that will be used to get move */
-/* each component of the pixel into place. */
-/* I have now added a special case for a 1bit alpha channel. If I find a 1b*/
-/* alpha then I will set the scale to -1.0 which should be unique. Later I */
-/* can check the alpha scale value too see if its -1.0 and thus handle it. I*/
-/* was finding that the case was not working tom my advantage so this is my */
-/* HACK for the day. As a TODO I should work on this... */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void Solve8BitChannelPixelFormat( DDPIXELFORMAT *pddpf, PPIXELINFO pPixel )
-{
- DPF(( DBG_FUNC, "Solve8BitChannelPixelFromat();" ));
-
- memset( pPixel, 0, sizeof(PPIXELINFO) );
-
- /* Check too see if the color space is valid in the PF. */
- if ( pddpf->dwFlags & DDPF_RGB )
- {
- /* Solve the red stuff. */
- pPixel->dwRMask = pddpf->dwRBitMask;
- pPixel->rShift = CountTrailingZeros( pPixel->dwRMask );
- pPixel->rScale = (float)0.00392156 * (float)(pPixel->dwRMask >> pPixel->rShift);
-
- /* Solve the green thingy's. */
- pPixel->dwGMask = pddpf->dwGBitMask;
- pPixel->gShift = CountTrailingZeros( pPixel->dwGMask );
- pPixel->gScale = (float)0.00392156 * (float)(pPixel->dwGMask >> pPixel->gShift);
-
- /* Solve the blues. */
- pPixel->dwBMask = pddpf->dwBBitMask;
- pPixel->bShift = CountTrailingZeros( pddpf->dwBBitMask );
- pPixel->bScale = (float)0.00392156 * (float)(pddpf->dwBBitMask >> pPixel->bShift);
- }
-
- /* Do the alpha channel if there is one. */
- if ( pddpf->dwFlags & DDPF_ALPHAPIXELS )
- {
- pPixel->dwAMask = pddpf->dwRGBAlphaBitMask;
- pPixel->aShift = CountTrailingZeros( pPixel->dwAMask );
-
- /* Special case a 1bit alpha. */
- if ( (pPixel->dwAMask >> pPixel->aShift) == 1 )
- pPixel->aScale = -1.0;
- else
- pPixel->aScale = (float)0.00392156 * (float)(pPixel->dwAMask >> pPixel->aShift);
- }
-
- /* Get the size of the pixel in bytes. Should work as dwRGBBitCount is in a union. */
- pPixel->cb = pddpf->dwRGBBitCount / 8;
-}
-/*===========================================================================*/
-/* See RETURN :) */
-/*===========================================================================*/
-/* RETURN: number of contiguous zeros starting from the right. */
-/*===========================================================================*/
-static int CountTrailingZeros( DWORD dwMask )
-{
- DWORD Mask;
-
- if ( dwMask == 0 )
- return 32;
-
- /* Can't take credit for this one! */
- Mask = dwMask & -(int)dwMask;
- return ((Mask & 0xFFFF0000)!=0) << 4
- | ((Mask & 0xFF00FF00)!=0) << 3
- | ((Mask & 0xF0F0F0F0)!=0) << 2
- | ((Mask & 0xCCCCCCCC)!=0) << 1
- | ((Mask & 0xAAAAAAAA)!=0);
-}
-/*===========================================================================*/
-/* This function will convert the DDraw error code to its macro string. The*/
-/* returned pointer is static so you need not worry about memory managemnet */
-/* but the error message gets written over from call to call... */
-/*===========================================================================*/
-/* RETURN: pointer to the single static buffer that hold the error message. */
-/*===========================================================================*/
-char *ErrorStringD3D( HRESULT hr )
-{
- static char errorString[128];
-
- switch( hr )
- {
- case DDERR_ALREADYINITIALIZED:
- strcpy( errorString, "DDERR_ALREADYINITIALIZED" );
- break;
-
- case DDERR_CANNOTATTACHSURFACE:
- strcpy( errorString, "DDERR_CANNOTATTACHSURFACE" );
- break;
-
- case DDERR_CANNOTDETACHSURFACE:
- strcpy( errorString, "DDERR_CANNOTDETACHSURFACE" );
- break;
-
- case DDERR_CURRENTLYNOTAVAIL:
- strcpy( errorString, "DDERR_CURRENTLYNOTAVAIL" );
- break;
-
- case DDERR_EXCEPTION:
- strcpy( errorString, "DDERR_EXCEPTION" );
- break;
-
- case DDERR_GENERIC:
- strcpy( errorString, "DDERR_GENERIC" );
- break;
-
- case DDERR_HEIGHTALIGN:
- strcpy( errorString, "DDERR_HEIGHTALIGN" );
- break;
-
- case DDERR_INCOMPATIBLEPRIMARY:
- strcpy( errorString, "DDERR_INCOMPATIBLEPRIMARY" );
- break;
-
- case DDERR_INVALIDCAPS:
- strcpy( errorString, "DDERR_INVALIDCAPS" );
- break;
-
- case DDERR_INVALIDCLIPLIST:
- strcpy( errorString, "DDERR_INVALIDCLIPLIST" );
- break;
-
- case DDERR_INVALIDMODE:
- strcpy( errorString, "DDERR_INVALIDMODE" );
- break;
-
- case DDERR_INVALIDOBJECT:
- strcpy( errorString, "DDERR_INVALIDOBJECT" );
- break;
-
- case DDERR_INVALIDPARAMS:
- strcpy( errorString, "DDERR_INVALIDPARAMS" );
- break;
-
- case DDERR_INVALIDPIXELFORMAT:
- strcpy( errorString, "DDERR_INVALIDPIXELFORMAT" );
- break;
-
- case DDERR_INVALIDRECT:
- strcpy( errorString, "DDERR_INVALIDRECT" );
- break;
-
- case DDERR_LOCKEDSURFACES:
- strcpy( errorString, "DDERR_LOCKEDSURFACES" );
- break;
-
- case DDERR_NO3D:
- strcpy( errorString, "DDERR_NO3D" );
- break;
-
- case DDERR_NOALPHAHW:
- strcpy( errorString, "DDERR_NOALPHAHW" );
- break;
-
- case DDERR_NOCLIPLIST:
- strcpy( errorString, "DDERR_NOCLIPLIST" );
- break;
-
- case DDERR_NOCOLORCONVHW:
- strcpy( errorString, "DDERR_NOCOLORCONVHW" );
- break;
-
- case DDERR_NOCOOPERATIVELEVELSET:
- strcpy( errorString, "DDERR_NOCOOPERATIVELEVELSET" );
- break;
-
- case DDERR_NOCOLORKEY:
- strcpy( errorString, "DDERR_NOCOLORKEY" );
- break;
-
- case DDERR_NOCOLORKEYHW:
- strcpy( errorString, "DDERR_NOCOLORKEYHW" );
- break;
-
- case DDERR_NODIRECTDRAWSUPPORT:
- strcpy( errorString, "DDERR_NODIRECTDRAWSUPPORT" );
- break;
-
- case DDERR_NOEXCLUSIVEMODE:
- strcpy( errorString, "DDERR_NOEXCLUSIVEMODE" );
- break;
-
- case DDERR_NOFLIPHW:
- strcpy( errorString, "DDERR_NOFLIPHW" );
- break;
-
- case DDERR_NOGDI:
- strcpy( errorString, "DDERR_NOGDI" );
- break;
-
- case DDERR_NOMIRRORHW:
- strcpy( errorString, "DDERR_NOMIRRORHW" );
- break;
-
- case DDERR_NOTFOUND:
- strcpy( errorString, "DDERR_NOTFOUND" );
- break;
-
- case DDERR_NOOVERLAYHW:
- strcpy( errorString, "DDERR_NOOVERLAYHW" );
- break;
-
- case DDERR_OVERLAPPINGRECTS:
- strcpy( errorString, "DDERR_OVERLAPPINGRECTS" );
- break;
-
- case DDERR_NORASTEROPHW:
- strcpy( errorString, "DDERR_NORASTEROPHW" );
- break;
-
- case DDERR_NOROTATIONHW:
- strcpy( errorString, "DDERR_NOROTATIONHW" );
- break;
-
- case DDERR_NOSTRETCHHW:
- strcpy( errorString, "DDERR_NOSTRETCHHW" );
- break;
-
- case DDERR_NOT4BITCOLOR:
- strcpy( errorString, "DDERR_NOT4BITCOLOR" );
- break;
-
- case DDERR_NOT4BITCOLORINDEX:
- strcpy( errorString, "DDERR_NOT4BITCOLORINDEX" );
- break;
-
- case DDERR_NOT8BITCOLOR:
- strcpy( errorString, "DDERR_NOT8BITCOLOR" );
- break;
-
- case DDERR_NOTEXTUREHW:
- strcpy( errorString, "DDERR_NOTEXTUREHW" );
- break;
-
- case DDERR_NOVSYNCHW:
- strcpy( errorString, "DDERR_NOVSYNCHW" );
- break;
-
- case DDERR_NOZBUFFERHW:
- strcpy( errorString, "DDERR_NOZBUFFERHW" );
- break;
-
- case DDERR_NOZOVERLAYHW:
- strcpy( errorString, "DDERR_NOZOVERLAYHW" );
- break;
-
- case DDERR_OUTOFCAPS:
- strcpy( errorString, "DDERR_OUTOFCAPS" );
- break;
-
- case DDERR_OUTOFMEMORY:
- strcpy( errorString, "DDERR_OUTOFMEMORY" );
- break;
-
- case DDERR_OUTOFVIDEOMEMORY:
- strcpy( errorString, "DDERR_OUTOFVIDEOMEMORY" );
- break;
-
- case DDERR_OVERLAYCANTCLIP:
- strcpy( errorString, "DDERR_OVERLAYCANTCLIP" );
- break;
-
- case DDERR_OVERLAYCOLORKEYONLYONEACTIVE:
- strcpy( errorString, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE" );
- break;
-
- case DDERR_PALETTEBUSY:
- strcpy( errorString, "DDERR_PALETTEBUSY" );
- break;
-
- case DDERR_COLORKEYNOTSET:
- strcpy( errorString, "DDERR_COLORKEYNOTSET" );
- break;
-
- case DDERR_SURFACEALREADYATTACHED:
- strcpy( errorString, "DDERR_SURFACEALREADYATTACHED" );
- break;
-
- case DDERR_SURFACEALREADYDEPENDENT:
- strcpy( errorString, "DDERR_SURFACEALREADYDEPENDENT" );
- break;
-
- case DDERR_SURFACEBUSY:
- strcpy( errorString, "DDERR_SURFACEBUSY" );
- break;
-
- case DDERR_CANTLOCKSURFACE:
- strcpy( errorString, "DDERR_CANTLOCKSURFACE" );
- break;
-
- case DDERR_SURFACEISOBSCURED:
- strcpy( errorString, "DDERR_SURFACEISOBSCURED" );
- break;
-
- case DDERR_SURFACELOST:
- strcpy( errorString, "DDERR_SURFACELOST" );
- break;
-
- case DDERR_SURFACENOTATTACHED:
- strcpy( errorString, "DDERR_SURFACENOTATTACHED" );
- break;
-
- case DDERR_TOOBIGHEIGHT:
- strcpy( errorString, "DDERR_TOOBIGHEIGHT" );
- break;
-
- case DDERR_TOOBIGSIZE:
- strcpy( errorString, "DDERR_TOOBIGSIZE" );
- break;
-
- case DDERR_TOOBIGWIDTH:
- strcpy( errorString, "DDERR_TOOBIGWIDTH" );
- break;
-
- case DDERR_UNSUPPORTED:
- strcpy( errorString, "DDERR_UNSUPPORTED" );
- break;
-
- case DDERR_UNSUPPORTEDFORMAT:
- strcpy( errorString, "DDERR_UNSUPPORTEDFORMAT" );
- break;
-
- case DDERR_UNSUPPORTEDMASK:
- strcpy( errorString, "DDERR_UNSUPPORTEDMASK" );
- break;
-
- case DDERR_INVALIDSTREAM:
- strcpy( errorString, "DDERR_INVALIDSTREAM" );
- break;
-
- case DDERR_VERTICALBLANKINPROGRESS:
- strcpy( errorString, "DDERR_VERTICALBLANKINPROGRESS" );
- break;
-
- case DDERR_WASSTILLDRAWING:
- strcpy( errorString, "DDERR_WASSTILLDRAWING" );
- break;
-
- case DDERR_XALIGN:
- strcpy( errorString, "DDERR_XALIGN" );
- break;
-
- case DDERR_INVALIDDIRECTDRAWGUID:
- strcpy( errorString, "DDERR_INVALIDDIRECTDRAWGUID" );
- break;
-
- case DDERR_DIRECTDRAWALREADYCREATED:
- strcpy( errorString, "DDERR_DIRECTDRAWALREADYCREATED" );
- break;
-
- case DDERR_NODIRECTDRAWHW:
- strcpy( errorString, "DDERR_NODIRECTDRAWHW" );
- break;
-
- case DDERR_PRIMARYSURFACEALREADYEXISTS:
- strcpy( errorString, "DDERR_PRIMARYSURFACEALREADYEXISTS" );
- break;
-
- case DDERR_NOEMULATION:
- strcpy( errorString, "DDERR_NOEMULATION" );
- break;
-
- case DDERR_REGIONTOOSMALL:
- strcpy( errorString, "DDERR_REGIONTOOSMALL" );
- break;
-
- case DDERR_CLIPPERISUSINGHWND:
- strcpy( errorString, "DDERR_CLIPPERISUSINGHWND" );
- break;
-
- case DDERR_NOCLIPPERATTACHED:
- strcpy( errorString, "DDERR_NOCLIPPERATTACHED" );
- break;
-
- case DDERR_NOHWND:
- strcpy( errorString, "DDERR_NOHWND" );
- break;
-
- case DDERR_HWNDSUBCLASSED:
- strcpy( errorString, "DDERR_HWNDSUBCLASSED" );
- break;
-
- case DDERR_HWNDALREADYSET:
- strcpy( errorString, "DDERR_HWNDALREADYSET" );
- break;
-
- case DDERR_NOPALETTEATTACHED:
- strcpy( errorString, "DDERR_NOPALETTEATTACHED" );
- break;
-
- case DDERR_NOPALETTEHW:
- strcpy( errorString, "DDERR_NOPALETTEHW" );
- break;
-
- case DDERR_BLTFASTCANTCLIP:
- strcpy( errorString, "DDERR_BLTFASTCANTCLIP" );
- break;
-
- case DDERR_NOBLTHW:
- strcpy( errorString, "DDERR_NOBLTHW" );
- break;
-
- case DDERR_NODDROPSHW:
- strcpy( errorString, "DDERR_NODDROPSHW" );
- break;
-
- case DDERR_OVERLAYNOTVISIBLE:
- strcpy( errorString, "DDERR_OVERLAYNOTVISIBLE" );
- break;
-
- case DDERR_NOOVERLAYDEST:
- strcpy( errorString, "DDERR_NOOVERLAYDEST" );
- break;
-
- case DDERR_INVALIDPOSITION:
- strcpy( errorString, "DDERR_INVALIDPOSITION" );
- break;
-
- case DDERR_NOTAOVERLAYSURFACE:
- strcpy( errorString, "DDERR_NOTAOVERLAYSURFACE" );
- break;
-
- case DDERR_EXCLUSIVEMODEALREADYSET:
- strcpy( errorString, "DDERR_EXCLUSIVEMODEALREADYSET" );
- break;
-
- case DDERR_NOTFLIPPABLE:
- strcpy( errorString, "DDERR_NOTFLIPPABLE" );
- break;
-
- case DDERR_CANTDUPLICATE:
- strcpy( errorString, "DDERR_CANTDUPLICATE" );
- break;
-
- case DDERR_NOTLOCKED:
- strcpy( errorString, "DDERR_NOTLOCKED" );
- break;
-
- case DDERR_CANTCREATEDC:
- strcpy( errorString, "DDERR_CANTCREATEDC" );
- break;
-
- case DDERR_NODC:
- strcpy( errorString, "DDERR_NODC" );
- break;
-
- case DDERR_WRONGMODE:
- strcpy( errorString, "DDERR_WRONGMODE" );
- break;
-
- case DDERR_IMPLICITLYCREATED:
- strcpy( errorString, "DDERR_IMPLICITLYCREATED" );
- break;
-
- case DDERR_NOTPALETTIZED:
- strcpy( errorString, "DDERR_NOTPALETTIZED" );
- break;
-
- case DDERR_UNSUPPORTEDMODE:
- strcpy( errorString, "DDERR_UNSUPPORTEDMODE" );
- break;
-
- case DDERR_NOMIPMAPHW:
- strcpy( errorString, "DDERR_NOMIPMAPHW" );
- break;
-
- case DDERR_INVALIDSURFACETYPE:
- strcpy( errorString, "DDERR_INVALIDSURFACETYPE" );
- break;
-
- case DDERR_NOOPTIMIZEHW:
- strcpy( errorString, "DDERR_NOOPTIMIZEHW" );
- break;
-
- case DDERR_NOTLOADED:
- strcpy( errorString, "DDERR_NOTLOADED" );
- break;
-
- case DDERR_NOFOCUSWINDOW:
- strcpy( errorString, "DDERR_NOFOCUSWINDOW" );
- break;
-
- case DDERR_DCALREADYCREATED:
- strcpy( errorString, "DDERR_DCALREADYCREATED" );
- break;
-
- case DDERR_NONONLOCALVIDMEM:
- strcpy( errorString, "DDERR_NONONLOCALVIDMEM" );
- break;
-
- case DDERR_CANTPAGELOCK:
- strcpy( errorString, "DDERR_CANTPAGELOCK" );
- break;
-
- case DDERR_CANTPAGEUNLOCK:
- strcpy( errorString, "DDERR_CANTPAGEUNLOCK" );
- break;
-
- case DDERR_NOTPAGELOCKED:
- strcpy( errorString, "DDERR_NOTPAGELOCKED" );
- break;
-
- case DDERR_MOREDATA:
- strcpy( errorString, "DDERR_MOREDATA" );
- break;
-
- case DDERR_EXPIRED:
- strcpy( errorString, "DDERR_EXPIRED" );
- break;
-
- case DDERR_VIDEONOTACTIVE:
- strcpy( errorString, "DDERR_VIDEONOTACTIVE" );
- break;
-
- case DDERR_DEVICEDOESNTOWNSURFACE:
- strcpy( errorString, "DDERR_DEVICEDOESNTOWNSURFACE" );
- break;
-
- case DDERR_NOTINITIALIZED:
- strcpy( errorString, "DDERR_NOTINITIALIZED" );
- break;
-
- default:
- strcpy( errorString, "<unknown error code>" );
- break;
- }
-
- return &errorString[0];
-}
diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c
deleted file mode 100644
index 09857f1dc8d..00000000000
--- a/src/mesa/drivers/d3d/D3Dvbrender.c
+++ /dev/null
@@ -1,2149 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include <stdio.h>
-#include "clip.h"
-#include "context.h"
-#include "light.h"
-#include "lines.h"
-#include "macros.h"
-#include "matrix.h"
-#include "pb.h"
-#include "points.h"
-#include "mtypes.h"
-#include "vb.h"
-#include "vbrender.h"
-#include "xform.h"
-#include "D3DMesa.h"
-
-static void SetRenderStates( GLcontext *ctx );
-static void DebugRenderStates( GLcontext *ctx, BOOL bForce );
-
-static void RenderPointsVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end );
-static void RenderQuad( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv );
-void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv );
-void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
-
-/* I went with a D3D vertex buffer that is 6 times that of the Mesa one */
-/* instead of having the D3D one flush when its full. This way Mesa will*/
-/* handle all the flushing. I need x6 as points can use 4 vertex each. */
-D3DTLVERTEX D3DTLVertices[ (VB_MAX*6) ];
-GLuint VList[VB_SIZE];
-/*===========================================================================*/
-/* Compute Z offsets for a polygon with plane defined by (A,B,C,D) */
-/* D is not needed. TODO: Currently we are calculating this but not using it.*/
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void OffsetPolygon( GLcontext *ctx, GLfloat a, GLfloat b, GLfloat c )
-{
- GLfloat ac,
- bc,
- m,
- offset;
-
- DPF(( DBG_FUNC, "OffsetPolygon();" ));
-
- if ( (c < 0.001F) && (c > - 0.001F) )
- {
- /* Prevents underflow problems. */
- ctx->PointZoffset = 0.0F;
- ctx->LineZoffset = 0.0F;
- ctx->PolygonZoffset = 0.0F;
- }
- else
- {
- ac = a / c;
- bc = b / c;
- if ( ac < 0.0F )
- ac = -ac;
- if ( bc<0.0F )
- bc = -bc;
- m = MAX2( ac, bc ); /* m = sqrt( ac*ac + bc*bc ); */
-
- offset = (m * ctx->Polygon.OffsetFactor + ctx->Polygon.OffsetUnits);
- ctx->PointZoffset = ctx->Polygon.OffsetPoint ? offset : 0.0F;
- ctx->LineZoffset = ctx->Polygon.OffsetLine ? offset : 0.0F;
- ctx->PolygonZoffset = ctx->Polygon.OffsetFill ? offset : 0.0F;
- }
-
- DPF(( DBG_PRIM_INFO, "OffsetPolygon: %f", offset ));
-}
-/*===========================================================================*/
-/* Compute signed area of the n-sided polgyon specified by vertices */
-/* vb->Win[] and vertex list vlist[]. */
-/* A clockwise polygon will return a negative area. A counter-clockwise */
-/* polygon will return a positive area. I have changed this function to */
-/* actually calculate twice the area as its faster and still gives the sign. */
-/*===========================================================================*/
-/* RETURN: signed area of the polgon. */
-/*===========================================================================*/
-static GLfloat PolygonArea( const struct vertex_buffer *vb, GLuint n, const GLuint vlist[] )
-{
- GLfloat area;
- GLuint i;
-
- DPF(( DBG_FUNC, "PolygonArea();" ));
-
-#define j0 vlist[i]
-#define j1 vlist[(i+1)%n]
-#define x0 vb->Win[j0][0]
-#define y0 vb->Win[j0][1]
-#define x1 vb->Win[j1][0]
-#define y1 vb->Win[j1][1]
-
- /* area = sum of trapezoids */
- for( i = 0, area = 0.0; i < n; i++ )
- area += ((x0 - x1) * (y0 + y1)); /* Note: no divide by two here! */
-
-#undef x0
-#undef y0
-#undef x1
-#undef y1
-#undef j1
-#undef j0
-
- // TODO: I don't see the point or * 0.5 as we just want the sign...
- return area;
-}
-/*===========================================================================*/
-/* Render a polygon that needs clipping on at least one vertex. The function*/
-/* will first clip the polygon to any user clipping planes then clip to the */
-/* viewing volume. The final polygon will be draw as single triangles that */
-/* first need minor proccessing (culling, offset, etc) before we draw the */
-/* polygon as a fan. NOTE: the fan is draw as single triangles as its not */
-/* formed sequentaly in the VB but is in the vlist[]. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderClippedPolygon( GLcontext *ctx, GLuint n, GLuint vlist[] )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLfloat (*win)[3] = VB->Win,
- *proj = ctx->ProjectionMatrix,
- ex, ey,
- fx, fy, c,
- wInv;
- GLuint index,
- pv,
- facing;
-
- DPF(( DBG_FUNC, "RenderClippedPolygon();" ));
-
- DPF(( DBG_PRIM_INFO, "RenderClippedtPolygon( %d )", n ));
-
- /* Which vertex dictates the color when flat shading. */
- pv = (ctx->Primitive==GL_POLYGON) ? vlist[0] : vlist[n-1];
-
- /* Clipping may introduce new vertices. New vertices will be stored in */
- /* the vertex buffer arrays starting with location VB->Free. After we've*/
- /* rendered the polygon, these extra vertices can be overwritten. */
- VB->Free = VB_MAX;
-
- /* Clip against user clipping planes in eye coord space. */
- if ( ctx->Transform.AnyClip )
- {
- n = gl_userclip_polygon( ctx, n, vlist );
- if ( n < 3 )
- return;
-
- /* Transform vertices from eye to clip coordinates: clip = Proj * eye */
- for( index = 0; index < n; index++ )
- {
- TRANSFORM_POINT( VB->Clip[vlist[index]], proj, VB->Eye[vlist[index]] );
- }
- }
-
- /* Clip against view volume in clip coord space */
- n = gl_viewclip_polygon( ctx, n, vlist );
- if ( n < 3 )
- return;
-
- /* Transform new vertices from clip to ndc to window coords. */
- /* ndc = clip / W window = viewport_mapping(ndc) */
- /* Note that window Z values are scaled to the range of integer */
- /* depth buffer values. */
-
- /* Only need to compute window coords for new vertices */
- for( index = VB_MAX; index < VB->Free; index++ )
- {
- if ( VB->Clip[index][3] != 0.0F )
- {
- wInv = 1.0F / VB->Clip[index][3];
-
- win[index][0] = VB->Clip[index][0] * wInv * ctx->Viewport.Sx + ctx->Viewport.Tx;
- win[index][1] = VB->Clip[index][1] * wInv * ctx->Viewport.Sy + ctx->Viewport.Ty;
- win[index][2] = VB->Clip[index][2] * wInv * ctx->Viewport.Sz + ctx->Viewport.Tz;
- }
- else
- {
- /* Can't divide by zero, so... */
- win[index][0] = win[index][1] = win[index][2] = 0.0F;
- }
- }
-
- /* Draw filled polygon as a triangle fan */
- for( index = 2; index < n; index++ )
- {
- /* Compute orientation of triangle */
- ex = win[vlist[index-1]][0] - win[vlist[0]][0];
- ey = win[vlist[index-1]][1] - win[vlist[0]][1];
- fx = win[vlist[index]][0] - win[vlist[0]][0];
- fy = win[vlist[index]][1] - win[vlist[0]][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* finish computing plane equation of polygon, compute offset */
- GLfloat fz = win[vlist[index]][2] - win[vlist[0]][2];
- GLfloat ez = win[vlist[index-1]][2] - win[vlist[0]][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
- RenderOneTriangle( ctx, vlist[0], vlist[index-1], vlist[index], pv );
- }
-}
-/*===========================================================================*/
-/* This function gets called when either the vertex buffer is full or glEnd */
-/* has been called. If the we aren't in rendering mode (FEEDBACK) then I */
-/* pass the vertex buffer back to Mesa to deal with by returning FALSE. */
-/* If I can render the primitive types in the buffer directly then I will */
-/* return TRUE after I render the vertex buffer and reset the vertex buffer. */
-/* */
-/* TODO: I don't handle the special case of when the vertex buffer is full */
-/* and we have a primitive that bounds this buffer and the next one to */
-/* come. I'm not sure right now if Mesa handles this for me... */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-GLboolean RenderVertexBuffer( GLcontext *ctx, GLboolean allDone )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLuint index,
- vlist[VB_SIZE];
-
- DPF(( DBG_FUNC, "RenderVertexBuffer();" ));
-
- /* We only need to hook actual tri's that need rendering. */
- if ( ctx->RenderMode != GL_RENDER )
- {
- // (ctx->Visual->AccumBits > 0) )
- // (ctx->Visual->StencilBits > 0) )
- DPF(( DBG_PRIM_INFO, "Passing VB back to Mesa" ));
- return FALSE;
- }
-
- /* I'm going to set the states here so that all functions will */
- /* be assured to have the right states. If Mesa's vertex bufefr */
- /* function calls one of my primitive functions (TRI,POINT,LINE) */
- /* it will need the right states. So instead of doing it in the */
- /* primitive function I will always do it here at risk of some */
- /* slow down to some cases... */
- SetRenderStates( ctx );
-
- switch( ctx->Primitive )
- {
- case GL_POINTS:
- DPF(( DBG_PRIM_INFO, "GL_POINTS( %d )", VB->Count ));
- RenderPointsVB( ctx, 0, VB->Count );
- break;
-
- case GL_LINES:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- /* Not supported functions yet so pass back that we failed to */
- /* render the vertex buffer and Mesa will have to do it. */
- DPF(( DBG_PRIM_INFO, "GL_LINE_?( %d )", VB->Count ));
- return FALSE;
-
- case GL_TRIANGLES:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_TRIANGLES( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_TRIANGLES( %d )", VB->Count ));
- RenderTriangleVB( ctx, 0, VB->Count );
- break;
-
- case GL_TRIANGLE_STRIP:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_TRIANGLE_STRIP( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_TRIANGLE_STRIP( %d )", VB->Count ));
- RenderTriangleStripVB( ctx, 0, VB->Count );
- break;
-
- case GL_TRIANGLE_FAN:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_TRIANGLE_FAN( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_TRIANGLE_FAN( %d )", VB->Count ));
- RenderTriangleFanVB( ctx, 0, VB->Count );
- break;
-
- case GL_QUADS:
- if ( VB->Count < 4 )
- {
- DPF(( DBG_PRIM_WARN, "GL_QUADS( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_QUADS( %d )", VB->Count ));
- RenderQuadVB( ctx, 0, VB->Count );
- break;
-
- case GL_QUAD_STRIP:
- if ( VB->Count < 4 )
- {
- DPF(( DBG_PRIM_WARN, "GL_QUAD_STRIP( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_QUAD_STRIP( %d )", VB->Count ));
-
- if ( VB->ClipOrMask )
- {
- for( index = 3; index < VB->Count; index += 2 )
- {
- if ( VB->ClipMask[index-3] & VB->ClipMask[index-2] & VB->ClipMask[index-1] & VB->ClipMask[index] & CLIP_ALL_BITS )
- {
- /* All points clipped by common plane */
- DPF(( DBG_PRIM_WARN, "GL_QUAD_STRIP( %d )", VB->Count ));
- continue;
- }
- else if ( VB->ClipMask[index-3] | VB->ClipMask[index-2] | VB->ClipMask[index-1] | VB->ClipMask[index] )
- {
- vlist[0] = index - 3;
- vlist[1] = index - 2;
- vlist[2] = index;
- vlist[3] = index - 1;
- RenderClippedPolygon( ctx, 4, vlist );
- }
- else
- {
- RenderQuad( ctx, (index-3), (index-2), index, (index-1), index );
- }
- }
- }
- else
- {
- /* No clipping needed */
- for( index = 3; index < VB->Count; index += 2 )
- RenderQuad( ctx, (index-3), (index-2), index, (index-1), index );
- }
- break;
-
- case GL_POLYGON:
- if ( VB->Count < 3 )
- {
- DPF(( DBG_PRIM_WARN, "GL_POLYGON( %d )", VB->Count ));
- return FALSE;
- }
-
- DPF(( DBG_PRIM_INFO, "GL_POLYGON( %d )", VB->Count ));
-
- /* All points clipped by common plane, draw nothing */
- if ( !(VB->ClipAndMask & CLIP_ALL_BITS) )
- RenderTriangleFanVB( ctx, 0, VB->Count );
- break;
-
- default:
- /* should never get here */
- _mesa_problem( ctx, "invalid mode in gl_render_vb" );
- }
-
- DPF(( DBG_PRIM_INFO, "ResetVB" ));
-
- /* We return TRUE to indicate we rendered the VB. */
- gl_reset_vb( ctx, allDone );
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as triangles. The */
-/* buffer has to be able to be rendered directly. This means that we are */
-/* filled, no offsets, no culling and one sided rendering. Also we must be */
-/* in render mode of course. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing;
-
- DPF(( DBG_FUNC, "RenderTriangleVB" ));
-
- if ( !VB->ClipOrMask )
- {
- DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) ));
- for( index = start, cVertex = 0; index < end; )
- {
- dwPVColor = (VB->Color[(index+2)][3]<<24) | (VB->Color[(index+2)][0]<<16) | (VB->Color[(index+2)][1]<<8) | VB->Color[(index+2)][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- index++;
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- index++;
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- index++;
- }
- }
- else
- {
-#define v1 index
-#define v2 (index+1)
-#define v3 (index+2)
-
- for( index = start, cVertex = 0; index < end; index += 3 )
- {
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS )
- {
- continue;
- }
- else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- RenderClippedPolygon( ctx, 3, VList );
- continue;
- }
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- /* Solve the prevoking vertex color as we need it for the 3rd triangle and flat shading. */
- dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- }
-#undef v1
-#undef v2
-#undef v3
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex > 2 )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as a triangle fan. */
-/* The buffer has to be able to be rendered directly. This means that we are*/
-/* filled, no offsets, no culling and one sided rendering. Also we must be */
-/* in render mode of course. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing;
- DWORD dwPVColor;
-
- DPF(( DBG_FUNC, "RenderTriangleFanVB();" ));
-
- /* Special case that we can blast the fan without culling, offset, etc... */
- if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) )
- {
- DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) ));
-
- /* Seed the the fan. */
- D3DTLVertices[0].sx = D3DVAL( VB->Win[start][0] );
- D3DTLVertices[0].sy = D3DVAL( (height - VB->Win[start][1]) );
- D3DTLVertices[0].sz = D3DVAL( VB->Win[start][2] );
- D3DTLVertices[0].tu = D3DVAL( VB->TexCoord[start][0] );
- D3DTLVertices[0].tv = D3DVAL( VB->TexCoord[start][1] );
- D3DTLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[start][3]) );
- D3DTLVertices[0].color= (VB->Color[start][3]<<24) | (VB->Color[start][0]<<16) | (VB->Color[start][1]<<8) | VB->Color[start][2];
-
- /* Seed the the fan. */
- D3DTLVertices[1].sx = D3DVAL( VB->Win[(start+1)][0] );
- D3DTLVertices[1].sy = D3DVAL( (height - VB->Win[(start+1)][1]) );
- D3DTLVertices[1].sz = D3DVAL( VB->Win[(start+1)][2] );
- D3DTLVertices[1].tu = D3DVAL( VB->TexCoord[(start+1)][0] );
- D3DTLVertices[1].tv = D3DVAL( VB->TexCoord[(start+1)][1] );
- D3DTLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[(start+1)][3]) );
- D3DTLVertices[1].color= (VB->Color[(start+1)][3]<<24) | (VB->Color[(start+1)][0]<<16) | (VB->Color[(start+1)][1]<<8) | VB->Color[(start+1)][2];
-
- for( index = (start+2), cVertex = 2; index < end; index++, cVertex++ )
- {
- /*=================================*/
- /* Add the next vertex to the fan. */
- /*=================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex].color = (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLEFAN, &D3DTLVertices[0], cVertex );
- }
- else
- {
-#define v1 start
-#define v2 (index-1)
-#define v3 index
-
- for( index = (start+2), cVertex = 0; index < end; index++ )
- {
- if ( VB->ClipOrMask )
- {
- /* All points clipped by common plane */
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS )
- {
- continue;
- }
- else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- RenderClippedPolygon( ctx, 3, VList );
- continue;
- }
- }
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-#undef v1
-#undef v2
-#undef v3
- }
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as a triangle strip. */
-/* The buffer has to be able to be rendered directly. This means that we are*/
-/* filled, no offsets, no culling and one sided rendering. Also we must be */
-/* in render mode of course. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex = 0,
- v1, v2, v3,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing;
- DWORD dwPVColor;
-
- DPF(( DBG_FUNC, "RenderTriangleStripVB();" ));
-
- /* Special case that we can blast the fan without culling, offset, etc... */
- if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) )
- {
- DPF(( DBG_PRIM_PROFILE, "DirectTriangles" ));
-
- /* Seed the the strip. */
- D3DTLVertices[0].sx = D3DVAL( VB->Win[start][0] );
- D3DTLVertices[0].sy = D3DVAL( (height - VB->Win[start][1]) );
- D3DTLVertices[0].sz = D3DVAL( VB->Win[start][2] );
- D3DTLVertices[0].tu = D3DVAL( VB->TexCoord[start][0] );
- D3DTLVertices[0].tv = D3DVAL( VB->TexCoord[start][1] );
- D3DTLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[start][3]) );
- D3DTLVertices[0].color= (VB->Color[start][3]<<24) | (VB->Color[start][0]<<16) | (VB->Color[start][1]<<8) | VB->Color[start][2];
-
- /* Seed the the strip. */
- D3DTLVertices[1].sx = D3DVAL( VB->Win[(start+1)][0] );
- D3DTLVertices[1].sy = D3DVAL( (height - VB->Win[(start+1)][1]) );
- D3DTLVertices[1].sz = D3DVAL( VB->Win[(start+1)][2] );
- D3DTLVertices[1].tu = D3DVAL( VB->TexCoord[(start+1)][0] );
- D3DTLVertices[1].tv = D3DVAL( VB->TexCoord[(start+1)][1] );
- D3DTLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[(start+1)][3]) );
- D3DTLVertices[1].color= (VB->Color[(start+1)][3]<<24) | (VB->Color[(start+1)][0]<<16) | (VB->Color[(start+1)][1]<<8) | VB->Color[(start+1)][2];
-
- for( index = (start+2), cVertex = 2; index < end; index++, cVertex++ )
- {
- /*===================================*/
- /* Add the next vertex to the strip. */
- /*===================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[index][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[index][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[index][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[index][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[index][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex].color = (VB->Color[index][3]<<24) | (VB->Color[index][0]<<16) | (VB->Color[index][1]<<8) | VB->Color[index][2];
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLESTRIP, &D3DTLVertices[0], cVertex );
- }
- else
- {
- for( index = (start+2); index < end; index++ )
- {
- /* We need to switch order so that winding won't be a problem. */
- if ( index & 1 )
- {
- v1 = index - 1;
- v2 = index - 2;
- v3 = index - 0;
- }
- else
- {
- v1 = index - 2;
- v2 = index - 1;
- v3 = index - 0;
- }
-
- /* All vertices clipped by common plane */
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & CLIP_ALL_BITS )
- continue;
-
- /* Check if any vertices need clipping. */
- if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- RenderClippedPolygon( ctx, 3, VList );
- }
- else
- {
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* Polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- /* Need right color if we have two sided lighting. */
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
-
- /* Solve the prevoking vertex color as we need it for the 3rd triangle and flat shading. */
- dwPVColor = (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= dwPVColor;
- }
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
- }
-}
-/*===========================================================================*/
-/* This function will render the current vertex buffer as Quads. The buffer*/
-/* has to be able to be rendered directly. This means that we are filled, no*/
-/* offsets, no culling and one sided rendering. Also we must be in render */
-/* mode of cource. */
-/* First I will fill the global D3D vertice buffer. Next I will set all the*/
-/* states for D3D based on the current OGL state. Finally I pass the D3D VB */
-/* to the wrapper that call DrawPrimitives. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int index,
- cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing; /* 0=front, 1=back */
-
- DPF(( DBG_FUNC, "RenderQuadVB();" ));
-
-#define v1 (index)
-#define v2 (index+1)
-#define v3 (index+2)
-#define v4 (index+3)
-
- if ( !VB->ClipOrMask )
- {
- DPF(( DBG_PRIM_PROFILE, "DirectTriangles" ));
-
- for( cVertex = 0, index = start; index < end; index += 4 )
- {
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v1][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v2][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v3][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v1][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v3][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v4][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v4][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( VB->Win[v4][2] );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v4][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v4][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
- }
- }
- else
- {
- for( cVertex = 0, index = start; index < end; index += 4 )
- {
- if ( VB->ClipMask[v1] & VB->ClipMask[v2] & VB->ClipMask[v3] & VB->ClipMask[v4] & CLIP_ALL_BITS )
- {
- continue;
- }
- else if ( VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3] | VB->ClipMask[v4] )
- {
- VList[0] = v1;
- VList[1] = v2;
- VList[2] = v3;
- VList[3] = v4;
- RenderClippedPolygon( ctx, 4, VList );
- continue;
- }
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- continue;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- continue;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v2][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v2][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v2][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v2][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v1][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v1][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v1][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v1][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v3][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v3][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v3][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v3][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- D3DTLVertices[cVertex].sx = D3DVAL( VB->Win[v4][0] );
- D3DTLVertices[cVertex].sy = D3DVAL( (height - VB->Win[v4][1]) );
- D3DTLVertices[cVertex].sz = D3DVAL( (VB->Win[v4][2] + ctx->PolygonZoffset) );
- D3DTLVertices[cVertex].tu = D3DVAL( VB->TexCoord[v4][0] );
- D3DTLVertices[cVertex].tv = D3DVAL( VB->TexCoord[v4][1] );
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) );
- D3DTLVertices[cVertex++].color= (ctx->Light.ShadeModel == GL_FLAT) ?
- dwPVColor :
- (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
- }
- }
-
-#undef v4
-#undef v3
-#undef v2
-#undef v1
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-}
-/*===========================================================================*/
-/* */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static void RenderQuad( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- GLfloat ex, ey,
- fx, fy, c;
- GLuint facing; /* 0=front, 1=back */
- static D3DTLVERTEX TLVertices[6];
-
- DPF(( DBG_FUNC, "RenderQuad" ));
- DPF(( DBG_PRIM_INFO, "RenderQuad( 1 )" ));
-
- /* Compute orientation of triangle */
- ex = VB->Win[v2][0] - VB->Win[v1][0];
- ey = VB->Win[v2][1] - VB->Win[v1][1];
- fx = VB->Win[v3][0] - VB->Win[v1][0];
- fy = VB->Win[v3][1] - VB->Win[v1][1];
- c = (ex * fy) - (ey * fx);
-
- /* polygon is perpindicular to view plane, don't draw it */
- if ( (c == 0.0F) && !ctx->Polygon.Unfilled )
- return;
-
- /* Backface culling. */
- facing = (c < 0.0F) ^ ctx->Polygon.FrontBit;
- if ( (facing + 1) & ctx->Polygon.CullBits )
- return;
-
- if ( ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE )
- {
- if ( facing == 1 )
- {
- /* use back color */
- VB->Color = VB->Bcolor;
- VB->Specular= VB->Bspec;
- }
- else
- {
- /* use front color */
- VB->Color = VB->Fcolor;
- VB->Specular= VB->Fspec;
- }
- }
-
- if ( ctx->IndirectTriangles & DD_TRI_OFFSET )
- {
- /* Finish computing plane equation of polygon, compute offset */
- GLfloat fz = VB->Win[v3][2] - VB->Win[v1][2];
- GLfloat ez = VB->Win[v2][2] - VB->Win[v1][2];
- GLfloat a = (ey * fz) - (ez * fy);
- GLfloat b = (ez * fx) - (ex * fz);
- OffsetPolygon( ctx, a, b, c );
- }
-
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2];
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- TLVertices[0].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- TLVertices[1].sx = D3DVAL( VB->Win[v2][0] );
- TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) );
- TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] );
- TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] );
- TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- TLVertices[2].sx = D3DVAL( VB->Win[v3][0] );
- TLVertices[2].sy = D3DVAL( (height - VB->Win[v3][1]) );
- TLVertices[2].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- TLVertices[2].tu = D3DVAL( VB->TexCoord[v3][0] );
- TLVertices[2].tv = D3DVAL( VB->TexCoord[v3][1] );
- TLVertices[2].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- TLVertices[2].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- TLVertices[3].sx = D3DVAL( VB->Win[v3][0] );
- TLVertices[3].sy = D3DVAL( (height - VB->Win[v3][1]) );
- TLVertices[3].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- TLVertices[3].tu = D3DVAL( VB->TexCoord[v3][0] );
- TLVertices[3].tv = D3DVAL( VB->TexCoord[v3][1] );
- TLVertices[3].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- TLVertices[3].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
-
- TLVertices[4].sx = D3DVAL( VB->Win[v4][0] );
- TLVertices[4].sy = D3DVAL( (height - VB->Win[v4][1]) );
- TLVertices[4].sz = D3DVAL( (VB->Win[v4][2] + ctx->PolygonZoffset) );
- TLVertices[4].tu = D3DVAL( VB->TexCoord[v4][0] );
- TLVertices[4].tv = D3DVAL( VB->TexCoord[v4][1] );
- TLVertices[4].rhw = D3DVAL( (1.0 / VB->Clip[v4][3]) );
- TLVertices[4].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v4][3]<<24) | (VB->Color[v4][0]<<16) | (VB->Color[v4][1]<<8) | VB->Color[v4][2];
-
- TLVertices[5].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[5].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[5].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- TLVertices[5].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[5].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[5].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[5].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- /* Draw the two triangles. */
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &TLVertices[0], 6 );
-}
-/*===========================================================================*/
-/* */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- static D3DTLVERTEX TLVertices[3];
-
- DPF(( DBG_FUNC, "RenderOneTriangle" ));
- DPF(( DBG_PRIM_INFO, "RenderTriangle( 1 )" ));
-
- /*=====================================*/
- /* Populate the the triangle vertices. */
- /*=====================================*/
- if ( ctx->Light.ShadeModel == GL_FLAT )
- dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2];
-
- TLVertices[0].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->PolygonZoffset) );
- TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
- DPF(( DBG_PRIM_INFO, "V1 -> x:%f y:%f z:%f c:%x",
- TLVertices[0].sx,
- TLVertices[0].sy,
- TLVertices[0].sz,
- TLVertices[0].color ));
-
- TLVertices[1].sx = D3DVAL( VB->Win[v2][0] );
- TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) );
- TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->PolygonZoffset) );
- TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] );
- TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] );
- TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
- DPF(( DBG_PRIM_INFO, "V2 -> x:%f y:%f z:%f c:%x",
- TLVertices[1].sx,
- TLVertices[1].sy,
- TLVertices[1].sz,
- TLVertices[1].color ));
-
- TLVertices[2].sx = D3DVAL( VB->Win[v3][0] );
- TLVertices[2].sy = D3DVAL( (height - VB->Win[v3][1]) );
- TLVertices[2].sz = D3DVAL( (VB->Win[v3][2] + ctx->PolygonZoffset) );
- TLVertices[2].tu = D3DVAL( VB->TexCoord[v3][0] );
- TLVertices[2].tv = D3DVAL( VB->TexCoord[v3][1] );
- TLVertices[2].rhw = D3DVAL( (1.0 / VB->Clip[v3][3]) );
- TLVertices[2].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v3][3]<<24) | (VB->Color[v3][0]<<16) | (VB->Color[v3][1]<<8) | VB->Color[v3][2];
- DPF(( DBG_PRIM_INFO, "V3 -> x:%f y:%f z:%f c:%x",
- TLVertices[2].sx,
- TLVertices[2].sy,
- TLVertices[2].sz,
- TLVertices[2].color ));
-
- /* Draw the triangle. */
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &TLVertices[0], 3 );
-}
-/*===========================================================================*/
-/* */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- int height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
- static D3DTLVERTEX TLVertices[2];
-
- DPF(( DBG_FUNC, "RenderOneLine" ));
- DPF(( DBG_PRIM_INFO, "RenderLine( 1 )" ));
-
- if ( VB->MonoColor )
- dwPVColor = (pContext->aCurrent<<24) | (pContext->rCurrent<<16) | (pContext->gCurrent<<8) | pContext->bCurrent;
- else
- dwPVColor = (VB->Color[pv][3]<<24) | (VB->Color[pv][0]<<16) | (VB->Color[pv][1]<<8) | VB->Color[pv][2];
-
- TLVertices[0].sx = D3DVAL( VB->Win[v1][0] );
- TLVertices[0].sy = D3DVAL( (height - VB->Win[v1][1]) );
- TLVertices[0].sz = D3DVAL( (VB->Win[v1][2] + ctx->LineZoffset) );
- TLVertices[0].tu = D3DVAL( VB->TexCoord[v1][0] );
- TLVertices[0].tv = D3DVAL( VB->TexCoord[v1][1] );
- TLVertices[0].rhw = D3DVAL( (1.0 / VB->Clip[v1][3]) );
- TLVertices[0].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v1][3]<<24) | (VB->Color[v1][0]<<16) | (VB->Color[v1][1]<<8) | VB->Color[v1][2];
-
- TLVertices[1].sx = D3DVAL( VB->Win[v2][0] );
- TLVertices[1].sy = D3DVAL( (height - VB->Win[v2][1]) );
- TLVertices[1].sz = D3DVAL( (VB->Win[v2][2] + ctx->LineZoffset) );
- TLVertices[1].tu = D3DVAL( VB->TexCoord[v2][0] );
- TLVertices[1].tv = D3DVAL( VB->TexCoord[v2][1] );
- TLVertices[1].rhw = D3DVAL( (1.0 / VB->Clip[v2][3]) );
- TLVertices[1].color = (ctx->Light.ShadeModel == GL_FLAT) ? dwPVColor :
- (VB->Color[v2][3]<<24) | (VB->Color[v2][0]<<16) | (VB->Color[v2][1]<<8) | VB->Color[v2][2];
-
- /* Draw line from (x0,y0) to (x1,y1) with current pixel color/index */
- DrawPrimitiveHAL( pContext->pShared, D3DPT_LINELIST, &TLVertices[0], 2 );
-}
-/*===========================================================================*/
-/* This function was written to convert points into triangles. I did this */
-/* as all card accelerate triangles and most drivers do this anyway. In hind*/
-/* thought this might be a bad idea as some cards do better. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void RenderPointsVB( GLcontext *ctx, GLuint start, GLuint end )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- struct vertex_buffer *VB = ctx->VB;
- struct pixel_buffer *PB = ctx->PB;
- GLuint index;
- GLfloat radius, z,
- xmin, ymin,
- xmax, ymax;
- GLint cVertex,
- height = (pContext->pShared->rectW.bottom - pContext->pShared->rectW.top);
- DWORD dwPVColor;
-
- DPF(( DBG_FUNC, "RenderPointsVB();" ));
-
- radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F;
-
- for( index = start, cVertex = 0; index <= end; index++ )
- {
- if ( VB->ClipMask[index] == 0 )
- {
- xmin = D3DVAL( VB->Win[index][0] - radius );
- xmax = D3DVAL( VB->Win[index][0] + radius );
- ymin = D3DVAL( height - VB->Win[index][1] - radius );
- ymax = D3DVAL( height - VB->Win[index][1] + radius );
- z = D3DVAL( (VB->Win[index][2] + ctx->PointZoffset) );
-
- dwPVColor = (VB->Color[index][3]<<24) |
- (VB->Color[index][0]<<16) |
- (VB->Color[index][1]<<8) |
- VB->Color[index][2];
-
- D3DTLVertices[cVertex].sx = xmin;
- D3DTLVertices[cVertex].sy = ymax;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmin;
- D3DTLVertices[cVertex].sy = ymin;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmax;
- D3DTLVertices[cVertex].sy = ymin;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmax;
- D3DTLVertices[cVertex].sy = ymin;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmax;
- D3DTLVertices[cVertex].sy = ymax;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
-
- D3DTLVertices[cVertex].sx = xmin;
- D3DTLVertices[cVertex].sy = ymax;
- D3DTLVertices[cVertex].sz = z;
- D3DTLVertices[cVertex].tu = 0.0;
- D3DTLVertices[cVertex].tv = 0.0;
- D3DTLVertices[cVertex].rhw = D3DVAL( (1.0 / VB->Clip[index][3]) );
- D3DTLVertices[cVertex++].color = dwPVColor;
- }
- }
-
- /* Render the converted vertex buffer. */
- if ( cVertex )
- DrawPrimitiveHAL( pContext->pShared, D3DPT_TRIANGLELIST, &D3DTLVertices[0], cVertex );
-}
-/*===========================================================================*/
-/* This gets call before we render any primitives so that the current OGL */
-/* states will be mapped the D3D context. I'm still not sure how D3D works */
-/* but I'm finding that it doesn't act like a state machine as OGL is. It */
-/* looks like the state gets set back to the defaults after a DrawPrimitives */
-/* or an EndScene. Also I set states that are the default even though this */
-/* is redundant as the defaults seem screwed up. */
-/* TODO: make a batch call. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetRenderStates( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DWORD dwFunc;
- static BOOL bTexture = FALSE;
- static int texName = -1;
-
- DPF(( DBG_FUNC, "SetRenderStates();" ));
-
- if ( g_DBGMask & DBG_STATES )
- DebugRenderStates( ctx, FALSE );
-
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_DITHERENABLE, (ctx->Color.DitherFlag) ? TRUE : FALSE );
-
- /*================================================*/
- /* Check too see if there are new TEXTURE states. */
- /*================================================*/
- if ( ctx->Texture._EnabledUnits )
- {
- switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode )
- {
- case GL_MODULATE:
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA )
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulatealpha];
- else
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_modulate];
- break;
-
- case GL_BLEND:
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha];
- break;
-
- case GL_REPLACE:
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal];
- break;
-
- case GL_DECAL:
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA )
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decalalpha];
- else
- dwFunc = pContext->pShared->dwTexFunc[d3dtblend_decal];
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMAPBLEND, dwFunc );
-
- switch( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter )
- {
- case GL_NEAREST:
- dwFunc = D3DFILTER_NEAREST;
- break;
- case GL_LINEAR:
- dwFunc = D3DFILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_MIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_LINEARMIPNEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_MIPLINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_LINEARMIPLINEAR;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMAG, dwFunc );
-
- switch( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter )
- {
- case GL_NEAREST:
- dwFunc = D3DFILTER_NEAREST;
- break;
- case GL_LINEAR:
- dwFunc = D3DFILTER_LINEAR;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_MIPNEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- dwFunc = D3DFILTER_LINEARMIPNEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_MIPLINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- dwFunc = D3DFILTER_LINEARMIPLINEAR;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_TEXTUREMIN, dwFunc );
-
- /* Another hack to cut down on redundant texture binding. */
- // if ( texName != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name )
- // {
- texName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name;
- CreateTMgrHAL( pContext->pShared,
- texName,
- 0,
- ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format,
- (RECT *)NULL,
- ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Width,
- ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Height,
- TM_ACTION_BIND,
- (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Data );
- // }
- bTexture = TRUE;
- }
- else
- {
- /* This is nasty but should cut down on the number of redundant calls. */
- if ( bTexture == TRUE )
- {
- DisableTMgrHAL( pContext->pShared );
- bTexture = FALSE;
- }
- }
-
- /*===============================================*/
- /* Check too see if there are new RASTER states. */
- /*===============================================*/
-
- // TODO: no concept of front & back.
- switch( ctx->Polygon.FrontMode )
- {
- case GL_POINT:
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_POINT );
- break;
- case GL_LINE:
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_WIREFRAME );
- break;
- case GL_FILL:
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
- break;
- }
-
- /*************/
- /* Z-Buffer. */
- /*************/
- if ( ctx->Depth.Test == GL_TRUE )
- {
- switch( ctx->Depth.Func )
- {
- case GL_NEVER:
- dwFunc = D3DCMP_NEVER;
- break;
- case GL_LESS:
- dwFunc = D3DCMP_LESS;
- break;
- case GL_GEQUAL:
- dwFunc = D3DCMP_GREATEREQUAL;
- break;
- case GL_LEQUAL:
- dwFunc = D3DCMP_LESSEQUAL;
- break;
- case GL_GREATER:
- dwFunc = D3DCMP_GREATER;
- break;
- case GL_NOTEQUAL:
- dwFunc = D3DCMP_NOTEQUAL;
- break;
- case GL_EQUAL:
- dwFunc = D3DCMP_EQUAL;
- break;
- case GL_ALWAYS:
- dwFunc = D3DCMP_ALWAYS;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZFUNC, dwFunc );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZENABLE, TRUE );
- }
- else
- {
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZENABLE, FALSE );
- }
-
- /*******************/
- /* Z-Write Enable. */
- /*******************/
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ZWRITEENABLE , (ctx->Depth.Mask == GL_TRUE) ? TRUE : FALSE );
-
- /***************/
- /* Alpha test. */
- /***************/
- if ( ctx->Color.AlphaEnabled == GL_TRUE )
- {
- switch( ctx->Color.AlphaFunc )
- {
- case GL_NEVER:
- dwFunc = D3DCMP_NEVER;
- break;
- case GL_LESS:
- dwFunc = D3DCMP_LESS;
- break;
- case GL_GEQUAL:
- dwFunc = D3DCMP_GREATEREQUAL;
- break;
- case GL_LEQUAL:
- dwFunc = D3DCMP_LESSEQUAL;
- break;
- case GL_GREATER:
- dwFunc = D3DCMP_GREATER;
- break;
- case GL_NOTEQUAL:
- dwFunc = D3DCMP_NOTEQUAL;
- break;
- case GL_EQUAL:
- dwFunc = D3DCMP_EQUAL;
- break;
- case GL_ALWAYS:
- dwFunc = D3DCMP_ALWAYS;
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHAFUNC , dwFunc );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
- }
- else
- {
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
- }
-
- /****************/
- /* Alpha blend. */
- /****************/
- if ( ctx->Color.BlendEnabled == GL_TRUE )
- {
- switch( ctx->Color.BlendSrc )
- {
- case GL_ZERO:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_zero];
- break;
- case GL_ONE:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one];
- break;
- case GL_DST_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_dst_color];
- break;
- case GL_ONE_MINUS_DST_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_dst_color];
- break;
- case GL_SRC_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_src_alpha];
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_src_alpha];
- break;
- case GL_DST_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_dst_alpha];
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_dst_alpha];
- break;
- case GL_SRC_ALPHA_SATURATE:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_src_alpha_saturate];
- break;
- case GL_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_constant_color];
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_constant_color];
- break;
- case GL_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_constant_alpha];
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwSrcBlendCaps[s_one_minus_constant_alpha];
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_SRCBLEND, dwFunc );
-
- switch( ctx->Color.BlendDst )
- {
- case GL_ZERO:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_zero];
- break;
- case GL_ONE:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one];
- break;
- case GL_SRC_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_src_color];
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_src_color];
- break;
- case GL_SRC_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_src_alpha];
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_src_alpha];
- break;
- case GL_DST_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_dst_alpha];
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_dst_alpha];
- break;
- case GL_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_constant_color];
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_constant_color];
- break;
- case GL_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_constant_alpha];
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- dwFunc = pContext->pShared->dwDestBlendCaps[d_one_minus_constant_alpha];
- break;
- }
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_DESTBLEND, dwFunc );
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE );
- }
- else
- {
- SetStateHAL( pContext->pShared, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
- }
-}
-/*===========================================================================*/
-/* If this function is called it will track the changes to the current */
-/* states that I'm setting in Direct3D. I did this so that the DPF's would */
-/* be under control! */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void DebugRenderStates( GLcontext *ctx, BOOL bForce )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DWORD dwFunc;
- static int dither = -1,
- texture = -1,
- textName = -1,
- textEnv = -1,
- textMin = -1,
- textMag = -1,
- polyMode = -1,
- depthTest = -1,
- depthFunc = -1,
- depthMask = -1,
- alphaTest = -1,
- alphaFunc = -1,
- blend = -1,
- blendSrc = -1,
- blendDest = -1;
-
- /* Force a displayed update of all current states. */
- if ( bForce )
- {
- dither = texture = textName = textEnv = textMin = textMag = -1;
- polyMode = depthTest = depthFunc = depthMask = -1;
- alphaTest = alphaFunc = blend = blendSrc = blendDest = -1;
- }
-
- if ( dither != ctx->Color.DitherFlag )
- {
- dither = ctx->Color.DitherFlag;
- DPF(( 0, "\tDither\t\t%s", (dither) ? "ENABLED" : "--------" ));
- }
- if ( depthTest != ctx->Depth.Test )
- {
- depthTest = ctx->Depth.Test;
- DPF(( 0, "\tDepth Test\t%s", (depthTest) ? "ENABLED" : "--------" ));
- }
- if ( alphaTest != ctx->Color.AlphaEnabled )
- {
- alphaTest = ctx->Color.AlphaEnabled;
-
- DPF(( 0, "\tAlpha Test\t%s", (alphaTest) ? "ENABLED" : "--------" ));
- }
- if ( blend != ctx->Color.BlendEnabled )
- {
- blend = ctx->Color.BlendEnabled;
-
- DPF(( 0, "\tBlending\t%s", (blend) ? "ENABLED" : "--------" ));
- }
-
- /*================================================*/
- /* Check too see if there are new TEXTURE states. */
- /*================================================*/
- if ( texture != ctx->Texture._EnabledUnits )
- {
- texture = ctx->Texture._EnabledUnits;
- DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" ));
- }
-
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current )
- {
- if ( ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name != textName )
- {
- textName = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name;
- DPF(( 0, "\tTexture Name:\t%d", textName ));
- DPF(( 0, "\tTexture Format:\t%s",
- (ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0][0]->Format == GL_RGBA) ?
- "GL_RGBA" : "GLRGB" ));
- }
-
- if ( textEnv != ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode )
- {
- textEnv = ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode;
-
- switch( textEnv )
- {
- case GL_MODULATE:
- DPF(( 0, "\tTexture\tMode\tGL_MODULATE" ));
- break;
- case GL_BLEND:
- DPF(( 0, "\tTexture\tMode\tGL_BLEND" ));
- break;
- case GL_REPLACE:
- DPF(( 0, "\tTexture\tMode\tGL_REPLACE" ));
- break;
- case GL_DECAL:
- DPF(( 0, "\tTexture\tMode\tGL_DECAL" ));
- break;
- }
- }
-
- if ( textMag != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter )
- {
- textMag = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MagFilter;
-
- switch( textMag )
- {
- case GL_NEAREST:
- DPF(( 0, "\tTexture MAG\tGL_NEAREST" ));
- break;
- case GL_LINEAR:
- DPF(( 0, "\tTexture MAG\tGL_LINEAR" ));
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MAG\tGL_NEAREST_MIPMAP_NEAREST" ));
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MAG\tGL_LINEAR_MIPMAP_NEAREST" ));
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MAG\tGL_NEAREST_MIPMAP_LINEAR" ));
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MAG\tGL_LINEAR_MIPMAP_LINEAR" ));
- break;
- }
- }
-
- if ( textMin != ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter )
- {
- textMin = ctx->Texture.Set[ctx->Texture.CurrentSet].Current->MinFilter;
-
- switch( textMin )
- {
- case GL_NEAREST:
- DPF(( 0, "\tTexture MIN\tGL_NEAREST" ));
- break;
- case GL_LINEAR:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR" ));
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MIN\tGL_NEAREST_MIPMAP_NEAREST" ));
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_NEAREST" ));
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_LINEAR" ));
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- DPF(( 0, "\tTexture MIN\tGL_LINEAR_MIPMAP_LINEAR" ));
- break;
- }
- }
- }
-
- if ( ctx->Polygon.FrontMode != polyMode )
- {
- polyMode = ctx->Polygon.FrontMode;
-
- switch( polyMode )
- {
- case GL_POINT:
- DPF(( 0, "\tMode\t\tGL_POINT" ));
- break;
- case GL_LINE:
- DPF(( 0, "\tMode\t\tGL_LINE" ));
- break;
- case GL_FILL:
- DPF(( 0, "\tMode\t\tGL_FILL" ));
- break;
- }
- }
-
- if ( depthFunc != ctx->Depth.Func )
- {
- depthFunc = ctx->Depth.Func;
-
- switch( depthFunc )
- {
- case GL_NEVER:
- DPF(( 0, "\tDepth Func\tGL_NEVER" ));
- break;
- case GL_LESS:
- DPF(( 0, "\tDepth Func\tGL_LESS" ));
- break;
- case GL_GEQUAL:
- DPF(( 0, "\tDepth Func\tGL_GEQUAL" ));
- break;
- case GL_LEQUAL:
- DPF(( 0, "\tDepth Func\tGL_LEQUAL" ));
- break;
- case GL_GREATER:
- DPF(( 0, "\tDepth Func\tGL_GREATER" ));
- break;
- case GL_NOTEQUAL:
- DPF(( 0, "\tDepth Func\tGL_NOTEQUAL" ));
- break;
- case GL_EQUAL:
- DPF(( 0, "\tDepth Func\tGL_EQUAL" ));
- break;
- case GL_ALWAYS:
- DPF(( 0, "\tDepth Func\tGL_ALWAYS" ));
- break;
- }
- }
-
- if ( depthMask != ctx->Depth.Mask )
- {
- depthMask = ctx->Depth.Mask;
- DPF(( 0, "\tZWrite\t\t%s", (depthMask) ? "ENABLED" : "--------" ));
- }
-
- if ( alphaFunc != ctx->Color.AlphaFunc )
- {
- alphaFunc = ctx->Color.AlphaFunc;
-
- switch( alphaFunc )
- {
- case GL_NEVER:
- DPF(( 0, "\tAlpha Func\tGL_NEVER" ));
- break;
- case GL_LESS:
- DPF(( 0, "\tAlpha Func\tGL_LESS" ));
- break;
- case GL_GEQUAL:
- DPF(( 0, "\tAlpha Func\tGL_GEQUAL" ));
- break;
- case GL_LEQUAL:
- DPF(( 0, "\tAlpha Func\tGL_LEQUAL" ));
- break;
- case GL_GREATER:
- DPF(( 0, "\tAlpha Func\tGL_GREATER" ));
- break;
- case GL_NOTEQUAL:
- DPF(( 0, "\tAlpha Func\tGL_NOTEQUAL" ));
- break;
- case GL_EQUAL:
- DPF(( 0, "\tAlpha Func\tGL_EQUAL" ));
- break;
- case GL_ALWAYS:
- DPF(( 0, "\tAlpha Func\tGL_ALWAYS" ));
- break;
- }
- }
-
- if ( blendSrc != ctx->Color.BlendSrc )
- {
- blendSrc = ctx->Color.BlendSrc;
-
- switch( blendSrc )
- {
- case GL_ZERO:
- DPF(( 0, "\tSRC Blend\tGL_ZERO" ));
- break;
- case GL_ONE:
- DPF(( 0, "\tSRC Blend\tGL_ONE" ));
- break;
- case GL_DST_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_DST_COLOR" ));
- break;
- case GL_ONE_MINUS_DST_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_DST_COLOR" ));
- break;
- case GL_SRC_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_SRC_ALPHA" ));
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_MINUS_SRC_ALPHA" ));
- break;
- case GL_DST_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_DST_ALPHA" ));
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_DST_ALPHA" ));
- break;
- case GL_SRC_ALPHA_SATURATE:
- DPF(( 0, "\tSRC Blend\tGL_SRC_ALPHA_SATURATE" ));
- break;
- case GL_CONSTANT_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_CONSTANT_COLOR" ));
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_CONSTANT_COLOR" ));
- break;
- case GL_CONSTANT_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_CONSTANT_ALPHA" ));
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- DPF(( 0, "\tSRC Blend\tGL_ONE_MINUS_CONSTANT_ALPHA" ));
- break;
- }
- }
-
- if ( blendDest != ctx->Color.BlendDst )
- {
- blendDest = ctx->Color.BlendDst;
-
- switch( blendDest )
- {
- case GL_ZERO:
- DPF(( 0, "\tDST Blend\tGL_ZERO" ));
- break;
- case GL_ONE:
- DPF(( 0, "\tDST Blend\tGL_ONE" ));
- break;
- case GL_SRC_COLOR:
- DPF(( 0, "\tDST Blend\tGL_SRC_COLOR" ));
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_SRC_COLOR" ));
- break;
- case GL_SRC_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_SRC_ALPHA" ));
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_SRC_ALPHA" ));
- break;
- case GL_DST_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_DST_ALPHA" ));
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_DST_ALPHA" ));
- break;
- case GL_CONSTANT_COLOR:
- DPF(( 0, "\tDST Blend\tGL_CONSTANT_COLOR" ));
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_CONSTANT_COLOR" ));
- break;
- case GL_CONSTANT_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_CONSTANT_ALPHA" ));
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- DPF(( 0, "\tDST Blend\tGL_ONE_MINUS_CONSTANT_ALPHA" ));
- break;
- }
- }
-}
diff --git a/src/mesa/drivers/d3d/DDrawPROCS.c b/src/mesa/drivers/d3d/DDrawPROCS.c
deleted file mode 100644
index a02a89debbb..00000000000
--- a/src/mesa/drivers/d3d/DDrawPROCS.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DMesa.h"
-/*===========================================================================*/
-/* This call will clear the render surface using the pixel info built from */
-/* the surface at creation time. The call uses Lock/Unlock to access the */
-/* surface. The call also special cases a full clear or a dirty rectangle. */
-/* Finally the call returns the new clear mask that reflects that the color */
-/* buffer was cleared. */
-/*===========================================================================*/
-/* RETURN: the original mask with the bits cleared that represents the buffer*/
-/* or buffers we just cleared. */
-/*===========================================================================*/
-GLbitfield ClearBuffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer,
- *pScanLine;
- int index,
- index2;
- DWORD dwColor;
-
- if ( mask & GL_COLOR_BUFFER_BIT )
- {
- /* Lock the surface to get the surface pointer. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Solve the color once only. */
- dwColor = ( ((DWORD)((float)pContext->rClear * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)pContext->gClear * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)pContext->bClear * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- if ( all )
- {
- for( index = 0, pScanLine = (UCHAR *)pddsd2->lpSurface; index < pContext->pShared->dwHeight; index++, pScanLine += pddsd2->lPitch )
- for( pBuffer = pScanLine, index2 = 0; index2 < pContext->pShared->dwWidth; index2++, pBuffer += pContext->pShared->pixel.cb )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- else
- {
- pScanLine = ((UCHAR *)pddsd2->lpSurface) +
- ( (FLIP( pContext->pShared->dwHeight, (y+height)) * pddsd2->lPitch) + (x * pContext->pShared->pixel.cb) );
-
- for( index = 0; index < height; index++, pScanLine += pddsd2->lPitch )
- {
- for( index2 = 0, pBuffer = pScanLine; index2 < width; index2++, pBuffer += pContext->pShared->pixel.cb )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- UnlockHAL( pContext->pShared, TRUE );
- }
-
- return (mask & ~GL_COLOR_BUFFER_BIT);
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WSpanRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb);
-
- if ( mask )
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- if ( mask[index] )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgb[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgb[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgb[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgb[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgb[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgb[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb);
-
- if ( mask )
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- if ( mask[index] )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The color is solved once from the current */
-/* color components. The alpha is ignored as Mesa is doing it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WSpanRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Lock the surface to get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Solve the color once only. (no alpha) */
- dwColor = ( ((DWORD)((float)pContext->rCurrent * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)pContext->gCurrent * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)pContext->bCurrent * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) + (x*pContext->pShared->pixel.cb);
-
- if ( mask )
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- if ( mask[index] )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- else
- {
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The alpha is ignored as Mesa does it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- if ( mask )
- {
- for( index = 0; index < n; index++ )
- {
- if ( mask[index] )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- for( index = 0; index < n; index++ )
- {
- /* Pack the color components. */
- dwColor = ( ((DWORD)((float)rgba[index][RCOMP] * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)rgba[index][GCOMP] * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)rgba[index][BCOMP] * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc (as all others) has been written for the general case. I use */
-/* the PIXELINFO structure to pack the pixel from RGB24 to whatever the Off- */
-/* Screen render surface uses. The color is solved once from the current */
-/* color components. The alpha is ignored as Mesa is doing it in SW. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void WPixelsRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD dwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Solve the color once only. I don't uses the alpha. */
- dwColor = ( ((DWORD)((float)pContext->rCurrent * pContext->pShared->pixel.rScale)) << pContext->pShared->pixel.rShift );
- dwColor |= ( ((DWORD)((float)pContext->gCurrent * pContext->pShared->pixel.gScale)) << pContext->pShared->pixel.gShift );
- dwColor |= ( ((DWORD)((float)pContext->bCurrent * pContext->pShared->pixel.bScale)) << pContext->pShared->pixel.bShift );
-
- if ( mask )
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- if ( mask[index] )
- {
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
- }
- else
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- /* Find the pixel. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb);
- memcpy( pBuffer, &dwColor, pContext->pShared->pixel.cb );
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc isn't written for speed rather its to handle the general case. */
-/* I grab each pixel from the surface and unpack the info using the PIXELINFO*/
-/* structure that was generated from the OffScreen surface pixelformat. The */
-/* function will not fill in the alpha value as Mesa I have Mesa allocate its*/
-/* own alpha channel when the context was created. I did this as I didn't */
-/* feel that it was worth the effort to try and get HW to work (bus bound). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void RSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- UCHAR *pBuffer;
- int index;
- DWORD *pdwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- /* Find the start of the span. Invert y for Windows. */
- pBuffer = (UCHAR *)pddsd2->lpSurface +
- (FLIP(pContext->pShared->dwHeight,y) * pddsd2->lPitch) +
- (x*pContext->pShared->pixel.cb);
-
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++, pBuffer += pContext->pShared->pixel.cb )
- {
- pdwColor = (DWORD *)pBuffer;
- rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale);
- rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale);
- rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale);
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
-/*===========================================================================*/
-/* This proc isn't written for speed rather its to handle the general case. */
-/* I grab each pixel from the surface and unpack the info using the PIXELINFO*/
-/* structure that was generated from the OffScreen surface pixelformat. The */
-/* function will not fill in the alpha value as Mesa I have Mesa allocate its*/
-/* own alpha channel when the context was created. I did this as I didn't */
-/* feel that it was worth the effort to try and get HW to work (bus bound). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void RPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DDSURFACEDESC2 *pddsd2;
- int index;
- DWORD *pdwColor;
-
- /* Get the surface pointer and the pitch. */
- pddsd2 = LockHAL( pContext->pShared, TRUE );
-
- if ( mask )
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- if ( mask[index] )
- {
- /* Find the start of the pixel. Invert y for Windows. */
- pdwColor = (DWORD *)((UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb));
- rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale);
- rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale);
- rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale);
- }
- }
- }
- else
- {
- /* We store the surface pointer as a UCHAR so that pixel.cb (count in btyles) will work for all. */
- for( index = 0; index < n; index++ )
- {
- /* Find the start of the pixel. Invert y for Windows. */
- pdwColor = (DWORD *)((UCHAR *)pddsd2->lpSurface + (FLIP(pContext->pShared->dwHeight,y[index]) * pddsd2->lPitch) + (x[index]*pContext->pShared->pixel.cb));
- rgba[index][RCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwRMask) >> pContext->pShared->pixel.rShift) / pContext->pShared->pixel.rScale);
- rgba[index][GCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwGMask) >> pContext->pShared->pixel.gShift) / pContext->pShared->pixel.gScale);
- rgba[index][BCOMP] = (GLubyte)((float)((*pdwColor & pContext->pShared->pixel.dwBMask) >> pContext->pShared->pixel.bShift) / pContext->pShared->pixel.bScale);
- }
- }
-
- /* Giver back. */
- UnlockHAL( pContext->pShared, TRUE );
-}
diff --git a/src/mesa/drivers/d3d/DEBUG.C b/src/mesa/drivers/d3d/DEBUG.C
deleted file mode 100644
index dfa524bf314..00000000000
--- a/src/mesa/drivers/d3d/DEBUG.C
+++ /dev/null
@@ -1,143 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "Debug.h"
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-DWORD g_DBGMask = DBG_ALL_ERROR;
-/*===========================================================================*/
-/* This is your basic DPF function with printf like support. The function */
-/* also works with a global debug mask variable. I have written support that*/
-/* allows for the user's enviroment variable space to be read and set the */
-/* masks. This is done when the dll starts and is only in the debug version.*/
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void _cdecl DebugPrint( int mask, char *pszFormat, ... )
-{
- char buffer[512];
- va_list args;
-
- /* A mask of 0 will always pass. Easy to remeber. */
- if ( (mask == 0) || (mask & g_DBGMask) )
- {
- va_start( args, pszFormat );
-
- if ( mask & DBG_ALL_ERROR )
- OutputDebugString( "MesaD3D: (ERROR)" );
- else
- OutputDebugString( "MesaD3D: " );
-
- vsprintf( buffer, pszFormat, args );
- strcat( buffer, "\n" );
- OutputDebugString( buffer );
-
- va_end( args );
- }
-}
-/*===========================================================================*/
-/* This call reads the users enviroment variables and sets any debug mask */
-/* that they have set to TRUE. Now the value must be "TRUE". */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void ReadDBGEnv( void )
-{
- g_DBGMask = DBG_ALL_ERROR;
-
-#define IS_VAR_SET(v) if ( getenv( # v ) && !strcmp(getenv( # v ),"TRUE") ) g_DBGMask |= v;
-
- IS_VAR_SET( DBG_FUNC );
- IS_VAR_SET( DBG_STATES );
-
- IS_VAR_SET( DBG_CNTX_INFO );
- IS_VAR_SET( DBG_CNTX_WARN );
- IS_VAR_SET( DBG_CNTX_PROFILE );
- IS_VAR_SET( DBG_CNTX_ERROR );
- IS_VAR_SET( DBG_CNTX_ALL );
-
- IS_VAR_SET( DBG_PRIM_INFO );
- IS_VAR_SET( DBG_PRIM_WARN );
- IS_VAR_SET( DBG_PRIM_PROFILE );
- IS_VAR_SET( DBG_PRIM_ERROR );
- IS_VAR_SET( DBG_PRIM_ALL );
-
- IS_VAR_SET( DBG_TXT_INFO );
- IS_VAR_SET( DBG_TXT_WARN );
- IS_VAR_SET( DBG_TXT_PROFILE );
- IS_VAR_SET( DBG_TXT_ERROR );
- IS_VAR_SET( DBG_TXT_ALL );
-
- IS_VAR_SET( DBG_ALL_INFO );
- IS_VAR_SET( DBG_ALL_WARN );
- IS_VAR_SET( DBG_ALL_PROFILE );
- IS_VAR_SET( DBG_ALL_ERROR );
- IS_VAR_SET( DBG_ALL );
-
-#undef IS_VAR_SET
-}
-/*===========================================================================*/
-/* This function will take a pointer to a DDSURFACEDESC2 structure & display*/
-/* the parsed information using a DPF call. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-void DebugPixelFormat( char *pszSurfaceName, DDPIXELFORMAT *pddpf )
-{
- char buffer[256];
-
- /* Parse the flag type and write the string equivalent. */
- if ( pddpf->dwFlags & DDPF_ALPHA )
- strcat( buffer, "DDPF_ALPHA " );
- if ( pddpf->dwFlags & DDPF_ALPHAPIXELS )
- strcat( buffer, "DDPF_ALPHAPIXELS " );
- if ( pddpf->dwFlags & DDPF_ALPHAPREMULT )
- strcat( buffer, "DDPF_ALPHAPREMULT " );
- if ( pddpf->dwFlags & DDPF_BUMPLUMINANCE )
- strcat( buffer, "DDPF_BUMPLUMINANCE " );
- if ( pddpf->dwFlags & DDPF_BUMPDUDV )
- strcat( buffer, "DDPF_BUMPDUDV " );
- if ( pddpf->dwFlags & DDPF_COMPRESSED )
- strcat( buffer, "DDPF_COMPRESSED " );
- if ( pddpf->dwFlags & DDPF_FOURCC )
- strcat( buffer, "DDPF_FOURCC " );
- if ( pddpf->dwFlags & DDPF_LUMINANCE )
- strcat( buffer, "DDPF_LUMINANCE " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED1 )
- strcat( buffer, "DDPF_PALETTEINDEXED1 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED2 )
- strcat( buffer, "DDPF_PALETTEINDEXED2 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED4 )
- strcat( buffer, "DDPF_PALETTEINDEXED4 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXED8 )
- strcat( buffer, "DDPF_PALETTEINDEXED8 " );
- if ( pddpf->dwFlags & DDPF_PALETTEINDEXEDTO8 )
- strcat( buffer, "DDPF_PALETTEINDEXEDTO8 " );
- if ( pddpf->dwFlags & DDPF_RGB )
- strcat( buffer, "DDPF_RGB " );
- if ( pddpf->dwFlags & DDPF_RGBTOYUV )
- strcat( buffer, "DDPF_RGBTOYUV " );
- if ( pddpf->dwFlags & DDPF_STENCILBUFFER )
- strcat( buffer, "DDPF_STENCILBUFFER " );
- if ( pddpf->dwFlags & DDPF_YUV )
- strcat( buffer, "DDPF_YUV " );
- if ( pddpf->dwFlags & DDPF_ZBUFFER )
- strcat( buffer, "DDPF_ZBUFFER " );
- if ( pddpf->dwFlags & DDPF_ZPIXELS )
- strcat( buffer, "DDPF_ZPIXELS " );
-
- DPF(( (DBG_TXT_INFO|DBG_CNTX_INFO),"%s", buffer ));
-}
-
-
-
-
-
diff --git a/src/mesa/drivers/d3d/DEBUG.H b/src/mesa/drivers/d3d/DEBUG.H
deleted file mode 100644
index 76122b91210..00000000000
--- a/src/mesa/drivers/d3d/DEBUG.H
+++ /dev/null
@@ -1,90 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef _DEBUG_H
-#define _DEBUG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <stdio.h>
-#include <string.h>
-#include <ddraw.h>
-#include <d3d.h>
-#include "D3DShared.h"
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Macros defines. */
-/*===========================================================================*/
-#define DBG_FUNC 0x00000001
-#define DBG_STATES 0x00000002
-
-#define DBG_CNTX_INFO 0x00000010
-#define DBG_CNTX_WARN 0x00000020
-#define DBG_CNTX_PROFILE 0x00000040
-#define DBG_CNTX_ERROR 0x00000080
-#define DBG_CNTX_ALL 0x000000F0
-
-#define DBG_PRIM_INFO 0x00000100
-#define DBG_PRIM_WARN 0x00000200
-#define DBG_PRIM_PROFILE 0x00000400
-#define DBG_PRIM_ERROR 0x00000800
-#define DBG_PRIM_ALL 0x00000F00
-
-#define DBG_TXT_INFO 0x00001000
-#define DBG_TXT_WARN 0x00002000
-#define DBG_TXT_PROFILE 0x00004000
-#define DBG_TXT_ERROR 0x00008000
-#define DBG_TXT_ALL 0x0000F000
-
-#define DBG_ALL_INFO 0x11111110
-#define DBG_ALL_WARN 0x22222220
-#define DBG_ALL_PROFILE 0x44444440
-#define DBG_ALL_ERROR 0x88888880
-#define DBG_ALL 0xFFFFFFFF
-
-#ifdef D3D_DEBUG
-# define DPF(arg) DebugPrint arg
-# define RIP(pH,msg,err) OutputDebugString(msg); \
- OutputDebugString(err); \
- OutputDebugString("\n"); \
- FatalShutDown(pH)
-#else
-# define DPF(arg)
-# define RIP(pH,msg,err) FatalShutDown(pH)
-#endif
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Function prototypes. */
-/*===========================================================================*/
-extern void ReadDBGEnv( void );
-extern void _cdecl DebugPrint( int mask, char *pszFormat, ... );
-extern void DebugPixelFormat( char *pszSurfaceName, DDPIXELFORMAT *pddpf );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-extern DWORD g_DBGMask;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/src/mesa/drivers/d3d/DbgEnv.bat b/src/mesa/drivers/d3d/DbgEnv.bat
deleted file mode 100644
index 40858e66844..00000000000
--- a/src/mesa/drivers/d3d/DbgEnv.bat
+++ /dev/null
@@ -1,25 +0,0 @@
-SET DBG_FUNC=FALSE
-
-SET DBG_CNTX_INFO=TRUE
-SET DBG_CNTX_WARN=TRUE
-SET DBG_CNTX_PROFILE=FALSE
-SET DBG_CNTX_ERROR=TRUE
-SET DBG_CNTX_ALL=TRUE
-
-SET DBG_PRIM_INFO=FALSE
-SET DBG_PRIM_WARN=FALSE
-SET DBG_PRIM_PROFILE=FALSE
-SET DBG_PRIM_ERROR=TRUE
-SET DBG_PRIM_ALL=FALSE
-
-SET DBG_TXT_INFO=FALSE
-SET DBG_TXT_WARN=TRUE
-SET DBG_TXT_PROFILE=FALSE
-SET DBG_TXT_ERROR=TRUE
-SET DBG_TXT_ALL=FALSE
-
-SET DBG_ALL_INFO=FALSE
-SET DBG_ALL_WARN=TRUE
-SET DBG_ALL_PROFILE=FALSE
-SET DBG_ALL_ERROR=TRUE
-SET DBG_ALL=FALSE
diff --git a/src/mesa/drivers/d3d/MAKEFILE b/src/mesa/drivers/d3d/MAKEFILE
deleted file mode 100644
index ad1d40dc27b..00000000000
--- a/src/mesa/drivers/d3d/MAKEFILE
+++ /dev/null
@@ -1,101 +0,0 @@
-##############################################################################
-#
-# Mesa-3.0 Makefile for DirectX 6 Driver
-#
-# By Leigh McRae
-#
-# http://www.altsoftware.com/
-#
-# Copyright (c) 1999-1998 alt.software inc. All Rights Reserved
-##############################################################################
-NAME=
-TARGET= WGL Driver (D3DHAL)
-
-D3D_DIR=$(MAKEDIR)\D3D
-TARGET_DIR=e:\WinNT\System32
-TEMP_DIR=c:\Temp
-
-SPACE=-
-LINKER=link.exe
-
-INCLUDE=$(SDKROOT)\include;$(INCLUDE)
-LIB=$(SDKROOT)\lib;$(LIB)
-##############################################################################
-CFLAGS = /c /nologo /W1 /G5 /I..\ /I..\..\Include \
- /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "MESAD3D"
-CPPFLAGS= /c /nologo /W1 /G5 /I..\ /I..\..\Include \
- /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "MESAD3D"
-
-!IF "$(DEBUG)" == "1"
-
-CFLAGS = /MTd /Od /Z7 /Yd /D "_DEBUG" /D "D3D_DEBUG" $(CFLAGS)
-CPPFLAGS = /MTd /Od /Z7 /Yd /D "_DEBUG" /D "D3D_DEBUG" $(CPPFLAGS)
-BUILD_TYPE=debug
-
-!ELSE
-
-CFLAGS = /MT /Ox /D "NDEBUG" $(CFLAGS)
-CPPFLAGS = /MT /Ox /D "NDEBUG" $(CPPFLAGS)
-BUILD_TYPE=release
-
-!ENDIF
-##############################################################################
-SRCS_WGL = wgl.c D3Dvbrender.c DDrawPROCS.c NULLProcs.c Debug.c
-SRCS_HAL = D3DInit.cpp D3DRaster.cpp D3DTextureMgr.cpp D3DUtils.cpp D3DCaps.cpp
-OBJS_WGL = $(SRCS_WGL:.c=.obj)
-OBJS_HAL = $(SRCS_HAL:.cpp=.obj)
-
-WINLIBS = kernel32.lib user32.lib gdi32.lib oldnames.lib
-DXLIBS =
-LIBS = $(WINLIBS) $(DXLIBS)
-###############################################################################
-# Primary Targets #
-###############################################################################
-
-default: header WGL HAL footer
-
-all: default
-
-WGL : $(OBJS_WGL)
-
-HAL : $(OBJS_HAL)
-
-install : forceit
- @echo $(SPACE)
- @echo ========================================
- @echo Install files created.
- @echo ========================================
-
-
-###############################################################################
-# Secondary Targets #
-###############################################################################
-
-clean:
- @echo ========================================
- @echo Cleaning $(TARGET)
- @del *.obj
- @del *.dep
- @del *.exp
- @del *.ncb
- @del *.plg
- @del *.lib
- @echo ========================================
-
-header:
- @echo ============================================================
- @echo Building $(TARGET) ($(BUILD_TYPE) version)
- @echo ============================================================
- @echo $(SPACE)
-
-footer:
- @echo $(SPACE)
- @echo ============================================================
- @echo DONE building $(TARGET) ($(BUILD_TYPE) version)
- @echo ============================================================
-
-forceit:
-
-
-
-
diff --git a/src/mesa/drivers/d3d/NULLProcs.h b/src/mesa/drivers/d3d/NULLProcs.h
deleted file mode 100644
index f0bbd2162dd..00000000000
--- a/src/mesa/drivers/d3d/NULLProcs.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef NULL_MESA_PROCS_INC
-#define NULL_MESA_PROCS_INC
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include "matrix.h"
-#include "context.h"
-#include "types.h"
-#include "vb.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-GLboolean NULLSetBuffer( GLcontext *ctx, GLenum mode );
-void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height );
-GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h );
-void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] );
-void NULLWrSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][4], const GLubyte m[] );
-void NULLWrSpRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte m[] );
-void NULLWrPiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte r[][4], const GLubyte m[] );
-void NULLWrPiRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte m[] );
-void NULLReSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte r[][4] );
-void NULLRePiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte r[][4], const GLubyte m[] );
-/*===========================================================================*/
-/* Extern function prototypes. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/NullProcs.c b/src/mesa/drivers/d3d/NullProcs.c
deleted file mode 100644
index d6fb598074b..00000000000
--- a/src/mesa/drivers/d3d/NullProcs.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 DirectX 6 Driver */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#ifndef NULL_MESA_PROCS_INC
-#define NULL_MESA_PROCS_INC
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include "matrix.h"
-#include "context.h"
-#include "mtypes.h"
-#include "vb.h"
-/*===========================================================================*/
-/* Macros. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-void NULLSetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-void NULLClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-GLboolean NULLSetBuffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bit );
-void NULLGetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height );
-GLbitfield NULLClearBuffers( GLcontext *ctx, GLbitfield m, GLboolean a, GLint x, GLint y, GLint w, GLint h );
-void NULLWrSpRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][3], const GLubyte m[] );
-void NULLWrSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte r[][4], const GLubyte m[] );
-void NULLWrSpRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte m[] );
-void NULLWrPiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte r[][4], const GLubyte m[] );
-void NULLWrPiRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte m[] );
-void NULLReSpRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte r[][4] );
-void NULLRePiRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte r[][4], const GLubyte m[] );
-/*===========================================================================*/
-/* Extern function prototypes. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-
-#endif
-
diff --git a/src/mesa/drivers/d3d/OPENGL32.DEF b/src/mesa/drivers/d3d/OPENGL32.DEF
deleted file mode 100644
index b32bd1fef81..00000000000
--- a/src/mesa/drivers/d3d/OPENGL32.DEF
+++ /dev/null
@@ -1,442 +0,0 @@
-;===========================================================================
-;
-; Mesa-3.0 DirectX 6 Driver
-;
-; By Leigh McRae
-;
-; http://www.altsoftware.com/
-;
-; Copyright (c) 1999-1998 alt.software inc. All Rights Reserved
-;===========================================================================
-NAME OpenGL32.DLL
-DESCRIPTION "Mesa-3.0 DX6 Driver Version 0.5"
-
-EXPORTS
- DllMain
- glAccum
- glAlphaFunc
- glAreTexturesResident
- glAreTexturesResidentEXT
- glArrayElement
- glArrayElementEXT
- glBegin
- glBindTexture
- glBindTextureEXT
- glBitmap
- glBlendColorEXT
- glBlendEquationEXT
- glBlendFunc
- glCallList
- glCallLists
- glClear
- glClearAccum
- glClearColor
- glClearDepth
- glClearIndex
- glClearStencil
- glClipPlane
- glColor3b
- glColor3bv
- glColor3d
- glColor3dv
- glColor3f
- glColor3fv
- glColor3i
- glColor3iv
- glColor3s
- glColor3sv
- glColor3ub
- glColor3ubv
- glColor3ui
- glColor3uiv
- glColor3us
- glColor3usv
- glColor4b
- glColor4bv
- glColor4d
- glColor4dv
- glColor4f
- glColor4fv
- glColor4i
- glColor4iv
- glColor4s
- glColor4sv
- glColor4ub
- glColor4ubv
- glColor4ui
- glColor4uiv
- glColor4us
- glColor4usv
- glColorMask
- glColorMaterial
- glColorPointer
- glColorPointerEXT
- glColorSubTableEXT
- glColorTableEXT
- glCopyPixels
- glCopyTexImage1D
- glCopyTexImage2D
- glCopyTexSubImage1D
- glCopyTexSubImage2D
- glCopyTexSubImage3DEXT
- glCullFace
- glDeleteLists
- glDeleteTextures
- glDeleteTexturesEXT
- glDepthFunc
- glDepthMask
- glDepthRange
- glDisable
- glDisableClientState
- glDrawArrays
- glDrawArraysEXT
- glDrawBuffer
- glDrawElements
- glDrawPixels
- glEdgeFlag
- glEdgeFlagPointer
- glEdgeFlagPointerEXT
- glEdgeFlagv
- glEnable
- glEnableClientState
- glEnd
- glEndList
- glEvalCoord1d
- glEvalCoord1dv
- glEvalCoord1f
- glEvalCoord1fv
- glEvalCoord2d
- glEvalCoord2dv
- glEvalCoord2f
- glEvalCoord2fv
- glEvalMesh1
- glEvalMesh2
- glEvalPoint1
- glEvalPoint2
- glFeedbackBuffer
- glFinish
- glFlush
- glFogf
- glFogfv
- glFogi
- glFogiv
- glFrontFace
- glFrustum
- glGenLists
- glGenTextures
- glGenTexturesEXT
- glGetBooleanv
- glGetClipPlane
- glGetColorTableEXT
- glGetColorTableParameterfvEXT
- glGetColorTableParameterivEXT
- glGetDoublev
- glGetError
- glGetFloatv
- glGetIntegerv
- glGetLightfv
- glGetLightiv
- glGetMapdv
- glGetMapfv
- glGetMapiv
- glGetMaterialfv
- glGetMaterialiv
- glGetPixelMapfv
- glGetPixelMapuiv
- glGetPixelMapusv
- glGetPointerv
- glGetPointervEXT
- glGetPolygonStipple
- glGetString
- glGetTexEnvfv
- glGetTexEnviv
- glGetTexGendv
- glGetTexGenfv
- glGetTexGeniv
- glGetTexImage
- glGetTexLevelParameterfv
- glGetTexLevelParameteriv
- glGetTexParameterfv
- glGetTexParameteriv
- glHint
- glIndexd
- glIndexdv
- glIndexf
- glIndexfv
- glIndexi
- glIndexiv
- glIndexMask
- glIndexPointer
- glIndexPointerEXT
- glIndexs
- glIndexsv
- glIndexub
- glIndexubv
- glInitNames
- glInterleavedArrays
- glIsEnabled
- glIsList
- glIsTexture
- glIsTextureEXT
- glLightf
- glLightfv
- glLighti
- glLightiv
- glLightModelf
- glLightModelfv
- glLightModeli
- glLightModeliv
- glLineStipple
- glLineWidth
- glListBase
- glLoadIdentity
- glLoadMatrixd
- glLoadMatrixf
- glLoadName
- glLogicOp
- glMap1d
- glMap1f
- glMap2d
- glMap2f
- glMapGrid1d
- glMapGrid1f
- glMapGrid2d
- glMapGrid2f
- glMaterialf
- glMaterialfv
- glMateriali
- glMaterialiv
- glMatrixMode
- glMultMatrixd
- glMultMatrixf
- glNewList
- glNormal3b
- glNormal3bv
- glNormal3d
- glNormal3dv
- glNormal3f
- glNormal3fv
- glNormal3i
- glNormal3iv
- glNormal3s
- glNormal3sv
- glNormalPointer
- glNormalPointerEXT
- glOrtho
- glPassThrough
- glPixelMapfv
- glPixelMapuiv
- glPixelMapusv
- glPixelStoref
- glPixelStorei
- glPixelTransferf
- glPixelTransferi
- glPixelZoom
- glPointParameterfEXT
- glPointParameterfvEXT
- glPointSize
- glPolygonMode
- glPolygonOffset
- glPolygonOffsetEXT
- glPolygonStipple
- glPopAttrib
- glPopClientAttrib
- glPopMatrix
- glPopName
- glPrioritizeTextures
- glPrioritizeTexturesEXT
- glPushAttrib
- glPushClientAttrib
- glPushMatrix
- glPushName
- glRasterPos2d
- glRasterPos2dv
- glRasterPos2f
- glRasterPos2fv
- glRasterPos2i
- glRasterPos2iv
- glRasterPos2s
- glRasterPos2sv
- glRasterPos3d
- glRasterPos3dv
- glRasterPos3f
- glRasterPos3fv
- glRasterPos3i
- glRasterPos3iv
- glRasterPos3s
- glRasterPos3sv
- glRasterPos4d
- glRasterPos4dv
- glRasterPos4f
- glRasterPos4fv
- glRasterPos4i
- glRasterPos4iv
- glRasterPos4s
- glRasterPos4sv
- glReadBuffer
- glReadPixels
- glRectd
- glRectdv
- glRectf
- glRectfv
- glRecti
- glRectiv
- glRects
- glRectsv
- glRenderMode
- glResizeBuffersMESA
- glRotated
- glRotatef
- glScaled
- glScalef
- glScissor
- glSelectBuffer
- glShadeModel
- glStencilFunc
- glStencilMask
- glStencilOp
- glTexCoord1d
- glTexCoord1dv
- glTexCoord1f
- glTexCoord1fv
- glTexCoord1i
- glTexCoord1iv
- glTexCoord1s
- glTexCoord1sv
- glTexCoord2d
- glTexCoord2dv
- glTexCoord2f
- glTexCoord2fv
- glTexCoord2i
- glTexCoord2iv
- glTexCoord2s
- glTexCoord2sv
- glTexCoord3d
- glTexCoord3dv
- glTexCoord3f
- glTexCoord3fv
- glTexCoord3i
- glTexCoord3iv
- glTexCoord3s
- glTexCoord3sv
- glTexCoord4d
- glTexCoord4dv
- glTexCoord4f
- glTexCoord4fv
- glTexCoord4i
- glTexCoord4iv
- glTexCoord4s
- glTexCoord4sv
- glTexCoordPointer
- glTexCoordPointerEXT
- glTexEnvf
- glTexEnvfv
- glTexEnvi
- glTexEnviv
- glTexGend
- glTexGendv
- glTexGenf
- glTexGenfv
- glTexGeni
- glTexGeniv
- glTexImage1D
- glTexImage2D
- glTexImage3DEXT
- glTexParameterf
- glTexParameterfv
- glTexParameteri
- glTexParameteriv
- glTexSubImage1D
- glTexSubImage2D
- glTexSubImage3DEXT
- glTranslated
- glTranslatef
- glVertex2d
- glVertex2dv
- glVertex2f
- glVertex2fv
- glVertex2i
- glVertex2iv
- glVertex2s
- glVertex2sv
- glVertex3d
- glVertex3dv
- glVertex3f
- glVertex3fv
- glVertex3i
- glVertex3iv
- glVertex3s
- glVertex3sv
- glVertex4d
- glVertex4dv
- glVertex4f
- glVertex4fv
- glVertex4i
- glVertex4iv
- glVertex4s
- glVertex4sv
- glVertexPointer
- glVertexPointerEXT
- glViewport
- glWindowPos2dMESA
- glWindowPos2dvMESA
- glWindowPos2fMESA
- glWindowPos2fvMESA
- glWindowPos2iMESA
- glWindowPos2ivMESA
- glWindowPos2sMESA
- glWindowPos2svMESA
- glWindowPos3dMESA
- glWindowPos3dvMESA
- glWindowPos3fMESA
- glWindowPos3fvMESA
- glWindowPos3iMESA
- glWindowPos3ivMESA
- glWindowPos3sMESA
- glWindowPos3svMESA
- glWindowPos4dMESA
- glWindowPos4dvMESA
- glWindowPos4fMESA
- glWindowPos4fvMESA
- glWindowPos4iMESA
- glWindowPos4ivMESA
- glWindowPos4sMESA
- glWindowPos4svMESA
-; WMesaCreateContext
-; WMesaDestroyContext
-; WMesaMakeCurrent
-; WMesaPaletteChange
-; WMesaSwapBuffers
-; OSMesaCreateContext
-; OSMesaDestroyContext
-; OSMesaMakeCurrent
-; OSMesaGetCurrentContext
-; OSMesaPixelStore
-; OSMesaGetIntegerv
-; OSMesaGetDepthBuffer
- wglCopyContext
- wglCreateContext
- wglCreateLayerContext
- wglDeleteContext
-; wglDescribeLayerPlane
- wglGetCurrentContext
- wglGetCurrentDC
-; wglGetLayerPaletteEntries
- wglGetProcAddress
- wglMakeCurrent
-; wglRealizeLayerPalette
-; wglSetLayerPaletteEntries
- wglShareLists
- wglSwapLayerBuffers
- wglUseFontBitmapsA
- wglUseFontBitmapsW
- wglUseFontOutlinesA
- wglUseFontOutlinesW
- wglChoosePixelFormat
- wglDescribePixelFormat
- wglGetPixelFormat
- wglSetPixelFormat
- wglSwapBuffers
-
-
-
diff --git a/src/mesa/drivers/d3d/WGL.C b/src/mesa/drivers/d3d/WGL.C
deleted file mode 100644
index e3b95e1de72..00000000000
--- a/src/mesa/drivers/d3d/WGL.C
+++ /dev/null
@@ -1,1262 +0,0 @@
-/*===========================================================================*/
-/* */
-/* Mesa-3.0 Makefile for DirectX 6 */
-/* */
-/* By Leigh McRae */
-/* */
-/* http://www.altsoftware.com/ */
-/* */
-/* Copyright (c) 1998-1997 alt.software inc. All Rights Reserved */
-/*===========================================================================*/
-#include "D3DMesa.h"
-/*===========================================================================*/
-/* Window managment. */
-/*===========================================================================*/
-static BOOL InitOpenGL( HINSTANCE hInst );
-static BOOL TermOpenGL( HINSTANCE hInst );
-static BOOL ResizeContext( GLcontext *ctx );
-static BOOL MakeCurrent( D3DMESACONTEXT *pContext );
-static void DestroyContext( D3DMESACONTEXT *pContext );
-static BOOL UnBindWindow( D3DMESACONTEXT *pContext );
-LONG APIENTRY wglMonitorProc( HWND hwnd, UINT message, UINT wParam, LONG lParam );
-/*===========================================================================*/
-/* Mesa hooks. */
-/*===========================================================================*/
-static void SetupDDPointers( GLcontext *ctx );
-static void SetupSWDDPointers( GLcontext *ctx );
-static void SetupHWDDPointers( GLcontext *ctx );
-static void SetupNULLDDPointers( GLcontext *ctx );
-static const char *RendererString( void );
-
-/* State Management hooks. */
-static void SetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-static void ClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a );
-static GLboolean SetBuffer( GLcontext *ctx, GLenum buffer );
-
-/* Window Management hooks. */
-static void GetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height );
-static void SetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h );
-static void Flush( GLcontext *ctx );
-
-/* Span rendering hooks. */
-void WSpanRGB( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgb[][3], const GLubyte mask[] );
-void WSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] );
-void WSpanRGBAMono( const GLcontext* ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] );
-void WPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] );
-void WPixelsRGBAMono( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] );
-void RSpanRGBA( const GLcontext* ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] );
-void RPixelsRGBA( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] );
-GLbitfield ClearBuffers( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-
-/* Primitve rendering hooks. */
-GLboolean RenderVertexBuffer( GLcontext *ctx, GLboolean allDone );
-void RenderOneTriangle( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint pv );
-void RenderOneLine( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
-GLbitfield ClearBuffersD3D( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height );
-
-/* Texture Management hooks. */
-static void TextureBind( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj );
-static void TextureLoad( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image );
-static void TextureSubImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-D3DMESACONTEXT *pD3DCurrent,
- *pD3DDefault; /* Thin support context. */
-
-struct __extensions__ ext[] = {
-
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
-};
-
-int qt_ext = sizeof(ext) / sizeof(ext[0]);
-float g_DepthScale,
- g_MaxDepth;
-/*===========================================================================*/
-/* When a process loads this DLL we will setup the linked list for context */
-/* management and create a default context that will support the API until */
-/* the user creates and binds thier own. This THIN default context is useful*/
-/* to have around. */
-/* When the process terminates we will clean up all resources here. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY DllMain( HINSTANCE hInst, DWORD reason, LPVOID reserved )
-{
- switch( reason )
- {
- case DLL_PROCESS_ATTACH:
- return InitOpenGL( hInst );
-
- case DLL_PROCESS_DETACH:
- return TermOpenGL( hInst );
- }
-
- return TRUE;
-}
-/*===========================================================================*/
-/* The first thing we do when this dll is hit is connect to the dll that has*/
-/* handles all the DirectX 6 rendering. I decided to use another dll as DX6 */
-/* is all C++ and Mesa-3.0 is C (thats a good thing). This way I can write */
-/* the DX6 in C++ and Mesa-3.0 in C without having to worry about linkage. */
-/* I feel this is easy and better then using static wrappers as it is likely */
-/* faster and it allows me to just develope the one without compiling the */
-/* other. */
-/* NOTE that at this point we don't have much other than a very thin context*/
-/* that will support the API calls only to the point of not causing the app */
-/* to crash from the API table being empty. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL InitOpenGL( HINSTANCE hInst )
-{
- /* Allocate and clear the default context. */
- pD3DDefault = (PD3DMESACONTEXT)ALLOC( sizeof(D3DMESACONTEXT) );
- if ( pD3DDefault == NULL )
- return FALSE;
- memset( pD3DDefault, 0, sizeof(D3DMESACONTEXT) );
-
- /* Clear the D3D vertex buffer so that values not used will be zero. This */
- /* save me from some redundant work. */
- memset( &D3DTLVertices, 0, sizeof(D3DTLVertices) );
-
- /* Update the link. We uses a circular list so that it is easy to */
- /* add and search. This context will also be used for head and tail.*/
- pD3DDefault->next = pD3DDefault;
-
- /*========================================================================*/
- /* Do all core Mesa stuff. */
- /*========================================================================*/
- pD3DDefault->gl_visual = _mesa_create_visual( TRUE,
- FALSE, /* db_flag */
- GL_FALSE, /* stereo */
- 8,8,8,8, /* r, g, b, a bits */
- 0, /* index bits */
- 16, /* depth_bits */
- 8, /* stencil_bits */
- 8,8,8,8, /* accum_bits */
- 1 );
-
- if ( pD3DDefault->gl_visual == NULL)
- {
- FREE( pD3DDefault );
- return FALSE;
- }
-
- /* Allocate a new Mesa context */
- pD3DDefault->gl_ctx = _mesa_create_context( pD3DDefault->gl_visual, NULL, pD3DDefault, GL_TRUE );
- if ( pD3DDefault->gl_ctx == NULL )
- {
- _mesa_destroy_visual( pD3DDefault->gl_visual );
- FREE( pD3DDefault );
- return FALSE;
- }
-
- /* Allocate a new Mesa frame buffer */
- pD3DDefault->gl_buffer = _mesa_create_framebuffer( pD3DDefault->gl_visual );
- if ( pD3DDefault->gl_buffer == NULL )
- {
- _mesa_destroy_visual( pD3DDefault->gl_visual );
- _mesa_destroy_context( pD3DDefault->gl_ctx );
- FREE( pD3DDefault );
- return FALSE;
- }
- SetupDDPointers( pD3DDefault->gl_ctx );
- _mesa_make_current( pD3DDefault->gl_ctx, pD3DDefault->gl_buffer );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will create a new D3D context but will not create the D3D */
-/* surfaces or even an instance of D3D (see at GetBufferSize). The only stuff*/
-/* done here is the internal Mesa stuff and some Win32 handles. */
-/*===========================================================================*/
-/* RETURN: casted pointer to the context, NULL. */
-/*===========================================================================*/
-HGLRC APIENTRY wglCreateContext( HDC hdc )
-{
- D3DMESACONTEXT *pNewContext;
- DWORD dwCoopFlags = DDSCL_NORMAL;
- RECT rectClient;
- POINT pt;
-
- /* ALLOC and clear the new context. */
- pNewContext = (PD3DMESACONTEXT)ALLOC( sizeof(D3DMESACONTEXT) );
- if ( pNewContext == NULL )
- {
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
- memset( pNewContext, 0, sizeof(D3DMESACONTEXT) );
-
- /*========================================================================*/
- /* Do all core Mesa stuff. */
- /*========================================================================*/
-
- /* TODO: support more then one visual. */
- pNewContext->gl_visual = _mesa_create_visual( TRUE,
- TRUE, /* db_flag */
- GL_FALSE, /* stereo */
- 8,8,8,8, /* r, g, b, a bits */
- 0, /* index bits */
- 16, /* depth_bits */
- 8, /* stencil_bits */
- 16,16,16,16,/* accum_bits */
- 1 );
- if ( pNewContext->gl_visual == NULL)
- {
- FREE( pNewContext );
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
-
- /* Allocate a new Mesa context */
- pNewContext->gl_ctx = _mesa_create_context( pNewContext->gl_visual, NULL, pNewContext, GL_TRUE );
- if ( pNewContext->gl_ctx == NULL )
- {
- _mesa_destroy_visual( pNewContext->gl_visual );
- FREE( pNewContext );
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
-
- /* Allocate a new Mesa frame buffer */
- pNewContext->gl_buffer = _mesa_create_framebuffer( pNewContext->gl_visual );
- if ( pNewContext->gl_buffer == NULL )
- {
- _mesa_destroy_visual( pNewContext->gl_visual );
- _mesa_destroy_context( pNewContext->gl_ctx );
- FREE( pNewContext );
- SetLastError( 0 );
- return (HGLRC)NULL;
- }
-
- /*========================================================================*/
- /* Do all the driver stuff. */
- /*========================================================================*/
- pNewContext->hdc = hdc;
- pNewContext->next = pD3DDefault->next;
- pD3DDefault->next = pNewContext; /* Add to circular list. */
-
- /* Create the HAL for the new context. */
- pNewContext->pShared = InitHAL( WindowFromDC(hdc) );
-
- return (HGLRC)pNewContext;
-}
-/*===========================================================================*/
-/* This is a wrapper function that is supported by MakeCurrent. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglMakeCurrent( HDC hdc, HGLRC hglrc )
-{
- return MakeCurrent((D3DMESACONTEXT *)hglrc);
-}
-/*===========================================================================*/
-/* MakeCurrent will unbind whatever context is current (if any) & then bind */
-/* the supplied context. A context that is bound has it's window proc hooked*/
-/* with the wglMonitorProc and the context pointer is saved in pD3DCurrent. */
-/* Once the context is bound we update the Mesa-3.0 hooks (SetDDPointers) and*/
-/* the viewport (Mesa-.30 and DX6). */
-/* */
-/* TODO: this function can't fail. */
-/*===========================================================================*/
-/* RETURN: TRUE */
-/*===========================================================================*/
-static BOOL MakeCurrent( D3DMESACONTEXT *pContext )
-{
- D3DMESACONTEXT *pNext;
-
- /*====================================================================*/
- /* This is a special case that is a request to have no context bound. */
- /*====================================================================*/
- if ( pContext == NULL )
- {
- /* Walk the whole list. We start and end at the Default context. */
- for( pNext = pD3DDefault->next; pNext != pD3DDefault; pNext = pNext->next )
- UnBindWindow( pNext );
-
- return TRUE;
- }
-
- /*=================================================*/
- /* Make for a fast redundant use of this function. */
- /*=================================================*/
- if ( pD3DCurrent == pContext )
- return TRUE;
-
- /*=============================*/
- /* Unbind the current context. */
- /*=============================*/
- UnBindWindow( pD3DCurrent );
-
- /*=====================================*/
- /* Let Mesa-3.0 we have a new context. */
- /*=====================================*/
- SetupDDPointers( pContext->gl_ctx );
- _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer );
-
- /* We are done so set the internal current context. */
- if ( pContext != pD3DDefault )
- {
- ResizeContext( pContext->gl_ctx );
- pContext->hOldProc = (WNDPROC)GetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC );
- SetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC, (LONG)wglMonitorProc );
- }
- pD3DCurrent = pContext;
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function will only return the current window size. I have re-done */
-/* this function so that it doesn't check the current size and react to it as*/
-/* I should be able to have all the react code in the WM_SIZE message. The */
-/* old version would check the current window size and create/resize the HAL */
-/* surfaces if they have changed. I needed to delay the creation if the */
-/* surfaces because sometimes I wouldn't have a window size so this is where */
-/* I delayed it. If you are reading this then all went ok! */
-/* The default context will return a zero sized window and I'm not sure if */
-/* this is ok at this point (TODO). */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void GetBufferSize( GLcontext *ctx, GLuint *width, GLuint *height )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Fall through for the default because that is one of the uses for it. */
- if ( pContext == pD3DDefault )
- {
- *width = 0;
- *height = 0;
- }
- else
- {
- *width = pContext->pShared->dwWidth;
- *height = pContext->pShared->dwHeight;
- }
-}
-/*===========================================================================*/
-/* */
-/* */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static BOOL ResizeContext( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx,
- *pCurrentTemp;
- RECT rectClient;
- POINT pt;
- DWORD dwWidth,
- dwHeight;
- static BOOL bDDrawLock = FALSE;
-
- /* Make sure we have some values. */
- if ( (pContext->hdc == NULL ) ||
- (pContext->pShared->hwnd != WindowFromDC(pContext->hdc)) ||
- (pContext == pD3DDefault) )
- return FALSE;
-
- /* Having problems with DDraw sending resize messages before I was done. */
- if( bDDrawLock == TRUE )
- return FALSE;
-
- // TODO: don't think I need this anymore.
- pCurrentTemp = pD3DCurrent;
- pD3DCurrent = pD3DDefault;
- bDDrawLock = TRUE;
-
- /* Get the current window dimentions. */
- UpdateScreenPosHAL( pContext->pShared );
- dwWidth = pContext->pShared->rectW.right - pContext->pShared->rectW.left;
- dwHeight = pContext->pShared->rectW.bottom - pContext->pShared->rectW.top;
-
- /* Is the size of the OffScreen Render different? */
- if ( (dwWidth != pContext->pShared->dwWidth) || (dwHeight != pContext->pShared->dwHeight) )
- {
- /* Create all the D3D surfaces and device. */
- CreateHAL( pContext->pShared );
-
- /* I did this so that software rendering would still work as */
- /* I don't need to scale the z values twice. */
- g_DepthScale = (pContext->pShared->bHardware) ? 1.0 : ((float)0x00FFFFFF);
- g_MaxDepth = (pContext->pShared->bHardware) ? 1.0 : ((float)0x00FFFFFF);
- gl_DepthRange( pContext->gl_ctx, ctx->Viewport.Near, ctx->Viewport.Far );
-
- /* Make sure we have a viewport. */
- gl_Viewport( pContext->gl_ctx, 0, 0, dwWidth, dwHeight );
-
- /* Update Mesa as we might have changed from SW <-> HW. */
- SetupDDPointers( pContext->gl_ctx );
- _mesa_make_current( pContext->gl_ctx, pContext->gl_buffer );
-
- /* If we are in HW we need to load the current texture if there is one already. */
- // if ( (ctx->Texture.Set[ctx->Texture.CurrentSet].Current != NULL) &&
- // (pContext->pShared->bHardware == TRUE) )
- // {
- // CreateTMgrHAL( pContext->pShared,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Name,
- // 0,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Format,
- // (RECT *)NULL,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Width,
- // ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Height,
- // TM_ACTION_BIND,
- // (void *)ctx->Texture.Set[ctx->Texture.CurrentSet].Current->Image[0]->Data );
- // }
- }
-
- // TODO: don't think I need this anymore.
- pD3DCurrent = pCurrentTemp;
- bDDrawLock = FALSE;
-
- return TRUE;
-}
-
-/*===========================================================================*
-/* This function will Blt the render buffer to the PRIMARY surface. I repeat*/
-/* this code for the other SwapBuffer like functions and the flush (didn't */
-/* want the function calling overhead). Thsi could have been a macro... */
-/* */
-/* TODO: there are some problems with viewport/scissoring. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglSwapBuffers( HDC hdc )
-{
- /* Fall through for the default because that is one of the uses for it. */
- if ( pD3DCurrent == pD3DDefault )
- return FALSE;
-
- SwapBuffersHAL( pD3DCurrent->pShared );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* Same as wglSwapBuffers. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY SwapBuffers( HDC hdc )
-{
- /* Fall through for the default because that is one of the uses for it. */
- if ( pD3DCurrent == pD3DDefault )
- return FALSE;
-
- SwapBuffersHAL( pD3DCurrent->pShared );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This should be ok as none of the SwapBuffers will cause a redundant Blt */
-/* as none of my Swap functions will call flush. This should also allow */
-/* sinlge buffered applications to work (not really worried though). Some */
-/* applications may flush then swap but then this is there fault IMHO. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void Flush( GLcontext *ctx )
-{
- /* Fall through for the default because that is one of the uses for it. */
- if ( pD3DCurrent == pD3DDefault )
- return;
-
- SwapBuffersHAL( pD3DCurrent->pShared );
-}
-/*===========================================================================*/
-/* For now this function will ignore the supplied PF. If I'm going to allow */
-/* the user to choice the mode and device at startup I'm going to have to do */
-/* something different. */
-/* */
-/* TODO: use the linked list of modes to build a pixel format to be returned */
-/* to the caller. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY wglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return 1;
-}
-/*===========================================================================*/
-/* See wglChoosePixelFormat. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY ChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return wglChoosePixelFormat(hdc,ppfd);
-}
-/*===========================================================================*/
-/* This function (for now) returns a static PF everytime. This is just to */
-/* allow things to continue. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY wglDescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd )
-{
- static PIXELFORMATDESCRIPTOR pfd =
- {
- sizeof(PIXELFORMATDESCRIPTOR), /* size */
- 1, /* version */
- PFD_SUPPORT_OPENGL |
- PFD_DRAW_TO_WINDOW |
- PFD_DOUBLEBUFFER, /* support double-buffering */
- PFD_TYPE_RGBA, /* color type */
- 16, /* prefered color depth */
- 0, 0, 0, 0, 0, 0, /* color bits (ignored) */
- 0, /* no alpha buffer */
- 0, /* alpha bits (ignored) */
- 0, /* no accumulation buffer */
- 0, 0, 0, 0, /* accum bits (ignored) */
- 16, /* depth buffer */
- 0, /* no stencil buffer */
- 0, /* no auxiliary buffers */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
- 0, 0, 0, /* no layer, visible, damage masks */
- };
-
- /* Return the address of this static PF if one was requested. */
- if ( ppfd != NULL )
- memcpy( ppfd, &pfd, sizeof(PIXELFORMATDESCRIPTOR) );
-
- return 1;
-}
-/*===========================================================================*/
-/* See wglDescribePixelFormat. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY DescribePixelFormat( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd )
-{
- return wglDescribePixelFormat(hdc,iPixelFormat,nBytes,ppfd);
-}
-/*===========================================================================*/
-/* This function will always return 1 for now. Just to allow for support. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY wglGetPixelFormat( HDC hdc )
-{
- return 1;
-}
-/*===========================================================================*/
-/* See wglGetPixelFormat. */
-/*===========================================================================*/
-/* RETURN: 1. */
-/*===========================================================================*/
-int APIENTRY GetPixelFormat( HDC hdc )
-{
- return wglGetPixelFormat(hdc);
-}
-/*===========================================================================*/
-/* This will aways work for now. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-BOOL APIENTRY wglSetPixelFormat( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return TRUE;
-}
-/*===========================================================================*/
-/* See wglSetPixelFormat. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY SetPixelFormat( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd )
-{
- return wglSetPixelFormat(hdc,iPixelFormat,ppfd);
-}
-/*===========================================================================*/
-/* This is a wrapper function that is supported by my own internal function.*/
-/* that takes my own D3D Mesa context structure. This so I can reuse the */
-/* function (no need for speed). */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-BOOL APIENTRY wglDeleteContext( HGLRC hglrc )
-{
- DestroyContext( (D3DMESACONTEXT *)hglrc );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* Simple getter function that uses a cast. */
-/*===========================================================================*/
-/* RETURN: casted pointer to the context, NULL. */
-/*===========================================================================*/
-HGLRC APIENTRY wglGetCurrentContext( VOID )
-{
- return (pD3DCurrent) ? (HGLRC)pD3DCurrent : (HGLRC)NULL;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglCopyContext( HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: NULL. */
-/*===========================================================================*/
-HGLRC APIENTRY wglCreateLayerContext( HDC hdc,int iLayerPlane )
-{
- SetLastError( 0 );
- return (HGLRC)NULL;
-}
-/*===========================================================================*/
-/* Simple getter function. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-HDC APIENTRY wglGetCurrentDC( VOID )
-{
- return (pD3DCurrent) ? pD3DCurrent->hdc : (HDC)NULL;
-}
-/*===========================================================================*/
-/* Simply call that searches the supported extensions for a match & returns */
-/* the pointer to the function that lends support. */
-/*===========================================================================*/
-/* RETURN: pointer to API call, NULL. */
-/*===========================================================================*/
-PROC APIENTRY wglGetProcAddress( LPCSTR lpszProc )
-{
- int index;
-
- for( index = 0; index < qt_ext; index++ )
- if( !strcmp(lpszProc,ext[index].name) )
- return ext[index].proc;
-
- SetLastError( 0 );
- return NULL;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontBitmaps( HDC fontDevice, DWORD firstChar, DWORD numChars, DWORD listBase )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontBitmapsW( HDC hdc,DWORD first,DWORD count,DWORD listBase )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglUseFontOutlinesW( HDC hdc,DWORD first,DWORD count, DWORD listBase,FLOAT deviation, FLOAT extrusion,int format, LPGLYPHMETRICSFLOAT lpgmf )
-{
- SetLastError( 0 );
- return FALSE ;
-}
-/*===========================================================================*/
-/* No support. */
-/*===========================================================================*/
-/* RETURN: FALSE. */
-/*===========================================================================*/
-BOOL APIENTRY wglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
-{
- SetLastError( 0 );
- return FALSE;
-}
-/*===========================================================================*/
-/* This function will be hooked into the window that has been bound. Right */
-/* now it is used to track the window size and position. Also the we clean */
-/* up the currrent context when the window is close/destroyed. */
-/* */
-/* TODO: there might be something wrong here as some games (Heretic II) don't*/
-/* track the window quit right. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-LONG APIENTRY wglMonitorProc( HWND hwnd, UINT message, UINT wParam, LONG lParam )
-{
- WNDPROC hOldProc;
- GLint width,
- height;
-
- switch( message )
- {
-// case WM_PAINT:
-// break;
-// case WM_ACTIVATE:
-// break;
-// case WM_SHOWWINDOW:
-// break;
-
- case UM_FATALSHUTDOWN:
- /* Support the API until we die... */
- MakeCurrent( pD3DDefault );
- break;
-
- case WM_MOVE:
- case WM_DISPLAYCHANGE:
- case WM_SIZE:
- ResizeContext( pD3DCurrent->gl_ctx );
- break;
-
- case WM_CLOSE:
- case WM_DESTROY:
- /* Support the API until we die... */
- hOldProc = pD3DCurrent->hOldProc;
- DestroyContext( pD3DCurrent );
- return (hOldProc)(hwnd,message,wParam,lParam);
- }
-
- return (pD3DCurrent->hOldProc)(hwnd,message,wParam,lParam);
-}
-
-/**********************************************************************/
-/***** Miscellaneous device driver funcs *****/
-/**********************************************************************/
-
-/*===========================================================================*/
-/* Not reacting to this as I'm only supporting drawing to the back buffer */
-/* right now. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-static GLboolean SetBuffer( GLcontext *ctx, GLenum buffer )
-{
- if (buffer == GL_BACK_LEFT)
- return GL_TRUE;
- else
- return GL_FALSE;
-}
-/*===========================================================================*/
-/* This proc will be called by Mesa when the viewport has been set. So if */
-/* we have a context and it isn't the default then we should let D3D know of */
-/* the change. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- RECT rect;
-
- /* Make sure we can set a viewport. */
- if ( pContext->pShared && (pContext != pD3DDefault) )
- {
- // TODO: might be needed.
- UpdateScreenPosHAL( pContext->pShared );
- rect.left = x;
- rect.right = x + w;
- rect.top = y;
- rect.bottom = y + h;
-
- // TODO: shared struct should make this call smaller
- SetViewportHAL( pContext->pShared, &rect, 0.0F, 1.0F );
- }
-}
-/*===========================================================================*/
-/* This function could be better I guess but I decided just to grab the four*/
-/* components and store then seperately. Makes it easier to use IMHO. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void ClearColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- pContext->aClear = a;
- pContext->bClear = b;
- pContext->gClear = g;
- pContext->rClear = r;
-}
-/*===========================================================================*/
-/* This function could be better I guess but I decided just to grab the four*/
-/* components and store then seperately. Makes it easier to use IMHO. */
-/* (is there an echo in here?) */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetColor( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- pContext->aCurrent = a;
- pContext->bCurrent = b;
- pContext->gCurrent = g;
- pContext->rCurrent = r;
-}
-/*===========================================================================*/
-/* */
-/* */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static const char *RendererString( void )
-{
- static char pszRender[64];
-
- strcpy( pszRender, "altD3D " );
-
- if ( pD3DCurrent->pShared->bHardware )
- strcat( pszRender, "(HW)");
- else
- strcat( pszRender, "(SW)");
-
- return (const char *)pszRender;
-}
-/*===========================================================================*/
-/* This function will choose which set of pointers Mesa will use based on */
-/* whether we hard using hardware or software. I have added another set of */
-/* pointers that will do nothing but stop the API from crashing. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void SetupDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- // TODO: write a generic NULL support for the span render.
- if ( pContext->pShared && pContext->pShared->bHardware )
- {
- ctx->Driver.UpdateState = SetupHWDDPointers;
- }
- else if ( pContext == pD3DDefault )
- {
- ctx->Driver.UpdateState = SetupNULLDDPointers;
- }
- else
- {
- ctx->Driver.UpdateState = SetupSWDDPointers;
- }
-}
-/*===========================================================================*/
-/* This function will populate all the Mesa driver hooks. This version of */
-/* hooks will do nothing but support the API when we don't have a valid */
-/* context bound. This is mostly for applications that don't behave right */
-/* and also to help exit as clean as possable when we have a FatalError. */
-/*===========================================================================*/
-/* RETURN: pointer to the specific function. */
-/*===========================================================================*/
-static void SetupNULLDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
- ctx->Driver.UpdateState = SetupNULLDDPointers;
-
- /* State management hooks. */
- ctx->Driver.Color = NULLSetColor;
- ctx->Driver.ClearColor = NULLClearColor;
- ctx->Driver.Clear = NULLClearBuffers;
- ctx->Driver.SetBuffer = NULLSetBuffer;
-
- /* Window management hooks. */
- ctx->Driver.GetBufferSize = NULLGetBufferSize;
-
- /* Primitive rendering hooks. */
- ctx->Driver.TriangleFunc = NULL;
- ctx->Driver.RenderVB = NULL;
-
- /* Pixel/span writing functions: */
- ctx->Driver.WriteRGBASpan = NULLWrSpRGBA;
- ctx->Driver.WriteRGBSpan = NULLWrSpRGB;
- ctx->Driver.WriteMonoRGBASpan = NULLWrSpRGBAMono;
- ctx->Driver.WriteRGBAPixels = NULLWrPiRGBA;
- ctx->Driver.WriteMonoRGBAPixels = NULLWrPiRGBAMono;
-
- /* Pixel/span reading functions: */
- ctx->Driver.ReadRGBASpan = NULLReSpRGBA;
- ctx->Driver.ReadRGBAPixels = NULLRePiRGBA;
-
- /* Misc. hooks. */
- ctx->Driver.RendererString = RendererString;
-}
-/*===========================================================================*/
-/* This function will populate all the Mesa driver hooks. There are two of */
-/* these functions. One if we have hardware support and one is there is only*/
-/* software. These functions will be called by Mesa and by the wgl.c when we*/
-/* have resized (or created) the buffers. The thing is that if a window gets*/
-/* resized we may loose hardware support or gain it... */
-/*===========================================================================*/
-/* RETURN: pointer to the specific function. */
-/*===========================================================================*/
-static void SetupSWDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
- ctx->Driver.UpdateState = SetupSWDDPointers;
-
- /* State management hooks. */
- ctx->Driver.Color = SetColor;
- ctx->Driver.ClearColor = ClearColor;
- ctx->Driver.Clear = ClearBuffers;
- ctx->Driver.SetBuffer = SetBuffer;
-
- /* Window management hooks. */
- ctx->Driver.GetBufferSize = GetBufferSize;
- ctx->Driver.Viewport = SetViewport;
-
- /* Primitive rendering hooks. */
- ctx->Driver.TriangleFunc = NULL;
- ctx->Driver.RenderVB = NULL;
-
- /* Texture management hooks. */
-
- /* Pixel/span writing functions: */
- ctx->Driver.WriteRGBASpan = WSpanRGBA;
- ctx->Driver.WriteRGBSpan = WSpanRGB;
- ctx->Driver.WriteMonoRGBASpan = WSpanRGBAMono;
- ctx->Driver.WriteRGBAPixels = WPixelsRGBA;
- ctx->Driver.WriteMonoRGBAPixels = WPixelsRGBAMono;
-
- /* Pixel/span reading functions: */
- ctx->Driver.ReadRGBASpan = RSpanRGBA;
- ctx->Driver.ReadRGBAPixels = RPixelsRGBA;
-
- /* Misc. hooks. */
- ctx->Driver.Flush = Flush;
- ctx->Driver.RendererString = RendererString;
-}
-/*===========================================================================*/
-/* This function will populate all the Mesa driver hooks. There are two of */
-/* these functions. One if we have hardware support and one is there is only*/
-/* software. These functions will be called by Mesa and by the wgl.c when we*/
-/* have resized (or created) the buffers. The thing is that if a window gets*/
-/* resized we may loose hardware support or gain it... */
-/*===========================================================================*/
-/* RETURN: pointer to the specific function. */
-/*===========================================================================*/
-static void SetupHWDDPointers( GLcontext *ctx )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* Initialize all the pointers in the DD struct. Do this whenever */
- /* a new context is made current or we change buffers via set_buffer! */
- ctx->Driver.UpdateState = SetupHWDDPointers;
-
- /* State management hooks. */
- ctx->Driver.Color = SetColor;
- ctx->Driver.ClearColor = ClearColor;
- ctx->Driver.Clear = ClearBuffersD3D;
- ctx->Driver.SetBuffer = SetBuffer;
-
- /* Window management hooks. */
- ctx->Driver.GetBufferSize = GetBufferSize;
- ctx->Driver.Viewport = SetViewport;
-
- /* Primitive rendering hooks. */
- ctx->Driver.TriangleFunc = RenderOneTriangle;
- ctx->Driver.LineFunc = RenderOneLine;
- ctx->Driver.RenderVB = RenderVertexBuffer;
-
- /* Pixel/span writing functions: */
- ctx->Driver.WriteRGBASpan = WSpanRGBA;
- ctx->Driver.WriteRGBSpan = WSpanRGB;
- ctx->Driver.WriteMonoRGBASpan = WSpanRGBAMono;
- ctx->Driver.WriteRGBAPixels = WPixelsRGBA;
- ctx->Driver.WriteMonoRGBAPixels = WPixelsRGBAMono;
-
- /* Pixel/span reading functions: */
- ctx->Driver.ReadRGBASpan = RSpanRGBA;
- ctx->Driver.ReadRGBAPixels = RPixelsRGBA;
-
- /* Texture management hooks. */
- // ctx->Driver.BindTexture = TextureBind;
- ctx->Driver.TexImage = TextureLoad;
- ctx->Driver.TexSubImage = TextureSubImage;
-
- /* Misc. hooks. */
- ctx->Driver.Flush = Flush;
- ctx->Driver.RendererString = RendererString;
-}
-/*===========================================================================*/
-/* This function will release all resources used by the DLL. Every context */
-/* will be clobbered by releaseing all driver desources and then freeing the */
-/* context memory. Most all the work is done in DestroyContext. */
-/*===========================================================================*/
-/* RETURN: TRUE. */
-/*===========================================================================*/
-static BOOL TermOpenGL( HINSTANCE hInst )
-{
- D3DMESACONTEXT *pTmp,
- *pNext;
-
- /* Just incase we are still getting paint msg. */
- MakeCurrent( pD3DDefault );
-
- /* Walk the list until we get back to the default context. */
- for( pTmp = pD3DDefault->next; pTmp != pD3DDefault; pTmp = pNext )
- {
- pNext = pTmp->next;
- DestroyContext( pTmp );
- }
- DestroyContext( pD3DDefault );
-
- return TRUE;
-}
-/*===========================================================================*/
-/* This function is an internal function that will clean up all the Mesa */
-/* context bound to this D3D context. Also any D3D stuff that this context */
-/* uses will be unloaded. */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static void DestroyContext( D3DMESACONTEXT *pContext )
-{
- D3DMESACONTEXT *pTmp;
-
- /* Walk the list until we find the context before this one. */
- for( pTmp = pD3DDefault; pTmp && (pTmp->next != pContext); pTmp = pTmp->next )
- if ( pTmp == pTmp->next )
- break;
-
- /* If we never found it it must already be deleted. */
- if ( pTmp->next != pContext )
- return;
-
- /* Make sure we are not using this context. */
- if ( pContext == pD3DCurrent )
- MakeCurrent( pD3DDefault );
-
- /* Free the Mesa stuff. */
- if ( pContext->gl_visual )
- {
- _mesa_destroy_visual( pContext->gl_visual );
- pContext->gl_visual = NULL;
- }
- if ( pContext->gl_buffer )
- {
- _mesa_destroy_framebuffer( pContext->gl_buffer );
- pContext->gl_buffer = NULL;
- }
- if ( pContext->gl_ctx )
- {
- _mesa_destroy_context( pContext->gl_ctx );
- pContext->gl_ctx = NULL;
- }
-
- /* Now dump the D3D. */
- if ( pContext->pShared )
- TermHAL( pContext->pShared );
-
- /* Update the previous context's link. */
- pTmp->next = pContext->next;
-
- /* Gonzo. */
- FREE( pContext );
-}
-/*===========================================================================*/
-/* This function will pull the supplied context away from Win32. Basicly it*/
-/* will remove the hook from the window Proc. */
-/* */
-/* TODO: might want to serialize this stuff... */
-/*===========================================================================*/
-/* RETURN: TRUE, FALSE. */
-/*===========================================================================*/
-static BOOL UnBindWindow( D3DMESACONTEXT *pContext )
-{
- if ( pContext == NULL )
- return FALSE;
-
- if ( pContext == pD3DDefault )
- return TRUE;
-
- /* Make sure we always have a context bound. */
- if ( pContext == pD3DCurrent )
- pD3DCurrent = pD3DDefault;
-
- SetWindowLong( pContext->pShared->hwnd, GWL_WNDPROC, (LONG)pContext->hOldProc );
- pContext->hOldProc = NULL;
-
- return TRUE;
-}
-/*===========================================================================*/
-/* There are two cases that allow for a faster clear when we know that the */
-/* whole buffer is cleared and that there is no clipping. */
-/*===========================================================================*/
-/* RETURN: the original mask with the bits cleared that represents the buffer*
-/* or buffers we just cleared. */
-/*===========================================================================*/
-GLbitfield ClearBuffersD3D( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- DWORD dwFlags = 0;
-
- if ( mask & GL_COLOR_BUFFER_BIT )
- {
- dwFlags |= D3DCLEAR_TARGET;
- mask &= ~GL_COLOR_BUFFER_BIT;
- }
- if ( mask & GL_DEPTH_BUFFER_BIT )
- {
- dwFlags |= D3DCLEAR_ZBUFFER;
- mask &= ~GL_DEPTH_BUFFER_BIT;
- }
- if ( dwFlags == 0 )
- return mask;
-
- ClearHAL( pContext->pShared,
- dwFlags,
- all,
- x, y,
- width, height,
- ((pContext->aClear<<24) | (pContext->rClear<<16) | (pContext->gClear<<8) | (pContext->bClear)),
- ctx->Depth.Clear,
- 0 );
-
- return mask;
-}
-
-
-
-/*===========================================================================*/
-/* TEXTURE MANAGER: ok here is how I did textures. Mesa-3.0 will keep track*/
-/* of all the textures for us. So this means that at anytime we can go to */
-/* the Mesa context and get the current texture. With this in mind this is */
-/* what I did. I really don't care about what textures get or are loaded */
-/* until I actually have to draw a tri that is textured. At this point I */
-/* must have the texture so I demand the texture by destorying all other */
-/* texture surfaces if need be and load the current one. This allows for the*/
-/* best preformance on low memory cards as time is not wasted loading and */
-/* unload textures. */
-/*===========================================================================*/
-
-
-
-
-
-/*===========================================================================*/
-/* TextureLoad will try and create a D3D surface from the supplied texture */
-/* object if its level 0 (first). The surface will be fully filled with the */
-/* texture. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void TextureLoad( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* TODO: only doing first LOD. */
- if ( (ctx->DriverCtx == NULL) || (level != 0) )
- return;
-
- CreateTMgrHAL( pContext->pShared,
- tObj->Name,
- level,
- tObj->Image[level]->Format,
- (RECT *)NULL,
- tObj->Image[level]->Width,
- tObj->Image[level]->Height,
- TM_ACTION_LOAD,
- (void *)tObj->Image[level]->Data );
-}
-/*===========================================================================*/
-/* TextureBind make sure that the texture is on the card. Thats it. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void TextureBind( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
-
- /* TODO: only doing first LOD. */
- if ( (tObj->Image[0] == NULL) || (ctx->DriverCtx == NULL) )
- return;
-
- CreateTMgrHAL( pContext->pShared,
- tObj->Name,
- 0,
- tObj->Image[0]->Format,
- (RECT *)NULL,
- tObj->Image[0]->Width,
- tObj->Image[0]->Height,
- TM_ACTION_BIND,
- (void *)tObj->Image[0]->Data );
-}
-/*===========================================================================*/
-/* TextureSubImage will make sure that the texture being updated is updated */
-/* if its on the card. */
-/*===========================================================================*/
-/* RETURN: */
-/*===========================================================================*/
-static void TextureSubImage( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image )
-{
- D3DMESACONTEXT *pContext = (D3DMESACONTEXT *)ctx->DriverCtx;
- RECT rect;
-
- /* TODO: only doing first LOD. */
- if ( (ctx->DriverCtx == NULL) || (level > 0) )
- return;
-
- /* Create a dirty rectangle structure. */
- rect.left = xoffset;
- rect.right = xoffset + width;
- rect.top = yoffset;
- rect.bottom = yoffset + height;
-
- CreateTMgrHAL( pContext->pShared,
- tObj->Name,
- 0,
- tObj->Image[0]->Format,
- &rect,
- tObj->Image[0]->Width,
- tObj->Image[0]->Height,
- TM_ACTION_UPDATE,
- (void *)tObj->Image[0]->Data );
-}
-
diff --git a/src/mesa/drivers/d3d/d3dText.h b/src/mesa/drivers/d3d/d3dText.h
deleted file mode 100644
index 9ff0650518b..00000000000
--- a/src/mesa/drivers/d3d/d3dText.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef D3D_TEXT_H
-#define D3D_TEXT_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*===========================================================================*/
-/* Includes. */
-/*===========================================================================*/
-#include <windows.h>
-#include <ddraw.h>
-#include <d3d.h>
-/*===========================================================================*/
-/* Magic numbers. */
-/*===========================================================================*/
-#define D3DLTEXT_BITSUSED 0xFFFFFFFF
-#define MAX_VERTICES 700 // (14*40) 14 per character, 40 characters
-/*===========================================================================*/
-/* Macros defines. */
-/*===========================================================================*/
-/*===========================================================================*/
-/* Type defines. */
-/*===========================================================================*/
-typedef struct _d3dText_metrics
-{
- float fntYScale,
- fntXScale;
-
- int fntXSpacing,
- fntYSpacing;
-
- DWORD dwColor;
- LPDIRECT3DDEVICE3 lpD3DDevice;
-
-} D3DFONTMETRICS, *PD3DFONTMETRICS;
-/*===========================================================================*/
-/* Function prototypes. */
-/*===========================================================================*/
-extern BOOL InitD3DText( void );
-extern void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics );
-extern void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics );
-/*===========================================================================*/
-/* Global variables. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile b/src/mesa/drivers/dri/common/xmlpool/Makefile
deleted file mode 100644
index ef94541c374..00000000000
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile
+++ /dev/null
@@ -1,96 +0,0 @@
-# Convenient makefile for managing translations.
-
-# Prerequisites:
-# - GNU gettext
-# - Python
-
-# Adding new translations
-# -----------------------
-
-# To start working on a new translation edit the POS=... line
-# below. If you want to add for example a french translation, add
-# fr.po.
-
-# Then run "make po" to generate a fresh .po file from translatable
-# strings in t_options.h. Now you can edit the new .po file (fr.po in
-# the example above) to translate the strings. Please make sure that
-# your editor encodes the file in UTF-8.
-
-# Updating existing translations
-# ------------------------------
-
-# Run "make po" to update .po files with new translatable strings from
-# t_options.h. Now you can edit the .po files you're interested
-# in. Please make sure that your editor encodes the file in UTF-8.
-
-# Updating options.h
-# ------------------
-
-# Finally run "make" to generate options.h from t_options.h with all
-# translations. Now you can rebuild the drivers. Any common options
-# used by the drivers will have option descriptions with the latest
-# translations.
-
-# Publishing translations
-# -----------------------
-
-# To get your translation(s) into Mesa CVS, please send me your
-# <lang>.po file.
-
-# More information:
-# - info gettext
-
-# The set of supported languages. Add languages as needed.
-POS=de.po es.po nl.po fr.po
-
-#
-# Don't change anything below, unless you know what you're doing.
-#
-LANGS=$(POS:%.po=%)
-MOS=$(POS:%.po=%/LC_MESSAGES/options.mo)
-POT=xmlpool.pot
-
-.PHONY: all clean pot po mo
-
-all: options.h
-
-# Only intermediate files are cleaned up. options.h is not deleted because
-# it's in CVS.
-clean:
- rm -f $(POT) *~
- rm -rf $(LANGS)
-
-# Default target options.h
-options.h: t_options.h mo
- python gen_xmlpool.py $(LANGS) > options.h
-
-# Update .mo files from the corresponding .po files.
-mo:
- @for mo in $(MOS); do \
- lang=$${mo%%/*}; \
- echo "Updating $$mo from $$lang.po."; \
- mkdir -p $${mo%/*}; \
- msgfmt -o $$mo $$lang.po; \
- done
-
-# Use this target to create or update .po files with new messages in
-# driconf.py.
-po: $(POS)
-
-pot: $(POT)
-
-# Extract message catalog from driconf.py.
-$(POT): t_options.h
- xgettext -L C --from-code utf-8 -o $(POT) t_options.h
-
-# Create or update a .po file for a specific language.
-%.po: $(POT)
- @if [ -f $@ ]; then \
- echo "Merging new strings from $(POT) into $@."; \
- mv $@ $@~; \
- msgmerge -o $@ $@~ $(POT); \
- else \
- echo "Initializing $@ from $(POT)."; \
- msginit -i $(POT) -o $@~ --locale=$*; \
- sed -e 's/charset=.*\\n/charset=UTF-8\\n/' $@~ > $@; \
- fi
diff --git a/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py b/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
deleted file mode 100644
index 7398c4cd0b2..00000000000
--- a/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import gettext
-import re
-
-# List of supported languages
-languages = sys.argv[1:]
-
-# Escape special characters in C strings
-def escapeCString (s):
- escapeSeqs = {'\a' : '\\a', '\b' : '\\b', '\f' : '\\f', '\n' : '\\n',
- '\r' : '\\r', '\t' : '\\t', '\v' : '\\v', '\\' : '\\\\'}
- # " -> '' is a hack. Quotes (") aren't possible in XML attributes.
- # Better use Unicode characters for typographic quotes in option
- # descriptions and translations.
- i = 0
- r = ''
- while i < len(s):
- # Special case: escape double quote with \u201c or \u201d, depending
- # on whether it's an open or close quote. This is needed because plain
- # double quotes are not possible in XML attributes.
- if s[i] == '"':
- if i == len(s)-1 or s[i+1].isspace():
- # close quote
- q = u'\u201c'
- else:
- # open quote
- q = u'\u201d'
- r = r + q
- elif escapeSeqs.has_key(s[i]):
- r = r + escapeSeqs[s[i]]
- else:
- r = r + s[i]
- i = i + 1
- return r
-
-# Expand escape sequences in C strings (needed for gettext lookup)
-def expandCString (s):
- escapeSeqs = {'a' : '\a', 'b' : '\b', 'f' : '\f', 'n' : '\n',
- 'r' : '\r', 't' : '\t', 'v' : '\v',
- '"' : '"', '\\' : '\\'}
- i = 0
- escape = False
- hexa = False
- octa = False
- num = 0
- digits = 0
- r = ''
- while i < len(s):
- if not escape:
- if s[i] == '\\':
- escape = True
- else:
- r = r + s[i]
- elif hexa:
- if (s[i] >= '0' and s[i] <= '9') or \
- (s[i] >= 'a' and s[i] <= 'f') or \
- (s[i] >= 'A' and s[i] <= 'F'):
- num = num * 16 + int(s[i],16)
- digits = digits + 1
- else:
- digits = 2
- if digits >= 2:
- hexa = False
- escape = False
- r = r + chr(num)
- elif octa:
- if s[i] >= '0' and s[i] <= '7':
- num = num * 8 + int(s[i],8)
- digits = digits + 1
- else:
- digits = 3
- if digits >= 3:
- octa = False
- escape = False
- r = r + chr(num)
- else:
- if escapeSeqs.has_key(s[i]):
- r = r + escapeSeqs[s[i]]
- escape = False
- elif s[i] >= '0' and s[i] <= '7':
- octa = True
- num = int(s[i],8)
- if num <= 3:
- digits = 1
- else:
- digits = 2
- elif s[i] == 'x' or s[i] == 'X':
- hexa = True
- num = 0
- digits = 0
- else:
- r = r + s[i]
- escape = False
- i = i + 1
- return r
-
-# Expand matches. The first match is always a DESC or DESC_BEGIN match.
-# Subsequent matches are ENUM matches.
-#
-# DESC, DESC_BEGIN format: \1 \2=<lang> \3 \4=gettext(" \5=<text> \6=") \7
-# ENUM format: \1 \2=gettext(" \3=<text> \4=") \5
-def expandMatches (matches, translations, end=None):
- assert len(matches) > 0
- nTranslations = len(translations)
- i = 0
- # Expand the description+enums for all translations
- for lang,trans in translations:
- i = i + 1
- # Make sure that all but the last line of a simple description
- # are extended with a backslash.
- suffix = ''
- if len(matches) == 1 and i < len(translations) and \
- not matches[0].expand (r'\7').endswith('\\'):
- suffix = ' \\'
- # Expand the description line. Need to use ugettext in order to allow
- # non-ascii unicode chars in the original English descriptions.
- text = escapeCString (trans.ugettext (unicode (expandCString (
- matches[0].expand (r'\5')), "utf-8"))).encode("utf-8")
- print matches[0].expand (r'\1' + lang + r'\3"' + text + r'"\7') + suffix
- # Expand any subsequent enum lines
- for match in matches[1:]:
- text = escapeCString (trans.ugettext (unicode (expandCString (
- match.expand (r'\3')), "utf-8"))).encode("utf-8")
- print match.expand (r'\1"' + text + r'"\5')
-
- # Expand description end
- if end:
- print end,
-
-# Compile a list of translation classes to all supported languages.
-# The first translation is always a NullTranslations.
-translations = [("en", gettext.NullTranslations())]
-for lang in languages:
- try:
- trans = gettext.translation ("options", ".", [lang])
- except IOError:
- sys.stderr.write ("Warning: language '%s' not found.\n" % lang)
- continue
- translations.append ((lang, trans))
-
-# Regular expressions:
-reLibintl_h = re.compile (r'#\s*include\s*<libintl.h>')
-reDESC = re.compile (r'(\s*DRI_CONF_DESC\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reDESC_BEGIN = re.compile (r'(\s*DRI_CONF_DESC_BEGIN\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reENUM = re.compile (r'(\s*DRI_CONF_ENUM\s*\([^,]+,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
-reDESC_END = re.compile (r'\s*DRI_CONF_DESC_END')
-
-# Print a header
-print \
-"/***********************************************************************\n" \
-" *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***\n" \
-" ***********************************************************************/"
-
-# Process the options template and generate options.h with all
-# translations.
-template = file ("t_options.h", "r")
-descMatches = []
-for line in template:
- if len(descMatches) > 0:
- matchENUM = reENUM .match (line)
- matchDESC_END = reDESC_END.match (line)
- if matchENUM:
- descMatches.append (matchENUM)
- elif matchDESC_END:
- expandMatches (descMatches, translations, line)
- descMatches = []
- else:
- sys.stderr.write (
- "Warning: unexpected line inside description dropped:\n%s\n" \
- % line)
- continue
- if reLibintl_h.search (line):
- # Ignore (comment out) #include <libintl.h>
- print "/* %s * commented out by gen_xmlpool.py */" % line
- continue
- matchDESC = reDESC .match (line)
- matchDESC_BEGIN = reDESC_BEGIN.match (line)
- if matchDESC:
- assert len(descMatches) == 0
- expandMatches ([matchDESC], translations)
- elif matchDESC_BEGIN:
- assert len(descMatches) == 0
- descMatches = [matchDESC_BEGIN]
- else:
- print line,
-
-if len(descMatches) > 0:
- sys.stderr.write ("Warning: unterminated description at end of file.\n")
- expandMatches (descMatches, translations)
diff --git a/src/mesa/drivers/dri/dri_client/Makefile b/src/mesa/drivers/dri/dri_client/Makefile
deleted file mode 100644
index 9ab60cdaf80..00000000000
--- a/src/mesa/drivers/dri/dri_client/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-# src/mesa/drivers/dri/gamma/Makefile
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-# Get rid of this:
-#
-DEFINES += -DGLX_DIRECT_RENDERING
-
-C_SOURCES = \
- xf86drm.c \
- xf86drmHash.c \
- xf86drmRandom.c \
- xf86drmSL.c \
-
-
-
-OBJECTS = $(C_SOURCES:.c=.o)
-
-INCLUDES = \
- -I$(TOP)/include \
- -I$(DRM_SOURCE_PATH)/shared-core \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -Iimports
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend dri.a
-
-
-# Run 'make dep' to update the dependencies if you change
-# what's included by any source file.
-depend: $(C_SOURCES) $(ASM_SOURCES)
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) \
- $(C_SOURCES) $(ASM_SOURCES)
-
-
-dri.a: $(OBJECTS)
- rm -f $@
- ar rcv $@ $(OBJECTS)
- ranlib $@
-
-# Remove .o and backup files
-clean:
- -rm -f *.o */*.o *~ *.so *.a depend depend.bak
-
-install:
-
-include depend
diff --git a/src/mesa/drivers/dri/dri_client/imports/xf86drm.h b/src/mesa/drivers/dri/dri_client/imports/xf86drm.h
deleted file mode 100644
index d3d78eb84e8..00000000000
--- a/src/mesa/drivers/dri/dri_client/imports/xf86drm.h
+++ /dev/null
@@ -1,636 +0,0 @@
-/**
- * \file xf86drm.h
- * OS-independent header for DRM user-level library interface.
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- */
-
-/*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * 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 (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
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.26 2003/08/16 19:26:37 dawes Exp $ */
-
-#ifndef _XF86DRM_H_
-#define _XF86DRM_H_
-
-#include <drm.h>
-
- /* Defaults, if nothing set in xf86config */
-#define DRM_DEV_UID 0
-#define DRM_DEV_GID 0
-/* Default /dev/dri directory permissions 0755 */
-#define DRM_DEV_DIRMODE \
- (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
-#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
-
-#define DRM_DIR_NAME "/dev/dri"
-#define DRM_DEV_NAME "%s/card%d"
-#define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */
-
-#define DRM_ERR_NO_DEVICE (-1001)
-#define DRM_ERR_NO_ACCESS (-1002)
-#define DRM_ERR_NOT_ROOT (-1003)
-#define DRM_ERR_INVALID (-1004)
-#define DRM_ERR_NO_FD (-1005)
-
-#define DRM_AGP_NO_HANDLE 0
-
-typedef unsigned int drmSize, *drmSizePtr; /**< For mapped regions */
-typedef void *drmAddress, **drmAddressPtr; /**< For mapped regions */
-
-/**
- * Driver version information.
- *
- * \sa drmGetVersion() and drmSetVersion().
- */
-typedef struct _drmVersion {
- int version_major; /**< Major version */
- int version_minor; /**< Minor version */
- int version_patchlevel; /**< Patch level */
- int name_len; /**< Length of name buffer */
- char *name; /**< Name of driver */
- int date_len; /**< Length of date buffer */
- char *date; /**< User-space buffer to hold date */
- int desc_len; /**< Length of desc buffer */
- char *desc; /**< User-space buffer to hold desc */
-} drmVersion, *drmVersionPtr;
-
-typedef struct _drmStats {
- unsigned long count; /**< Number of data */
- struct {
- unsigned long value; /**< Value from kernel */
- const char *long_format; /**< Suggested format for long_name */
- const char *long_name; /**< Long name for value */
- const char *rate_format; /**< Suggested format for rate_name */
- const char *rate_name; /**< Short name for value per second */
- int isvalue; /**< True if value (vs. counter) */
- const char *mult_names; /**< Multiplier names (e.g., "KGM") */
- int mult; /**< Multiplier value (e.g., 1024) */
- int verbose; /**< Suggest only in verbose output */
- } data[15];
-} drmStatsT;
-
-
- /* All of these enums *MUST* match with the
- kernel implementation -- so do *NOT*
- change them! (The drmlib implementation
- will just copy the flags instead of
- translating them.) */
-typedef enum {
- DRM_FRAME_BUFFER = 0, /**< WC, no caching, no core dump */
- DRM_REGISTERS = 1, /**< no caching, no core dump */
- DRM_SHM = 2, /**< shared, cached */
- DRM_AGP = 3, /**< AGP/GART */
- DRM_SCATTER_GATHER = 4 /**< PCI scatter/gather */
-} drmMapType;
-
-typedef enum {
- DRM_RESTRICTED = 0x0001, /**< Cannot be mapped to client-virtual */
- DRM_READ_ONLY = 0x0002, /**< Read-only in client-virtual */
- DRM_LOCKED = 0x0004, /**< Physical pages locked */
- DRM_KERNEL = 0x0008, /**< Kernel requires access */
- DRM_WRITE_COMBINING = 0x0010, /**< Use write-combining, if available */
- DRM_CONTAINS_LOCK = 0x0020, /**< SHM page that contains lock */
- DRM_REMOVABLE = 0x0040 /**< Removable mapping */
-} drmMapFlags;
-
-/**
- * \warning These values *MUST* match drm.h
- */
-typedef enum {
- /** \name Flags for DMA buffer dispatch */
- /*@{*/
- DRM_DMA_BLOCK = 0x01, /**<
- * Block until buffer dispatched.
- *
- * \note the buffer may not yet have been
- * processed by the hardware -- getting a
- * hardware lock with the hardware quiescent
- * will ensure that the buffer has been
- * processed.
- */
- DRM_DMA_WHILE_LOCKED = 0x02, /**< Dispatch while lock held */
- DRM_DMA_PRIORITY = 0x04, /**< High priority dispatch */
- /*@}*/
-
- /** \name Flags for DMA buffer request */
- /*@{*/
- DRM_DMA_WAIT = 0x10, /**< Wait for free buffers */
- DRM_DMA_SMALLER_OK = 0x20, /**< Smaller-than-requested buffers OK */
- DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */
- /*@}*/
-} drmDMAFlags;
-
-typedef enum {
- DRM_PAGE_ALIGN = 0x01,
- DRM_AGP_BUFFER = 0x02,
- DRM_SG_BUFFER = 0x04
-} drmBufDescFlags;
-
-typedef enum {
- DRM_LOCK_READY = 0x01, /**< Wait until hardware is ready for DMA */
- DRM_LOCK_QUIESCENT = 0x02, /**< Wait until hardware quiescent */
- DRM_LOCK_FLUSH = 0x04, /**< Flush this context's DMA queue first */
- DRM_LOCK_FLUSH_ALL = 0x08, /**< Flush all DMA queues first */
- /* These *HALT* flags aren't supported yet
- -- they will be used to support the
- full-screen DGA-like mode. */
- DRM_HALT_ALL_QUEUES = 0x10, /**< Halt all current and future queues */
- DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */
-} drmLockFlags;
-
-typedef enum {
- DRM_CONTEXT_PRESERVED = 0x01, /**< This context is preserved and
- never swapped. */
- DRM_CONTEXT_2DONLY = 0x02 /**< This context is for 2D rendering only. */
-} drm_context_tFlags, *drm_context_tFlagsPtr;
-
-typedef struct _drmBufDesc {
- int count; /**< Number of buffers of this size */
- int size; /**< Size in bytes */
- int low_mark; /**< Low water mark */
- int high_mark; /**< High water mark */
-} drmBufDesc, *drmBufDescPtr;
-
-typedef struct _drmBufInfo {
- int count; /**< Number of buffers described in list */
- drmBufDescPtr list; /**< List of buffer descriptions */
-} drmBufInfo, *drmBufInfoPtr;
-
-typedef struct _drmBuf {
- int idx; /**< Index into the master buffer list */
- int total; /**< Buffer size */
- int used; /**< Amount of buffer in use (for DMA) */
- drmAddress address; /**< Address */
-} drmBuf, *drmBufPtr;
-
-/**
- * Buffer mapping information.
- *
- * Used by drmMapBufs() and drmUnmapBufs() to store information about the
- * mapped buffers.
- */
-typedef struct _drmBufMap {
- int count; /**< Number of buffers mapped */
- drmBufPtr list; /**< Buffers */
-} drmBufMap, *drmBufMapPtr;
-
-typedef struct _drmLock {
- volatile unsigned int lock;
- char padding[60];
- /* This is big enough for most current (and future?) architectures:
- DEC Alpha: 32 bytes
- Intel Merced: ?
- Intel P5/PPro/PII/PIII: 32 bytes
- Intel StrongARM: 32 bytes
- Intel i386/i486: 16 bytes
- MIPS: 32 bytes (?)
- Motorola 68k: 16 bytes
- Motorola PowerPC: 32 bytes
- Sun SPARC: 32 bytes
- */
-} drmLock, *drmLockPtr;
-
-/**
- * Indices here refer to the offset into
- * list in drmBufInfo
- */
-typedef struct _drmDMAReq {
- drm_context_t context; /**< Context handle */
- int send_count; /**< Number of buffers to send */
- int *send_list; /**< List of handles to buffers */
- int *send_sizes; /**< Lengths of data to send, in bytes */
- drmDMAFlags flags; /**< Flags */
- int request_count; /**< Number of buffers requested */
- int request_size; /**< Desired size of buffers requested */
- int *request_list; /**< Buffer information */
- int *request_sizes; /**< Minimum acceptable sizes */
- int granted_count; /**< Number of buffers granted at this size */
-} drmDMAReq, *drmDMAReqPtr;
-
-typedef struct _drmRegion {
- drm_handle_t handle;
- unsigned int offset;
- drmSize size;
- drmAddress map;
-} drmRegion, *drmRegionPtr;
-
-typedef struct _drmTextureRegion {
- unsigned char next;
- unsigned char prev;
- unsigned char in_use;
- unsigned char padding; /**< Explicitly pad this out */
- unsigned int age;
-} drmTextureRegion, *drmTextureRegionPtr;
-
-
-typedef enum {
- DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
- DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
- DRM_VBLANK_SIGNAL = 0x40000000 /* Send signal instead of blocking */
-} drmVBlankSeqType;
-
-typedef struct _drmVBlankReq {
- drmVBlankSeqType type;
- unsigned int sequence;
- unsigned long signal;
-} drmVBlankReq, *drmVBlankReqPtr;
-
-typedef struct _drmVBlankReply {
- drmVBlankSeqType type;
- unsigned int sequence;
- long tval_sec;
- long tval_usec;
-} drmVBlankReply, *drmVBlankReplyPtr;
-
-typedef union _drmVBlank {
- drmVBlankReq request;
- drmVBlankReply reply;
-} drmVBlank, *drmVBlankPtr;
-
-typedef struct _drmSetVersion {
- int drm_di_major;
- int drm_di_minor;
- int drm_dd_major;
- int drm_dd_minor;
-} drmSetVersion, *drmSetVersionPtr;
-
-
-#define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock)
-
-#define DRM_LOCK_HELD 0x80000000 /**< Hardware lock is held */
-#define DRM_LOCK_CONT 0x40000000 /**< Hardware lock is contended */
-
-#if defined(__GNUC__) && (__GNUC__ >= 2)
-# if defined(__i386) || defined(__amd64__)
- /* Reflect changes here to drmP.h */
-#define DRM_CAS(lock,old,new,__ret) \
- do { \
- int __dummy; /* Can't mark eax as clobbered */ \
- __asm__ __volatile__( \
- "lock ; cmpxchg %4,%1\n\t" \
- "setnz %0" \
- : "=d" (__ret), \
- "=m" (__drm_dummy_lock(lock)), \
- "=a" (__dummy) \
- : "2" (old), \
- "r" (new)); \
- } while (0)
-
-#elif defined(__alpha__)
-
-#define DRM_CAS(lock, old, new, ret) \
- do { \
- int old32; \
- int cur32; \
- __asm__ __volatile__( \
- " mb\n" \
- " zap %4, 0xF0, %0\n" \
- " ldl_l %1, %2\n" \
- " zap %1, 0xF0, %1\n" \
- " cmpeq %0, %1, %1\n" \
- " beq %1, 1f\n" \
- " bis %5, %5, %1\n" \
- " stl_c %1, %2\n" \
- "1: xor %1, 1, %1\n" \
- " stl %1, %3" \
- : "+r" (old32), \
- "+&r" (cur32), \
- "=m" (__drm_dummy_lock(lock)),\
- "=m" (ret) \
- : "r" (old), \
- "r" (new)); \
- } while(0)
-
-#elif defined(__sparc__)
-
-#define DRM_CAS(lock,old,new,__ret) \
-do { register unsigned int __old __asm("o0"); \
- register unsigned int __new __asm("o1"); \
- register volatile unsigned int *__lock __asm("o2"); \
- __old = old; \
- __new = new; \
- __lock = (volatile unsigned int *)lock; \
- __asm__ __volatile__( \
- /*"cas [%2], %3, %0"*/ \
- ".word 0xd3e29008\n\t" \
- /*"membar #StoreStore | #StoreLoad"*/ \
- ".word 0x8143e00a" \
- : "=&r" (__new) \
- : "0" (__new), \
- "r" (__lock), \
- "r" (__old) \
- : "memory"); \
- __ret = (__new != __old); \
-} while(0)
-
-#elif defined(__ia64__)
-
-#ifdef __INTEL_COMPILER
-/* this currently generates bad code (missing stop bits)... */
-#include <ia64intrin.h>
-
-#define DRM_CAS(lock,old,new,__ret) \
- do { \
- unsigned long __result, __old = (old) & 0xffffffff; \
- __mf(); \
- __result = _InterlockedCompareExchange_acq(&__drm_dummy_lock(lock), (new), __old);\
- __ret = (__result) != (__old); \
-/* __ret = (__sync_val_compare_and_swap(&__drm_dummy_lock(lock), \
- (old), (new)) \
- != (old)); */\
- } while (0)
-
-#else
-#define DRM_CAS(lock,old,new,__ret) \
- do { \
- unsigned int __result, __old = (old); \
- __asm__ __volatile__( \
- "mf\n" \
- "mov ar.ccv=%2\n" \
- ";;\n" \
- "cmpxchg4.acq %0=%1,%3,ar.ccv" \
- : "=r" (__result), "=m" (__drm_dummy_lock(lock)) \
- : "r" ((unsigned long)__old), "r" (new) \
- : "memory"); \
- __ret = (__result) != (__old); \
- } while (0)
-
-#endif
-
-#elif defined(__powerpc__)
-
-#define DRM_CAS(lock,old,new,__ret) \
- do { \
- __asm__ __volatile__( \
- "sync;" \
- "0: lwarx %0,0,%1;" \
- " xor. %0,%3,%0;" \
- " bne 1f;" \
- " stwcx. %2,0,%1;" \
- " bne- 0b;" \
- "1: " \
- "sync;" \
- : "=&r"(__ret) \
- : "r"(lock), "r"(new), "r"(old) \
- : "cr0", "memory"); \
- } while (0)
-
-#endif /* architecture */
-#endif /* __GNUC__ >= 2 */
-
-#ifndef DRM_CAS
-#define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
-#endif
-
-#if defined(__alpha__) || defined(__powerpc__)
-#define DRM_CAS_RESULT(_result) int _result
-#else
-#define DRM_CAS_RESULT(_result) char _result
-#endif
-
-#define DRM_LIGHT_LOCK(fd,lock,context) \
- do { \
- DRM_CAS_RESULT(__ret); \
- DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \
- if (__ret) drmGetLock(fd,context,0); \
- } while(0)
-
- /* This one counts fast locks -- for
- benchmarking only. */
-#define DRM_LIGHT_LOCK_COUNT(fd,lock,context,count) \
- do { \
- DRM_CAS_RESULT(__ret); \
- DRM_CAS(lock,context,DRM_LOCK_HELD|context,__ret); \
- if (__ret) drmGetLock(fd,context,0); \
- else ++count; \
- } while(0)
-
-#define DRM_LOCK(fd,lock,context,flags) \
- do { \
- if (flags) drmGetLock(fd,context,flags); \
- else DRM_LIGHT_LOCK(fd,lock,context); \
- } while(0)
-
-#define DRM_UNLOCK(fd,lock,context) \
- do { \
- DRM_CAS_RESULT(__ret); \
- DRM_CAS(lock,DRM_LOCK_HELD|context,context,__ret); \
- if (__ret) drmUnlock(fd,context); \
- } while(0)
-
- /* Simple spin locks */
-#define DRM_SPINLOCK(spin,val) \
- do { \
- DRM_CAS_RESULT(__ret); \
- do { \
- DRM_CAS(spin,0,val,__ret); \
- if (__ret) while ((spin)->lock); \
- } while (__ret); \
- } while(0)
-
-#define DRM_SPINLOCK_TAKE(spin,val) \
- do { \
- DRM_CAS_RESULT(__ret); \
- int cur; \
- do { \
- cur = (*spin).lock; \
- DRM_CAS(spin,cur,val,__ret); \
- } while (__ret); \
- } while(0)
-
-#define DRM_SPINLOCK_COUNT(spin,val,count,__ret) \
- do { \
- int __i; \
- __ret = 1; \
- for (__i = 0; __ret && __i < count; __i++) { \
- DRM_CAS(spin,0,val,__ret); \
- if (__ret) for (;__i < count && (spin)->lock; __i++); \
- } \
- } while(0)
-
-#define DRM_SPINUNLOCK(spin,val) \
- do { \
- DRM_CAS_RESULT(__ret); \
- if ((*spin).lock == val) { /* else server stole lock */ \
- do { \
- DRM_CAS(spin,val,0,__ret); \
- } while (__ret); \
- } \
- } while(0)
-
-/* General user-level programmer's API: unprivileged */
-extern int drmAvailable(void);
-extern int drmOpen(const char *name, const char *busid);
-extern int drmClose(int fd);
-extern drmVersionPtr drmGetVersion(int fd);
-extern drmVersionPtr drmGetLibVersion(int fd);
-extern void drmFreeVersion(drmVersionPtr);
-extern int drmGetMagic(int fd, drm_magic_t * magic);
-extern char *drmGetBusid(int fd);
-extern int drmGetInterruptFromBusID(int fd, int busnum, int devnum,
- int funcnum);
-extern int drmGetMap(int fd, int idx, drm_handle_t *offset,
- drmSize *size, drmMapType *type,
- drmMapFlags *flags, drm_handle_t *handle,
- int *mtrr);
-extern int drmGetClient(int fd, int idx, int *auth, int *pid,
- int *uid, unsigned long *magic,
- unsigned long *iocs);
-extern int drmGetStats(int fd, drmStatsT *stats);
-extern int drmSetInterfaceVersion(int fd, drmSetVersion *version);
-extern int drmCommandNone(int fd, unsigned long drmCommandIndex);
-extern int drmCommandRead(int fd, unsigned long drmCommandIndex,
- void *data, unsigned long size);
-extern int drmCommandWrite(int fd, unsigned long drmCommandIndex,
- void *data, unsigned long size);
-extern int drmCommandWriteRead(int fd, unsigned long drmCommandIndex,
- void *data, unsigned long size);
-
-/* General user-level programmer's API: X server (root) only */
-extern void drmFreeBusid(const char *busid);
-extern int drmSetBusid(int fd, const char *busid);
-extern int drmAuthMagic(int fd, drm_magic_t magic);
-extern int drmAddMap(int fd,
- drm_handle_t offset,
- drmSize size,
- drmMapType type,
- drmMapFlags flags,
- drm_handle_t * handle);
-extern int drmRmMap(int fd, drm_handle_t handle);
-extern int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id,
- drm_handle_t handle);
-
-extern int drmAddBufs(int fd, int count, int size,
- drmBufDescFlags flags,
- int agp_offset);
-extern int drmMarkBufs(int fd, double low, double high);
-extern int drmCreateContext(int fd, drm_context_t * handle);
-extern int drmSetContextFlags(int fd, drm_context_t context,
- drm_context_tFlags flags);
-extern int drmGetContextFlags(int fd, drm_context_t context,
- drm_context_tFlagsPtr flags);
-extern int drmAddContextTag(int fd, drm_context_t context, void *tag);
-extern int drmDelContextTag(int fd, drm_context_t context);
-extern void *drmGetContextTag(int fd, drm_context_t context);
-extern drm_context_t * drmGetReservedContextList(int fd, int *count);
-extern void drmFreeReservedContextList(drm_context_t *);
-extern int drmSwitchToContext(int fd, drm_context_t context);
-extern int drmDestroyContext(int fd, drm_context_t handle);
-extern int drmCreateDrawable(int fd, drm_drawable_t * handle);
-extern int drmDestroyDrawable(int fd, drm_drawable_t handle);
-extern int drmCtlInstHandler(int fd, int irq);
-extern int drmCtlUninstHandler(int fd);
-extern int drmInstallSIGIOHandler(int fd,
- void (*f)(int fd,
- void *oldctx,
- void *newctx));
-extern int drmRemoveSIGIOHandler(int fd);
-
-/* General user-level programmer's API: authenticated client and/or X */
-extern int drmMap(int fd,
- drm_handle_t handle,
- drmSize size,
- drmAddressPtr address);
-extern int drmUnmap(drmAddress address, drmSize size);
-extern drmBufInfoPtr drmGetBufInfo(int fd);
-extern drmBufMapPtr drmMapBufs(int fd);
-extern int drmUnmapBufs(drmBufMapPtr bufs);
-extern int drmDMA(int fd, drmDMAReqPtr request);
-extern int drmFreeBufs(int fd, int count, int *list);
-extern int drmGetLock(int fd,
- drm_context_t context,
- drmLockFlags flags);
-extern int drmUnlock(int fd, drm_context_t context);
-extern int drmFinish(int fd, int context, drmLockFlags flags);
-extern int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id,
- drm_handle_t * handle);
-
-/* AGP/GART support: X server (root) only */
-extern int drmAgpAcquire(int fd);
-extern int drmAgpRelease(int fd);
-extern int drmAgpEnable(int fd, unsigned long mode);
-extern int drmAgpAlloc(int fd, unsigned long size,
- unsigned long type, unsigned long *address,
- unsigned long *handle);
-extern int drmAgpFree(int fd, unsigned long handle);
-extern int drmAgpBind(int fd, unsigned long handle,
- unsigned long offset);
-extern int drmAgpUnbind(int fd, unsigned long handle);
-
-/* AGP/GART info: authenticated client and/or X */
-extern int drmAgpVersionMajor(int fd);
-extern int drmAgpVersionMinor(int fd);
-extern unsigned long drmAgpGetMode(int fd);
-extern unsigned long drmAgpBase(int fd); /* Physical location */
-extern unsigned long drmAgpSize(int fd); /* Bytes */
-extern unsigned long drmAgpMemoryUsed(int fd);
-extern unsigned long drmAgpMemoryAvail(int fd);
-extern unsigned int drmAgpVendorId(int fd);
-extern unsigned int drmAgpDeviceId(int fd);
-
-/* PCI scatter/gather support: X server (root) only */
-extern int drmScatterGatherAlloc(int fd, unsigned long size,
- unsigned long *handle);
-extern int drmScatterGatherFree(int fd, unsigned long handle);
-
-extern int drmWaitVBlank(int fd, drmVBlankPtr vbl);
-
-/* Support routines */
-extern int drmError(int err, const char *label);
-extern void *drmMalloc(int size);
-extern void drmFree(void *pt);
-
-/* Hash table routines */
-extern void *drmHashCreate(void);
-extern int drmHashDestroy(void *t);
-extern int drmHashLookup(void *t, unsigned long key, void **value);
-extern int drmHashInsert(void *t, unsigned long key, void *value);
-extern int drmHashDelete(void *t, unsigned long key);
-extern int drmHashFirst(void *t, unsigned long *key, void **value);
-extern int drmHashNext(void *t, unsigned long *key, void **value);
-
-/* PRNG routines */
-extern void *drmRandomCreate(unsigned long seed);
-extern int drmRandomDestroy(void *state);
-extern unsigned long drmRandom(void *state);
-extern double drmRandomDouble(void *state);
-
-/* Skip list routines */
-
-extern void *drmSLCreate(void);
-extern int drmSLDestroy(void *l);
-extern int drmSLLookup(void *l, unsigned long key, void **value);
-extern int drmSLInsert(void *l, unsigned long key, void *value);
-extern int drmSLDelete(void *l, unsigned long key);
-extern int drmSLNext(void *l, unsigned long *key, void **value);
-extern int drmSLFirst(void *l, unsigned long *key, void **value);
-extern void drmSLDump(void *l);
-extern int drmSLLookupNeighbors(void *l, unsigned long key,
- unsigned long *prev_key, void **prev_value,
- unsigned long *next_key, void **next_value);
-
-#endif
diff --git a/src/mesa/drivers/dri/dri_client/xf86drm.c b/src/mesa/drivers/dri/dri_client/xf86drm.c
deleted file mode 100644
index dba0f98deba..00000000000
--- a/src/mesa/drivers/dri/dri_client/xf86drm.c
+++ /dev/null
@@ -1,2333 +0,0 @@
-/**
- * \file xf86drm.c
- * User-level interface to DRM device
- *
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- * \author Kevin E. Martin <martin@valinux.com>
- */
-
-/*
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * 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 (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
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.36 2003/08/24 17:35:35 tsi Exp $ */
-
-#ifdef XFree86Server
-# include "xf86.h"
-# include "xf86_OSproc.h"
-# include "drm.h"
-# include "xf86_ansic.h"
-# define _DRM_MALLOC xalloc
-# define _DRM_FREE xfree
-# ifndef XFree86LOADER
-# include <sys/mman.h>
-# endif
-#else
-# include <stdio.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <string.h>
-# include <ctype.h>
-# include <fcntl.h>
-# include <errno.h>
-# include <signal.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# define stat_t struct stat
-# include <sys/ioctl.h>
-# include <sys/mman.h>
-# include <sys/time.h>
-# include <stdarg.h>
-# ifdef DRM_USE_MALLOC
-# define _DRM_MALLOC malloc
-# define _DRM_FREE free
-# else
-# include <X11/Xlibint.h>
-# define _DRM_MALLOC Xmalloc
-# define _DRM_FREE Xfree
-# endif
-# include "drm.h"
-#endif
-
-/* No longer needed with CVS kernel modules on alpha
-#if defined(__alpha__) && defined(__linux__)
-extern unsigned long _bus_base(void);
-#define BUS_BASE _bus_base()
-#endif
-*/
-
-/* Not all systems have MAP_FAILED defined */
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-#include "xf86drm.h"
-
-#ifdef __FreeBSD__
-#define DRM_MAJOR 145
-#endif
-
-#ifdef __NetBSD__
-#define DRM_MAJOR 34
-#endif
-
-# ifdef __OpenBSD__
-# define DRM_MAJOR 81
-# endif
-
-#ifndef DRM_MAJOR
-#define DRM_MAJOR 226 /* Linux */
-#endif
-
-#ifndef DRM_MAX_MINOR
-#define DRM_MAX_MINOR 16
-#endif
-
-#ifdef __linux__
-#include <sys/sysmacros.h> /* for makedev() */
-#endif
-
-#ifndef makedev
- /* This definition needs to be changed on
- some systems if dev_t is a structure.
- If there is a header file we can get it
- from, there would be best. */
-#define makedev(x,y) ((dev_t)(((x) << 8) | (y)))
-#endif
-
-#define DRM_MSG_VERBOSITY 3
-
-/**
- * Output a message to stderr.
- *
- * \param format printf() like format string.
- *
- * \internal
- * This function is a wrapper around vfprintf().
- */
-static void
-drmMsg(const char *format, ...)
-{
- va_list ap;
-
-#ifndef XFree86Server
- const char *env;
- if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose"))
-#endif
- {
- va_start(ap, format);
-#ifdef XFree86Server
- xf86VDrvMsgVerb(-1, X_NONE, DRM_MSG_VERBOSITY, format, ap);
-#else
- vfprintf(stderr, format, ap);
-#endif
- va_end(ap);
- }
-}
-
-static void *drmHashTable = NULL; /* Context switch callbacks */
-
-typedef struct drmHashEntry {
- int fd;
- void (*f)(int, void *, void *);
- void *tagTable;
-} drmHashEntry;
-
-void *drmMalloc(int size)
-{
- void *pt;
- if ((pt = _DRM_MALLOC(size))) memset(pt, 0, size);
- return pt;
-}
-
-void drmFree(void *pt)
-{
- if (pt) _DRM_FREE(pt);
-}
-
-/* drmStrdup can't use strdup(3), since it doesn't call _DRM_MALLOC... */
-static char *drmStrdup(const char *s)
-{
- char *retval = NULL;
-
- if (s) {
- retval = _DRM_MALLOC(strlen(s)+1);
- strcpy(retval, s);
- }
- return retval;
-}
-
-
-static unsigned long drmGetKeyFromFd(int fd)
-{
- stat_t st;
-
- st.st_rdev = 0;
- fstat(fd, &st);
- return st.st_rdev;
-}
-
-static drmHashEntry *drmGetEntry(int fd)
-{
- unsigned long key = drmGetKeyFromFd(fd);
- void *value;
- drmHashEntry *entry;
-
- if (!drmHashTable) drmHashTable = drmHashCreate();
-
- if (drmHashLookup(drmHashTable, key, &value)) {
- entry = drmMalloc(sizeof(*entry));
- entry->fd = fd;
- entry->f = NULL;
- entry->tagTable = drmHashCreate();
- drmHashInsert(drmHashTable, key, entry);
- } else {
- entry = value;
- }
- return entry;
-}
-
-/**
- * Compare two busid strings
- *
- * \param first
- * \param second
- *
- * \return 1 if matched.
- *
- * \internal
- * This function compares two bus ID strings. It understands the older
- * PCI:b:d:f format and the newer pci:oooo:bb:dd.f format. In the format, o is
- * domain, b is bus, d is device, f is function.
- */
-static int drmMatchBusID(const char *id1, const char *id2)
-{
- /* First, check if the IDs are exactly the same */
- if (strcasecmp(id1, id2) == 0)
- return 1;
-
- /* Try to match old/new-style PCI bus IDs. */
- if (strncasecmp(id1, "pci", 3) == 0) {
- int o1, b1, d1, f1;
- int o2, b2, d2, f2;
- int ret;
-
- ret = sscanf(id1, "pci:%04x:%02x:%02x.%d", &o1, &b1, &d1, &f1);
- if (ret != 4) {
- o1 = 0;
- ret = sscanf(id1, "PCI:%d:%d:%d", &b1, &d1, &f1);
- if (ret != 3)
- return 0;
- }
-
- ret = sscanf(id2, "pci:%04x:%02x:%02x.%d", &o2, &b2, &d2, &f2);
- if (ret != 4) {
- o2 = 0;
- ret = sscanf(id2, "PCI:%d:%d:%d", &b2, &d2, &f2);
- if (ret != 3)
- return 0;
- }
-
- if ((o1 != o2) || (b1 != b2) || (d1 != d2) || (f1 != f2))
- return 0;
- else
- return 1;
- }
- return 0;
-}
-
-/**
- * Open the DRM device, creating it if necessary.
- *
- * \param dev major and minor numbers of the device.
- * \param minor minor number of the device.
- *
- * \return a file descriptor on success, or a negative value on error.
- *
- * \internal
- * Assembles the device name from \p minor and opens it, creating the device
- * special file node with the major and minor numbers specified by \p dev and
- * parent directory if necessary and was called by root.
- */
-static int drmOpenDevice(long dev, int minor)
-{
- stat_t st;
- char buf[64];
- int fd;
- mode_t devmode = DRM_DEV_MODE;
- int isroot = !geteuid();
-#if defined(XFree86Server)
- uid_t user = DRM_DEV_UID;
- gid_t group = DRM_DEV_GID;
-#endif
-
- sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
- drmMsg("drmOpenDevice: node name is %s\n", buf);
-
-#if defined(XFree86Server)
- devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE;
- devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
- group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID;
-#endif
-
- if (stat(DRM_DIR_NAME, &st)) {
- if (!isroot) return DRM_ERR_NOT_ROOT;
- mkdir(DRM_DIR_NAME, DRM_DEV_DIRMODE);
- chown(DRM_DIR_NAME, 0, 0); /* root:root */
- chmod(DRM_DIR_NAME, DRM_DEV_DIRMODE);
- }
-
- /* Check if the device node exists and create it if necessary. */
- if (stat(buf, &st)) {
- if (!isroot) return DRM_ERR_NOT_ROOT;
- remove(buf);
- mknod(buf, S_IFCHR | devmode, dev);
- }
-#if defined(XFree86Server)
- chown(buf, user, group);
- chmod(buf, devmode);
-#endif
-
- fd = open(buf, O_RDWR, 0);
- drmMsg("drmOpenDevice: open result is %d, (%s)\n",
- fd, fd < 0 ? strerror(errno) : "OK");
- if (fd >= 0) return fd;
-
- /* Check if the device node is not what we expect it to be, and recreate it
- * and try again if so.
- */
- if (st.st_rdev != dev) {
- if (!isroot) return DRM_ERR_NOT_ROOT;
- remove(buf);
- mknod(buf, S_IFCHR | devmode, dev);
-#if defined(XFree86Server)
- chown(buf, user, group);
- chmod(buf, devmode);
-#endif
- }
- fd = open(buf, O_RDWR, 0);
- drmMsg("drmOpenDevice: open result is %d, (%s)\n",
- fd, fd < 0 ? strerror(errno) : "OK");
- if (fd >= 0) return fd;
-
- drmMsg("drmOpenDevice: Open failed\n");
- remove(buf);
- return -errno;
-}
-
-
-/**
- * Open the DRM device
- *
- * \param minor device minor number.
- * \param create allow to create the device if set.
- *
- * \return a file descriptor on success, or a negative value on error.
- *
- * \internal
- * Calls drmOpenDevice() if \p create is set, otherwise assembles the device
- * name from \p minor and opens it.
- */
-static int drmOpenMinor(int minor, int create)
-{
- int fd;
- char buf[64];
-
- if (create) return drmOpenDevice(makedev(DRM_MAJOR, minor), minor);
-
- sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
- if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd;
- return -errno;
-}
-
-
-/**
- * Determine whether the DRM kernel driver has been loaded.
- *
- * \return 1 if the DRM driver is loaded, 0 otherwise.
- *
- * \internal
- * Determine the presence of the kernel driver by attempting to open the 0
- * minor and get version information. For backward compatibility with older
- * Linux implementations, /proc/dri is also checked.
- */
-int drmAvailable(void)
-{
- drmVersionPtr version;
- int retval = 0;
- int fd;
-
- if ((fd = drmOpenMinor(0, 1)) < 0) {
-#ifdef __linux__
- /* Try proc for backward Linux compatibility */
- if (!access("/proc/dri/0", R_OK)) return 1;
-#endif
- return 0;
- }
-
- if ((version = drmGetVersion(fd))) {
- retval = 1;
- drmFreeVersion(version);
- }
- close(fd);
-
- return retval;
-}
-
-
-/**
- * Open the device by bus ID.
- *
- * \param busid bus ID.
- *
- * \return a file descriptor on success, or a negative value on error.
- *
- * \internal
- * This function attempts to open every possible minor (up to DRM_MAX_MINOR),
- * comparing the device bus ID with the one supplied.
- *
- * \sa drmOpenMinor() and drmGetBusid().
- */
-static int drmOpenByBusid(const char *busid)
-{
- int i;
- int fd;
- const char *buf;
- drmSetVersion sv;
-
- drmMsg("drmOpenByBusid: Searching for BusID %s\n", busid);
- for (i = 0; i < DRM_MAX_MINOR; i++) {
- fd = drmOpenMinor(i, 1);
- drmMsg("drmOpenByBusid: drmOpenMinor returns %d\n", fd);
- if (fd >= 0) {
- sv.drm_di_major = 1;
- sv.drm_di_minor = 1;
- sv.drm_dd_major = -1; /* Don't care */
- drmSetInterfaceVersion(fd, &sv);
- buf = drmGetBusid(fd);
- drmMsg("drmOpenByBusid: drmGetBusid reports %s\n", buf);
- if (buf && drmMatchBusID(buf, busid)) {
- drmFreeBusid(buf);
- return fd;
- }
- if (buf) drmFreeBusid(buf);
- close(fd);
- }
- }
- return -1;
-}
-
-
-/**
- * Open the device by name.
- *
- * \param name driver name.
- *
- * \return a file descriptor on success, or a negative value on error.
- *
- * \internal
- * This function opens the first minor number that matches the driver name and
- * isn't already in use. If it's in use it then it will already have a bus ID
- * assigned.
- *
- * \sa drmOpenMinor(), drmGetVersion() and drmGetBusid().
- */
-static int drmOpenByName(const char *name)
-{
- int i;
- int fd;
- drmVersionPtr version;
- char * id;
-
- if (!drmAvailable()) {
-#if !defined(XFree86Server)
- return -1;
-#else
- /* try to load the kernel module now */
- if (!xf86LoadKernelModule(name)) {
- ErrorF("[drm] failed to load kernel module \"%s\"\n",
- name);
- return -1;
- }
-#endif
- }
-
- /*
- * Open the first minor number that matches the driver name and isn't
- * already in use. If it's in use it will have a busid assigned already.
- */
- for (i = 0; i < DRM_MAX_MINOR; i++) {
- if ((fd = drmOpenMinor(i, 1)) >= 0) {
- if ((version = drmGetVersion(fd))) {
- if (!strcmp(version->name, name)) {
- drmFreeVersion(version);
- id = drmGetBusid(fd);
- drmMsg("drmGetBusid returned '%s'\n", id ? id : "NULL");
- if (!id || !*id) {
- if (id) {
- drmFreeBusid(id);
- }
- return fd;
- } else {
- drmFreeBusid(id);
- }
- } else {
- drmFreeVersion(version);
- }
- }
- close(fd);
- }
- }
-
-#ifdef __linux__
- /* Backward-compatibility /proc support */
- for (i = 0; i < 8; i++) {
- char proc_name[64], buf[512];
- char *driver, *pt, *devstring;
- int retcode;
-
- sprintf(proc_name, "/proc/dri/%d/name", i);
- if ((fd = open(proc_name, 0, 0)) >= 0) {
- retcode = read(fd, buf, sizeof(buf)-1);
- close(fd);
- if (retcode) {
- buf[retcode-1] = '\0';
- for (driver = pt = buf; *pt && *pt != ' '; ++pt)
- ;
- if (*pt) { /* Device is next */
- *pt = '\0';
- if (!strcmp(driver, name)) { /* Match */
- for (devstring = ++pt; *pt && *pt != ' '; ++pt)
- ;
- if (*pt) { /* Found busid */
- return drmOpenByBusid(++pt);
- } else { /* No busid */
- return drmOpenDevice(strtol(devstring, NULL, 0),i);
- }
- }
- }
- }
- }
- }
-#endif
-
- return -1;
-}
-
-
-/**
- * Open the DRM device.
- *
- * Looks up the specified name and bus ID, and opens the device found. The
- * entry in /dev/dri is created if necessary and if called by root.
- *
- * \param name driver name. Not referenced if bus ID is supplied.
- * \param busid bus ID. Zero if not known.
- *
- * \return a file descriptor on success, or a negative value on error.
- *
- * \internal
- * It calls drmOpenByBusid() if \p busid is specified or drmOpenByName()
- * otherwise.
- */
-int drmOpen(const char *name, const char *busid)
-{
-#ifdef XFree86Server
- if (!drmAvailable() && name != NULL) {
- /* try to load the kernel */
- if (!xf86LoadKernelModule(name)) {
- ErrorF("[drm] failed to load kernel module \"%s\"\n",
- name);
- return -1;
- }
- }
-#endif
-
- if (busid) {
- int fd;
-
- fd = drmOpenByBusid(busid);
- if (fd >= 0)
- return fd;
- }
- if (name)
- return drmOpenByName(name);
- return -1;
-}
-
-
-/**
- * Free the version information returned by drmGetVersion().
- *
- * \param v pointer to the version information.
- *
- * \internal
- * It frees the memory pointed by \p %v as well as all the non-null strings
- * pointers in it.
- */
-void drmFreeVersion(drmVersionPtr v)
-{
- if (!v) return;
- if (v->name) drmFree(v->name);
- if (v->date) drmFree(v->date);
- if (v->desc) drmFree(v->desc);
- drmFree(v);
-}
-
-
-/**
- * Free the non-public version information returned by the kernel.
- *
- * \param v pointer to the version information.
- *
- * \internal
- * Used by drmGetVersion() to free the memory pointed by \p %v as well as all
- * the non-null strings pointers in it.
- */
-static void drmFreeKernelVersion(drm_version_t *v)
-{
- if (!v) return;
- if (v->name) drmFree(v->name);
- if (v->date) drmFree(v->date);
- if (v->desc) drmFree(v->desc);
- drmFree(v);
-}
-
-
-/**
- * Copy version information.
- *
- * \param d destination pointer.
- * \param s source pointer.
- *
- * \internal
- * Used by drmGetVersion() to translate the information returned by the ioctl
- * interface in a private structure into the public structure counterpart.
- */
-static void drmCopyVersion(drmVersionPtr d, const drm_version_t *s)
-{
- d->version_major = s->version_major;
- d->version_minor = s->version_minor;
- d->version_patchlevel = s->version_patchlevel;
- d->name_len = s->name_len;
- d->name = drmStrdup(s->name);
- d->date_len = s->date_len;
- d->date = drmStrdup(s->date);
- d->desc_len = s->desc_len;
- d->desc = drmStrdup(s->desc);
-}
-
-
-/**
- * Query the driver version information.
- *
- * \param fd file descriptor.
- *
- * \return pointer to a drmVersion structure which should be freed with
- * drmFreeVersion().
- *
- * \note Similar information is available via /proc/dri.
- *
- * \internal
- * It gets the version information via successive DRM_IOCTL_VERSION ioctls,
- * first with zeros to get the string lengths, and then the actually strings.
- * It also null-terminates them since they might not be already.
- */
-drmVersionPtr drmGetVersion(int fd)
-{
- drmVersionPtr retval;
- drm_version_t *version = drmMalloc(sizeof(*version));
-
- /* First, get the lengths */
- version->name_len = 0;
- version->name = NULL;
- version->date_len = 0;
- version->date = NULL;
- version->desc_len = 0;
- version->desc = NULL;
-
- if (ioctl(fd, DRM_IOCTL_VERSION, version)) {
- drmFreeKernelVersion(version);
- return NULL;
- }
-
- /* Now, allocate space and get the data */
- if (version->name_len)
- version->name = drmMalloc(version->name_len + 1);
- if (version->date_len)
- version->date = drmMalloc(version->date_len + 1);
- if (version->desc_len)
- version->desc = drmMalloc(version->desc_len + 1);
-
- if (ioctl(fd, DRM_IOCTL_VERSION, version)) {
- drmMsg("DRM_IOCTL_VERSION: %s\n", strerror(errno));
- drmFreeKernelVersion(version);
- return NULL;
- }
-
- /* The results might not be null-terminated
- strings, so terminate them. */
-
- if (version->name_len) version->name[version->name_len] = '\0';
- if (version->date_len) version->date[version->date_len] = '\0';
- if (version->desc_len) version->desc[version->desc_len] = '\0';
-
- /* Now, copy it all back into the
- client-visible data structure... */
- retval = drmMalloc(sizeof(*retval));
- drmCopyVersion(retval, version);
- drmFreeKernelVersion(version);
- return retval;
-}
-
-
-/**
- * Get version information for the DRM user space library.
- *
- * This version number is driver independent.
- *
- * \param fd file descriptor.
- *
- * \return version information.
- *
- * \internal
- * This function allocates and fills a drm_version structure with a hard coded
- * version number.
- */
-drmVersionPtr drmGetLibVersion(int fd)
-{
- drm_version_t *version = drmMalloc(sizeof(*version));
-
- /* Version history:
- * revision 1.0.x = original DRM interface with no drmGetLibVersion
- * entry point and many drm<Device> extensions
- * revision 1.1.x = added drmCommand entry points for device extensions
- * added drmGetLibVersion to identify libdrm.a version
- * revision 1.2.x = added drmSetInterfaceVersion
- * modified drmOpen to handle both busid and name
- */
- version->version_major = 1;
- version->version_minor = 2;
- version->version_patchlevel = 0;
-
- return (drmVersionPtr)version;
-}
-
-
-/**
- * Free the bus ID information.
- *
- * \param busid bus ID information string as given by drmGetBusid().
- *
- * \internal
- * This function is just frees the memory pointed by \p busid.
- */
-void drmFreeBusid(const char *busid)
-{
- drmFree((void *)busid);
-}
-
-
-/**
- * Get the bus ID of the device.
- *
- * \param fd file descriptor.
- *
- * \return bus ID string.
- *
- * \internal
- * This function gets the bus ID via successive DRM_IOCTL_GET_UNIQUE ioctls to
- * get the string length and data, passing the arguments in a drm_unique
- * structure.
- */
-char *drmGetBusid(int fd)
-{
- drm_unique_t u;
-
- u.unique_len = 0;
- u.unique = NULL;
-
- if (ioctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) return NULL;
- u.unique = drmMalloc(u.unique_len + 1);
- if (ioctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) return NULL;
- u.unique[u.unique_len] = '\0';
-
- return u.unique;
-}
-
-
-/**
- * Set the bus ID of the device.
- *
- * \param fd file descriptor.
- * \param busid bus ID string.
- *
- * \return zero on success, negative on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_SET_UNIQUE ioctl, passing
- * the arguments in a drm_unique structure.
- */
-int drmSetBusid(int fd, const char *busid)
-{
- drm_unique_t u;
-
- u.unique = (char *)busid;
- u.unique_len = strlen(busid);
-
- if (ioctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) {
- return -errno;
- }
- return 0;
-}
-
-int drmGetMagic(int fd, drm_magic_t * magic)
-{
- drm_auth_t auth;
-
- *magic = 0;
- if (ioctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) return -errno;
- *magic = auth.magic;
- return 0;
-}
-
-int drmAuthMagic(int fd, drm_magic_t magic)
-{
- drm_auth_t auth;
-
- auth.magic = magic;
- if (ioctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) return -errno;
- return 0;
-}
-
-/**
- * Specifies a range of memory that is available for mapping by a
- * non-root process.
- *
- * \param fd file descriptor.
- * \param offset usually the physical address. The actual meaning depends of
- * the \p type parameter. See below.
- * \param size of the memory in bytes.
- * \param type type of the memory to be mapped.
- * \param flags combination of several flags to modify the function actions.
- * \param handle will be set to a value that may be used as the offset
- * parameter for mmap().
- *
- * \return zero on success or a negative value on error.
- *
- * \par Mapping the frame buffer
- * For the frame buffer
- * - \p offset will be the physical address of the start of the frame buffer,
- * - \p size will be the size of the frame buffer in bytes, and
- * - \p type will be DRM_FRAME_BUFFER.
- *
- * \par
- * The area mapped will be uncached. If MTRR support is available in the
- * kernel, the frame buffer area will be set to write combining.
- *
- * \par Mapping the MMIO register area
- * For the MMIO register area,
- * - \p offset will be the physical address of the start of the register area,
- * - \p size will be the size of the register area bytes, and
- * - \p type will be DRM_REGISTERS.
- * \par
- * The area mapped will be uncached.
- *
- * \par Mapping the SAREA
- * For the SAREA,
- * - \p offset will be ignored and should be set to zero,
- * - \p size will be the desired size of the SAREA in bytes,
- * - \p type will be DRM_SHM.
- *
- * \par
- * A shared memory area of the requested size will be created and locked in
- * kernel memory. This area may be mapped into client-space by using the handle
- * returned.
- *
- * \note May only be called by root.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_ADD_MAP ioctl, passing
- * the arguments in a drm_map structure.
- */
-int drmAddMap(int fd,
- drm_handle_t offset,
- drmSize size,
- drmMapType type,
- drmMapFlags flags,
- drm_handle_t * handle)
-{
- drm_map_t map;
-
- map.offset = offset;
-/* No longer needed with CVS kernel modules on alpha
-#ifdef __alpha__
- if (type != DRM_SHM)
- map.offset += BUS_BASE;
-#endif
-*/
- map.size = size;
- map.handle = 0;
- map.type = type;
- map.flags = flags;
- if (ioctl(fd, DRM_IOCTL_ADD_MAP, &map)) return -errno;
- if (handle) *handle = (drm_handle_t)map.handle;
- return 0;
-}
-
-int drmRmMap(int fd, drm_handle_t handle)
-{
- drm_map_t map;
-
- map.handle = (void *)handle;
-
- if(ioctl(fd, DRM_IOCTL_RM_MAP, &map)) return -errno;
- return 0;
-}
-
-/**
- * Make buffers available for DMA transfers.
- *
- * \param fd file descriptor.
- * \param count number of buffers.
- * \param size size of each buffer.
- * \param flags buffer allocation flags.
- * \param agp_offset offset in the AGP aperture
- *
- * \return number of buffers allocated, negative on error.
- *
- * \internal
- * This function is a wrapper around DRM_IOCTL_ADD_BUFS ioctl.
- *
- * \sa drm_buf_desc.
- */
-int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags,
- int agp_offset)
-{
- drm_buf_desc_t request;
-
- request.count = count;
- request.size = size;
- request.low_mark = 0;
- request.high_mark = 0;
- request.flags = flags;
- request.agp_start = agp_offset;
-
- if (ioctl(fd, DRM_IOCTL_ADD_BUFS, &request)) return -errno;
- return request.count;
-}
-
-int drmMarkBufs(int fd, double low, double high)
-{
- drm_buf_info_t info;
- int i;
-
- info.count = 0;
- info.list = NULL;
-
- if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return -EINVAL;
-
- if (!info.count) return -EINVAL;
-
- if (!(info.list = drmMalloc(info.count * sizeof(*info.list))))
- return -ENOMEM;
-
- if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) {
- int retval = -errno;
- drmFree(info.list);
- return retval;
- }
-
- for (i = 0; i < info.count; i++) {
- info.list[i].low_mark = low * info.list[i].count;
- info.list[i].high_mark = high * info.list[i].count;
- if (ioctl(fd, DRM_IOCTL_MARK_BUFS, &info.list[i])) {
- int retval = -errno;
- drmFree(info.list);
- return retval;
- }
- }
- drmFree(info.list);
-
- return 0;
-}
-
-/**
- * Free buffers.
- *
- * \param fd file descriptor.
- * \param count number of buffers to free.
- * \param list list of buffers to be freed.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \note This function is primarily used for debugging.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_FREE_BUFS ioctl, passing
- * the arguments in a drm_buf_free structure.
- */
-int drmFreeBufs(int fd, int count, int *list)
-{
- drm_buf_free_t request;
-
- request.count = count;
- request.list = list;
- if (ioctl(fd, DRM_IOCTL_FREE_BUFS, &request)) return -errno;
- return 0;
-}
-
-
-/**
- * Close the device.
- *
- * \param fd file descriptor.
- *
- * \internal
- * This function closes the file descriptor.
- */
-int drmClose(int fd)
-{
- unsigned long key = drmGetKeyFromFd(fd);
- drmHashEntry *entry = drmGetEntry(fd);
-
- drmHashDestroy(entry->tagTable);
- entry->fd = 0;
- entry->f = NULL;
- entry->tagTable = NULL;
-
- drmHashDelete(drmHashTable, key);
- drmFree(entry);
-
- return close(fd);
-}
-
-
-/**
- * Map a region of memory.
- *
- * \param fd file descriptor.
- * \param handle handle returned by drmAddMap().
- * \param size size in bytes. Must match the size used by drmAddMap().
- * \param address will contain the user-space virtual address where the mapping
- * begins.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper for mmap().
- */
-int drmMap(int fd,
- drm_handle_t handle,
- drmSize size,
- drmAddressPtr address)
-{
- static unsigned long pagesize_mask = 0;
-
- if (fd < 0) return -EINVAL;
-
- if (!pagesize_mask)
- pagesize_mask = getpagesize() - 1;
-
- size = (size + pagesize_mask) & ~pagesize_mask;
-
- *address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle);
- if (*address == MAP_FAILED) return -errno;
- return 0;
-}
-
-
-/**
- * Unmap mappings obtained with drmMap().
- *
- * \param address address as given by drmMap().
- * \param size size in bytes. Must match the size used by drmMap().
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper for unmap().
- */
-int drmUnmap(drmAddress address, drmSize size)
-{
- return munmap(address, size);
-}
-
-drmBufInfoPtr drmGetBufInfo(int fd)
-{
- drm_buf_info_t info;
- drmBufInfoPtr retval;
- int i;
-
- info.count = 0;
- info.list = NULL;
-
- if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return NULL;
-
- if (info.count) {
- if (!(info.list = drmMalloc(info.count * sizeof(*info.list))))
- return NULL;
-
- if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) {
- drmFree(info.list);
- return NULL;
- }
- /* Now, copy it all back into the
- client-visible data structure... */
- retval = drmMalloc(sizeof(*retval));
- retval->count = info.count;
- retval->list = drmMalloc(info.count * sizeof(*retval->list));
- for (i = 0; i < info.count; i++) {
- retval->list[i].count = info.list[i].count;
- retval->list[i].size = info.list[i].size;
- retval->list[i].low_mark = info.list[i].low_mark;
- retval->list[i].high_mark = info.list[i].high_mark;
- }
- drmFree(info.list);
- return retval;
- }
- return NULL;
-}
-
-/**
- * Map all DMA buffers into client-virtual space.
- *
- * \param fd file descriptor.
- *
- * \return a pointer to a ::drmBufMap structure.
- *
- * \note The client may not use these buffers until obtaining buffer indices
- * with drmDMA().
- *
- * \internal
- * This function calls the DRM_IOCTL_MAP_BUFS ioctl and copies the returned
- * information about the buffers in a drm_buf_map structure into the
- * client-visible data structures.
- */
-drmBufMapPtr drmMapBufs(int fd)
-{
- drm_buf_map_t bufs;
- drmBufMapPtr retval;
- int i;
-
- bufs.count = 0;
- bufs.list = NULL;
- bufs.virtual = NULL;
- if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) return NULL;
-
- if (!bufs.count) return NULL;
-
- if (!(bufs.list = drmMalloc(bufs.count * sizeof(*bufs.list))))
- return NULL;
-
- if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) {
- drmFree(bufs.list);
- return NULL;
- }
- /* Now, copy it all back into the
- client-visible data structure... */
- retval = drmMalloc(sizeof(*retval));
- retval->count = bufs.count;
- retval->list = drmMalloc(bufs.count * sizeof(*retval->list));
- for (i = 0; i < bufs.count; i++) {
- retval->list[i].idx = bufs.list[i].idx;
- retval->list[i].total = bufs.list[i].total;
- retval->list[i].used = 0;
- retval->list[i].address = bufs.list[i].address;
- }
-
- drmFree(bufs.list);
-
- return retval;
-}
-
-
-/**
- * Unmap buffers allocated with drmMapBufs().
- *
- * \return zero on success, or negative value on failure.
- *
- * \internal
- * Calls munmap() for every buffer stored in \p bufs and frees the
- * memory allocated by drmMapBufs().
- */
-int drmUnmapBufs(drmBufMapPtr bufs)
-{
- int i;
-
- for (i = 0; i < bufs->count; i++) {
- munmap(bufs->list[i].address, bufs->list[i].total);
- }
-
- drmFree(bufs->list);
- drmFree(bufs);
-
- return 0;
-}
-
-
-#define DRM_DMA_RETRY 16
-
-/**
- * Reserve DMA buffers.
- *
- * \param fd file descriptor.
- * \param request
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * Assemble the arguments into a drm_dma structure and keeps issuing the
- * DRM_IOCTL_DMA ioctl until success or until maximum number of retries.
- */
-int drmDMA(int fd, drmDMAReqPtr request)
-{
- drm_dma_t dma;
- int ret, i = 0;
-
- /* Copy to hidden structure */
- dma.context = request->context;
- dma.send_count = request->send_count;
- dma.send_indices = request->send_list;
- dma.send_sizes = request->send_sizes;
- dma.flags = request->flags;
- dma.request_count = request->request_count;
- dma.request_size = request->request_size;
- dma.request_indices = request->request_list;
- dma.request_sizes = request->request_sizes;
- dma.granted_count = 0;
-
- do {
- ret = ioctl( fd, DRM_IOCTL_DMA, &dma );
- } while ( ret && errno == EAGAIN && i++ < DRM_DMA_RETRY );
-
- if ( ret == 0 ) {
- request->granted_count = dma.granted_count;
- return 0;
- } else {
- return -errno;
- }
-}
-
-
-/**
- * Obtain heavyweight hardware lock.
- *
- * \param fd file descriptor.
- * \param context context.
- * \param flags flags that determine the sate of the hardware when the function
- * returns.
- *
- * \return always zero.
- *
- * \internal
- * This function translates the arguments into a drm_lock structure and issue
- * the DRM_IOCTL_LOCK ioctl until the lock is successfully acquired.
- */
-int drmGetLock(int fd, drm_context_t context, drmLockFlags flags)
-{
- drm_lock_t lock;
-
- lock.context = context;
- lock.flags = 0;
- if (flags & DRM_LOCK_READY) lock.flags |= _DRM_LOCK_READY;
- if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT;
- if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH;
- if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL;
- if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES;
- if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES;
-
- while (ioctl(fd, DRM_IOCTL_LOCK, &lock))
- ;
- return 0;
-}
-
-/**
- * Release the hardware lock.
- *
- * \param fd file descriptor.
- * \param context context.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_UNLOCK ioctl, passing the
- * argument in a drm_lock structure.
- */
-int drmUnlock(int fd, drm_context_t context)
-{
- drm_lock_t lock;
-
- lock.context = context;
- lock.flags = 0;
- return ioctl(fd, DRM_IOCTL_UNLOCK, &lock);
-}
-
-drm_context_t * drmGetReservedContextList(int fd, int *count)
-{
- drm_ctx_res_t res;
- drm_ctx_t *list;
- drm_context_t * retval;
- int i;
-
- res.count = 0;
- res.contexts = NULL;
- if (ioctl(fd, DRM_IOCTL_RES_CTX, &res)) return NULL;
-
- if (!res.count) return NULL;
-
- if (!(list = drmMalloc(res.count * sizeof(*list)))) return NULL;
- if (!(retval = drmMalloc(res.count * sizeof(*retval)))) {
- drmFree(list);
- return NULL;
- }
-
- res.contexts = list;
- if (ioctl(fd, DRM_IOCTL_RES_CTX, &res)) return NULL;
-
- for (i = 0; i < res.count; i++) retval[i] = list[i].handle;
- drmFree(list);
-
- *count = res.count;
- return retval;
-}
-
-void drmFreeReservedContextList(drm_context_t * pt)
-{
- drmFree(pt);
-}
-
-/**
- * Create context.
- *
- * Used by the X server during GLXContext initialization. This causes
- * per-context kernel-level resources to be allocated.
- *
- * \param fd file descriptor.
- * \param handle is set on success. To be used by the client when requesting DMA
- * dispatch with drmDMA().
- *
- * \return zero on success, or a negative value on failure.
- *
- * \note May only be called by root.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_ADD_CTX ioctl, passing the
- * argument in a drm_ctx structure.
- */
-int drmCreateContext(int fd, drm_context_t * handle)
-{
- drm_ctx_t ctx;
-
- ctx.flags = 0; /* Modified with functions below */
- if (ioctl(fd, DRM_IOCTL_ADD_CTX, &ctx)) return -errno;
- *handle = ctx.handle;
- return 0;
-}
-
-int drmSwitchToContext(int fd, drm_context_t context)
-{
- drm_ctx_t ctx;
-
- ctx.handle = context;
- if (ioctl(fd, DRM_IOCTL_SWITCH_CTX, &ctx)) return -errno;
- return 0;
-}
-
-int drmSetContextFlags(int fd, drm_context_t context, drm_context_tFlags flags)
-{
- drm_ctx_t ctx;
-
- /* Context preserving means that no context
- switched are done between DMA buffers
- from one context and the next. This is
- suitable for use in the X server (which
- promises to maintain hardware context,
- or in the client-side library when
- buffers are swapped on behalf of two
- threads. */
- ctx.handle = context;
- ctx.flags = 0;
- if (flags & DRM_CONTEXT_PRESERVED) ctx.flags |= _DRM_CONTEXT_PRESERVED;
- if (flags & DRM_CONTEXT_2DONLY) ctx.flags |= _DRM_CONTEXT_2DONLY;
- if (ioctl(fd, DRM_IOCTL_MOD_CTX, &ctx)) return -errno;
- return 0;
-}
-
-int drmGetContextFlags(int fd, drm_context_t context, drm_context_tFlagsPtr flags)
-{
- drm_ctx_t ctx;
-
- ctx.handle = context;
- if (ioctl(fd, DRM_IOCTL_GET_CTX, &ctx)) return -errno;
- *flags = 0;
- if (ctx.flags & _DRM_CONTEXT_PRESERVED) *flags |= DRM_CONTEXT_PRESERVED;
- if (ctx.flags & _DRM_CONTEXT_2DONLY) *flags |= DRM_CONTEXT_2DONLY;
- return 0;
-}
-
-/**
- * Destroy context.
- *
- * Free any kernel-level resources allocated with drmCreateContext() associated
- * with the context.
- *
- * \param fd file descriptor.
- * \param handle handle given by drmCreateContext().
- *
- * \return zero on success, or a negative value on failure.
- *
- * \note May only be called by root.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_RM_CTX ioctl, passing the
- * argument in a drm_ctx structure.
- */
-int drmDestroyContext(int fd, drm_context_t handle)
-{
- drm_ctx_t ctx;
- ctx.handle = handle;
- if (ioctl(fd, DRM_IOCTL_RM_CTX, &ctx)) return -errno;
- return 0;
-}
-
-int drmCreateDrawable(int fd, drm_drawable_t * handle)
-{
- drm_draw_t draw;
- if (ioctl(fd, DRM_IOCTL_ADD_DRAW, &draw)) return -errno;
- *handle = draw.handle;
- return 0;
-}
-
-int drmDestroyDrawable(int fd, drm_drawable_t handle)
-{
- drm_draw_t draw;
- draw.handle = handle;
- if (ioctl(fd, DRM_IOCTL_RM_DRAW, &draw)) return -errno;
- return 0;
-}
-
-/**
- * Acquire the AGP device.
- *
- * Must be called before any of the other AGP related calls.
- *
- * \param fd file descriptor.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_ACQUIRE ioctl.
- */
-int drmAgpAcquire(int fd)
-{
- if (ioctl(fd, DRM_IOCTL_AGP_ACQUIRE, NULL)) return -errno;
- return 0;
-}
-
-
-/**
- * Release the AGP device.
- *
- * \param fd file descriptor.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_RELEASE ioctl.
- */
-int drmAgpRelease(int fd)
-{
- if (ioctl(fd, DRM_IOCTL_AGP_RELEASE, NULL)) return -errno;
- return 0;
-}
-
-
-/**
- * Set the AGP mode.
- *
- * \param fd file descriptor.
- * \param mode AGP mode.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_ENABLE ioctl, passing the
- * argument in a drm_agp_mode structure.
- */
-int drmAgpEnable(int fd, unsigned long mode)
-{
- drm_agp_mode_t m;
-
- m.mode = mode;
- if (ioctl(fd, DRM_IOCTL_AGP_ENABLE, &m)) return -errno;
- return 0;
-}
-
-
-/**
- * Allocate a chunk of AGP memory.
- *
- * \param fd file descriptor.
- * \param size requested memory size in bytes. Will be rounded to page boundary.
- * \param type type of memory to allocate.
- * \param address if not zero, will be set to the physical address of the
- * allocated memory.
- * \param handle on success will be set to a handle of the allocated memory.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_ALLOC ioctl, passing the
- * arguments in a drm_agp_buffer structure.
- */
-int drmAgpAlloc(int fd, unsigned long size, unsigned long type,
- unsigned long *address, unsigned long *handle)
-{
- drm_agp_buffer_t b;
-
- *handle = DRM_AGP_NO_HANDLE;
- b.size = size;
- b.handle = 0;
- b.type = type;
- if (ioctl(fd, DRM_IOCTL_AGP_ALLOC, &b)) return -errno;
- if (address != 0UL) *address = b.physical;
- *handle = b.handle;
- return 0;
-}
-
-
-/**
- * Free a chunk of AGP memory.
- *
- * \param fd file descriptor.
- * \param handle handle to the allocated memory, as given by drmAgpAllocate().
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_FREE ioctl, passing the
- * argument in a drm_agp_buffer structure.
- */
-int drmAgpFree(int fd, unsigned long handle)
-{
- drm_agp_buffer_t b;
-
- b.size = 0;
- b.handle = handle;
- if (ioctl(fd, DRM_IOCTL_AGP_FREE, &b)) return -errno;
- return 0;
-}
-
-
-/**
- * Bind a chunk of AGP memory.
- *
- * \param fd file descriptor.
- * \param handle handle to the allocated memory, as given by drmAgpAllocate().
- * \param offset offset in bytes. It will round to page boundary.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_BIND ioctl, passing the
- * argument in a drm_agp_binding structure.
- */
-int drmAgpBind(int fd, unsigned long handle, unsigned long offset)
-{
- drm_agp_binding_t b;
-
- b.handle = handle;
- b.offset = offset;
- if (ioctl(fd, DRM_IOCTL_AGP_BIND, &b)) return -errno;
- return 0;
-}
-
-
-/**
- * Unbind a chunk of AGP memory.
- *
- * \param fd file descriptor.
- * \param handle handle to the allocated memory, as given by drmAgpAllocate().
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_UNBIND ioctl, passing
- * the argument in a drm_agp_binding structure.
- */
-int drmAgpUnbind(int fd, unsigned long handle)
-{
- drm_agp_binding_t b;
-
- b.handle = handle;
- b.offset = 0;
- if (ioctl(fd, DRM_IOCTL_AGP_UNBIND, &b)) return -errno;
- return 0;
-}
-
-
-/**
- * Get AGP driver major version number.
- *
- * \param fd file descriptor.
- *
- * \return major version number on success, or a negative value on failure..
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-int drmAgpVersionMajor(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return -errno;
- return i.agp_version_major;
-}
-
-
-/**
- * Get AGP driver minor version number.
- *
- * \param fd file descriptor.
- *
- * \return minor version number on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-int drmAgpVersionMinor(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return -errno;
- return i.agp_version_minor;
-}
-
-
-/**
- * Get AGP mode.
- *
- * \param fd file descriptor.
- *
- * \return mode on success, or zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned long drmAgpGetMode(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.mode;
-}
-
-
-/**
- * Get AGP aperture base.
- *
- * \param fd file descriptor.
- *
- * \return aperture base on success, zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned long drmAgpBase(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.aperture_base;
-}
-
-
-/**
- * Get AGP aperture size.
- *
- * \param fd file descriptor.
- *
- * \return aperture size on success, zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned long drmAgpSize(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.aperture_size;
-}
-
-
-/**
- * Get used AGP memory.
- *
- * \param fd file descriptor.
- *
- * \return memory used on success, or zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned long drmAgpMemoryUsed(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.memory_used;
-}
-
-
-/**
- * Get available AGP memory.
- *
- * \param fd file descriptor.
- *
- * \return memory available on success, or zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned long drmAgpMemoryAvail(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.memory_allowed;
-}
-
-
-/**
- * Get hardware vendor ID.
- *
- * \param fd file descriptor.
- *
- * \return vendor ID on success, or zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned int drmAgpVendorId(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.id_vendor;
-}
-
-
-/**
- * Get hardware device ID.
- *
- * \param fd file descriptor.
- *
- * \return zero on success, or zero on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_AGP_INFO ioctl, getting the
- * necessary information in a drm_agp_info structure.
- */
-unsigned int drmAgpDeviceId(int fd)
-{
- drm_agp_info_t i;
-
- if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0;
- return i.id_device;
-}
-
-int drmScatterGatherAlloc(int fd, unsigned long size, unsigned long *handle)
-{
- drm_scatter_gather_t sg;
-
- *handle = 0;
- sg.size = size;
- sg.handle = 0;
- if (ioctl(fd, DRM_IOCTL_SG_ALLOC, &sg)) return -errno;
- *handle = sg.handle;
- return 0;
-}
-
-int drmScatterGatherFree(int fd, unsigned long handle)
-{
- drm_scatter_gather_t sg;
-
- sg.size = 0;
- sg.handle = handle;
- if (ioctl(fd, DRM_IOCTL_SG_FREE, &sg)) return -errno;
- return 0;
-}
-
-/**
- * Wait for VBLANK.
- *
- * \param fd file descriptor.
- * \param vbl pointer to a drmVBlank structure.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_WAIT_VBLANK ioctl.
- */
-int drmWaitVBlank(int fd, drmVBlankPtr vbl)
-{
- int ret;
-
- do {
- ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl);
- vbl->request.type &= ~DRM_VBLANK_RELATIVE;
- } while (ret && errno == EINTR);
-
- return ret;
-}
-
-int drmError(int err, const char *label)
-{
- switch (err) {
- case DRM_ERR_NO_DEVICE: fprintf(stderr, "%s: no device\n", label); break;
- case DRM_ERR_NO_ACCESS: fprintf(stderr, "%s: no access\n", label); break;
- case DRM_ERR_NOT_ROOT: fprintf(stderr, "%s: not root\n", label); break;
- case DRM_ERR_INVALID: fprintf(stderr, "%s: invalid args\n", label);break;
- default:
- if (err < 0) err = -err;
- fprintf( stderr, "%s: error %d (%s)\n", label, err, strerror(err) );
- break;
- }
-
- return 1;
-}
-
-/**
- * Install IRQ handler.
- *
- * \param fd file descriptor.
- * \param irq IRQ number.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_CONTROL ioctl, passing the
- * argument in a drm_control structure.
- */
-int drmCtlInstHandler(int fd, int irq)
-{
- drm_control_t ctl;
-
- ctl.func = DRM_INST_HANDLER;
- ctl.irq = irq;
- if (ioctl(fd, DRM_IOCTL_CONTROL, &ctl)) return -errno;
- return 0;
-}
-
-
-/**
- * Uninstall IRQ handler.
- *
- * \param fd file descriptor.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_CONTROL ioctl, passing the
- * argument in a drm_control structure.
- */
-int drmCtlUninstHandler(int fd)
-{
- drm_control_t ctl;
-
- ctl.func = DRM_UNINST_HANDLER;
- ctl.irq = 0;
- if (ioctl(fd, DRM_IOCTL_CONTROL, &ctl)) return -errno;
- return 0;
-}
-
-int drmFinish(int fd, int context, drmLockFlags flags)
-{
- drm_lock_t lock;
-
- lock.context = context;
- lock.flags = 0;
- if (flags & DRM_LOCK_READY) lock.flags |= _DRM_LOCK_READY;
- if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT;
- if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH;
- if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL;
- if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES;
- if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES;
- if (ioctl(fd, DRM_IOCTL_FINISH, &lock)) return -errno;
- return 0;
-}
-
-/**
- * Get IRQ from bus ID.
- *
- * \param fd file descriptor.
- * \param busnum bus number.
- * \param devnum device number.
- * \param funcnum function number.
- *
- * \return IRQ number on success, or a negative value on failure.
- *
- * \internal
- * This function is a wrapper around the DRM_IOCTL_IRQ_BUSID ioctl, passing the
- * arguments in a drm_irq_busid structure.
- */
-int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum)
-{
- drm_irq_busid_t p;
-
- p.busnum = busnum;
- p.devnum = devnum;
- p.funcnum = funcnum;
- if (ioctl(fd, DRM_IOCTL_IRQ_BUSID, &p)) return -errno;
- return p.irq;
-}
-
-int drmAddContextTag(int fd, drm_context_t context, void *tag)
-{
- drmHashEntry *entry = drmGetEntry(fd);
-
- if (drmHashInsert(entry->tagTable, context, tag)) {
- drmHashDelete(entry->tagTable, context);
- drmHashInsert(entry->tagTable, context, tag);
- }
- return 0;
-}
-
-int drmDelContextTag(int fd, drm_context_t context)
-{
- drmHashEntry *entry = drmGetEntry(fd);
-
- return drmHashDelete(entry->tagTable, context);
-}
-
-void *drmGetContextTag(int fd, drm_context_t context)
-{
- drmHashEntry *entry = drmGetEntry(fd);
- void *value;
-
- if (drmHashLookup(entry->tagTable, context, &value)) return NULL;
-
- return value;
-}
-
-int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id, drm_handle_t handle)
-{
- drm_ctx_priv_map_t map;
-
- map.ctx_id = ctx_id;
- map.handle = (void *)handle;
-
- if (ioctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) return -errno;
- return 0;
-}
-
-int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id, drm_handle_t * handle)
-{
- drm_ctx_priv_map_t map;
-
- map.ctx_id = ctx_id;
-
- if (ioctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) return -errno;
- if (handle) *handle = (drm_handle_t)map.handle;
-
- return 0;
-}
-
-int drmGetMap(int fd, int idx, drm_handle_t *offset, drmSize *size,
- drmMapType *type, drmMapFlags *flags, drm_handle_t *handle,
- int *mtrr)
-{
- drm_map_t map;
-
- map.offset = idx;
- if (ioctl(fd, DRM_IOCTL_GET_MAP, &map)) return -errno;
- *offset = map.offset;
- *size = map.size;
- *type = map.type;
- *flags = map.flags;
- *handle = (unsigned long)map.handle;
- *mtrr = map.mtrr;
- return 0;
-}
-
-int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid,
- unsigned long *magic, unsigned long *iocs)
-{
- drm_client_t client;
-
- client.idx = idx;
- if (ioctl(fd, DRM_IOCTL_GET_CLIENT, &client)) return -errno;
- *auth = client.auth;
- *pid = client.pid;
- *uid = client.uid;
- *magic = client.magic;
- *iocs = client.iocs;
- return 0;
-}
-
-int drmGetStats(int fd, drmStatsT *stats)
-{
- drm_stats_t s;
- int i;
-
- if (ioctl(fd, DRM_IOCTL_GET_STATS, &s)) return -errno;
-
- stats->count = 0;
- memset(stats, 0, sizeof(*stats));
- if (s.count > sizeof(stats->data)/sizeof(stats->data[0]))
- return -1;
-
-#define SET_VALUE \
- stats->data[i].long_format = "%-20.20s"; \
- stats->data[i].rate_format = "%8.8s"; \
- stats->data[i].isvalue = 1; \
- stats->data[i].verbose = 0
-
-#define SET_COUNT \
- stats->data[i].long_format = "%-20.20s"; \
- stats->data[i].rate_format = "%5.5s"; \
- stats->data[i].isvalue = 0; \
- stats->data[i].mult_names = "kgm"; \
- stats->data[i].mult = 1000; \
- stats->data[i].verbose = 0
-
-#define SET_BYTE \
- stats->data[i].long_format = "%-20.20s"; \
- stats->data[i].rate_format = "%5.5s"; \
- stats->data[i].isvalue = 0; \
- stats->data[i].mult_names = "KGM"; \
- stats->data[i].mult = 1024; \
- stats->data[i].verbose = 0
-
-
- stats->count = s.count;
- for (i = 0; i < s.count; i++) {
- stats->data[i].value = s.data[i].value;
- switch (s.data[i].type) {
- case _DRM_STAT_LOCK:
- stats->data[i].long_name = "Lock";
- stats->data[i].rate_name = "Lock";
- SET_VALUE;
- break;
- case _DRM_STAT_OPENS:
- stats->data[i].long_name = "Opens";
- stats->data[i].rate_name = "O";
- SET_COUNT;
- stats->data[i].verbose = 1;
- break;
- case _DRM_STAT_CLOSES:
- stats->data[i].long_name = "Closes";
- stats->data[i].rate_name = "Lock";
- SET_COUNT;
- stats->data[i].verbose = 1;
- break;
- case _DRM_STAT_IOCTLS:
- stats->data[i].long_name = "Ioctls";
- stats->data[i].rate_name = "Ioc/s";
- SET_COUNT;
- break;
- case _DRM_STAT_LOCKS:
- stats->data[i].long_name = "Locks";
- stats->data[i].rate_name = "Lck/s";
- SET_COUNT;
- break;
- case _DRM_STAT_UNLOCKS:
- stats->data[i].long_name = "Unlocks";
- stats->data[i].rate_name = "Unl/s";
- SET_COUNT;
- break;
- case _DRM_STAT_IRQ:
- stats->data[i].long_name = "IRQs";
- stats->data[i].rate_name = "IRQ/s";
- SET_COUNT;
- break;
- case _DRM_STAT_PRIMARY:
- stats->data[i].long_name = "Primary Bytes";
- stats->data[i].rate_name = "PB/s";
- SET_BYTE;
- break;
- case _DRM_STAT_SECONDARY:
- stats->data[i].long_name = "Secondary Bytes";
- stats->data[i].rate_name = "SB/s";
- SET_BYTE;
- break;
- case _DRM_STAT_DMA:
- stats->data[i].long_name = "DMA";
- stats->data[i].rate_name = "DMA/s";
- SET_COUNT;
- break;
- case _DRM_STAT_SPECIAL:
- stats->data[i].long_name = "Special DMA";
- stats->data[i].rate_name = "dma/s";
- SET_COUNT;
- break;
- case _DRM_STAT_MISSED:
- stats->data[i].long_name = "Miss";
- stats->data[i].rate_name = "Ms/s";
- SET_COUNT;
- break;
- case _DRM_STAT_VALUE:
- stats->data[i].long_name = "Value";
- stats->data[i].rate_name = "Value";
- SET_VALUE;
- break;
- case _DRM_STAT_BYTE:
- stats->data[i].long_name = "Bytes";
- stats->data[i].rate_name = "B/s";
- SET_BYTE;
- break;
- case _DRM_STAT_COUNT:
- default:
- stats->data[i].long_name = "Count";
- stats->data[i].rate_name = "Cnt/s";
- SET_COUNT;
- break;
- }
- }
- return 0;
-}
-
-/**
- * Issue a set-version ioctl.
- *
- * \param fd file descriptor.
- * \param drmCommandIndex command index
- * \param data source pointer of the data to be read and written.
- * \param size size of the data to be read and written.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * It issues a read-write ioctl given by
- * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
- */
-int drmSetInterfaceVersion(int fd, drmSetVersion *version )
-{
- int retcode = 0;
- drm_set_version_t sv;
-
- sv.drm_di_major = version->drm_di_major;
- sv.drm_di_minor = version->drm_di_minor;
- sv.drm_dd_major = version->drm_dd_major;
- sv.drm_dd_minor = version->drm_dd_minor;
-
- if (ioctl(fd, DRM_IOCTL_SET_VERSION, &sv)) {
- retcode = -errno;
- }
-
- version->drm_di_major = sv.drm_di_major;
- version->drm_di_minor = sv.drm_di_minor;
- version->drm_dd_major = sv.drm_dd_major;
- version->drm_dd_minor = sv.drm_dd_minor;
-
- return retcode;
-}
-
-/**
- * Send a device-specific command.
- *
- * \param fd file descriptor.
- * \param drmCommandIndex command index
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * It issues a ioctl given by
- * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
- */
-int drmCommandNone(int fd, unsigned long drmCommandIndex)
-{
- void *data = NULL; /* dummy */
- unsigned long request;
-
- request = DRM_IO( DRM_COMMAND_BASE + drmCommandIndex);
-
- if (ioctl(fd, request, data)) {
- return -errno;
- }
- return 0;
-}
-
-
-/**
- * Send a device-specific read command.
- *
- * \param fd file descriptor.
- * \param drmCommandIndex command index
- * \param data destination pointer of the data to be read.
- * \param size size of the data to be read.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * It issues a read ioctl given by
- * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
- */
-int drmCommandRead(int fd, unsigned long drmCommandIndex,
- void *data, unsigned long size )
-{
- unsigned long request;
-
- request = DRM_IOC( DRM_IOC_READ, DRM_IOCTL_BASE,
- DRM_COMMAND_BASE + drmCommandIndex, size);
-
- if (ioctl(fd, request, data)) {
- return -errno;
- }
- return 0;
-}
-
-
-/**
- * Send a device-specific write command.
- *
- * \param fd file descriptor.
- * \param drmCommandIndex command index
- * \param data source pointer of the data to be written.
- * \param size size of the data to be written.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * It issues a write ioctl given by
- * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
- */
-int drmCommandWrite(int fd, unsigned long drmCommandIndex,
- void *data, unsigned long size )
-{
- unsigned long request;
-
- request = DRM_IOC( DRM_IOC_WRITE, DRM_IOCTL_BASE,
- DRM_COMMAND_BASE + drmCommandIndex, size);
-
- if (ioctl(fd, request, data)) {
- return -errno;
- }
- return 0;
-}
-
-
-/**
- * Send a device-specific read-write command.
- *
- * \param fd file descriptor.
- * \param drmCommandIndex command index
- * \param data source pointer of the data to be read and written.
- * \param size size of the data to be read and written.
- *
- * \return zero on success, or a negative value on failure.
- *
- * \internal
- * It issues a read-write ioctl given by
- * \code DRM_COMMAND_BASE + drmCommandIndex \endcode.
- */
-int drmCommandWriteRead(int fd, unsigned long drmCommandIndex,
- void *data, unsigned long size )
-{
- unsigned long request;
-
- request = DRM_IOC( DRM_IOC_READ|DRM_IOC_WRITE, DRM_IOCTL_BASE,
- DRM_COMMAND_BASE + drmCommandIndex, size);
-
- if (ioctl(fd, request, data)) {
- return -errno;
- }
- return 0;
-}
-
-#if defined(XFree86Server)
-static void drmSIGIOHandler(int interrupt, void *closure)
-{
- unsigned long key;
- void *value;
- ssize_t count;
- drm_ctx_t ctx;
- typedef void (*_drmCallback)(int, void *, void *);
- char buf[256];
- drm_context_t old;
- drm_context_t new;
- void *oldctx;
- void *newctx;
- char *pt;
- drmHashEntry *entry;
-
- if (!drmHashTable) return;
- if (drmHashFirst(drmHashTable, &key, &value)) {
- entry = value;
- do {
-#if 0
- fprintf(stderr, "Trying %d\n", entry->fd);
-#endif
- if ((count = read(entry->fd, buf, sizeof(buf))) > 0) {
- buf[count] = '\0';
-#if 0
- fprintf(stderr, "Got %s\n", buf);
-#endif
-
- for (pt = buf; *pt != ' '; ++pt); /* Find first space */
- ++pt;
- old = strtol(pt, &pt, 0);
- new = strtol(pt, NULL, 0);
- oldctx = drmGetContextTag(entry->fd, old);
- newctx = drmGetContextTag(entry->fd, new);
-#if 0
- fprintf(stderr, "%d %d %p %p\n", old, new, oldctx, newctx);
-#endif
- ((_drmCallback)entry->f)(entry->fd, oldctx, newctx);
- ctx.handle = new;
- ioctl(entry->fd, DRM_IOCTL_NEW_CTX, &ctx);
- }
- } while (drmHashNext(drmHashTable, &key, &value));
- }
-}
-
-int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *))
-{
- drmHashEntry *entry;
-
- entry = drmGetEntry(fd);
- entry->f = f;
-
- return xf86InstallSIGIOHandler(fd, drmSIGIOHandler, 0);
-}
-
-int drmRemoveSIGIOHandler(int fd)
-{
- drmHashEntry *entry = drmGetEntry(fd);
-
- entry->f = NULL;
-
- return xf86RemoveSIGIOHandler(fd);
-}
-#endif
diff --git a/src/mesa/drivers/dri/dri_client/xf86drmHash.c b/src/mesa/drivers/dri/dri_client/xf86drmHash.c
deleted file mode 100644
index 5f89d540dc2..00000000000
--- a/src/mesa/drivers/dri/dri_client/xf86drmHash.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* xf86drmHash.c -- Small hash table support for integer -> integer mapping
- * Created: Sun Apr 18 09:35:45 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, 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
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $
- *
- * DESCRIPTION
- *
- * This file contains a straightforward implementation of a fixed-sized
- * hash table using self-organizing linked lists [Knuth73, pp. 398-399] for
- * collision resolution. There are two potentially interesting things
- * about this implementation:
- *
- * 1) The table is power-of-two sized. Prime sized tables are more
- * traditional, but do not have a significant advantage over power-of-two
- * sized table, especially when double hashing is not used for collision
- * resolution.
- *
- * 2) The hash computation uses a table of random integers [Hanson97,
- * pp. 39-41].
- *
- * FUTURE ENHANCEMENTS
- *
- * With a table size of 512, the current implementation is sufficient for a
- * few hundred keys. Since this is well above the expected size of the
- * tables for which this implementation was designed, the implementation of
- * dynamic hash tables was postponed until the need arises. A common (and
- * naive) approach to dynamic hash table implementation simply creates a
- * new hash table when necessary, rehashes all the data into the new table,
- * and destroys the old table. The approach in [Larson88] is superior in
- * two ways: 1) only a portion of the table is expanded when needed,
- * distributing the expansion cost over several insertions, and 2) portions
- * of the table can be locked, enabling a scalable thread-safe
- * implementation.
- *
- * REFERENCES
- *
- * [Hanson97] David R. Hanson. C Interfaces and Implementations:
- * Techniques for Creating Reusable Software. Reading, Massachusetts:
- * Addison-Wesley, 1997.
- *
- * [Knuth73] Donald E. Knuth. The Art of Computer Programming. Volume 3:
- * Sorting and Searching. Reading, Massachusetts: Addison-Wesley, 1973.
- *
- * [Larson88] Per-Ake Larson. "Dynamic Hash Tables". CACM 31(4), April
- * 1988, pp. 446-457.
- *
- */
-
-#define HASH_MAIN 0
-
-#if HASH_MAIN
-# include <stdio.h>
-# include <stdlib.h>
-#else
-# include "xf86drm.h"
-# ifdef XFree86LOADER
-# include "xf86.h"
-# include "xf86_ansic.h"
-# else
-# include <stdio.h>
-# include <stdlib.h>
-# endif
-#endif
-
-#define HASH_MAGIC 0xdeadbeef
-#define HASH_DEBUG 0
-#define HASH_SIZE 512 /* Good for about 100 entries */
- /* If you change this value, you probably
- have to change the HashHash hashing
- function! */
-
-#if HASH_MAIN
-#define HASH_ALLOC malloc
-#define HASH_FREE free
-#define HASH_RANDOM_DECL
-#define HASH_RANDOM_INIT(seed) srandom(seed)
-#define HASH_RANDOM random()
-#else
-#define HASH_ALLOC drmMalloc
-#define HASH_FREE drmFree
-#define HASH_RANDOM_DECL void *state
-#define HASH_RANDOM_INIT(seed) state = drmRandomCreate(seed)
-#define HASH_RANDOM drmRandom(state)
-
-#endif
-
-typedef struct HashBucket {
- unsigned long key;
- void *value;
- struct HashBucket *next;
-} HashBucket, *HashBucketPtr;
-
-typedef struct HashTable {
- unsigned long magic;
- unsigned long entries;
- unsigned long hits; /* At top of linked list */
- unsigned long partials; /* Not at top of linked list */
- unsigned long misses; /* Not in table */
- HashBucketPtr buckets[HASH_SIZE];
- int p0;
- HashBucketPtr p1;
-} HashTable, *HashTablePtr;
-
-#if HASH_MAIN
-extern void *drmHashCreate(void);
-extern int drmHashDestroy(void *t);
-extern int drmHashLookup(void *t, unsigned long key, unsigned long *value);
-extern int drmHashInsert(void *t, unsigned long key, unsigned long value);
-extern int drmHashDelete(void *t, unsigned long key);
-#endif
-
-static unsigned long HashHash(unsigned long key)
-{
- unsigned long hash = 0;
- unsigned long tmp = key;
- static int init = 0;
- static unsigned long scatter[256];
- int i;
-
- if (!init) {
- HASH_RANDOM_DECL;
- HASH_RANDOM_INIT(37);
- for (i = 0; i < 256; i++) scatter[i] = HASH_RANDOM;
- ++init;
- }
-
- while (tmp) {
- hash = (hash << 1) + scatter[tmp & 0xff];
- tmp >>= 8;
- }
-
- hash %= HASH_SIZE;
-#if HASH_DEBUG
- printf( "Hash(%d) = %d\n", key, hash);
-#endif
- return hash;
-}
-
-void *drmHashCreate(void)
-{
- HashTablePtr table;
- int i;
-
- table = HASH_ALLOC(sizeof(*table));
- if (!table) return NULL;
- table->magic = HASH_MAGIC;
- table->entries = 0;
- table->hits = 0;
- table->partials = 0;
- table->misses = 0;
-
- for (i = 0; i < HASH_SIZE; i++) table->buckets[i] = NULL;
- return table;
-}
-
-int drmHashDestroy(void *t)
-{
- HashTablePtr table = (HashTablePtr)t;
- HashBucketPtr bucket;
- HashBucketPtr next;
- int i;
-
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- for (i = 0; i < HASH_SIZE; i++) {
- for (bucket = table->buckets[i]; bucket;) {
- next = bucket->next;
- HASH_FREE(bucket);
- bucket = next;
- }
- }
- HASH_FREE(table);
- return 0;
-}
-
-/* Find the bucket and organize the list so that this bucket is at the
- top. */
-
-static HashBucketPtr HashFind(HashTablePtr table,
- unsigned long key, unsigned long *h)
-{
- unsigned long hash = HashHash(key);
- HashBucketPtr prev = NULL;
- HashBucketPtr bucket;
-
- if (h) *h = hash;
-
- for (bucket = table->buckets[hash]; bucket; bucket = bucket->next) {
- if (bucket->key == key) {
- if (prev) {
- /* Organize */
- prev->next = bucket->next;
- bucket->next = table->buckets[hash];
- table->buckets[hash] = bucket;
- ++table->partials;
- } else {
- ++table->hits;
- }
- return bucket;
- }
- prev = bucket;
- }
- ++table->misses;
- return NULL;
-}
-
-int drmHashLookup(void *t, unsigned long key, void **value)
-{
- HashTablePtr table = (HashTablePtr)t;
- HashBucketPtr bucket;
-
- if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- bucket = HashFind(table, key, NULL);
- if (!bucket) return 1; /* Not found */
- *value = bucket->value;
- return 0; /* Found */
-}
-
-int drmHashInsert(void *t, unsigned long key, void *value)
-{
- HashTablePtr table = (HashTablePtr)t;
- HashBucketPtr bucket;
- unsigned long hash;
-
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- if (HashFind(table, key, &hash)) return 1; /* Already in table */
-
- bucket = HASH_ALLOC(sizeof(*bucket));
- if (!bucket) return -1; /* Error */
- bucket->key = key;
- bucket->value = value;
- bucket->next = table->buckets[hash];
- table->buckets[hash] = bucket;
-#if HASH_DEBUG
- printf("Inserted %d at %d/%p\n", key, hash, bucket);
-#endif
- return 0; /* Added to table */
-}
-
-int drmHashDelete(void *t, unsigned long key)
-{
- HashTablePtr table = (HashTablePtr)t;
- unsigned long hash;
- HashBucketPtr bucket;
-
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- bucket = HashFind(table, key, &hash);
-
- if (!bucket) return 1; /* Not found */
-
- table->buckets[hash] = bucket->next;
- HASH_FREE(bucket);
- return 0;
-}
-
-int drmHashNext(void *t, unsigned long *key, void **value)
-{
- HashTablePtr table = (HashTablePtr)t;
-
- for (; table->p0 < HASH_SIZE;
- ++table->p0, table->p1 = table->buckets[table->p0]) {
- if (table->p1) {
- *key = table->p1->key;
- *value = table->p1->value;
- table->p1 = table->p1->next;
- return 1;
- }
- }
- return 0;
-}
-
-int drmHashFirst(void *t, unsigned long *key, void **value)
-{
- HashTablePtr table = (HashTablePtr)t;
-
- if (table->magic != HASH_MAGIC) return -1; /* Bad magic */
-
- table->p0 = 0;
- table->p1 = table->buckets[0];
- return drmHashNext(table, key, value);
-}
-
-#if HASH_MAIN
-#define DIST_LIMIT 10
-static int dist[DIST_LIMIT];
-
-static void clear_dist(void) {
- int i;
-
- for (i = 0; i < DIST_LIMIT; i++) dist[i] = 0;
-}
-
-static int count_entries(HashBucketPtr bucket)
-{
- int count = 0;
-
- for (; bucket; bucket = bucket->next) ++count;
- return count;
-}
-
-static void update_dist(int count)
-{
- if (count >= DIST_LIMIT) ++dist[DIST_LIMIT-1];
- else ++dist[count];
-}
-
-static void compute_dist(HashTablePtr table)
-{
- int i;
- HashBucketPtr bucket;
-
- printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n",
- table->entries, table->hits, table->partials, table->misses);
- clear_dist();
- for (i = 0; i < HASH_SIZE; i++) {
- bucket = table->buckets[i];
- update_dist(count_entries(bucket));
- }
- for (i = 0; i < DIST_LIMIT; i++) {
- if (i != DIST_LIMIT-1) printf("%5d %10d\n", i, dist[i]);
- else printf("other %10d\n", dist[i]);
- }
-}
-
-static void check_table(HashTablePtr table,
- unsigned long key, unsigned long value)
-{
- unsigned long retval = 0;
- int retcode = drmHashLookup(table, key, &retval);
-
- switch (retcode) {
- case -1:
- printf("Bad magic = 0x%08lx:"
- " key = %lu, expected = %lu, returned = %lu\n",
- table->magic, key, value, retval);
- break;
- case 1:
- printf("Not found: key = %lu, expected = %lu returned = %lu\n",
- key, value, retval);
- break;
- case 0:
- if (value != retval)
- printf("Bad value: key = %lu, expected = %lu, returned = %lu\n",
- key, value, retval);
- break;
- default:
- printf("Bad retcode = %d: key = %lu, expected = %lu, returned = %lu\n",
- retcode, key, value, retval);
- break;
- }
-}
-
-int main(void)
-{
- HashTablePtr table;
- int i;
-
- printf("\n***** 256 consecutive integers ****\n");
- table = drmHashCreate();
- for (i = 0; i < 256; i++) drmHashInsert(table, i, i);
- for (i = 0; i < 256; i++) check_table(table, i, i);
- for (i = 256; i >= 0; i--) check_table(table, i, i);
- compute_dist(table);
- drmHashDestroy(table);
-
- printf("\n***** 1024 consecutive integers ****\n");
- table = drmHashCreate();
- for (i = 0; i < 1024; i++) drmHashInsert(table, i, i);
- for (i = 0; i < 1024; i++) check_table(table, i, i);
- for (i = 1024; i >= 0; i--) check_table(table, i, i);
- compute_dist(table);
- drmHashDestroy(table);
-
- printf("\n***** 1024 consecutive page addresses (4k pages) ****\n");
- table = drmHashCreate();
- for (i = 0; i < 1024; i++) drmHashInsert(table, i*4096, i);
- for (i = 0; i < 1024; i++) check_table(table, i*4096, i);
- for (i = 1024; i >= 0; i--) check_table(table, i*4096, i);
- compute_dist(table);
- drmHashDestroy(table);
-
- printf("\n***** 1024 random integers ****\n");
- table = drmHashCreate();
- srandom(0xbeefbeef);
- for (i = 0; i < 1024; i++) drmHashInsert(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 1024; i++) check_table(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 1024; i++) check_table(table, random(), i);
- compute_dist(table);
- drmHashDestroy(table);
-
- printf("\n***** 5000 random integers ****\n");
- table = drmHashCreate();
- srandom(0xbeefbeef);
- for (i = 0; i < 5000; i++) drmHashInsert(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 5000; i++) check_table(table, random(), i);
- srandom(0xbeefbeef);
- for (i = 0; i < 5000; i++) check_table(table, random(), i);
- compute_dist(table);
- drmHashDestroy(table);
-
- return 0;
-}
-#endif
diff --git a/src/mesa/drivers/dri/dri_client/xf86drmRandom.c b/src/mesa/drivers/dri/dri_client/xf86drmRandom.c
deleted file mode 100644
index cca831d7517..00000000000
--- a/src/mesa/drivers/dri/dri_client/xf86drmRandom.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* xf86drmRandom.c -- "Minimal Standard" PRNG Implementation
- * Created: Mon Apr 19 08:28:13 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, 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
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRandom.c,v 1.4 2000/06/17 00:03:34 martin Exp $
- *
- * DESCRIPTION
- *
- * This file contains a simple, straightforward implementation of the Park
- * & Miller "Minimal Standard" PRNG [PM88, PMS93], which is a Lehmer
- * multiplicative linear congruential generator (MLCG) with a period of
- * 2^31-1.
- *
- * This implementation is intended to provide a reliable, portable PRNG
- * that is suitable for testing a hash table implementation and for
- * implementing skip lists.
- *
- * FUTURE ENHANCEMENTS
- *
- * If initial seeds are not selected randomly, two instances of the PRNG
- * can be correlated. [Knuth81, pp. 32-33] describes a shuffling technique
- * that can eliminate this problem.
- *
- * If PRNGs are used for simulation, the period of the current
- * implementation may be too short. [LE88] discusses methods of combining
- * MLCGs to produce much longer periods, and suggests some alternative
- * values for A and M. [LE90 and Sch92] also provide information on
- * long-period PRNGs.
- *
- * REFERENCES
- *
- * [Knuth81] Donald E. Knuth. The Art of Computer Programming. Volume 2:
- * Seminumerical Algorithms. Reading, Massachusetts: Addison-Wesley, 1981.
- *
- * [LE88] Pierre L'Ecuyer. "Efficient and Portable Combined Random Number
- * Generators". CACM 31(6), June 1988, pp. 742-774.
- *
- * [LE90] Pierre L'Ecuyer. "Random Numbers for Simulation". CACM 33(10,
- * October 1990, pp. 85-97.
- *
- * [PM88] Stephen K. Park and Keith W. Miller. "Random Number Generators:
- * Good Ones are Hard to Find". CACM 31(10), October 1988, pp. 1192-1201.
- *
- * [Sch92] Bruce Schneier. "Pseudo-Ransom Sequence Generator for 32-Bit
- * CPUs". Dr. Dobb's Journal 17(2), February 1992, pp. 34, 37-38, 40.
- *
- * [PMS93] Stephen K. Park, Keith W. Miller, and Paul K. Stockmeyer. In
- * "Technical Correspondence: Remarks on Choosing and Implementing Random
- * Number Generators". CACM 36(7), July 1993, pp. 105-110.
- *
- */
-
-#define RANDOM_MAIN 0
-
-#if RANDOM_MAIN
-# include <stdio.h>
-# include <stdlib.h>
-#else
-# include "xf86drm.h"
-# ifdef XFree86LOADER
-# include "xf86.h"
-# include "xf86_ansic.h"
-# else
-# include <stdio.h>
-# include <stdlib.h>
-# endif
-#endif
-
-#define RANDOM_MAGIC 0xfeedbeef
-#define RANDOM_DEBUG 0
-
-#if RANDOM_MAIN
-#define RANDOM_ALLOC malloc
-#define RANDOM_FREE free
-#else
-#define RANDOM_ALLOC drmMalloc
-#define RANDOM_FREE drmFree
-#endif
-
-typedef struct RandomState {
- unsigned long magic;
- unsigned long a;
- unsigned long m;
- unsigned long q; /* m div a */
- unsigned long r; /* m mod a */
- unsigned long check;
- long seed;
-} RandomState;
-
-#if RANDOM_MAIN
-extern void *drmRandomCreate(unsigned long seed);
-extern int drmRandomDestroy(void *state);
-extern unsigned long drmRandom(void *state);
-extern double drmRandomDouble(void *state);
-#endif
-
-void *drmRandomCreate(unsigned long seed)
-{
- RandomState *state;
-
- state = RANDOM_ALLOC(sizeof(*state));
- if (!state) return NULL;
- state->magic = RANDOM_MAGIC;
-#if 0
- /* Park & Miller, October 1988 */
- state->a = 16807;
- state->m = 2147483647;
- state->check = 1043618065; /* After 10000 iterations */
-#else
- /* Park, Miller, and Stockmeyer, July 1993 */
- state->a = 48271;
- state->m = 2147483647;
- state->check = 399268537; /* After 10000 iterations */
-#endif
- state->q = state->m / state->a;
- state->r = state->m % state->a;
-
- state->seed = seed;
- /* Check for illegal boundary conditions,
- and choose closest legal value. */
- if (state->seed <= 0) state->seed = 1;
- if (state->seed >= state->m) state->seed = state->m - 1;
-
- return state;
-}
-
-int drmRandomDestroy(void *state)
-{
- RANDOM_FREE(state);
- return 0;
-}
-
-unsigned long drmRandom(void *state)
-{
- RandomState *s = (RandomState *)state;
- long hi;
- long lo;
-
- hi = s->seed / s->q;
- lo = s->seed % s->q;
- s->seed = s->a * lo - s->r * hi;
- if (s->seed <= 0) s->seed += s->m;
-
- return s->seed;
-}
-
-double drmRandomDouble(void *state)
-{
- RandomState *s = (RandomState *)state;
-
- return (double)drmRandom(state)/(double)s->m;
-}
-
-#if RANDOM_MAIN
-static void check_period(long seed)
-{
- unsigned long count = 0;
- unsigned long initial;
- void *state;
-
- state = drmRandomCreate(seed);
- initial = drmRandom(state);
- ++count;
- while (initial != drmRandom(state)) {
- if (!++count) break;
- }
- printf("With seed of %10ld, period = %10lu (0x%08lx)\n",
- seed, count, count);
- drmRandomDestroy(state);
-}
-
-int main(void)
-{
- RandomState *state;
- int i;
- unsigned long rand;
-
- state = drmRandomCreate(1);
- for (i = 0; i < 10000; i++) {
- rand = drmRandom(state);
- }
- printf("After 10000 iterations: %lu (%lu expected): %s\n",
- rand, state->check,
- rand - state->check ? "*INCORRECT*" : "CORRECT");
- drmRandomDestroy(state);
-
- printf("Checking periods...\n");
- check_period(1);
- check_period(2);
- check_period(31415926);
-
- return 0;
-}
-#endif
diff --git a/src/mesa/drivers/dri/dri_client/xf86drmSL.c b/src/mesa/drivers/dri/dri_client/xf86drmSL.c
deleted file mode 100644
index a9d64c920f0..00000000000
--- a/src/mesa/drivers/dri/dri_client/xf86drmSL.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/* xf86drmSL.c -- Skip list support
- * Created: Mon May 10 09:28:13 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, 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
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors: Rickard E. (Rik) Faith <faith@valinux.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSL.c,v 1.3 2000/06/17 00:03:34 martin Exp $
- *
- * DESCRIPTION
- *
- * This file contains a straightforward skip list implementation.n
- *
- * FUTURE ENHANCEMENTS
- *
- * REFERENCES
- *
- * [Pugh90] William Pugh. Skip Lists: A Probabilistic Alternative to
- * Balanced Trees. CACM 33(6), June 1990, pp. 668-676.
- *
- */
-
-#define SL_MAIN 0
-
-#if SL_MAIN
-# include <stdio.h>
-# include <stdlib.h>
-# include <sys/time.h>
-#else
-# include "xf86drm.h"
-# ifdef XFree86LOADER
-# include "xf86.h"
-# include "xf86_ansic.h"
-# else
-# include <stdio.h>
-# include <stdlib.h>
-# endif
-#endif
-
-#define SL_LIST_MAGIC 0xfacade00LU
-#define SL_ENTRY_MAGIC 0x00fab1edLU
-#define SL_FREED_MAGIC 0xdecea5edLU
-#define SL_MAX_LEVEL 16
-#define SL_DEBUG 0
-#define SL_RANDOM_SEED 0xc01055a1LU
-
-#if SL_MAIN
-#define SL_ALLOC malloc
-#define SL_FREE free
-#define SL_RANDOM_DECL static int state = 0;
-#define SL_RANDOM_INIT(seed) if (!state) { srandom(seed); ++state; }
-#define SL_RANDOM random()
-#else
-#define SL_ALLOC drmMalloc
-#define SL_FREE drmFree
-#define SL_RANDOM_DECL static void *state = NULL
-#define SL_RANDOM_INIT(seed) if (!state) state = drmRandomCreate(seed)
-#define SL_RANDOM drmRandom(state)
-
-#endif
-
-typedef struct SLEntry {
- unsigned long magic; /* SL_ENTRY_MAGIC */
- unsigned long key;
- void *value;
- int levels;
- struct SLEntry *forward[1]; /* variable sized array */
-} SLEntry, *SLEntryPtr;
-
-typedef struct SkipList {
- unsigned long magic; /* SL_LIST_MAGIC */
- int level;
- int count;
- SLEntryPtr head;
- SLEntryPtr p0; /* Position for iteration */
-} SkipList, *SkipListPtr;
-
-#if SL_MAIN
-extern void *drmSLCreate(void);
-extern int drmSLDestroy(void *l);
-extern int drmSLLookup(void *l, unsigned long key, void **value);
-extern int drmSLInsert(void *l, unsigned long key, void *value);
-extern int drmSLDelete(void *l, unsigned long key);
-extern int drmSLNext(void *l, unsigned long *key, void **value);
-extern int drmSLFirst(void *l, unsigned long *key, void **value);
-extern void drmSLDump(void *l);
-extern int drmSLLookupNeighbors(void *l, unsigned long key,
- unsigned long *prev_key, void **prev_value,
- unsigned long *next_key, void **next_value);
-#endif
-
-static SLEntryPtr SLCreateEntry(int max_level, unsigned long key, void *value)
-{
- SLEntryPtr entry;
-
- if (max_level < 0 || max_level > SL_MAX_LEVEL) max_level = SL_MAX_LEVEL;
-
- entry = SL_ALLOC(sizeof(*entry)
- + (max_level + 1) * sizeof(entry->forward[0]));
- if (!entry) return NULL;
- entry->magic = SL_ENTRY_MAGIC;
- entry->key = key;
- entry->value = value;
- entry->levels = max_level + 1;
-
- return entry;
-}
-
-static int SLRandomLevel(void)
-{
- int level = 1;
- SL_RANDOM_DECL;
-
- SL_RANDOM_INIT(SL_RANDOM_SEED);
-
- while ((SL_RANDOM & 0x01) && level < SL_MAX_LEVEL) ++level;
- return level;
-}
-
-void *drmSLCreate(void)
-{
- SkipListPtr list;
- int i;
-
- list = SL_ALLOC(sizeof(*list));
- if (!list) return NULL;
- list->magic = SL_LIST_MAGIC;
- list->level = 0;
- list->head = SLCreateEntry(SL_MAX_LEVEL, 0, NULL);
- list->count = 0;
-
- for (i = 0; i <= SL_MAX_LEVEL; i++) list->head->forward[i] = NULL;
-
- return list;
-}
-
-int drmSLDestroy(void *l)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr entry;
- SLEntryPtr next;
-
- if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
-
- for (entry = list->head; entry; entry = next) {
- if (entry->magic != SL_ENTRY_MAGIC) return -1; /* Bad magic */
- next = entry->forward[0];
- entry->magic = SL_FREED_MAGIC;
- SL_FREE(entry);
- }
-
- list->magic = SL_FREED_MAGIC;
- SL_FREE(list);
- return 0;
-}
-
-static SLEntryPtr SLLocate(void *l, unsigned long key, SLEntryPtr *update)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr entry;
- int i;
-
- if (list->magic != SL_LIST_MAGIC) return NULL;
-
- for (i = list->level, entry = list->head; i >= 0; i--) {
- while (entry->forward[i] && entry->forward[i]->key < key)
- entry = entry->forward[i];
- update[i] = entry;
- }
-
- return entry->forward[0];
-}
-
-int drmSLInsert(void *l, unsigned long key, void *value)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr entry;
- SLEntryPtr update[SL_MAX_LEVEL + 1];
- int level;
- int i;
-
- if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
-
- entry = SLLocate(list, key, update);
-
- if (entry && entry->key == key) return 1; /* Already in list */
-
-
- level = SLRandomLevel();
- if (level > list->level) {
- level = ++list->level;
- update[level] = list->head;
- }
-
- entry = SLCreateEntry(level, key, value);
-
- /* Fix up forward pointers */
- for (i = 0; i <= level; i++) {
- entry->forward[i] = update[i]->forward[i];
- update[i]->forward[i] = entry;
- }
-
- ++list->count;
- return 0; /* Added to table */
-}
-
-int drmSLDelete(void *l, unsigned long key)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr update[SL_MAX_LEVEL + 1];
- SLEntryPtr entry;
- int i;
-
- if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
-
- entry = SLLocate(list, key, update);
-
- if (!entry || entry->key != key) return 1; /* Not found */
-
- /* Fix up forward pointers */
- for (i = 0; i <= list->level; i++) {
- if (update[i]->forward[i] == entry)
- update[i]->forward[i] = entry->forward[i];
- }
-
- entry->magic = SL_FREED_MAGIC;
- SL_FREE(entry);
-
- while (list->level && !list->head->forward[list->level]) --list->level;
- --list->count;
- return 0;
-}
-
-int drmSLLookup(void *l, unsigned long key, void **value)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr update[SL_MAX_LEVEL + 1];
- SLEntryPtr entry;
-
- entry = SLLocate(list, key, update);
-
- if (entry && entry->key == key) {
- *value = entry;
- return 0;
- }
- *value = NULL;
- return -1;
-}
-
-int drmSLLookupNeighbors(void *l, unsigned long key,
- unsigned long *prev_key, void **prev_value,
- unsigned long *next_key, void **next_value)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr update[SL_MAX_LEVEL + 1];
- SLEntryPtr entry;
- int retcode = 0;
-
- entry = SLLocate(list, key, update);
-
- *prev_key = *next_key = key;
- *prev_value = *next_value = NULL;
-
- if (update[0]) {
- *prev_key = update[0]->key;
- *prev_value = update[0]->value;
- ++retcode;
- if (update[0]->forward[0]) {
- *next_key = update[0]->forward[0]->key;
- *next_value = update[0]->forward[0]->value;
- ++retcode;
- }
- }
- return retcode;
-}
-
-int drmSLNext(void *l, unsigned long *key, void **value)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr entry;
-
- if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
-
- entry = list->p0;
-
- if (entry) {
- list->p0 = entry->forward[0];
- *key = entry->key;
- *value = entry->value;
- return 1;
- }
- list->p0 = NULL;
- return 0;
-}
-
-int drmSLFirst(void *l, unsigned long *key, void **value)
-{
- SkipListPtr list = (SkipListPtr)l;
-
- if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */
-
- list->p0 = list->head->forward[0];
- return drmSLNext(list, key, value);
-}
-
-/* Dump internal data structures for debugging. */
-void drmSLDump(void *l)
-{
- SkipListPtr list = (SkipListPtr)l;
- SLEntryPtr entry;
- int i;
-
- if (list->magic != SL_LIST_MAGIC) {
- printf("Bad magic: 0x%08lx (expected 0x%08lx)\n",
- list->magic, SL_LIST_MAGIC);
- return;
- }
-
- printf("Level = %d, count = %d\n", list->level, list->count);
- for (entry = list->head; entry; entry = entry->forward[0]) {
- if (entry->magic != SL_ENTRY_MAGIC) {
- printf("Bad magic: 0x%08lx (expected 0x%08lx)\n",
- list->magic, SL_ENTRY_MAGIC);
- }
- printf("\nEntry %p <0x%08lx, %p> has %2d levels\n",
- entry, entry->key, entry->value, entry->levels);
- for (i = 0; i < entry->levels; i++) {
- if (entry->forward[i]) {
- printf(" %2d: %p <0x%08lx, %p>\n",
- i,
- entry->forward[i],
- entry->forward[i]->key,
- entry->forward[i]->value);
- } else {
- printf(" %2d: %p\n", i, entry->forward[i]);
- }
- }
- }
-}
-
-#if SL_MAIN
-static void print(SkipListPtr list)
-{
- unsigned long key;
- void *value;
-
- if (drmSLFirst(list, &key, &value)) {
- do {
- printf("key = %5lu, value = %p\n", key, value);
- } while (drmSLNext(list, &key, &value));
- }
-}
-
-static double do_time(int size, int iter)
-{
- SkipListPtr list;
- int i, j;
- unsigned long keys[1000000];
- unsigned long previous;
- unsigned long key;
- void *value;
- struct timeval start, stop;
- double usec;
- SL_RANDOM_DECL;
-
- SL_RANDOM_INIT(12345);
-
- list = drmSLCreate();
-
- for (i = 0; i < size; i++) {
- keys[i] = SL_RANDOM;
- drmSLInsert(list, keys[i], NULL);
- }
-
- previous = 0;
- if (drmSLFirst(list, &key, &value)) {
- do {
- if (key <= previous) {
- printf( "%lu !< %lu\n", previous, key);
- }
- previous = key;
- } while (drmSLNext(list, &key, &value));
- }
-
- gettimeofday(&start, NULL);
- for (j = 0; j < iter; j++) {
- for (i = 0; i < size; i++) {
- if (drmSLLookup(list, keys[i], &value))
- printf("Error %lu %d\n", keys[i], i);
- }
- }
- gettimeofday(&stop, NULL);
-
- usec = (double)(stop.tv_sec * 1000000 + stop.tv_usec
- - start.tv_sec * 1000000 - start.tv_usec) / (size * iter);
-
- printf("%0.2f microseconds for list length %d\n", usec, size);
-
- drmSLDestroy(list);
-
- return usec;
-}
-
-static void print_neighbors(void *list, unsigned long key)
-{
- unsigned long prev_key = 0;
- unsigned long next_key = 0;
- void *prev_value;
- void *next_value;
- int retval;
-
- retval = drmSLLookupNeighbors(list, key,
- &prev_key, &prev_value,
- &next_key, &next_value);
- printf("Neighbors of %5lu: %d %5lu %5lu\n",
- key, retval, prev_key, next_key);
-}
-
-int main(void)
-{
- SkipListPtr list;
- double usec, usec2, usec3, usec4;
-
- list = drmSLCreate();
- printf( "list at %p\n", list);
-
- print(list);
- printf("\n==============================\n\n");
-
- drmSLInsert(list, 123, NULL);
- drmSLInsert(list, 213, NULL);
- drmSLInsert(list, 50, NULL);
- print(list);
- printf("\n==============================\n\n");
-
- print_neighbors(list, 0);
- print_neighbors(list, 50);
- print_neighbors(list, 51);
- print_neighbors(list, 123);
- print_neighbors(list, 200);
- print_neighbors(list, 213);
- print_neighbors(list, 256);
- printf("\n==============================\n\n");
-
- drmSLDelete(list, 50);
- print(list);
- printf("\n==============================\n\n");
-
- drmSLDump(list);
- drmSLDestroy(list);
- printf("\n==============================\n\n");
-
- usec = do_time(100, 10000);
- usec2 = do_time(1000, 500);
- printf("Table size increased by %0.2f, search time increased by %0.2f\n",
- 1000.0/100.0, usec2 / usec);
-
- usec3 = do_time(10000, 50);
- printf("Table size increased by %0.2f, search time increased by %0.2f\n",
- 10000.0/100.0, usec3 / usec);
-
- usec4 = do_time(100000, 4);
- printf("Table size increased by %0.2f, search time increased by %0.2f\n",
- 100000.0/100.0, usec4 / usec);
-
- return 0;
-}
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/Makefile b/src/mesa/drivers/dri/i915-tex/Makefile
deleted file mode 100644
index fff8e9a1179..00000000000
--- a/src/mesa/drivers/dri/i915-tex/Makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = i915_dri.so
-
-DRIVER_SOURCES = \
- i830_context.c \
- i830_metaops.c \
- i830_state.c \
- i830_texblend.c \
- i830_tex.c \
- i830_texstate.c \
- i830_vtbl.c \
- intel_render.c \
- intel_regions.c \
- intel_buffer_objects.c \
- intel_batchbuffer.c \
- intel_mipmap_tree.c \
- i915_tex_layout.c \
- intel_tex_image.c \
- intel_tex_subimage.c \
- intel_tex_copy.c \
- intel_tex_validate.c \
- intel_tex_format.c \
- intel_tex.c \
- intel_pixel.c \
- intel_pixel_copy.c \
- intel_pixel_read.c \
- intel_pixel_draw.c \
- intel_buffers.c \
- intel_blit.c \
- i915_tex.c \
- i915_texstate.c \
- i915_context.c \
- i915_debug.c \
- i915_fragprog.c \
- i915_metaops.c \
- i915_program.c \
- i915_state.c \
- i915_texprog.c \
- i915_vtbl.c \
- intel_context.c \
- intel_ioctl.c \
-<<<<<<< Makefile
- intel_pixel.c \
- intel_render.c \
- intel_rotate.c \
-=======
->>>>>>> 1.3.4.11
- intel_screen.c \
- intel_span.c \
- intel_state.c \
-<<<<<<< Makefile
- intel_tex.c \
- intel_texmem.c \
- intel_tris.c
-=======
- intel_tris.c \
- intel_fbo.c \
- intel_depthstencil.c \
- intel_bufmgr.c
-
-
->>>>>>> 1.3.4.11
-
-C_SOURCES = \
- $(COMMON_SOURCES) \
- $(MINIGLX_SOURCES) \
- $(DRIVER_SOURCES)
-
-ASM_SOURCES =
-
-
-
-include ../Makefile.template
-
-symlinks:
diff --git a/src/mesa/drivers/dri/i915-tex/i830_context.c b/src/mesa/drivers/dri/i915-tex/i830_context.c
deleted file mode 100644
index a1cb25ca4e4..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_context.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "i830_context.h"
-#include "imports.h"
-#include "texmem.h"
-#include "intel_tex.h"
-#include "tnl/tnl.h"
-#include "tnl/t_vertex.h"
-#include "tnl/t_context.h"
-#include "utils.h"
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-static const struct dri_extension i830_extensions[] =
-{
- { "GL_ARB_texture_env_crossbar", NULL },
- { NULL, NULL }
-};
-
-
-static void i830InitDriverFunctions( struct dd_function_table *functions )
-{
- intelInitDriverFunctions( functions );
- i830InitStateFuncs( functions );
- i830InitTextureFuncs( functions );
-}
-
-
-GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- struct dd_function_table functions;
- struct i830_context *i830 = CALLOC_STRUCT(i830_context);
- struct intel_context *intel = &i830->intel;
- GLcontext *ctx = &intel->ctx;
- GLuint i;
- if (!i830) return GL_FALSE;
-
- i830InitVtbl( i830 );
- i830InitDriverFunctions( &functions );
-
- if (!intelInitContext( intel, mesaVis, driContextPriv,
- sharedContextPrivate, &functions )) {
- FREE(i830);
- return GL_FALSE;
- }
-
- intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
- intel->ctx.Const.MaxTextureImageUnits = I830_TEX_UNITS;
- intel->ctx.Const.MaxTextureCoordUnits = I830_TEX_UNITS;
-
- /* Advertise the full hardware capabilities. The new memory
- * manager should cope much better with overload situations:
- */
-<<<<<<< i830_context.c
- intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
- i = driQueryOptioni( &intel->intelScreen->optionCache, "allow_large_textures");
- driCalculateMaxTextureLevels( intel->texture_heaps,
- intel->nr_heaps,
- &intel->ctx.Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 8, /* max 3D texture size is 256^3 */
- 10, /* max CUBE texture size is 1024x1024 */
- 11, /* max RECT. supported */
- 12,
- GL_FALSE,
- i );
-=======
- ctx->Const.MaxTextureLevels = 12;
- ctx->Const.Max3DTextureLevels = 9;
- ctx->Const.MaxCubeTextureLevels = 11;
- ctx->Const.MaxTextureRectSize = (1<<11);
- ctx->Const.MaxTextureUnits = I830_TEX_UNITS;
->>>>>>> 1.11.2.2
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- 18 * sizeof(GLfloat) );
-
- intel->verts = TNL_CONTEXT(ctx)->clipspace.vertex_buf;
-
- driInitExtensions( ctx, i830_extensions, GL_FALSE );
-
- i830InitState( i830 );
- i830InitMetaFuncs( i830 );
-
- _tnl_allow_vertex_fog( ctx, 1 );
- _tnl_allow_pixel_fog( ctx, 0 );
-
- return GL_TRUE;
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/i830_context.h b/src/mesa/drivers/dri/i915-tex/i830_context.h
deleted file mode 100644
index 34b4d07602d..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_context.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef I830CONTEXT_INC
-#define I830CONTEXT_INC
-
-#include "intel_context.h"
-
-#define I830_FALLBACK_TEXTURE 0x1000
-#define I830_FALLBACK_COLORMASK 0x2000
-#define I830_FALLBACK_STENCIL 0x4000
-#define I830_FALLBACK_STIPPLE 0x8000
-#define I830_FALLBACK_LOGICOP 0x10000
-
-#define I830_UPLOAD_CTX 0x1
-#define I830_UPLOAD_BUFFERS 0x2
-#define I830_UPLOAD_STIPPLE 0x4
-#define I830_UPLOAD_INVARIENT 0x8
-#define I830_UPLOAD_TEX(i) (0x10<<(i))
-#define I830_UPLOAD_TEXBLEND(i) (0x100<<(i))
-#define I830_UPLOAD_TEX_ALL (0x0f0)
-#define I830_UPLOAD_TEXBLEND_ALL (0xf00)
-
-/* State structure offsets - these will probably disappear.
- */
-#define I830_DESTREG_CBUFADDR0 0
-#define I830_DESTREG_CBUFADDR1 1
-#define I830_DESTREG_DBUFADDR0 2
-#define I830_DESTREG_DBUFADDR1 3
-#define I830_DESTREG_DV0 4
-#define I830_DESTREG_DV1 5
-#define I830_DESTREG_SENABLE 6
-#define I830_DESTREG_SR0 7
-#define I830_DESTREG_SR1 8
-#define I830_DESTREG_SR2 9
-#define I830_DEST_SETUP_SIZE 10
-
-#define I830_CTXREG_STATE1 0
-#define I830_CTXREG_STATE2 1
-#define I830_CTXREG_STATE3 2
-#define I830_CTXREG_STATE4 3
-#define I830_CTXREG_STATE5 4
-#define I830_CTXREG_IALPHAB 5
-#define I830_CTXREG_STENCILTST 6
-#define I830_CTXREG_ENABLES_1 7
-#define I830_CTXREG_ENABLES_2 8
-#define I830_CTXREG_AA 9
-#define I830_CTXREG_FOGCOLOR 10
-#define I830_CTXREG_BLENDCOLOR0 11
-#define I830_CTXREG_BLENDCOLOR1 12
-#define I830_CTXREG_VF 13
-#define I830_CTXREG_VF2 14
-#define I830_CTXREG_MCSB0 15
-#define I830_CTXREG_MCSB1 16
-#define I830_CTX_SETUP_SIZE 17
-
-#define I830_STPREG_ST0 0
-#define I830_STPREG_ST1 1
-#define I830_STP_SETUP_SIZE 2
-
-#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */
-#define I830_TEXREG_TM0S1 1
-#define I830_TEXREG_TM0S2 2
-#define I830_TEXREG_TM0S3 3
-#define I830_TEXREG_TM0S4 4
-#define I830_TEXREG_MCS 5 /* _3DSTATE_MAP_COORD_SETS */
-#define I830_TEXREG_CUBE 6 /* _3DSTATE_MAP_SUBE */
-#define I830_TEX_SETUP_SIZE 7
-
-#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */
-
-struct i830_texture_object
-{
- struct intel_texture_object intel;
- GLuint Setup[I830_TEX_SETUP_SIZE];
-};
-
-#define I830_TEX_UNITS 4
-
-struct i830_hw_state {
- GLuint Ctx[I830_CTX_SETUP_SIZE];
- GLuint Buffer[I830_DEST_SETUP_SIZE];
- GLuint Stipple[I830_STP_SETUP_SIZE];
- GLuint Tex[I830_TEX_UNITS][I830_TEX_SETUP_SIZE];
- GLuint TexBlend[I830_TEX_UNITS][I830_TEXBLEND_SIZE];
- GLuint TexBlendWordsUsed[I830_TEX_UNITS];
-
- struct intel_region *draw_region;
- struct intel_region *depth_region;
-
- /* Regions aren't actually that appropriate here as the memory may
- * be from a PBO or FBO. Just use the buffer id. Will have to do
- * this for draw and depth for FBO's...
- */
- GLuint tex_buffer[I830_TEX_UNITS];
- GLuint tex_offset[I830_TEX_UNITS];
-
- GLuint emitted; /* I810_UPLOAD_* */
- GLuint active;
-};
-
-struct i830_context
-{
- struct intel_context intel;
-
- GLuint lodbias_tm0s3[MAX_TEXTURE_UNITS];
- GLuint last_index;
-
- struct i830_hw_state meta, initial, state, *current;
-};
-
-
-
-
-#define I830_STATECHANGE(i830, flag) \
-do { \
- INTEL_FIREVERTICES( &i830->intel ); \
- i830->state.emitted &= ~flag; \
-} while (0)
-
-#define I830_ACTIVESTATE(i830, flag, mode) \
-do { \
- INTEL_FIREVERTICES( &i830->intel ); \
- if (mode) \
- i830->state.active |= flag; \
- else \
- i830->state.active &= ~flag; \
-} while (0)
-
-/* i830_vtbl.c
- */
-extern void
-i830InitVtbl( struct i830_context *i830 );
-
-/* i830_context.c
- */
-extern GLboolean
-i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-/* i830_tex.c, i830_texstate.c
- */
-extern void
-i830UpdateTextureState( struct intel_context *intel );
-
-extern void
-i830InitTextureFuncs( struct dd_function_table *functions );
-
-/* i830_texblend.c
- */
-extern GLuint i830SetTexEnvCombine(struct i830_context *i830,
- const struct gl_tex_env_combine_state * combine, GLint blendUnit,
- GLuint texel_op, GLuint *state, const GLfloat *factor );
-
-extern void
-i830EmitTextureBlend( struct i830_context *i830 );
-
-
-/* i830_state.c
- */
-extern void
-i830InitStateFuncs( struct dd_function_table *functions );
-
-extern void
-i830EmitState( struct i830_context *i830 );
-
-extern void
-i830InitState( struct i830_context *i830 );
-
-/* i830_metaops.c
- */
-extern void
-i830InitMetaFuncs( struct i830_context *i830 );
-
-<<<<<<< i830_context.h
-extern void
-i830RotateWindow(intelContextPtr intel, __DRIdrawablePrivate *dPriv,
- GLuint srcBuf);
-=======
-/*======================================================================
- * Inline conversion functions. These are better-typed than the
- * macros used previously:
- */
-static INLINE struct i830_context *
-i830_context( GLcontext *ctx )
-{
- return (struct i830_context *)ctx;
-}
->>>>>>> 1.4.12.3
-
-#endif
-
diff --git a/src/mesa/drivers/dri/i915-tex/i830_metaops.c b/src/mesa/drivers/dri/i915-tex/i830_metaops.c
deleted file mode 100644
index 1213f8ab47b..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_metaops.c
+++ /dev/null
@@ -1,910 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "utils.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_ioctl.h"
-#include "intel_regions.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-/* A large amount of state doesn't need to be uploaded.
- */
-#define ACTIVE (I830_UPLOAD_INVARIENT | \
- I830_UPLOAD_CTX | \
- I830_UPLOAD_BUFFERS | \
- I830_UPLOAD_STIPPLE | \
- I830_UPLOAD_TEXBLEND(0) | \
- I830_UPLOAD_TEX(0))
-
-
-#define SET_STATE( i830, STATE ) \
-do { \
- assert(!i830->intel.prim.flush); \
- i830->current->emitted = 0; \
- i830->current = &i830->STATE; \
- i830->current->emitted = 0; \
-} while (0)
-
-
-static void set_no_stencil_write( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_FALSE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-static void set_no_depth_write( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-/* Set depth unit to replace.
- */
-static void set_depth_replace( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- * ctx->Driver.DepthMask( ctx, GL_TRUE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DEPTH_WRITE;
-
- /* ctx->Driver.DepthFunc( ctx, GL_ALWAYS )
- */
- i830->meta.Ctx[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
- i830->meta.Ctx[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(COMPAREFUNC_ALWAYS));
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-
-/* Set stencil unit to replace always with the reference value.
- */
-static void set_stencil_replace( struct intel_context *intel,
- GLuint s_mask,
- GLuint s_clear)
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_TRUE )
- */
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
-
- /* ctx->Driver.StencilMask( ctx, s_mask )
- */
- i830->meta.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- i830->meta.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK((s_mask&0xff)));
-
- /* ctx->Driver.StencilOp( ctx, GL_REPLACE, GL_REPLACE, GL_REPLACE )
- */
- i830->meta.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK);
- i830->meta.Ctx[I830_CTXREG_STENCILTST] |=
- (ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_REPLACE) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_REPLACE));
-
- /* ctx->Driver.StencilFunc( ctx, GL_ALWAYS, s_clear, ~0 )
- */
- i830->meta.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i830->meta.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff));
-
- i830->meta.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
- i830->meta.Ctx[I830_CTXREG_STENCILTST] |=
- (ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_REF_VALUE((s_clear&0xff)) |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS));
-
-
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-
-static void set_color_mask( struct intel_context *intel, GLboolean state )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- const GLuint mask = ((1 << WRITEMASK_RED_SHIFT) |
- (1 << WRITEMASK_GREEN_SHIFT) |
- (1 << WRITEMASK_BLUE_SHIFT) |
- (1 << WRITEMASK_ALPHA_SHIFT));
-
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] &= ~mask;
-
- if (state) {
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] |=
- (i830->state.Ctx[I830_CTXREG_ENABLES_2] & mask);
- }
-
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-/* Installs a one-stage passthrough texture blend pipeline. Is there
- * more that can be done to turn off texturing?
- */
-static void set_no_texture( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- static const struct gl_tex_env_combine_state comb = {
- GL_NONE, GL_NONE,
- { GL_TEXTURE, 0, 0, }, { GL_TEXTURE, 0, 0, },
- { GL_SRC_COLOR, 0, 0 }, { GL_SRC_ALPHA, 0, 0 },
- 0, 0, 0, 0
- };
-
- i830->meta.TexBlendWordsUsed[0] =
- i830SetTexEnvCombine( i830, & comb, 0, TEXBLENDARG_TEXEL0,
- i830->meta.TexBlend[0], NULL);
-
- i830->meta.TexBlend[0][0] |= TEXOP_LAST_STAGE;
- i830->meta.emitted &= ~I830_UPLOAD_TEXBLEND(0);
-}
-
-/* Set up a single element blend stage for 'replace' texturing with no
- * funny ops.
- */
-<<<<<<< i830_metaops.c
-static void enable_texture_blend_replace( i830ContextPtr i830 )
-=======
-static void set_texture_blend_replace( struct intel_context *intel )
->>>>>>> 1.6.2.9
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- static const struct gl_tex_env_combine_state comb = {
- GL_REPLACE, GL_REPLACE,
-<<<<<<< i830_metaops.c
- { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE }, { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, },
- { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR }, { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA },
-=======
- { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, }, { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, },
- { GL_SRC_COLOR, GL_SRC_COLOR, GL_SRC_COLOR }, { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA },
->>>>>>> 1.6.2.9
- 0, 0, 1, 1
- };
-
- i830->meta.TexBlendWordsUsed[0] =
- i830SetTexEnvCombine( i830, & comb, 0, TEXBLENDARG_TEXEL0,
- i830->meta.TexBlend[0], NULL);
-
- i830->meta.TexBlend[0][0] |= TEXOP_LAST_STAGE;
- i830->meta.emitted &= ~I830_UPLOAD_TEXBLEND(0);
-
-/* fprintf(stderr, "%s: TexBlendWordsUsed[0]: %d\n", */
-/* __FUNCTION__, i830->meta.TexBlendWordsUsed[0]); */
-}
-
-
-
-/* Set up an arbitary piece of memory as a rectangular texture
- * (including the front or back buffer).
- */
-<<<<<<< i830_metaops.c
-static void set_tex_rect_source( i830ContextPtr i830,
- GLuint offset,
- GLuint width,
- GLuint height,
- GLuint pitch, /* in bytes */
- GLuint textureFormat )
-=======
-static GLboolean set_tex_rect_source( struct intel_context *intel,
- GLuint buffer,
- GLuint offset,
- GLuint pitch,
- GLuint height,
- GLenum format,
- GLenum type)
->>>>>>> 1.6.2.9
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- GLuint *setup = i830->meta.Tex[0];
- GLint numLevels = 1;
- GLuint textureFormat;
- GLuint cpp;
-
- /* A full implementation of this would do the upload through
- * glTexImage2d, and get all the conversion operations at that
- * point. We are restricted, but still at least have access to the
- * fragment program swizzle.
- */
- switch (format) {
- case GL_BGRA:
- switch (type) {
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_BYTE:
- textureFormat = (MAPSURF_32BIT | MT_32BIT_ARGB8888);
- cpp = 4;
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_RGBA:
- switch (type) {
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_BYTE:
- textureFormat = (MAPSURF_32BIT | MT_32BIT_ABGR8888);
- cpp = 4;
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_BGR:
- switch (type) {
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- textureFormat = (MAPSURF_16BIT | MT_16BIT_RGB565);
- cpp = 2;
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_RGB:
- switch (type) {
- case GL_UNSIGNED_SHORT_5_6_5:
- textureFormat = (MAPSURF_16BIT | MT_16BIT_RGB565);
- cpp = 2;
- break;
- default:
- return GL_FALSE;
- }
- break;
-
-<<<<<<< i830_metaops.c
-/* fprintf(stderr, "%s: offset: %x w: %d h: %d pitch %d format %x\n", */
-/* __FUNCTION__, offset, width, height, pitch, textureFormat ); */
-=======
- default:
- return GL_FALSE;
- }
-
- i830->meta.tex_buffer[0] = buffer;
- i830->meta.tex_offset[0] = offset;
->>>>>>> 1.6.2.9
-
- setup[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
- (LOAD_TEXTURE_MAP0 << 0) | 4);
- setup[I830_TEXREG_TM0S1] = (((height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((pitch - 1) << TM0S1_WIDTH_SHIFT) |
- textureFormat);
- setup[I830_TEXREG_TM0S2] = (((((pitch * cpp) / 4) - 1) << TM0S2_PITCH_SHIFT) |
- TM0S2_CUBE_FACE_ENA_MASK);
-
- setup[I830_TEXREG_TM0S3] = ( (((numLevels - 1)*4) << TM0S3_MIN_MIP_SHIFT) |
- (FILTER_NEAREST << TM0S3_MIN_FILTER_SHIFT) |
- (MIPFILTER_NONE << TM0S3_MIP_FILTER_SHIFT) |
- (FILTER_NEAREST << TM0S3_MAG_FILTER_SHIFT));
-
- setup[I830_TEXREG_CUBE] = (_3DSTATE_MAP_CUBE | MAP_UNIT(0));
-
- setup[I830_TEXREG_MCS] = (_3DSTATE_MAP_COORD_SET_CMD |
- MAP_UNIT(0) |
- ENABLE_TEXCOORD_PARAMS |
- TEXCOORDS_ARE_IN_TEXELUNITS |
- TEXCOORDTYPE_CARTESIAN |
- ENABLE_ADDR_V_CNTL |
- TEXCOORD_ADDR_V_MODE(TEXCOORDMODE_WRAP) |
- ENABLE_ADDR_U_CNTL |
- TEXCOORD_ADDR_U_MODE(TEXCOORDMODE_WRAP));
-
- i830->meta.emitted &= ~I830_UPLOAD_TEX(0);
- return GL_TRUE;
-}
-
-
-<<<<<<< i830_metaops.c
-/* Select between front and back draw buffers.
- */
-static void set_draw_region( i830ContextPtr i830,
- const intelRegion *region )
-{
- i830->meta.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(region->pitch) | BUF_3D_USE_FENCE);
- i830->meta.Buffer[I830_DESTREG_CBUFADDR2] = region->offset;
- i830->meta.emitted &= ~I830_UPLOAD_BUFFERS;
-}
-
-/* Setup an arbitary draw format, useful for targeting
- * texture or agp memory.
- */
-#if 0
-static void set_draw_format( i830ContextPtr i830,
- GLuint format,
- GLuint depth_format)
-{
- i830->meta.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- format |
- DEPTH_IS_Z |
- depth_format);
-}
-#endif
-
-
-static void set_vertex_format( i830ContextPtr i830 )
-=======
-static void set_vertex_format( struct intel_context *intel )
->>>>>>> 1.6.2.9
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- i830->meta.Ctx[I830_CTXREG_VF] = (_3DSTATE_VFT0_CMD |
- VFT0_TEX_COUNT(1) |
- VFT0_DIFFUSE |
- VFT0_XYZ);
- i830->meta.Ctx[I830_CTXREG_VF2] = (_3DSTATE_VFT1_CMD |
- VFT1_TEX0_FMT(TEXCOORDFMT_2D) |
- VFT1_TEX1_FMT(TEXCOORDFMT_2D) |
- VFT1_TEX2_FMT(TEXCOORDFMT_2D) |
- VFT1_TEX3_FMT(TEXCOORDFMT_2D));
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-}
-
-
-static void meta_import_pixel_state( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- i830->meta.Ctx[I830_CTXREG_STATE1] = i830->state.Ctx[I830_CTXREG_STATE1];
- i830->meta.Ctx[I830_CTXREG_STATE2] = i830->state.Ctx[I830_CTXREG_STATE2];
- i830->meta.Ctx[I830_CTXREG_STATE3] = i830->state.Ctx[I830_CTXREG_STATE3];
- i830->meta.Ctx[I830_CTXREG_STATE4] = i830->state.Ctx[I830_CTXREG_STATE4];
- i830->meta.Ctx[I830_CTXREG_STATE5] = i830->state.Ctx[I830_CTXREG_STATE5];
- i830->meta.Ctx[I830_CTXREG_IALPHAB] = i830->state.Ctx[I830_CTXREG_IALPHAB];
- i830->meta.Ctx[I830_CTXREG_STENCILTST] = i830->state.Ctx[I830_CTXREG_STENCILTST];
- i830->meta.Ctx[I830_CTXREG_ENABLES_1] = i830->state.Ctx[I830_CTXREG_ENABLES_1];
- i830->meta.Ctx[I830_CTXREG_ENABLES_2] = i830->state.Ctx[I830_CTXREG_ENABLES_2];
- i830->meta.Ctx[I830_CTXREG_AA] = i830->state.Ctx[I830_CTXREG_AA];
- i830->meta.Ctx[I830_CTXREG_FOGCOLOR] = i830->state.Ctx[I830_CTXREG_FOGCOLOR];
- i830->meta.Ctx[I830_CTXREG_BLENDCOLOR0] = i830->state.Ctx[I830_CTXREG_BLENDCOLOR0];
- i830->meta.Ctx[I830_CTXREG_BLENDCOLOR1] = i830->state.Ctx[I830_CTXREG_BLENDCOLOR1];
- i830->meta.Ctx[I830_CTXREG_MCSB0] = i830->state.Ctx[I830_CTXREG_MCSB0];
- i830->meta.Ctx[I830_CTXREG_MCSB1] = i830->state.Ctx[I830_CTXREG_MCSB1];
-
-<<<<<<< i830_metaops.c
-/* fprintf(stderr, "%s: %f,%f-%f,%f 0x%x%x%x%x %f,%f-%f,%f\n", */
-/* __FUNCTION__, */
-/* x0,y0,x1,y1,red,green,blue,alpha,s0,t0,s1,t1); */
-
-
- /* initial vertex, left bottom */
- tmp.v.x = x0;
- tmp.v.y = y0;
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
- tmp.v.u0 = s0;
- tmp.v.v0 = t0;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right bottom */
- vb += 8;
- tmp.v.x = x1;
- tmp.v.u0 = s1;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* right top */
- vb += 8;
- tmp.v.y = y1;
- tmp.v.v0 = t1;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
- /* left top */
- vb += 8;
- tmp.v.x = x0;
- tmp.v.u0 = s0;
- for (i = 0 ; i < 8 ; i++)
- vb[i] = tmp.ui[i];
-
-/* fprintf(stderr, "%s: DV1: %x\n", */
-/* __FUNCTION__, i830->meta.Buffer[I830_DESTREG_DV1]); */
-}
-
-static void draw_poly(i830ContextPtr i830,
- GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha,
- GLuint numVerts,
- GLfloat verts[][2],
- GLfloat texcoords[][2])
-{
- GLuint vertex_size = 8;
- GLuint *vb = intelEmitInlinePrimitiveLocked( &i830->intel,
- PRIM3D_TRIFAN,
- numVerts * vertex_size,
- vertex_size );
- intelVertex tmp;
- int i, k;
-
- /* initial constant vertex fields */
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
-
- for (k = 0; k < numVerts; k++) {
- tmp.v.x = verts[k][0];
- tmp.v.y = verts[k][1];
- tmp.v.u0 = texcoords[k][0];
- tmp.v.v0 = texcoords[k][1];
-
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- vb += vertex_size;
- }
-}
-
-void
-i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- i830ContextPtr i830 = I830_CONTEXT( intel );
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- intelScreenPrivate *screen = intel->intelScreen;
- int x0, y0, x1, y1;
-
- INTEL_FIREVERTICES(intel);
- SET_STATE( i830, meta );
- set_initial_state( i830 );
-/* set_no_texture( i830 ); */
- set_vertex_format( i830 );
-
- LOCK_HARDWARE(intel);
-
- if(!all) {
- x0 = cx;
- y0 = cy;
- x1 = x0 + cw;
- y1 = y0 + ch;
- } else {
- x0 = 0;
- y0 = 0;
- x1 = x0 + dPriv->w;
- y1 = y0 + dPriv->h;
- }
-=======
->>>>>>> 1.6.2.9
-
- i830->meta.Ctx[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- i830->meta.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE;
- i830->meta.emitted &= ~I830_UPLOAD_CTX;
-
-<<<<<<< i830_metaops.c
- if(mask & BUFFER_BIT_FRONT_LEFT) {
- set_no_depth_stencil_write( i830 );
- set_color_mask( i830, GL_TRUE );
- set_draw_region( i830, &screen->front );
- draw_quad(i830, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-=======
->>>>>>> 1.6.2.9
-
-<<<<<<< i830_metaops.c
- if(mask & BUFFER_BIT_BACK_LEFT) {
- set_no_depth_stencil_write( i830 );
- set_color_mask( i830, GL_TRUE );
- set_draw_region( i830, &screen->back );
-
- draw_quad(i830, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-
- if(mask & BUFFER_BIT_STENCIL) {
- set_stencil_replace( i830,
- intel->ctx.Stencil.WriteMask[0],
- intel->ctx.Stencil.Clear);
-
- set_color_mask( i830, GL_FALSE );
- set_draw_region( i830, &screen->front );
- draw_quad( i830, x0, x1, y0, y1, 0, 0, 0, 0, 0, 0, 0, 0 );
- }
-
- UNLOCK_HARDWARE(intel);
-
- INTEL_FIREVERTICES(intel);
- SET_STATE( i830, state );
-=======
- i830->meta.Buffer[I830_DESTREG_SENABLE] = i830->state.Buffer[I830_DESTREG_SENABLE];
- i830->meta.Buffer[I830_DESTREG_SR1] = i830->state.Buffer[I830_DESTREG_SR1];
- i830->meta.Buffer[I830_DESTREG_SR2] = i830->state.Buffer[I830_DESTREG_SR2];
- i830->meta.emitted &= ~I830_UPLOAD_BUFFERS;
->>>>>>> 1.6.2.9
-}
-
-
-<<<<<<< i830_metaops.c
-#if 0
-=======
-
-/* Select between front and back draw buffers.
- */
-static void meta_draw_region( struct intel_context *intel,
- struct intel_region *draw_region,
- struct intel_region *depth_region )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- GLuint format;
- GLuint depth_format = DEPTH_FRMT_16_FIXED;
->>>>>>> 1.6.2.9
-
- intel_region_release(intel, &i830->meta.draw_region);
- intel_region_reference(&i830->meta.draw_region, draw_region);
-
-<<<<<<< i830_metaops.c
-
- enable_texture_blend_replace( i830 );
-
-
- /* Set the 3d engine to draw into the agp memory
- */
-
- set_draw_region( i830, destOffset );
- set_draw_format( i830, destFormat, depthFormat );
-
-
- /* Draw a single quad, no cliprects:
- */
- i830->intel.numClipRects = 1;
- i830->intel.pClipRects = &tmp;
- i830->intel.pClipRects[0].x1 = 0;
- i830->intel.pClipRects[0].y1 = 0;
- i830->intel.pClipRects[0].x2 = width;
- i830->intel.pClipRects[0].y2 = height;
-=======
- intel_region_release(intel, &i830->meta.depth_region);
- intel_region_reference(&i830->meta.depth_region, depth_region);
->>>>>>> 1.6.2.9
-
- /* XXX FBO: grab code from i915 meta_draw_region */
-
- /* XXX: 555 support?
- */
- if (draw_region->cpp == 2)
- format = DV_PF_565;
- else
- format = DV_PF_8888;
-
- if (depth_region) {
- if (depth_region->cpp == 2)
- depth_format = DEPTH_FRMT_16_FIXED;
- else
- depth_format = DEPTH_FRMT_24_FIXED_8_OTHER;
- }
-
-<<<<<<< i830_metaops.c
- /* Todo -- don't want to clobber all the drawing state like we do
- * for readpixels -- most of this state can be handled just fine.
- */
- if ( ctx->_ImageTransferState ||
- unpack->SwapBytes ||
- unpack->LsbFirst ||
- ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->Depth.OcclusionTest) {
- fprintf(stderr, "%s: other tests failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-=======
- i830->meta.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- format |
- DEPTH_IS_Z |
- depth_format);
->>>>>>> 1.6.2.9
-
- i830->meta.emitted &= ~I830_UPLOAD_BUFFERS;
-}
-
-
-/* Operations where the 3D engine is decoupled temporarily from the
- * current GL state and used for other purposes than simply rendering
- * incoming triangles.
- */
-static void install_meta_state( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- memcpy(&i830->meta, &i830->initial, sizeof(i830->meta) );
-
- i830->meta.active = ACTIVE;
- i830->meta.emitted = 0;
-
- SET_STATE(i830, meta);
- set_vertex_format(intel);
- set_no_texture(intel);
-}
-
-static void leave_meta_state( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- intel_region_release(intel, &i830->meta.draw_region);
- intel_region_release(intel, &i830->meta.depth_region);
-/* intel_region_release(intel, &i830->meta.tex_region[0]); */
- SET_STATE(i830, state);
-}
-
-
-
-void i830InitMetaFuncs( struct i830_context *i830 )
-{
- i830->intel.vtbl.install_meta_state = install_meta_state;
- i830->intel.vtbl.leave_meta_state = leave_meta_state;
- i830->intel.vtbl.meta_no_depth_write = set_no_depth_write;
- i830->intel.vtbl.meta_no_stencil_write = set_no_stencil_write;
- i830->intel.vtbl.meta_stencil_replace = set_stencil_replace;
- i830->intel.vtbl.meta_depth_replace = set_depth_replace;
- i830->intel.vtbl.meta_color_mask = set_color_mask;
- i830->intel.vtbl.meta_no_texture = set_no_texture;
- i830->intel.vtbl.meta_texture_blend_replace = set_texture_blend_replace;
- i830->intel.vtbl.meta_tex_rect_source = set_tex_rect_source;
- i830->intel.vtbl.meta_draw_region = meta_draw_region;
- i830->intel.vtbl.meta_import_pixel_state = meta_import_pixel_state;
-}
-
-
-
-
-<<<<<<< i830_metaops.c
- /* Set the pixel image up as a rectangular texture.
- */
- set_tex_rect_source( i830,
- src_offset,
- width,
- height,
- pitch, /* XXXX!!!! -- /2 sometimes */
- textureFormat );
-
-
- enable_texture_blend_replace( i830 );
-
-
- /* Draw to the current draw buffer:
- */
- set_draw_offset( i830, dst_offset );
-
- /* Draw a quad, use regular cliprects
- */
-/* fprintf(stderr, "x: %d y: %d width %d height %d\n", x, y, width, height); */
-
- draw_quad( i830,
- x, x+width, y, y+height,
- 0, 255, 0, 0,
- 0, width, 0, height );
-
- intelWindowMoved( intel );
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( ctx ); /* required by GL */
-
- SET_STATE(i830, state);
-
- return GL_TRUE;
-}
-=======
->>>>>>> 1.6.2.9
-
-#endif
-
-/**
- * Copy the window contents named by dPriv to the rotated (or reflected)
- * color buffer.
- * srcBuf is BUFFER_BIT_FRONT_LEFT or BUFFER_BIT_BACK_LEFT to indicate the source.
- */
-void
-i830RotateWindow(intelContextPtr intel, __DRIdrawablePrivate *dPriv,
- GLuint srcBuf)
-{
- i830ContextPtr i830 = I830_CONTEXT( intel );
- intelScreenPrivate *screen = intel->intelScreen;
- const GLuint cpp = screen->cpp;
- drm_clip_rect_t fullRect;
- GLuint textureFormat, srcOffset, srcPitch;
- const drm_clip_rect_t *clipRects;
- int numClipRects;
- int i;
-
- int xOrig, yOrig;
- int origNumClipRects;
- drm_clip_rect_t *origRects;
-
- /*
- * set up hardware state
- */
- intelFlush( &intel->ctx );
-
- SET_STATE( i830, meta );
- set_initial_state( i830 );
- set_no_texture( i830 );
- set_vertex_format( i830 );
- set_no_depth_stencil_write( i830 );
- set_color_mask( i830, GL_FALSE );
-
- LOCK_HARDWARE(intel);
-
- /* save current drawing origin and cliprects (restored at end) */
- xOrig = intel->drawX;
- yOrig = intel->drawY;
- origNumClipRects = intel->numClipRects;
- origRects = intel->pClipRects;
-
- if (!intel->numClipRects)
- goto done;
-
- /*
- * set drawing origin, cliprects for full-screen access to rotated screen
- */
- fullRect.x1 = 0;
- fullRect.y1 = 0;
- fullRect.x2 = screen->rotatedWidth;
- fullRect.y2 = screen->rotatedHeight;
- intel->drawX = 0;
- intel->drawY = 0;
- intel->numClipRects = 1;
- intel->pClipRects = &fullRect;
-
- set_draw_region( i830, &screen->rotated );
-
- if (cpp == 4)
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- else
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
-
- if (srcBuf == BUFFER_BIT_FRONT_LEFT) {
- srcPitch = screen->front.pitch; /* in bytes */
- srcOffset = screen->front.offset; /* bytes */
- clipRects = dPriv->pClipRects;
- numClipRects = dPriv->numClipRects;
- }
- else {
- srcPitch = screen->back.pitch; /* in bytes */
- srcOffset = screen->back.offset; /* bytes */
- clipRects = dPriv->pBackClipRects;
- numClipRects = dPriv->numBackClipRects;
- }
-
- /* set the whole screen up as a texture to avoid alignment issues */
- set_tex_rect_source(i830,
- srcOffset,
- screen->width,
- screen->height,
- srcPitch,
- textureFormat);
-
- enable_texture_blend_replace(i830);
-
- /*
- * loop over the source window's cliprects
- */
- for (i = 0; i < numClipRects; i++) {
- int srcX0 = clipRects[i].x1;
- int srcY0 = clipRects[i].y1;
- int srcX1 = clipRects[i].x2;
- int srcY1 = clipRects[i].y2;
- GLfloat verts[4][2], tex[4][2];
- int j;
-
- /* build vertices for four corners of clip rect */
- verts[0][0] = srcX0; verts[0][1] = srcY0;
- verts[1][0] = srcX1; verts[1][1] = srcY0;
- verts[2][0] = srcX1; verts[2][1] = srcY1;
- verts[3][0] = srcX0; verts[3][1] = srcY1;
-
- /* .. and texcoords */
- tex[0][0] = srcX0; tex[0][1] = srcY0;
- tex[1][0] = srcX1; tex[1][1] = srcY0;
- tex[2][0] = srcX1; tex[2][1] = srcY1;
- tex[3][0] = srcX0; tex[3][1] = srcY1;
-
- /* transform coords to rotated screen coords */
-
- for (j = 0; j < 4; j++) {
- matrix23TransformCoordf(&screen->rotMatrix,
- &verts[j][0], &verts[j][1]);
- }
-
- /* draw polygon to map source image to dest region */
- draw_poly(i830, 255, 255, 255, 255, 4, verts, tex);
-
- } /* cliprect loop */
-
- assert(!intel->prim.flush);
- intelFlushBatchLocked( intel, GL_FALSE, GL_FALSE, GL_FALSE );
-
- done:
- /* restore original drawing origin and cliprects */
- intel->drawX = xOrig;
- intel->drawY = yOrig;
- intel->numClipRects = origNumClipRects;
- intel->pClipRects = origRects;
-
- UNLOCK_HARDWARE(intel);
-
- SET_STATE( i830, state );
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/i830_reg.h b/src/mesa/drivers/dri/i915-tex/i830_reg.h
deleted file mode 100644
index ff08683d7e3..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_reg.h
+++ /dev/null
@@ -1,641 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#ifndef _I830_REG_H_
-#define _I830_REG_H_
-
-
-#include "intel_reg.h"
-
-#define I830_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24))
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-#define AA_LINE_ENABLE ((1<<1) | 1)
-#define AA_LINE_DISABLE (1<<1)
-
-#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) (((x)/4)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-
-#define _3DSTATE_COLOR_FACTOR_CMD (CMD_3D | (0x1d<<24) | (0x1<<16))
-
-#define _3DSTATE_COLOR_FACTOR_N_CMD(stage) (CMD_3D | (0x1d<<24) | \
- ((0x90+(stage))<<16))
-
-#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-
-#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLR_BUF_8BIT 0
-#define COLR_BUF_RGB555 (1<<8)
-#define COLR_BUF_RGB565 (2<<8)
-#define COLR_BUF_ARGB8888 (3<<8)
-#define DEPTH_IS_Z 0
-#define DEPTH_IS_W (1<<6)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define DEPTH_FRMT_24_FLOAT_8_OTHER (3<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 0
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-
-#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-
-#define _3DSTATE_ENABLES_1_CMD (CMD_3D|(0x3<<24))
-#define ENABLE_LOGIC_OP_MASK ((1<<23)|(1<<22))
-#define ENABLE_LOGIC_OP ((1<<23)|(1<<22))
-#define DISABLE_LOGIC_OP (1<<23)
-#define ENABLE_STENCIL_TEST ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_TEST (1<<21)
-#define ENABLE_DEPTH_BIAS ((1<<11)|(1<<10))
-#define DISABLE_DEPTH_BIAS (1<<11)
-#define ENABLE_SPEC_ADD_MASK ((1<<9)|(1<<8))
-#define ENABLE_SPEC_ADD ((1<<9)|(1<<8))
-#define DISABLE_SPEC_ADD (1<<9)
-#define ENABLE_DIS_FOG_MASK ((1<<7)|(1<<6))
-#define ENABLE_FOG ((1<<7)|(1<<6))
-#define DISABLE_FOG (1<<7)
-#define ENABLE_DIS_ALPHA_TEST_MASK ((1<<5)|(1<<4))
-#define ENABLE_ALPHA_TEST ((1<<5)|(1<<4))
-#define DISABLE_ALPHA_TEST (1<<5)
-#define ENABLE_DIS_CBLEND_MASK ((1<<3)|(1<<2))
-#define ENABLE_COLOR_BLEND ((1<<3)|(1<<2))
-#define DISABLE_COLOR_BLEND (1<<3)
-#define ENABLE_DIS_DEPTH_TEST_MASK ((1<<1)|1)
-#define ENABLE_DEPTH_TEST ((1<<1)|1)
-#define DISABLE_DEPTH_TEST (1<<1)
-
-/* _3DSTATE_ENABLES_2, p138 */
-#define _3DSTATE_ENABLES_2_CMD (CMD_3D|(0x4<<24))
-#define ENABLE_STENCIL_WRITE ((1<<21)|(1<<20))
-#define DISABLE_STENCIL_WRITE (1<<21)
-#define ENABLE_TEX_CACHE ((1<<17)|(1<<16))
-#define DISABLE_TEX_CACHE (1<<17)
-#define ENABLE_DITHER ((1<<9)|(1<<8))
-#define DISABLE_DITHER (1<<9)
-#define ENABLE_COLOR_MASK (1<<10)
-#define WRITEMASK_ALPHA (1<<7)
-#define WRITEMASK_ALPHA_SHIFT 7
-#define WRITEMASK_RED (1<<6)
-#define WRITEMASK_RED_SHIFT 6
-#define WRITEMASK_GREEN (1<<5)
-#define WRITEMASK_GREEN_SHIFT 5
-#define WRITEMASK_BLUE (1<<4)
-#define WRITEMASK_BLUE_SHIFT 4
-#define WRITEMASK_MASK ((1<<4)|(1<<5)|(1<<6)|(1<<7))
-#define ENABLE_COLOR_WRITE ((1<<3)|(1<<2))
-#define DISABLE_COLOR_WRITE (1<<3)
-#define ENABLE_DIS_DEPTH_WRITE_MASK 0x3
-#define ENABLE_DEPTH_WRITE ((1<<1)|1)
-#define DISABLE_DEPTH_WRITE (1<<1)
-
-/* _3DSTATE_FOG_COLOR, p139 */
-#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* _3DSTATE_FOG_MODE, p140 */
-#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FOGFUNC_ENABLE (1<<31)
-#define FOGFUNC_VERTEX 0
-#define FOGFUNC_PIXEL_EXP (1<<28)
-#define FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FOGSRC_INDEX_Z (1<<27)
-#define FOGSRC_INDEX_W ((1<<27)|(1<<25))
-#define FOG_LINEAR_CONST (1<<24)
-#define FOG_CONST_1(x) ((x)<<4)
-#define ENABLE_FOG_DENSITY (1<<23)
-/* Dword 2 */
-#define FOG_CONST_2(x) (x)
-/* Dword 3 */
-#define FOG_DENSITY(x) (x)
-
-/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p142 */
-#define _3DSTATE_INDPT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define ENABLE_INDPT_ALPHA_BLEND ((1<<23)|(1<<22))
-#define DISABLE_INDPT_ALPHA_BLEND (1<<23)
-#define ALPHA_BLENDFUNC_MASK 0x3f0000
-#define ENABLE_ALPHA_BLENDFUNC (1<<21)
-#define ABLENDFUNC_ADD 0
-#define ABLENDFUNC_SUB (1<<16)
-#define ABLENDFUNC_RVSE_SUB (2<<16)
-#define ABLENDFUNC_MIN (3<<16)
-#define ABLENDFUNC_MAX (4<<16)
-#define SRC_DST_ABLEND_MASK 0xfff
-#define ENABLE_SRC_ABLEND_FACTOR (1<<11)
-#define SRC_ABLEND_FACT(x) ((x)<<6)
-#define ENABLE_DST_ABLEND_FACTOR (1<<5)
-#define DST_ABLEND_FACT(x) (x)
-
-
-/* _3DSTATE_MAP_BLEND_ARG, p152 */
-#define _3DSTATE_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
-
-#define TEXPIPE_COLOR 0
-#define TEXPIPE_ALPHA (1<<18)
-#define TEXPIPE_KILL (2<<18)
-#define TEXBLEND_ARG0 0
-#define TEXBLEND_ARG1 (1<<15)
-#define TEXBLEND_ARG2 (2<<15)
-#define TEXBLEND_ARG3 (3<<15)
-#define TEXBLENDARG_MODIFY_PARMS (1<<6)
-#define TEXBLENDARG_REPLICATE_ALPHA (1<<5)
-#define TEXBLENDARG_INV_ARG (1<<4)
-#define TEXBLENDARG_ONE 0
-#define TEXBLENDARG_FACTOR 0x01
-#define TEXBLENDARG_ACCUM 0x02
-#define TEXBLENDARG_DIFFUSE 0x03
-#define TEXBLENDARG_SPEC 0x04
-#define TEXBLENDARG_CURRENT 0x05
-#define TEXBLENDARG_TEXEL0 0x06
-#define TEXBLENDARG_TEXEL1 0x07
-#define TEXBLENDARG_TEXEL2 0x08
-#define TEXBLENDARG_TEXEL3 0x09
-#define TEXBLENDARG_FACTOR_N 0x0e
-
-/* _3DSTATE_MAP_BLEND_OP, p155 */
-#define _3DSTATE_MAP_BLEND_OP_CMD(stage) (CMD_3D|(0x0d<<24)|((stage)<<20))
-#if 0
-# define TEXPIPE_COLOR 0
-# define TEXPIPE_ALPHA (1<<18)
-# define TEXPIPE_KILL (2<<18)
-#endif
-#define ENABLE_TEXOUTPUT_WRT_SEL (1<<17)
-#define TEXOP_OUTPUT_CURRENT 0
-#define TEXOP_OUTPUT_ACCUM (1<<15)
-#define ENABLE_TEX_CNTRL_STAGE ((1<<12)|(1<<11))
-#define DISABLE_TEX_CNTRL_STAGE (1<<12)
-#define TEXOP_SCALE_SHIFT 9
-#define TEXOP_SCALE_1X (0 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_2X (1 << TEXOP_SCALE_SHIFT)
-#define TEXOP_SCALE_4X (2 << TEXOP_SCALE_SHIFT)
-#define TEXOP_MODIFY_PARMS (1<<8)
-#define TEXOP_LAST_STAGE (1<<7)
-#define TEXBLENDOP_KILLPIXEL 0x02
-#define TEXBLENDOP_ARG1 0x01
-#define TEXBLENDOP_ARG2 0x02
-#define TEXBLENDOP_MODULATE 0x03
-#define TEXBLENDOP_ADD 0x06
-#define TEXBLENDOP_ADDSIGNED 0x07
-#define TEXBLENDOP_BLEND 0x08
-#define TEXBLENDOP_BLEND_AND_ADD 0x09
-#define TEXBLENDOP_SUBTRACT 0x0a
-#define TEXBLENDOP_DOT3 0x0b
-#define TEXBLENDOP_DOT4 0x0c
-#define TEXBLENDOP_MODULATE_AND_ADD 0x0d
-#define TEXBLENDOP_MODULATE_2X_AND_ADD 0x0e
-#define TEXBLENDOP_MODULATE_4X_AND_ADD 0x0f
-
-/* _3DSTATE_MAP_BUMP_TABLE, p160 TODO */
-/* _3DSTATE_MAP_COLOR_CHROMA_KEY, p161 TODO */
-
-#define _3DSTATE_MAP_COORD_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8c<<16))
-#define DISABLE_TEX_TRANSFORM (1<<28)
-#define TEXTURE_SET(x) (x<<29)
-
-#define _3DSTATE_VERTEX_TRANSFORM ((3<<29)|(0x1d<<24)|(0x8b<<16))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define DISABLE_PERSPECTIVE_DIVIDE (1<<29)
-
-
-/* _3DSTATE_MAP_COORD_SET_BINDINGS, p162 */
-#define _3DSTATE_MAP_COORD_SETBIND_CMD (CMD_3D|(0x1d<<24)|(0x02<<16))
-#define TEXBIND_MASK3 ((1<<15)|(1<<14)|(1<<13)|(1<<12))
-#define TEXBIND_MASK2 ((1<<11)|(1<<10)|(1<<9)|(1<<8))
-#define TEXBIND_MASK1 ((1<<7)|(1<<6)|(1<<5)|(1<<4))
-#define TEXBIND_MASK0 ((1<<3)|(1<<2)|(1<<1)|1)
-
-#define TEXBIND_SET3(x) ((x)<<12)
-#define TEXBIND_SET2(x) ((x)<<8)
-#define TEXBIND_SET1(x) ((x)<<4)
-#define TEXBIND_SET0(x) (x)
-
-#define TEXCOORDSRC_KEEP 0
-#define TEXCOORDSRC_DEFAULT 0x01
-#define TEXCOORDSRC_VTXSET_0 0x08
-#define TEXCOORDSRC_VTXSET_1 0x09
-#define TEXCOORDSRC_VTXSET_2 0x0a
-#define TEXCOORDSRC_VTXSET_3 0x0b
-#define TEXCOORDSRC_VTXSET_4 0x0c
-#define TEXCOORDSRC_VTXSET_5 0x0d
-#define TEXCOORDSRC_VTXSET_6 0x0e
-#define TEXCOORDSRC_VTXSET_7 0x0f
-
-#define MAP_UNIT(unit) ((unit)<<16)
-#define MAP_UNIT_MASK (0x7<<16)
-
-/* _3DSTATE_MAP_COORD_SETS, p164 */
-#define _3DSTATE_MAP_COORD_SET_CMD (CMD_3D|(0x1c<<24)|(0x01<<19))
-#define ENABLE_TEXCOORD_PARAMS (1<<15)
-#define TEXCOORDS_ARE_NORMAL (1<<14)
-#define TEXCOORDS_ARE_IN_TEXELUNITS 0
-#define TEXCOORDTYPE_CARTESIAN 0
-#define TEXCOORDTYPE_HOMOGENEOUS (1<<11)
-#define TEXCOORDTYPE_VECTOR (2<<11)
-#define TEXCOORDTYPE_MASK (0x7<<11)
-#define ENABLE_ADDR_V_CNTL (1<<7)
-#define ENABLE_ADDR_U_CNTL (1<<3)
-#define TEXCOORD_ADDR_V_MODE(x) ((x)<<4)
-#define TEXCOORD_ADDR_U_MODE(x) (x)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP 2
-#define TEXCOORDMODE_WRAP_SHORTEST 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORD_ADDR_V_MASK 0x70
-#define TEXCOORD_ADDR_U_MASK 0x7
-
-/* _3DSTATE_MAP_CUBE, p168 TODO */
-#define _3DSTATE_MAP_CUBE (CMD_3D|(0x1c<<24)|(0x0a<<19))
-#define CUBE_NEGX_ENABLE (1<<5)
-#define CUBE_POSX_ENABLE (1<<4)
-#define CUBE_NEGY_ENABLE (1<<3)
-#define CUBE_POSY_ENABLE (1<<2)
-#define CUBE_NEGZ_ENABLE (1<<1)
-#define CUBE_POSZ_ENABLE (1<<0)
-
-
-/* _3DSTATE_MODES_1, p190 */
-#define _3DSTATE_MODES_1_CMD (CMD_3D|(0x08<<24))
-#define BLENDFUNC_MASK 0x3f0000
-#define ENABLE_COLR_BLND_FUNC (1<<21)
-#define BLENDFUNC_ADD 0
-#define BLENDFUNC_SUB (1<<16)
-#define BLENDFUNC_RVRSE_SUB (2<<16)
-#define BLENDFUNC_MIN (3<<16)
-#define BLENDFUNC_MAX (4<<16)
-#define SRC_DST_BLND_MASK 0xfff
-#define ENABLE_SRC_BLND_FACTOR (1<<11)
-#define ENABLE_DST_BLND_FACTOR (1<<5)
-#define SRC_BLND_FACT(x) ((x)<<6)
-#define DST_BLND_FACT(x) (x)
-
-
-/* _3DSTATE_MODES_2, p192 */
-#define _3DSTATE_MODES_2_CMD (CMD_3D|(0x0f<<24))
-#define ENABLE_GLOBAL_DEPTH_BIAS (1<<22)
-#define GLOBAL_DEPTH_BIAS(x) ((x)<<14)
-#define ENABLE_ALPHA_TEST_FUNC (1<<13)
-#define ENABLE_ALPHA_REF_VALUE (1<<8)
-#define ALPHA_TEST_FUNC(x) ((x)<<9)
-#define ALPHA_REF_VALUE(x) (x)
-
-#define ALPHA_TEST_REF_MASK 0x3fff
-
-/* _3DSTATE_MODES_3, p193 */
-#define _3DSTATE_MODES_3_CMD (CMD_3D|(0x02<<24))
-#define DEPTH_TEST_FUNC_MASK 0x1f0000
-#define ENABLE_DEPTH_TEST_FUNC (1<<20)
-/* Uses COMPAREFUNC */
-#define DEPTH_TEST_FUNC(x) ((x)<<16)
-#define ENABLE_ALPHA_SHADE_MODE (1<<11)
-#define ENABLE_FOG_SHADE_MODE (1<<9)
-#define ENABLE_SPEC_SHADE_MODE (1<<7)
-#define ENABLE_COLOR_SHADE_MODE (1<<5)
-#define ALPHA_SHADE_MODE(x) ((x)<<10)
-#define FOG_SHADE_MODE(x) ((x)<<8)
-#define SPEC_SHADE_MODE(x) ((x)<<6)
-#define COLOR_SHADE_MODE(x) ((x)<<4)
-#define CULLMODE_MASK 0xf
-#define ENABLE_CULL_MODE (1<<3)
-#define CULLMODE_BOTH 0
-#define CULLMODE_NONE 1
-#define CULLMODE_CW 2
-#define CULLMODE_CCW 3
-
-#define SHADE_MODE_LINEAR 0
-#define SHADE_MODE_FLAT 0x1
-
-/* _3DSTATE_MODES_4, p195 */
-#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x16<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21))
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) (((x)&0xff)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) ((x)&0xff)
-
-/* _3DSTATE_MODES_5, p196 */
-#define _3DSTATE_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define ENABLE_SPRITE_POINT_TEX (1<<23)
-#define SPRITE_POINT_TEX_ON (1<<22)
-#define SPRITE_POINT_TEX_OFF 0
-#define FLUSH_RENDER_CACHE (1<<18)
-#define FLUSH_TEXTURE_CACHE (1<<16)
-#define FIXED_LINE_WIDTH_MASK 0xfc00
-#define ENABLE_FIXED_LINE_WIDTH (1<<15)
-#define FIXED_LINE_WIDTH(x) ((x)<<10)
-#define FIXED_POINT_WIDTH_MASK 0x3ff
-#define ENABLE_FIXED_POINT_WIDTH (1<<9)
-#define FIXED_POINT_WIDTH(x) (x)
-
-/* _3DSTATE_RASTERIZATION_RULES, p198 */
-#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define ENABLE_TRI_STRIP_PROVOKE_VRTX (1<<2)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-#define TRI_STRIP_PROVOKE_VRTX(x) (x)
-
-/* _3DSTATE_SCISSOR_ENABLE, p200 */
-#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* _3DSTATE_SCISSOR_RECTANGLE_0, p201 */
-#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* _3DSTATE_STENCIL_TEST, p202 */
-#define _3DSTATE_STENCIL_TEST_CMD (CMD_3D|(0x09<<24))
-#define ENABLE_STENCIL_PARMS (1<<23)
-#define STENCIL_OPS_MASK (0xffc000)
-#define STENCIL_FAIL_OP(x) ((x)<<20)
-#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17)
-#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14)
-
-#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9))
-#define ENABLE_STENCIL_TEST_FUNC (1<<13)
-/* Uses COMPAREFUNC */
-#define STENCIL_TEST_FUNC(x) ((x)<<9)
-#define STENCIL_REF_VALUE_MASK ((1<<8)|0xff)
-#define ENABLE_STENCIL_REF_VALUE (1<<8)
-#define STENCIL_REF_VALUE(x) (x)
-
-/* _3DSTATE_VERTEX_FORMAT, p204 */
-#define _3DSTATE_VFT0_CMD (CMD_3D|(0x05<<24))
-#define VFT0_POINT_WIDTH (1<<12)
-#define VFT0_TEX_COUNT_MASK (7<<8)
-#define VFT0_TEX_COUNT_SHIFT 8
-#define VFT0_TEX_COUNT(x) ((x)<<8)
-#define VFT0_SPEC (1<<7)
-#define VFT0_DIFFUSE (1<<6)
-#define VFT0_DEPTH_OFFSET (1<<5)
-#define VFT0_XYZ (1<<1)
-#define VFT0_XYZW (2<<1)
-#define VFT0_XY (3<<1)
-#define VFT0_XYW (4<<1)
-#define VFT0_XYZW_MASK (7<<1)
-
-/* _3DSTATE_VERTEX_FORMAT_2, p206 */
-#define _3DSTATE_VFT1_CMD (CMD_3D|(0x0a<<24))
-#define VFT1_TEX7_FMT(x) ((x)<<14)
-#define VFT1_TEX6_FMT(x) ((x)<<12)
-#define VFT1_TEX5_FMT(x) ((x)<<10)
-#define VFT1_TEX4_FMT(x) ((x)<<8)
-#define VFT1_TEX3_FMT(x) ((x)<<6)
-#define VFT1_TEX2_FMT(x) ((x)<<4)
-#define VFT1_TEX1_FMT(x) ((x)<<2)
-#define VFT1_TEX0_FMT(x) (x)
-#define VFT1_TEX0_MASK 3
-#define VFT1_TEX1_SHIFT 2
-#define TEXCOORDFMT_2D 0
-#define TEXCOORDFMT_3D 1
-#define TEXCOORDFMT_4D 2
-#define TEXCOORDFMT_1D 3
-
-/*New stuff picked up along the way */
-
-#define MLC_LOD_BIAS_MASK ((1<<7)-1)
-
-
-/* _3DSTATE_VERTEX_TRANSFORM, p207 */
-#define _3DSTATE_VERTEX_TRANS_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|0)
-#define _3DSTATE_VERTEX_TRANS_MTX_CMD (CMD_3D|(0x1d<<24)|(0x8b<<16)|6)
-/* Dword 1 */
-#define ENABLE_VIEWPORT_TRANSFORM ((1<<31)|(1<<30))
-#define DISABLE_VIEWPORT_TRANSFORM (1<<31)
-#define ENABLE_PERSP_DIVIDE ((1<<29)|(1<<28))
-#define DISABLE_PERSP_DIVIDE (1<<29)
-#define VRTX_TRANS_LOAD_MATRICES 0x7421
-#define VRTX_TRANS_NO_LOAD_MATRICES 0x0000
-/* Dword 2 -> 7 are matrix elements */
-
-/* _3DSTATE_W_STATE, p209 */
-#define _3DSTATE_W_STATE_CMD (CMD_3D|(0x1d<<24)|(0x8d<<16)|1)
-/* Dword 1 */
-#define MAGIC_W_STATE_DWORD1 0x00000008
-/* Dword 2 */
-#define WFAR_VALUE(x) (x)
-
-
-/* Stipple command, carried over from the i810, apparently:
- */
-#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-
-
-#define _3DSTATE_LOAD_STATE_IMMEDIATE_2 ((0x3<<29)|(0x1d<<24)|(0x03<<16))
-#define LOAD_TEXTURE_MAP0 (1<<11)
-#define LOAD_GLOBAL_COLOR_FACTOR (1<<6)
-
-#define TM0S0_ADDRESS_MASK 0xfffffffc
-#define TM0S0_USE_FENCE (1<<1)
-
-#define TM0S1_HEIGHT_SHIFT 21
-#define TM0S1_WIDTH_SHIFT 10
-#define TM0S1_PALETTE_SELECT (1<<9)
-#define TM0S1_MAPSURF_FORMAT_MASK (0x7 << 6)
-#define TM0S1_MAPSURF_FORMAT_SHIFT 6
-#define MAPSURF_8BIT_INDEXED (0<<6)
-#define MAPSURF_8BIT (1<<6)
-#define MAPSURF_16BIT (2<<6)
-#define MAPSURF_32BIT (3<<6)
-#define MAPSURF_411 (4<<6)
-#define MAPSURF_422 (5<<6)
-#define MAPSURF_COMPRESSED (6<<6)
-#define MAPSURF_4BIT_INDEXED (7<<6)
-#define TM0S1_MT_FORMAT_MASK (0x7 << 3)
-#define TM0S1_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_IDX_RGB565 (0<<3) /* SURFACE_8BIT_INDEXED */
-#define MT_8BIT_IDX_ARGB1555 (1<<3)
-#define MT_8BIT_IDX_ARGB4444 (2<<3)
-#define MT_8BIT_IDX_AY88 (3<<3)
-#define MT_8BIT_IDX_ABGR8888 (4<<3)
-#define MT_8BIT_IDX_BUMP_88DVDU (5<<3)
-#define MT_8BIT_IDX_BUMP_655LDVDU (6<<3)
-#define MT_8BIT_IDX_ARGB8888 (7<<3)
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_DIB_ARGB1555_8888 (4<<3)
-#define MT_16BIT_BUMP_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_DIB_RGB565_8888 (7<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
-#define MT_32BIT_DIB_8888 (7<<3)
-#define MT_411_YUV411 (0<<3) /* SURFACE_411 */
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define TM0S1_COLORSPACE_CONVERSION (1 << 2)
-#define TM0S1_TILED_SURFACE (1 << 1)
-#define TM0S1_TILE_WALK (1 << 0)
-
-#define TM0S2_PITCH_SHIFT 21
-#define TM0S2_CUBE_FACE_ENA_SHIFT 15
-#define TM0S2_CUBE_FACE_ENA_MASK (1<<15)
-#define TM0S2_MAP_FORMAT (1<<14)
-#define TM0S2_VERTICAL_LINE_STRIDE (1<<13)
-#define TM0S2_VERITCAL_LINE_STRIDE_OFF (1<<12)
-#define TM0S2_OUTPUT_CHAN_SHIFT 10
-#define TM0S2_OUTPUT_CHAN_MASK (3<<10)
-
-#define TM0S3_MIP_FILTER_MASK (0x3<<30)
-#define TM0S3_MIP_FILTER_SHIFT 30
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define TM0S3_MAG_FILTER_MASK (0x3<<28)
-#define TM0S3_MAG_FILTER_SHIFT 28
-#define TM0S3_MIN_FILTER_MASK (0x3<<26)
-#define TM0S3_MIN_FILTER_SHIFT 26
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-
-#define TM0S3_LOD_BIAS_SHIFT 17
-#define TM0S3_LOD_BIAS_MASK (0x1ff<<17)
-#define TM0S3_MAX_MIP_SHIFT 9
-#define TM0S3_MAX_MIP_MASK (0xff<<9)
-#define TM0S3_MIN_MIP_SHIFT 3
-#define TM0S3_MIN_MIP_MASK (0x3f<<3)
-#define TM0S3_KILL_PIXEL (1<<2)
-#define TM0S3_KEYED_FILTER (1<<1)
-#define TM0S3_CHROMA_KEY (1<<0)
-
-
-/* _3DSTATE_MAP_TEXEL_STREAM, p188 */
-#define _3DSTATE_MAP_TEX_STREAM_CMD (CMD_3D|(0x1c<<24)|(0x05<<19))
-#define DISABLE_TEX_STREAM_BUMP (1<<12)
-#define ENABLE_TEX_STREAM_BUMP ((1<<12)|(1<<11))
-#define TEX_MODIFY_UNIT_0 0
-#define TEX_MODIFY_UNIT_1 (1<<8)
-#define ENABLE_TEX_STREAM_COORD_SET (1<<7)
-#define TEX_STREAM_COORD_SET(x) ((x)<<4)
-#define ENABLE_TEX_STREAM_MAP_IDX (1<<3)
-#define TEX_STREAM_MAP_IDX(x) (x)
-
-
-#define MI_FLUSH ((0<<29)|(4<<23))
-#define FLUSH_MAP_CACHE (1<<0)
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/i830_state.c b/src/mesa/drivers/dri/i915-tex/i830_state.c
deleted file mode 100644
index 7a514c33468..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_state.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "texmem.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_fbo.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-static void
-i830StencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref,
- GLuint mask)
-{
- struct i830_context *i830 = i830_context(ctx);
- int test = intel_translate_compare_func(func);
-
- mask = mask & 0xff;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(func), ref, mask);
-
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i830->state.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(mask));
- i830->state.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK |
- ENABLE_STENCIL_TEST_FUNC_MASK);
- i830->state.Ctx[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_REF_VALUE |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_REF_VALUE(ref) |
- STENCIL_TEST_FUNC(test));
-}
-
-static void
-i830StencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask)
-{
- struct i830_context *i830 = i830_context(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
-
- mask = mask & 0xff;
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- i830->state.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(mask));
-}
-
-static void
-i830StencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- struct i830_context *i830 = i830_context(ctx);
- int fop, dfop, dpop;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(fail),
- _mesa_lookup_enum_by_nr(zfail),
- _mesa_lookup_enum_by_nr(zpass));
-
- fop = 0; dfop = 0; dpop = 0;
-
- switch(fail) {
- case GL_KEEP:
- fop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- fop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- fop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- fop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- fop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- fop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- fop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- fop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zfail) {
- case GL_KEEP:
- dfop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dfop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dfop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dfop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dfop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dfop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dfop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dfop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
- switch(zpass) {
- case GL_KEEP:
- dpop = STENCILOP_KEEP;
- break;
- case GL_ZERO:
- dpop = STENCILOP_ZERO;
- break;
- case GL_REPLACE:
- dpop = STENCILOP_REPLACE;
- break;
- case GL_INCR:
- dpop = STENCILOP_INCRSAT;
- break;
- case GL_DECR:
- dpop = STENCILOP_DECRSAT;
- break;
- case GL_INCR_WRAP:
- dpop = STENCILOP_INCR;
- break;
- case GL_DECR_WRAP:
- dpop = STENCILOP_DECR;
- break;
- case GL_INVERT:
- dpop = STENCILOP_INVERT;
- break;
- default:
- break;
- }
-
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK);
- i830->state.Ctx[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(fop) |
- STENCIL_PASS_DEPTH_FAIL_OP(dfop) |
- STENCIL_PASS_DEPTH_PASS_OP(dpop));
-}
-
-static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- struct i830_context *i830 = i830_context(ctx);
- int test = intel_translate_compare_func(func);
- GLubyte refByte;
- GLuint refInt;
-
- UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref);
- refInt = (GLuint)refByte;
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE2] &= ~ALPHA_TEST_REF_MASK;
- i830->state.Ctx[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC |
- ENABLE_ALPHA_REF_VALUE |
- ALPHA_TEST_FUNC(test) |
- ALPHA_REF_VALUE(refInt));
-}
-
-/**
- * Makes sure that the proper enables are set for LogicOp, Independant Alpha
- * Blend, and Blending. It needs to be called from numerous places where we
- * could change the LogicOp or Independant Alpha Blend without subsequent
- * calls to glEnable.
- *
- * \todo
- * This function is substantially different from the old i830-specific driver.
- * I'm not sure which is correct.
- */
-static void i830EvalLogicOpBlendState(GLcontext *ctx)
-{
- struct i830_context *i830 = i830_context(ctx);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- if (ctx->Color._LogicOpEnabled) {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP);
- } else if (ctx->Color.BlendEnabled) {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (ENABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- } else {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND |
- ENABLE_LOGIC_OP_MASK);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND |
- DISABLE_LOGIC_OP);
- }
-}
-
-static void i830BlendColor(GLcontext *ctx, const GLfloat color[4])
-{
- struct i830_context *i830 = i830_context(ctx);
- GLubyte r, g, b, a;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, color[ACOMP]);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
-}
-
-/**
- * Sets both the blend equation (called "function" in i830 docs) and the
- * blend function (called "factor" in i830 docs). This is done in a single
- * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
- * change the interpretation of the blend function.
- */
-static void i830_set_blend_state( GLcontext * ctx )
-{
- struct i830_context *i830 = i830_context(ctx);
- int funcA;
- int funcRGB;
- int eqnA;
- int eqnRGB;
- int iab;
- int s1;
-
-
- funcRGB = SRC_BLND_FACT( intel_translate_blend_factor( ctx->Color.BlendSrcRGB ) )
- | DST_BLND_FACT( intel_translate_blend_factor( ctx->Color.BlendDstRGB ) );
-
- switch(ctx->Color.BlendEquationRGB) {
- case GL_FUNC_ADD:
- eqnRGB = BLENDFUNC_ADD;
- break;
- case GL_MIN:
- eqnRGB = BLENDFUNC_MIN;
- funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_MAX:
- eqnRGB = BLENDFUNC_MAX;
- funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_FUNC_SUBTRACT:
- eqnRGB = BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnRGB = BLENDFUNC_RVRSE_SUB;
- break;
- default:
- fprintf( stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n",
- __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB );
- return;
- }
-
-
- funcA = SRC_ABLEND_FACT( intel_translate_blend_factor( ctx->Color.BlendSrcA ) )
- | DST_ABLEND_FACT( intel_translate_blend_factor( ctx->Color.BlendDstA ) );
-
- switch(ctx->Color.BlendEquationA) {
- case GL_FUNC_ADD:
- eqnA = BLENDFUNC_ADD;
- break;
- case GL_MIN:
- eqnA = BLENDFUNC_MIN;
- funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_MAX:
- eqnA = BLENDFUNC_MAX;
- funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE);
- break;
- case GL_FUNC_SUBTRACT:
- eqnA = BLENDFUNC_SUB;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- eqnA = BLENDFUNC_RVRSE_SUB;
- break;
- default:
- fprintf( stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n",
- __FUNCTION__, __LINE__, ctx->Color.BlendEquationA );
- return;
- }
-
- iab = eqnA | funcA
- | _3DSTATE_INDPT_ALPHA_BLEND_CMD
- | ENABLE_SRC_ABLEND_FACTOR | ENABLE_DST_ABLEND_FACTOR
- | ENABLE_ALPHA_BLENDFUNC;
- s1 = eqnRGB | funcRGB
- | _3DSTATE_MODES_1_CMD
- | ENABLE_SRC_BLND_FACTOR | ENABLE_DST_BLND_FACTOR
- | ENABLE_COLR_BLND_FUNC;
-
- if ( (eqnA | funcA) != (eqnRGB | funcRGB) )
- iab |= ENABLE_INDPT_ALPHA_BLEND;
- else
- iab |= DISABLE_INDPT_ALPHA_BLEND;
-
- if (iab != i830->state.Ctx[I830_CTXREG_IALPHAB] ||
- s1 != i830->state.Ctx[I830_CTXREG_STATE1]) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_IALPHAB] = iab;
- i830->state.Ctx[I830_CTXREG_STATE1] = s1;
- }
-
- /* This will catch a logicop blend equation. It will also ensure
- * independant alpha blend is really in the correct state (either enabled
- * or disabled) if blending is already enabled.
- */
-
- i830EvalLogicOpBlendState(ctx);
-
- if (0) {
- fprintf(stderr, "[%s:%u] STATE1: 0x%08x IALPHAB: 0x%08x blend is %sabled\n",
- __FUNCTION__, __LINE__,
- i830->state.Ctx[I830_CTXREG_STATE1],
- i830->state.Ctx[I830_CTXREG_IALPHAB],
- (ctx->Color.BlendEnabled) ? "en" : "dis");
- }
-}
-
-
-static void i830BlendEquationSeparate(GLcontext *ctx, GLenum modeRGB,
- GLenum modeA)
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s -> %s, %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(modeRGB),
- _mesa_lookup_enum_by_nr(modeA));
-
- (void) modeRGB;
- (void) modeA;
- i830_set_blend_state( ctx );
-}
-
-
-static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
- GLenum dfactorRGB, GLenum sfactorA,
- GLenum dfactorA )
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(sfactorRGB),
- _mesa_lookup_enum_by_nr(dfactorRGB),
- _mesa_lookup_enum_by_nr(sfactorA),
- _mesa_lookup_enum_by_nr(dfactorA));
-
- (void) sfactorRGB;
- (void) dfactorRGB;
- (void) sfactorA;
- (void) dfactorA;
- i830_set_blend_state( ctx );
-}
-
-
-
-static void i830DepthFunc(GLcontext *ctx, GLenum func)
-{
- struct i830_context *i830 = i830_context(ctx);
- int test = intel_translate_compare_func(func);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
- i830->state.Ctx[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(test));
-}
-
-static void i830DepthMask(GLcontext *ctx, GLboolean flag)
-{
- struct i830_context *i830 = i830_context(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK;
-
- if (flag && ctx->Depth.Test)
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DEPTH_WRITE;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE;
-}
-
-/* =============================================================
- * Polygon stipple
- *
- * The i830 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i830PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- struct i830_context *i830 = i830_context(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- i830->intel.reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE);
- i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 3 ; j >= 0; j--)
- for (i = 0 ; i < 4 ; i++, m++)
- if (*m != p[j]) {
- i830->intel.hw_stipple = 0;
- return;
- }
-
- newMask = (((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12));
-
-
- if (newMask == 0xffff || newMask == 0x0) {
- /* this is needed to make conform pass */
- i830->intel.hw_stipple = 0;
- return;
- }
-
- i830->state.Stipple[I830_STPREG_ST1] &= ~0xffff;
- i830->state.Stipple[I830_STPREG_ST1] |= newMask;
- i830->intel.hw_stipple = 1;
-
- if (active)
- i830->state.Stipple[I830_STPREG_ST1] |= ST1_ENABLE;
-}
-
-
-/* =============================================================
- * Hardware clipping
- */
-static void i830Scissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- struct i830_context *i830 = i830_context(ctx);
- int x1, y1, x2, y2;
-
- if (!ctx->DrawBuffer)
- return;
-
- x1 = x;
- y1 = ctx->DrawBuffer->Height - (y + h);
- x2 = x + w - 1;
- y2 = y1 + h - 1;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
- x, y, w, h);
-
- x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1);
- y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1);
- x2 = CLAMP(x2, 0, ctx->DrawBuffer->Width - 1);
- y2 = CLAMP(y2, 0, ctx->DrawBuffer->Height - 1);
-
- I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
- i830->state.Buffer[I830_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff);
- i830->state.Buffer[I830_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff);
-}
-
-static void i830LogicOp(GLcontext *ctx, GLenum opcode)
-{
- struct i830_context *i830 = i830_context(ctx);
- int tmp = intel_translate_logic_op( opcode );
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE4] &= ~LOGICOP_MASK;
- i830->state.Ctx[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
-}
-
-
-
-static void i830CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- struct i830_context *i830 = i830_context(ctx);
- GLuint mode;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!ctx->Polygon.CullFlag) {
- mode = CULLMODE_NONE;
- }
- else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = CULLMODE_CW;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
- }
- else {
- mode = CULLMODE_BOTH;
- }
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE3] &= ~CULLMODE_MASK;
- i830->state.Ctx[I830_CTXREG_STATE3] |= ENABLE_CULL_MODE | mode;
-}
-
-static void i830LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- struct i830_context *i830 = i830_context( ctx );
- int width;
- int state5;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- width = (int)(widthf * 2);
- CLAMP_SELF(width, 1, 15);
-
- state5 = i830->state.Ctx[I830_CTXREG_STATE5] & ~FIXED_LINE_WIDTH_MASK;
- state5 |= (ENABLE_FIXED_LINE_WIDTH | FIXED_LINE_WIDTH(width));
-
- if (state5 != i830->state.Ctx[I830_CTXREG_STATE5]) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE5] = state5;
- }
-}
-
-static void i830PointSize(GLcontext *ctx, GLfloat size)
-{
- struct i830_context *i830 = i830_context(ctx);
- GLint point_size = (int)size;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- CLAMP_SELF(point_size, 1, 256);
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK;
- i830->state.Ctx[I830_CTXREG_STATE5] |= (ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(point_size));
-}
-
-
-/* =============================================================
- * Color masks
- */
-
-static void i830ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- struct i830_context *i830 = i830_context( ctx );
- GLuint tmp = 0;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- tmp = ((i830->state.Ctx[I830_CTXREG_ENABLES_2] & ~WRITEMASK_MASK) |
- ENABLE_COLOR_MASK |
- ENABLE_COLOR_WRITE |
- ((!r) << WRITEMASK_RED_SHIFT) |
- ((!g) << WRITEMASK_GREEN_SHIFT) |
- ((!b) << WRITEMASK_BLUE_SHIFT) |
- ((!a) << WRITEMASK_ALPHA_SHIFT));
-
- if (tmp != i830->state.Ctx[I830_CTXREG_ENABLES_2]) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_2] = tmp;
- }
-}
-
-static void update_specular( GLcontext *ctx )
-{
- struct i830_context *i830 = i830_context( ctx );
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK;
-
- if (NEED_SECONDARY_COLOR(ctx))
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD;
-}
-
-static void i830LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- update_specular( ctx );
- }
-}
-
-/* In Mesa 3.5 we can reliably do native flatshading.
- */
-static void i830ShadeModel(GLcontext *ctx, GLenum mode)
-{
- struct i830_context *i830 = i830_context(ctx);
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
-
-#define SHADE_MODE_MASK ((1<<10)|(1<<8)|(1<<6)|(1<<4))
-
- i830->state.Ctx[I830_CTXREG_STATE3] &= ~SHADE_MODE_MASK;
-
- if (mode == GL_FLAT) {
- i830->state.Ctx[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_FLAT) |
- FOG_SHADE_MODE(SHADE_MODE_FLAT) |
- SPEC_SHADE_MODE(SHADE_MODE_FLAT) |
- COLOR_SHADE_MODE(SHADE_MODE_FLAT));
- } else {
- i830->state.Ctx[I830_CTXREG_STATE3] |= (ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR));
- }
-}
-
-/* =============================================================
- * Fog
- */
-static void i830Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- struct i830_context *i830 = i830_context(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_FOG_COLOR) {
- GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
-
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_FOGCOLOR] = (_3DSTATE_FOG_COLOR_CMD | color);
- }
-}
-
-/* =============================================================
- */
-
-static void i830Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- struct i830_context *i830 = i830_context(ctx);
-
- switch(cap) {
- case GL_LIGHTING:
- case GL_COLOR_SUM:
- update_specular( ctx );
- break;
-
- case GL_ALPHA_TEST:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_ALPHA_TEST_MASK;
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_ALPHA_TEST;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_ALPHA_TEST;
-
- break;
-
- case GL_BLEND:
- i830EvalLogicOpBlendState(ctx);
- break;
-
- case GL_COLOR_LOGIC_OP:
- i830EvalLogicOpBlendState(ctx);
-
- /* Logicop doesn't seem to work at 16bpp:
- */
- if (i830->intel.intelScreen->cpp == 2)
- FALLBACK( &i830->intel, I830_FALLBACK_LOGICOP, state );
- break;
-
- case GL_DITHER:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DITHER;
-
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DITHER;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DITHER;
- break;
-
- case GL_DEPTH_TEST:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK;
-
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST;
-
- /* Also turn off depth writes when GL_DEPTH_TEST is disabled:
- */
- i830DepthMask( ctx, ctx->Depth.Mask );
- break;
-
- case GL_SCISSOR_TEST:
- I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
-
- if (state)
- i830->state.Buffer[I830_DESTREG_SENABLE] =
- (_3DSTATE_SCISSOR_ENABLE_CMD |
- ENABLE_SCISSOR_RECT);
- else
- i830->state.Buffer[I830_DESTREG_SENABLE] =
- (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- break;
-
- case GL_LINE_SMOOTH:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- i830->state.Ctx[I830_CTXREG_AA] &= ~AA_LINE_ENABLE;
- if (state)
- i830->state.Ctx[I830_CTXREG_AA] |= AA_LINE_ENABLE;
- else
- i830->state.Ctx[I830_CTXREG_AA] |= AA_LINE_DISABLE;
- break;
-
- case GL_FOG:
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_FOG_MASK;
- if (state)
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_FOG;
- else
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_FOG;
- break;
-
- case GL_CULL_FACE:
- i830CullFaceFrontFace(ctx, 0);
- break;
-
- case GL_TEXTURE_2D:
- break;
-
- case GL_STENCIL_TEST:
- {
- GLboolean hw_stencil = GL_FALSE;
- if (ctx->DrawBuffer) {
- struct intel_renderbuffer *irbStencil
- = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
- hw_stencil = (irbStencil && irbStencil->region);
- }
- if (hw_stencil) {
- I830_STATECHANGE(i830, I830_UPLOAD_CTX);
-
- if (state) {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST;
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE;
- } else {
- i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST;
- i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_STENCIL_WRITE;
- i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST;
- i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_STENCIL_WRITE;
- }
- } else {
- FALLBACK( &i830->intel, I830_FALLBACK_STENCIL, state );
- }
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- /* The stipple command worked on my 855GM box, but not my 845G.
- * I'll do more testing later to find out exactly which hardware
- * supports it. Disabled for now.
- */
- if (i830->intel.hw_stipple &&
- i830->intel.reduced_primitive == GL_TRIANGLES)
- {
- I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE);
- i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE;
- if (state)
- i830->state.Stipple[I830_STPREG_ST1] |= ST1_ENABLE;
- }
- break;
-
- default:
- ;
- }
-}
-
-
-static void i830_init_packets( struct i830_context *i830 )
-{
- intelScreenPrivate *screen = i830->intel.intelScreen;
-
- /* Zero all state */
- memset(&i830->state, 0, sizeof(i830->state));
-
- /* Set default blend state */
- i830->state.TexBlend[0][0] = (_3DSTATE_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXOP_LAST_STAGE |
- TEXBLENDOP_ARG1);
- i830->state.TexBlend[0][1] = (_3DSTATE_MAP_BLEND_OP_CMD(0) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- i830->state.TexBlend[0][2] = (_3DSTATE_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
- i830->state.TexBlend[0][3] = (_3DSTATE_MAP_BLEND_ARG_CMD(0) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_DIFFUSE);
-
- i830->state.TexBlendWordsUsed[0] = 4;
-
-
- i830->state.Ctx[I830_CTXREG_VF] = 0;
- i830->state.Ctx[I830_CTXREG_VF2] = 0;
-
- i830->state.Ctx[I830_CTXREG_AA] = (_3DSTATE_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE |
- AA_LINE_REGION_WIDTH_1_0 |
- AA_LINE_DISABLE);
-
- i830->state.Ctx[I830_CTXREG_ENABLES_1] = (_3DSTATE_ENABLES_1_CMD |
- DISABLE_LOGIC_OP |
- DISABLE_STENCIL_TEST |
- DISABLE_DEPTH_BIAS |
- DISABLE_SPEC_ADD |
- DISABLE_FOG |
- DISABLE_ALPHA_TEST |
- DISABLE_COLOR_BLEND |
- DISABLE_DEPTH_TEST);
-
-#if 000 /* XXX all the stencil enable state is set in i830Enable(), right? */
- if (i830->intel.hw_stencil) {
- i830->state.Ctx[I830_CTXREG_ENABLES_2] = (_3DSTATE_ENABLES_2_CMD |
- ENABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- } else
-#endif
- {
- i830->state.Ctx[I830_CTXREG_ENABLES_2] = (_3DSTATE_ENABLES_2_CMD |
- DISABLE_STENCIL_WRITE |
- ENABLE_TEX_CACHE |
- ENABLE_DITHER |
- ENABLE_COLOR_MASK |
- /* set no color comps disabled */
- ENABLE_COLOR_WRITE |
- ENABLE_DEPTH_WRITE);
- }
-
- i830->state.Ctx[I830_CTXREG_STATE1] = (_3DSTATE_MODES_1_CMD |
- ENABLE_COLR_BLND_FUNC |
- BLENDFUNC_ADD |
- ENABLE_SRC_BLND_FACTOR |
- SRC_BLND_FACT(BLENDFACT_ONE) |
- ENABLE_DST_BLND_FACTOR |
- DST_BLND_FACT(BLENDFACT_ZERO) );
-
- i830->state.Ctx[I830_CTXREG_STATE2] = (_3DSTATE_MODES_2_CMD |
- ENABLE_GLOBAL_DEPTH_BIAS |
- GLOBAL_DEPTH_BIAS(0) |
- ENABLE_ALPHA_TEST_FUNC |
- ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ALPHA_REF_VALUE(0) );
-
- i830->state.Ctx[I830_CTXREG_STATE3] = (_3DSTATE_MODES_3_CMD |
- ENABLE_DEPTH_TEST_FUNC |
- DEPTH_TEST_FUNC(COMPAREFUNC_LESS) |
- ENABLE_ALPHA_SHADE_MODE |
- ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_FOG_SHADE_MODE |
- FOG_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_SPEC_SHADE_MODE |
- SPEC_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_COLOR_SHADE_MODE |
- COLOR_SHADE_MODE(SHADE_MODE_LINEAR) |
- ENABLE_CULL_MODE |
- CULLMODE_NONE);
-
- i830->state.Ctx[I830_CTXREG_STATE4] = (_3DSTATE_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(LOGICOP_COPY) |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(0xff));
-
- i830->state.Ctx[I830_CTXREG_STENCILTST] = (_3DSTATE_STENCIL_TEST_CMD |
- ENABLE_STENCIL_PARMS |
- STENCIL_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_FAIL_OP(STENCILOP_KEEP) |
- STENCIL_PASS_DEPTH_PASS_OP(STENCILOP_KEEP) |
- ENABLE_STENCIL_TEST_FUNC |
- STENCIL_TEST_FUNC(COMPAREFUNC_ALWAYS) |
- ENABLE_STENCIL_REF_VALUE |
- STENCIL_REF_VALUE(0) );
-
- i830->state.Ctx[I830_CTXREG_STATE5] = (_3DSTATE_MODES_5_CMD |
- FLUSH_TEXTURE_CACHE |
- ENABLE_SPRITE_POINT_TEX |
- SPRITE_POINT_TEX_OFF |
- ENABLE_FIXED_LINE_WIDTH |
- FIXED_LINE_WIDTH(0x2) | /* 1.0 */
- ENABLE_FIXED_POINT_WIDTH |
- FIXED_POINT_WIDTH(1) );
-
- i830->state.Ctx[I830_CTXREG_IALPHAB] = (_3DSTATE_INDPT_ALPHA_BLEND_CMD |
- DISABLE_INDPT_ALPHA_BLEND |
- ENABLE_ALPHA_BLENDFUNC |
- ABLENDFUNC_ADD);
-
- i830->state.Ctx[I830_CTXREG_FOGCOLOR] = (_3DSTATE_FOG_COLOR_CMD |
- FOG_COLOR_RED(0) |
- FOG_COLOR_GREEN(0) |
- FOG_COLOR_BLUE(0));
-
- i830->state.Ctx[I830_CTXREG_BLENDCOLOR0] = _3DSTATE_CONST_BLEND_COLOR_CMD;
- i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = 0;
-
- i830->state.Ctx[I830_CTXREG_MCSB0] = _3DSTATE_MAP_COORD_SETBIND_CMD;
- i830->state.Ctx[I830_CTXREG_MCSB1] = (TEXBIND_SET3(TEXCOORDSRC_VTXSET_3) |
- TEXBIND_SET2(TEXCOORDSRC_VTXSET_2) |
- TEXBIND_SET1(TEXCOORDSRC_VTXSET_1) |
- TEXBIND_SET0(TEXCOORDSRC_VTXSET_0));
-
-
- i830->state.Stipple[I830_STPREG_ST0] = _3DSTATE_STIPPLE;
-
- i830->state.Buffer[I830_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(screen->front.pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
-
-
- i830->state.Buffer[I830_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH |
-<<<<<<< i830_state.c
- BUF_3D_PITCH(screen->depth.pitch) | /* pitch in bytes */
-=======
- BUF_3D_PITCH(screen->depth.pitch * screen->cpp) | /* XXX FBO fix */
->>>>>>> 1.7.2.6
- BUF_3D_USE_FENCE);
-/* i830->state.Buffer[I830_DESTREG_DBUFADDR2] = screen->depth.offset; */
-
-
- i830->state.Buffer[I830_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD;
-
- switch (screen->fbFormat) {
- case DV_PF_565:
- i830->state.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- i830->state.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- screen->fbFormat |
- DEPTH_IS_Z |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
-
- i830->state.Buffer[I830_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- i830->state.Buffer[I830_DESTREG_SR0] = _3DSTATE_SCISSOR_RECT_0_CMD;
- i830->state.Buffer[I830_DESTREG_SR1] = 0;
- i830->state.Buffer[I830_DESTREG_SR2] = 0;
-}
-
-
-void i830InitStateFuncs( struct dd_function_table *functions )
-{
- functions->AlphaFunc = i830AlphaFunc;
- functions->BlendColor = i830BlendColor;
- functions->BlendEquationSeparate = i830BlendEquationSeparate;
- functions->BlendFuncSeparate = i830BlendFuncSeparate;
- functions->ColorMask = i830ColorMask;
- functions->CullFace = i830CullFaceFrontFace;
- functions->DepthFunc = i830DepthFunc;
- functions->DepthMask = i830DepthMask;
- functions->Enable = i830Enable;
- functions->Fogfv = i830Fogfv;
- functions->FrontFace = i830CullFaceFrontFace;
- functions->LightModelfv = i830LightModelfv;
- functions->LineWidth = i830LineWidth;
- functions->LogicOpcode = i830LogicOp;
- functions->PointSize = i830PointSize;
- functions->PolygonStipple = i830PolygonStipple;
- functions->Scissor = i830Scissor;
- functions->ShadeModel = i830ShadeModel;
- functions->StencilFuncSeparate = i830StencilFuncSeparate;
- functions->StencilMaskSeparate = i830StencilMaskSeparate;
- functions->StencilOpSeparate = i830StencilOpSeparate;
-}
-
-void i830InitState( struct i830_context *i830 )
-{
- GLcontext *ctx = &i830->intel.ctx;
-
- i830_init_packets( i830 );
-
- intelInitState( ctx );
-
- memcpy( &i830->initial, &i830->state, sizeof(i830->state) );
-
- i830->current = &i830->state;
- i830->state.emitted = 0;
- i830->state.active = (I830_UPLOAD_INVARIENT |
- I830_UPLOAD_TEXBLEND(0) |
- I830_UPLOAD_STIPPLE |
- I830_UPLOAD_CTX |
- I830_UPLOAD_BUFFERS);
-}
-
-
-
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/i830_tex.c b/src/mesa/drivers/dri/i915-tex/i830_tex.c
deleted file mode 100644
index 4c5fb3e69f6..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_tex.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "image.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "intel_ioctl.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-
-
-static void i830TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
-
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR:
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB:
- case GL_COMBINE_ALPHA:
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- break;
-
- case GL_TEXTURE_LOD_BIAS: {
- struct i830_context *i830 = i830_context( ctx );
- GLuint unit = ctx->Texture.CurrentUnit;
- int b = (int) ((*param) * 16.0);
- if (b > 63) b = 63;
- if (b < -64) b = -64;
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(unit));
- i830->lodbias_tm0s3[unit] = ((b << TM0S3_LOD_BIAS_SHIFT) & TM0S3_LOD_BIAS_MASK);
- break;
- }
-
- default:
- break;
- }
-}
-
-static void i830BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texObj )
-{
- i830TextureObjectPtr tex;
-
- if (!texObj->DriverData)
- i830AllocTexObj( texObj );
-
- tex = (i830TextureObjectPtr)texObj->DriverData;
-}
-
-
-
-void i830InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->BindTexture = i830BindTexture;
- functions->TexEnv = i830TexEnv;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i830_texblend.c b/src/mesa/drivers/dri/i915-tex/i830_texblend.c
deleted file mode 100644
index 4c1bee58d8e..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_texblend.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "mm.h"
-
-#include "intel_screen.h"
-#include "intel_ioctl.h"
-#include "intel_tex.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-
-/* ================================================================
- * Texture combine functions
- */
-static GLuint pass_through( GLuint *state, GLuint blendUnit )
-{
- state[0] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[1] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_SCALE_1X |
- TEXOP_MODIFY_PARMS |
- TEXBLENDOP_ARG1);
- state[2] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_COLOR |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
- state[3] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- TEXBLEND_ARG1 |
- TEXBLENDARG_MODIFY_PARMS |
- TEXBLENDARG_CURRENT);
-
- return 4;
-}
-
-static GLuint emit_factor( GLuint blendUnit, GLuint *state, GLuint count,
- const GLfloat *factor )
-{
- GLubyte r, g, b, a;
- GLuint col;
-
- if (0)
- fprintf(stderr, "emit constant %d: %.2f %.2f %.2f %.2f\n",
- blendUnit, factor[0], factor[1], factor[2], factor[3]);
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, factor[0]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, factor[1]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, factor[2]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, factor[3]);
-
- col = ((a << 24) | (r << 16) | (g << 8) | b);
-
- state[count++] = _3DSTATE_COLOR_FACTOR_N_CMD(blendUnit);
- state[count++] = col;
-
- return count;
-}
-
-
-static INLINE GLuint GetTexelOp(GLint unit)
-{
- switch(unit) {
- case 0: return TEXBLENDARG_TEXEL0;
- case 1: return TEXBLENDARG_TEXEL1;
- case 2: return TEXBLENDARG_TEXEL2;
- case 3: return TEXBLENDARG_TEXEL3;
- default: return TEXBLENDARG_TEXEL0;
- }
-}
-
-
-/**
- * Calculate the hardware instuctions to setup the current texture enviromnemt
- * settings. Since \c gl_texture_unit::_CurrentCombine is used, both
- * "classic" texture enviroments and GL_ARB_texture_env_combine type texture
- * environments are treated identically.
- *
- * \todo
- * This function should return \c GLboolean. When \c GL_FALSE is returned,
- * it means that an environment is selected that the hardware cannot do. This
- * is the way the Radeon and R200 drivers work.
- *
- * \todo
- * Looking at i830_3d_regs.h, it seems the i830 can do part of
- * GL_ATI_texture_env_combine3. It can handle using \c GL_ONE and
- * \c GL_ZERO as combine inputs (which the code already supports). It can
- * also handle the \c GL_MODULATE_ADD_ATI mode. Is it worth investigating
- * partial support for the extension?
- */
-GLuint
-i830SetTexEnvCombine(struct i830_context *i830,
- const struct gl_tex_env_combine_state * combine,
- GLint blendUnit,
- GLuint texel_op,
- GLuint *state,
- const GLfloat *factor )
-{
- const GLuint numColorArgs = combine->_NumArgsRGB;
- const GLuint numAlphaArgs = combine->_NumArgsA;
-
- GLuint blendop;
- GLuint ablendop;
- GLuint args_RGB[3];
- GLuint args_A[3];
- GLuint rgb_shift;
- GLuint alpha_shift;
- GLboolean need_factor = 0;
- int i;
- unsigned used;
- static const GLuint tex_blend_rgb[3] = {
- TEXPIPE_COLOR | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_COLOR | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_COLOR | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
- };
- static const GLuint tex_blend_a[3] = {
- TEXPIPE_ALPHA | TEXBLEND_ARG1 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_ALPHA | TEXBLEND_ARG2 | TEXBLENDARG_MODIFY_PARMS,
- TEXPIPE_ALPHA | TEXBLEND_ARG0 | TEXBLENDARG_MODIFY_PARMS,
- };
-
- if(INTEL_DEBUG&DEBUG_TEXTURE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- switch (combine->ModeRGB) {
- case GL_DOT3_RGB_EXT:
- alpha_shift = combine->ScaleShiftA;
- rgb_shift = 0;
- break;
-
- case GL_DOT3_RGBA_EXT:
- alpha_shift = 0;
- rgb_shift = 0;
- break;
-
- default:
- rgb_shift = combine->ScaleShiftRGB;
- alpha_shift = combine->ScaleShiftA;
- break;
- }
-
-
- switch(combine->ModeRGB) {
- case GL_REPLACE:
- blendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- blendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- blendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- blendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- blendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- blendop = TEXBLENDOP_SUBTRACT;
- break;
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGB:
- blendop = TEXBLENDOP_DOT3;
- break;
- case GL_DOT3_RGBA_EXT:
- case GL_DOT3_RGBA:
- blendop = TEXBLENDOP_DOT3;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
- blendop |= (rgb_shift << TEXOP_SCALE_SHIFT);
-
-
- /* Handle RGB args */
- for(i = 0; i < 3; i++) {
- switch(combine->SourceRGB[i]) {
- case GL_TEXTURE:
- args_RGB[i] = texel_op;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- args_RGB[i] = GetTexelOp( combine->SourceRGB[i] - GL_TEXTURE0 );
- break;
- case GL_CONSTANT:
- args_RGB[i] = TEXBLENDARG_FACTOR_N;
- need_factor = 1;
- break;
- case GL_PRIMARY_COLOR:
- args_RGB[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_RGB[i] = TEXBLENDARG_CURRENT;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
- switch(combine->OperandRGB[i]) {
- case GL_SRC_COLOR:
- args_RGB[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- args_RGB[i] |= TEXBLENDARG_INV_ARG;
- break;
- case GL_SRC_ALPHA:
- args_RGB[i] |= TEXBLENDARG_REPLICATE_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- args_RGB[i] |= (TEXBLENDARG_REPLICATE_ALPHA |
- TEXBLENDARG_INV_ARG);
- break;
- default:
- return pass_through( state, blendUnit );
- }
- }
-
-
- /* Need to knobble the alpha calculations of TEXBLENDOP_DOT4 to
- * match the spec. Can't use DOT3 as it won't propogate values
- * into alpha as required:
- *
- * Note - the global factor is set up with alpha == .5, so
- * the alpha part of the DOT4 calculation should be zero.
- */
- if ( combine->ModeRGB == GL_DOT3_RGBA_EXT ||
- combine->ModeRGB == GL_DOT3_RGBA ) {
- ablendop = TEXBLENDOP_DOT4;
- args_A[0] = TEXBLENDARG_FACTOR; /* the global factor */
- args_A[1] = TEXBLENDARG_FACTOR;
- args_A[2] = TEXBLENDARG_FACTOR;
- }
- else {
- switch(combine->ModeA) {
- case GL_REPLACE:
- ablendop = TEXBLENDOP_ARG1;
- break;
- case GL_MODULATE:
- ablendop = TEXBLENDOP_MODULATE;
- break;
- case GL_ADD:
- ablendop = TEXBLENDOP_ADD;
- break;
- case GL_ADD_SIGNED:
- ablendop = TEXBLENDOP_ADDSIGNED;
- break;
- case GL_INTERPOLATE:
- ablendop = TEXBLENDOP_BLEND;
- break;
- case GL_SUBTRACT:
- ablendop = TEXBLENDOP_SUBTRACT;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
-
- ablendop |= (alpha_shift << TEXOP_SCALE_SHIFT);
-
- /* Handle A args */
- for(i = 0; i < 3; i++) {
- switch(combine->SourceA[i]) {
- case GL_TEXTURE:
- args_A[i] = texel_op;
- break;
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- args_A[i] = GetTexelOp( combine->SourceA[i] - GL_TEXTURE0 );
- break;
- case GL_CONSTANT:
- args_A[i] = TEXBLENDARG_FACTOR_N;
- need_factor = 1;
- break;
- case GL_PRIMARY_COLOR:
- args_A[i] = TEXBLENDARG_DIFFUSE;
- break;
- case GL_PREVIOUS:
- args_A[i] = TEXBLENDARG_CURRENT;
- break;
- default:
- return pass_through( state, blendUnit );
- }
-
- switch(combine->OperandA[i]) {
- case GL_SRC_ALPHA:
- args_A[i] |= 0;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- args_A[i] |= TEXBLENDARG_INV_ARG;
- break;
- default:
- return pass_through( state, blendUnit );
- }
- }
- }
-
-
-
- /* Native Arg1 == Arg0 in GL_EXT_texture_env_combine spec */
- /* Native Arg2 == Arg1 in GL_EXT_texture_env_combine spec */
- /* Native Arg0 == Arg2 in GL_EXT_texture_env_combine spec */
-
- /* When we render we need to figure out which is the last really enabled
- * tex unit, and put last stage on it
- */
-
-
- /* Build color & alpha pipelines */
-
- used = 0;
- state[used++] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_COLOR |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- DISABLE_TEX_CNTRL_STAGE |
- TEXOP_MODIFY_PARMS |
- blendop);
- state[used++] = (_3DSTATE_MAP_BLEND_OP_CMD(blendUnit) |
- TEXPIPE_ALPHA |
- ENABLE_TEXOUTPUT_WRT_SEL |
- TEXOP_OUTPUT_CURRENT |
- TEXOP_MODIFY_PARMS |
- ablendop);
-
- for ( i = 0 ; i < numColorArgs ; i++ ) {
- state[used++] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- tex_blend_rgb[i] | args_RGB[i]);
- }
-
- for ( i = 0 ; i < numAlphaArgs ; i++ ) {
- state[used++] = (_3DSTATE_MAP_BLEND_ARG_CMD(blendUnit) |
- tex_blend_a[i] | args_A[i]);
- }
-
-
- if (need_factor)
- return emit_factor( blendUnit, state, used, factor );
- else
- return used;
-}
-
-
-static void emit_texblend( struct i830_context *i830, GLuint unit, GLuint blendUnit,
- GLboolean last_stage )
-{
- struct gl_texture_unit *texUnit = &i830->intel.ctx.Texture.Unit[unit];
- GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz;
-
-
- if (0) fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit);
-
- /* Update i830->state.TexBlend
- */
- tmp_sz = i830SetTexEnvCombine(i830, texUnit->_CurrentCombine, blendUnit,
- GetTexelOp(unit), tmp,
- texUnit->EnvColor );
-
- if (last_stage)
- tmp[0] |= TEXOP_LAST_STAGE;
-
- if (tmp_sz != i830->state.TexBlendWordsUsed[blendUnit] ||
- memcmp( tmp, i830->state.TexBlend[blendUnit], tmp_sz * sizeof(GLuint))) {
-
- I830_STATECHANGE( i830, I830_UPLOAD_TEXBLEND(blendUnit) );
- memcpy( i830->state.TexBlend[blendUnit], tmp, tmp_sz * sizeof(GLuint));
- i830->state.TexBlendWordsUsed[blendUnit] = tmp_sz;
- }
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(blendUnit), GL_TRUE);
-}
-
-static void emit_passthrough( struct i830_context *i830 )
-{
- GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz;
- GLuint unit = 0;
-
- tmp_sz = pass_through( tmp, unit );
- tmp[0] |= TEXOP_LAST_STAGE;
-
- if (tmp_sz != i830->state.TexBlendWordsUsed[unit] ||
- memcmp( tmp, i830->state.TexBlend[unit], tmp_sz * sizeof(GLuint))) {
-
- I830_STATECHANGE( i830, I830_UPLOAD_TEXBLEND(unit) );
- memcpy( i830->state.TexBlend[unit], tmp, tmp_sz * sizeof(GLuint));
- i830->state.TexBlendWordsUsed[unit] = tmp_sz;
- }
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(unit), GL_TRUE);
-}
-
-void i830EmitTextureBlend( struct i830_context *i830 )
-{
- GLcontext *ctx = &i830->intel.ctx;
- GLuint unit, last_stage = 0, blendunit = 0;
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, GL_FALSE);
-
- if (ctx->Texture._EnabledUnits) {
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled)
- last_stage = unit;
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled)
- emit_texblend( i830, unit, blendunit++, last_stage == unit );
- }
- else {
- emit_passthrough( i830 );
- }
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/i830_texstate.c b/src/mesa/drivers/dri/i915-tex/i830_texstate.c
deleted file mode 100644
index dc9aca80fa9..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_texstate.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "texformat.h"
-#include "texstore.h"
-
-#include "mm.h"
-
-#include "intel_screen.h"
-#include "intel_ioctl.h"
-#include "intel_tex.h"
-#include "intel_mipmap_tree.h"
-#include "intel_regions.h"
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-
-
-static GLuint translate_texture_format( GLuint mesa_format )
-{
- switch (mesa_format) {
- case MESA_FORMAT_L8:
- return MAPSURF_8BIT | MT_8BIT_L8;
- case MESA_FORMAT_I8:
- return MAPSURF_8BIT | MT_8BIT_I8;
- case MESA_FORMAT_A8:
- return MAPSURF_8BIT | MT_8BIT_I8; /* Kludge! */
- case MESA_FORMAT_AL88:
- return MAPSURF_16BIT | MT_16BIT_AY88;
- case MESA_FORMAT_RGB565:
- return MAPSURF_16BIT | MT_16BIT_RGB565;
- case MESA_FORMAT_ARGB1555:
- return MAPSURF_16BIT | MT_16BIT_ARGB1555;
- case MESA_FORMAT_ARGB4444:
- return MAPSURF_16BIT | MT_16BIT_ARGB4444;
- case MESA_FORMAT_ARGB8888:
- return MAPSURF_32BIT | MT_32BIT_ARGB8888;
- case MESA_FORMAT_YCBCR_REV:
- return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
- case MESA_FORMAT_YCBCR:
- return (MAPSURF_422 | MT_422_YCRCB_SWAPY);
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGB_DXT1:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- case MESA_FORMAT_RGBA_DXT3:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- case MESA_FORMAT_RGBA_DXT5:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
- default:
- fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__,
- mesa_format);
- abort();
- return 0;
- }
-}
-
-
-
-
-/* The i915 (and related graphics cores) do not support GL_CLAMP. The
- * Intel drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- */
-static GLuint translate_wrap_mode( GLenum wrap )
-{
- switch( wrap ) {
- case GL_REPEAT:
- return TEXCOORDMODE_WRAP;
- case GL_CLAMP:
- case GL_CLAMP_TO_EDGE:
- return TEXCOORDMODE_CLAMP; /* not really correct */
- case GL_CLAMP_TO_BORDER:
- return TEXCOORDMODE_CLAMP_BORDER;
- case GL_MIRRORED_REPEAT:
- return TEXCOORDMODE_MIRROR;
- default:
- return TEXCOORDMODE_WRAP;
- }
-}
-
-
-/* Recalculate all state from scratch. Perhaps not the most
- * efficient, but this has gotten complex enough that we need
- * something which is understandable and reliable.
- */
-static GLboolean i830_update_tex_unit( struct intel_context *intel,
- GLuint unit,
- GLuint ss3 )
-{
- GLcontext *ctx = &intel->ctx;
- struct i830_context *i830 = i830_context(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
- struct gl_texture_image *firstImage;
- GLuint *state = i830->state.Tex[unit];
-
- memset(state, 0, sizeof(state));
-
- if (!intel_finalize_mipmap_tree(intel, unit))
- return GL_FALSE;
-
- /* Get first image here, since intelObj->firstLevel will get set in
- * the intel_finalize_mipmap_tree() call above.
- */
- firstImage = tObj->Image[0][intelObj->firstLevel];
-
- i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
- i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
- intelObj->firstLevel);
-
-
- state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
- (LOAD_TEXTURE_MAP0 << unit) | 4);
-
-/* state[I830_TEXREG_TM0S0] = (TM0S0_USE_FENCE | */
-/* t->intel.TextureOffset); */
-
-
- state[I830_TEXREG_TM0S1] =
- (((firstImage->Height - 1) << TM0S1_HEIGHT_SHIFT) |
- ((firstImage->Width - 1) << TM0S1_WIDTH_SHIFT) |
- translate_texture_format( firstImage->TexFormat->MesaFormat));
-
- state[I830_TEXREG_TM0S2] =
- (((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) - 1) << TM0S2_PITCH_SHIFT) |
- TM0S2_CUBE_FACE_ENA_MASK);
-
- {
- if (tObj->Target == GL_TEXTURE_CUBE_MAP)
- state[I830_TEXREG_CUBE] = (_3DSTATE_MAP_CUBE | MAP_UNIT(unit) |
- CUBE_NEGX_ENABLE |
- CUBE_POSX_ENABLE |
- CUBE_NEGY_ENABLE |
- CUBE_POSY_ENABLE |
- CUBE_NEGZ_ENABLE |
- CUBE_POSZ_ENABLE);
- else
- state[I830_TEXREG_CUBE] = (_3DSTATE_MAP_CUBE | MAP_UNIT(unit));
- }
-
-
-
-
- {
- GLuint minFilt, mipFilt, magFilt;
-
- switch (tObj->MinFilter) {
- case GL_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_LINEAR;
- break;
- default:
- return GL_FALSE;
- }
-
- if ( tObj->MaxAnisotropy > 1.0 ) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- }
- else {
- switch (tObj->MagFilter) {
- case GL_NEAREST:
- magFilt = FILTER_NEAREST;
- break;
- case GL_LINEAR:
- magFilt = FILTER_LINEAR;
- break;
- default:
- return GL_FALSE;
- }
- }
-
- state[I830_TEXREG_TM0S3] = i830->lodbias_tm0s3[unit];
-
-#if 0
- /* YUV conversion:
- */
- if (firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR ||
- firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV)
- state[I830_TEXREG_TM0S3] |= SS2_COLORSPACE_CONVERSION;
-#endif
-
- state[I830_TEXREG_TM0S3] |= ((intelObj->lastLevel -
- intelObj->firstLevel)*4) << TM0S3_MIN_MIP_SHIFT;
-
- state[I830_TEXREG_TM0S3] |= ((minFilt << TM0S3_MIN_FILTER_SHIFT) |
- (mipFilt << TM0S3_MIP_FILTER_SHIFT) |
- (magFilt << TM0S3_MAG_FILTER_SHIFT));
- }
-
- {
- GLenum ws = tObj->WrapS;
- GLenum wt = tObj->WrapT;
-
-
- /* 3D textures not available on i830
- */
- if (tObj->Target == GL_TEXTURE_3D)
- return GL_FALSE;
-
- state[I830_TEXREG_MCS] = (_3DSTATE_MAP_COORD_SET_CMD |
- MAP_UNIT(unit) |
- ENABLE_TEXCOORD_PARAMS |
- ss3 |
- ENABLE_ADDR_V_CNTL |
- TEXCOORD_ADDR_V_MODE(translate_wrap_mode(wt)) |
- ENABLE_ADDR_U_CNTL |
- TEXCOORD_ADDR_U_MODE(translate_wrap_mode(ws)));
- }
-
-
- state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
- tObj->_BorderChan[1],
- tObj->_BorderChan[2],
- tObj->_BorderChan[3]);
-
-
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE);
- /* memcmp was already disabled, but definitely won't work as the
- * region might now change and that wouldn't be detected:
- */
- I830_STATECHANGE( i830, I830_UPLOAD_TEX(unit) );
- return GL_TRUE;
-}
-
-
-
-
-void i830UpdateTextureState( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- GLboolean ok = GL_TRUE;
- GLuint i;
-
- for (i = 0 ; i < I830_TEX_UNITS && ok ; i++) {
- switch (intel->ctx.Texture.Unit[i]._ReallyEnabled) {
- case TEXTURE_1D_BIT:
- case TEXTURE_2D_BIT:
- case TEXTURE_CUBE_BIT:
- ok = i830_update_tex_unit( intel, i, TEXCOORDS_ARE_NORMAL );
- break;
- case TEXTURE_RECT_BIT:
- ok = i830_update_tex_unit( intel, i, TEXCOORDS_ARE_IN_TEXELUNITS );
- break;
- case 0:
- if (i830->state.active & I830_UPLOAD_TEX(i))
- I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(i), GL_FALSE);
- break;
- case TEXTURE_3D_BIT:
- default:
- ok = GL_FALSE;
- break;
- }
- }
-
- FALLBACK( intel, I830_FALLBACK_TEXTURE, !ok );
-
- if (ok)
- i830EmitTextureBlend( i830 );
-}
-
-
-
-
-
-
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/i830_vtbl.c b/src/mesa/drivers/dri/i915-tex/i830_vtbl.c
deleted file mode 100644
index 6d4d2c8dace..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i830_vtbl.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include "i830_context.h"
-#include "i830_reg.h"
-
-#include "intel_batchbuffer.h"
-#include "intel_regions.h"
-
-#include "tnl/t_context.h"
-#include "tnl/t_vertex.h"
-
-static GLboolean i830_check_vertex_size( struct intel_context *intel,
- GLuint expected );
-
-#define SZ_TO_HW(sz) ((sz-2)&0x3)
-#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
-#define EMIT_ATTR( ATTR, STYLE, V0 ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = (ATTR); \
- intel->vertex_attrs[intel->vertex_attr_count].format = (STYLE); \
- intel->vertex_attr_count++; \
- v0 |= V0; \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = 0; \
- intel->vertex_attrs[intel->vertex_attr_count].format = EMIT_PAD; \
- intel->vertex_attrs[intel->vertex_attr_count].offset = (N); \
- intel->vertex_attr_count++; \
-} while (0)
-
-
-#define VRTX_TEX_SET_FMT(n, x) ((x)<<((n)*2))
-#define TEXBIND_SET(n, x) ((x)<<((n)*4))
-
-static void i830_render_start( struct intel_context *intel )
-{
- GLcontext *ctx = &intel->ctx;
- struct i830_context *i830 = i830_context(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- GLuint v0 = _3DSTATE_VFT0_CMD;
- GLuint v2 = _3DSTATE_VFT1_CMD;
- GLuint mcsb1 = 0;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- intel->vertex_attr_count = 0;
-
- /* EMIT_ATTR's must be in order as they tell t_vertex.c how to
- * build up a hardware vertex.
- */
- if (index & _TNL_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, VFT0_XYZW );
- intel->coloroffset = 4;
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, VFT0_XYZ );
- intel->coloroffset = 3;
- }
-
- if (index & _TNL_BIT_POINTSIZE) {
- EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, VFT0_POINT_WIDTH );
- }
-
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VFT0_DIFFUSE );
-
- intel->specoffset = 0;
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if (index & _TNL_BIT_COLOR1) {
- intel->specoffset = intel->coloroffset + 1;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VFT0_SPEC );
- }
- else
- EMIT_PAD( 3 );
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, VFT0_SPEC );
- else
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- int i, count = 0;
-
- for (i = 0; i < I830_TEX_UNITS; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- GLuint sz = VB->TexCoordPtr[i]->size;
- GLuint emit;
- GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] &
- ~TEXCOORDTYPE_MASK);
-
- switch (sz) {
- case 1:
- case 2:
- emit = EMIT_2F;
- sz = 2;
- mcs |= TEXCOORDTYPE_CARTESIAN;
- break;
- case 3:
- emit = EMIT_3F;
- sz = 3;
- mcs |= TEXCOORDTYPE_VECTOR;
- break;
- case 4:
- emit = EMIT_3F_XYW;
- sz = 3;
- mcs |= TEXCOORDTYPE_HOMOGENEOUS;
- break;
- default:
- continue;
- };
-
-
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, emit, 0 );
- v2 |= VRTX_TEX_SET_FMT(count, SZ_TO_HW(sz));
- mcsb1 |= (count+8)<<(i*4);
-
- if (mcs != i830->state.Tex[i][I830_TEXREG_MCS]) {
- I830_STATECHANGE(i830, I830_UPLOAD_TEX(i));
- i830->state.Tex[i][I830_TEXREG_MCS] = mcs;
- }
-
- count++;
- }
- }
-
- v0 |= VFT0_TEX_COUNT(count);
- }
-
- /* Only need to change the vertex emit code if there has been a
- * statechange to a new hardware vertex format:
- */
- if (v0 != i830->state.Ctx[I830_CTXREG_VF] ||
- v2 != i830->state.Ctx[I830_CTXREG_VF2] ||
- mcsb1 != i830->state.Ctx[I830_CTXREG_MCSB1] ||
- index != i830->last_index) {
- int k;
-
- I830_STATECHANGE( i830, I830_UPLOAD_CTX );
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- intel->vertex_size =
- _tnl_install_attrs( ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->vertex_size >>= 2;
-
- i830->state.Ctx[I830_CTXREG_VF] = v0;
- i830->state.Ctx[I830_CTXREG_VF2] = v2;
- i830->state.Ctx[I830_CTXREG_MCSB1] = mcsb1;
- i830->last_index = index;
-
- k = i830_check_vertex_size( intel, intel->vertex_size );
- assert(k);
- }
-}
-
-static void i830_reduced_primitive_state( struct intel_context *intel,
- GLenum rprim )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- GLuint st1 = i830->state.Stipple[I830_STPREG_ST1];
-
- st1 &= ~ST1_ENABLE;
-
- switch (rprim) {
- case GL_TRIANGLES:
- if (intel->ctx.Polygon.StippleFlag &&
- intel->hw_stipple)
- st1 |= ST1_ENABLE;
- break;
- case GL_LINES:
- case GL_POINTS:
- default:
- break;
- }
-
- i830->intel.reduced_primitive = rprim;
-
- if (st1 != i830->state.Stipple[I830_STPREG_ST1]) {
- I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE);
- i830->state.Stipple[I830_STPREG_ST1] = st1;
- }
-}
-
-/* Pull apart the vertex format registers and figure out how large a
- * vertex is supposed to be.
- */
-static GLboolean i830_check_vertex_size( struct intel_context *intel,
- GLuint expected )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- int vft0 = i830->current->Ctx[I830_CTXREG_VF];
- int vft1 = i830->current->Ctx[I830_CTXREG_VF2];
- int nrtex = (vft0 & VFT0_TEX_COUNT_MASK) >> VFT0_TEX_COUNT_SHIFT;
- int i, sz = 0;
-
- switch (vft0 & VFT0_XYZW_MASK) {
- case VFT0_XY: sz = 2; break;
- case VFT0_XYZ: sz = 3; break;
- case VFT0_XYW: sz = 3; break;
- case VFT0_XYZW: sz = 4; break;
- default:
- fprintf(stderr, "no xyzw specified\n");
- return 0;
- }
-
- if (vft0 & VFT0_SPEC) sz++;
- if (vft0 & VFT0_DIFFUSE) sz++;
- if (vft0 & VFT0_DEPTH_OFFSET) sz++;
- if (vft0 & VFT0_POINT_WIDTH) sz++;
-
- for (i = 0 ; i < nrtex ; i++) {
- switch (vft1 & VFT1_TEX0_MASK) {
- case TEXCOORDFMT_2D: sz += 2; break;
- case TEXCOORDFMT_3D: sz += 3; break;
- case TEXCOORDFMT_4D: sz += 4; break;
- case TEXCOORDFMT_1D: sz += 1; break;
- }
- vft1 >>= VFT1_TEX1_SHIFT;
- }
-
- if (sz != expected)
- fprintf(stderr, "vertex size mismatch %d/%d\n", sz, expected);
-
- return sz == expected;
-}
-
-static void i830_emit_invarient_state( struct intel_context *intel )
-{
- BATCH_LOCALS;
-
- BEGIN_BATCH(200, 0);
-
- OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_Z_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_FOG_MODE_CMD);
- OUT_BATCH(FOGFUNC_ENABLE |
- FOG_LINEAR_CONST |
- FOGSRC_INDEX_Z |
- ENABLE_FOG_DENSITY);
- OUT_BATCH(0);
- OUT_BATCH(0);
-
-
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(0) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(0) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(0));
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(1) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(1) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(1));
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(2) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(2) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(2));
- OUT_BATCH(_3DSTATE_MAP_TEX_STREAM_CMD |
- MAP_UNIT(3) |
- DISABLE_TEX_STREAM_BUMP |
- ENABLE_TEX_STREAM_COORD_SET |
- TEX_STREAM_COORD_SET(3) |
- ENABLE_TEX_STREAM_MAP_IDX | TEX_STREAM_MAP_IDX(3));
-
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(0));
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(1));
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(2));
- OUT_BATCH(_3DSTATE_MAP_COORD_TRANSFORM);
- OUT_BATCH(DISABLE_TEX_TRANSFORM | TEXTURE_SET(3));
-
- OUT_BATCH(_3DSTATE_RASTER_RULES_CMD |
- ENABLE_POINT_RASTER_RULE |
- OGL_POINT_RASTER_RULE |
- ENABLE_LINE_STRIP_PROVOKE_VRTX |
- ENABLE_TRI_FAN_PROVOKE_VRTX |
- ENABLE_TRI_STRIP_PROVOKE_VRTX |
- LINE_STRIP_PROVOKE_VRTX(1) |
- TRI_FAN_PROVOKE_VRTX(2) |
- TRI_STRIP_PROVOKE_VRTX(2));
-
- OUT_BATCH(_3DSTATE_VERTEX_TRANSFORM);
- OUT_BATCH(DISABLE_VIEWPORT_TRANSFORM | DISABLE_PERSPECTIVE_DIVIDE);
-
- OUT_BATCH(_3DSTATE_W_STATE_CMD);
- OUT_BATCH(MAGIC_W_STATE_DWORD1);
- OUT_BATCH(0x3f800000 /* 1.0 in IEEE float */ );
-
-
- OUT_BATCH(_3DSTATE_COLOR_FACTOR_CMD);
- OUT_BATCH(0x80808080); /* .5 required in alpha for GL_DOT3_RGBA_EXT */
-
- ADVANCE_BATCH();
-}
-
-
-#define emit( intel, state, size ) \
-do { \
- int k; \
- BEGIN_BATCH(size / sizeof(GLuint), 0); \
- for (k = 0 ; k < size / sizeof(GLuint) ; k++) { \
- if (0) _mesa_printf(" 0x%08x\n", state[k]); \
- OUT_BATCH(state[k]); \
- } \
- ADVANCE_BATCH(); \
-} while (0)
-
-static GLuint get_state_size( struct i830_hw_state *state )
-{
- GLuint dirty = state->active & ~state->emitted;
- GLuint sz = 0;
- GLuint i;
-
- if (dirty & I830_UPLOAD_CTX)
- sz += sizeof(state->Ctx);
-
- if (dirty & I830_UPLOAD_BUFFERS)
- sz += sizeof(state->Buffer);
-
- if (dirty & I830_UPLOAD_STIPPLE)
- sz += sizeof(state->Stipple);
-
- for (i = 0; i < I830_TEX_UNITS; i++) {
- if ((dirty & I830_UPLOAD_TEX(i)))
- sz += sizeof(state->Tex[i]);
-
- if (dirty & I830_UPLOAD_TEXBLEND(i))
- sz += state->TexBlendWordsUsed[i] * 4;
- }
-
- return sz;
-}
-
-
-/* Push the state into the sarea and/or texture memory.
- */
-static void i830_emit_state( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- struct i830_hw_state *state = i830->current;
- int i;
- GLuint dirty = state->active & ~state->emitted;
- GLuint counter = intel->batch.counter;
- BATCH_LOCALS;
-
- if (intel->batch.space < get_state_size(state)) {
- intelFlushBatch(intel, GL_TRUE);
- dirty = state->active & ~state->emitted;
- counter = intel->batch.counter;
- }
-
- if (dirty & I830_UPLOAD_INVARIENT) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I830_UPLOAD_INVARIENT:\n");
- i830_emit_invarient_state( intel );
- }
-
- if (dirty & I830_UPLOAD_CTX) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I830_UPLOAD_CTX:\n");
- emit( i830, state->Ctx, sizeof(state->Ctx) );
-
- }
-
- if (dirty & I830_UPLOAD_BUFFERS) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I830_UPLOAD_BUFFERS:\n");
- BEGIN_BATCH(I830_DEST_SETUP_SIZE+2, 0);
- OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR0]);
- OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR1]);
- OUT_RELOC(state->draw_region->buffer, DRM_MM_TT|DRM_MM_WRITE, 0);
-
- if (state->depth_region) {
- OUT_BATCH(state->Buffer[I830_DESTREG_DBUFADDR0]);
- OUT_BATCH(state->Buffer[I830_DESTREG_DBUFADDR1]);
- OUT_RELOC(state->depth_region->buffer, DRM_MM_TT |DRM_MM_WRITE, 0);
- }
-
- OUT_BATCH(state->Buffer[I830_DESTREG_DV0]);
- OUT_BATCH(state->Buffer[I830_DESTREG_DV1]);
- OUT_BATCH(state->Buffer[I830_DESTREG_SENABLE]);
- OUT_BATCH(state->Buffer[I830_DESTREG_SR0]);
- OUT_BATCH(state->Buffer[I830_DESTREG_SR1]);
- OUT_BATCH(state->Buffer[I830_DESTREG_SR2]);
- ADVANCE_BATCH();
- }
-
- if (dirty & I830_UPLOAD_STIPPLE) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I830_UPLOAD_STIPPLE:\n");
- emit( i830, state->Stipple, sizeof(state->Stipple) );
- }
-
- for (i = 0; i < I830_TEX_UNITS; i++) {
- if ((dirty & I830_UPLOAD_TEX(i))) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I830_UPLOAD_TEX(%d):\n", i);
-
- BEGIN_BATCH(I830_TEX_SETUP_SIZE+1, 0);
- OUT_BATCH(state->Tex[i][I830_TEXREG_TM0LI]);
-
- if (state->tex_buffer[i]) {
- OUT_RELOC(state->tex_buffer[i],
- DRM_MM_TT|DRM_MM_READ,
- state->tex_offset[i] | TM0S0_USE_FENCE);
- }
- else {
- assert(i == 0);
- assert(state == &i830->meta);
- OUT_BATCH(0);
- }
-
- OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S1]);
- OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S2]);
- OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S3]);
- OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S4]);
- OUT_BATCH(state->Tex[i][I830_TEXREG_MCS]);
- OUT_BATCH(state->Tex[i][I830_TEXREG_CUBE]);
- }
-
- if (dirty & I830_UPLOAD_TEXBLEND(i)) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I830_UPLOAD_TEXBLEND(%d): %d words\n", i,
- state->TexBlendWordsUsed[i]);
- emit( i830, state->TexBlend[i],
- state->TexBlendWordsUsed[i] * 4 );
- }
- }
-
- state->emitted |= dirty;
- intel->batch.last_emit_state = counter;
- assert(counter == intel->batch.counter);
-}
-
-static void i830_destroy_context( struct intel_context *intel )
-{
- _tnl_free_vertices(&intel->ctx);
-}
-
-<<<<<<< i830_vtbl.c
-static void
-i830_set_color_region(intelContextPtr intel, const intelRegion *region)
-=======
-static void i830_set_draw_region( struct intel_context *intel,
- struct intel_region *draw_region,
- struct intel_region *depth_region)
->>>>>>> 1.6.12.10
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
-
- intel_region_release(intel, &i830->state.draw_region);
- intel_region_release(intel, &i830->state.depth_region);
- intel_region_reference(&i830->state.draw_region, draw_region);
- intel_region_reference(&i830->state.depth_region, depth_region);
-
- /* XXX FBO: Need code from i915_set_draw_region() */
-
- I830_STATECHANGE( i830, I830_UPLOAD_BUFFERS );
-<<<<<<< i830_vtbl.c
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(region->pitch) | BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_CBUFADDR2] = region->offset;
-=======
->>>>>>> 1.6.12.10
-}
-
-
-static void
-i830_set_z_region(intelContextPtr intel, const intelRegion *region)
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
- I830_STATECHANGE( i830, I830_UPLOAD_BUFFERS );
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH | BUF_3D_PITCH(region->pitch) | BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_DBUFADDR2] = region->offset;
-}
-
-
-static void
-i830_update_color_z_regions(intelContextPtr intel,
- const intelRegion *colorRegion,
- const intelRegion *depthRegion)
-{
- i830ContextPtr i830 = I830_CONTEXT(intel);
-
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(colorRegion->pitch) | BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_CBUFADDR2] = colorRegion->offset;
-
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH | BUF_3D_PITCH(depthRegion->pitch) | BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_DBUFADDR2] = depthRegion->offset;
-}
-
-
-/* This isn't really handled at the moment.
- */
-static void i830_lost_hardware( struct intel_context *intel )
-{
- struct i830_context *i830 = i830_context(&intel->ctx);
- i830->state.emitted = 0;
-}
-
-
-
-static GLuint i830_flush_cmd( void )
-{
- return MI_FLUSH | FLUSH_MAP_CACHE;
-}
-
-
-
-
-void i830InitVtbl( struct i830_context *i830 )
-{
- i830->intel.vtbl.check_vertex_size = i830_check_vertex_size;
-<<<<<<< i830_vtbl.c
- i830->intel.vtbl.clear_with_tris = i830ClearWithTris;
- i830->intel.vtbl.rotate_window = i830RotateWindow;
-=======
->>>>>>> 1.6.12.10
- i830->intel.vtbl.destroy = i830_destroy_context;
- i830->intel.vtbl.emit_state = i830_emit_state;
- i830->intel.vtbl.lost_hardware = i830_lost_hardware;
- i830->intel.vtbl.reduced_primitive_state = i830_reduced_primitive_state;
-<<<<<<< i830_vtbl.c
- i830->intel.vtbl.set_color_region = i830_set_color_region;
- i830->intel.vtbl.set_z_region = i830_set_z_region;
- i830->intel.vtbl.update_color_z_regions = i830_update_color_z_regions;
-=======
- i830->intel.vtbl.set_draw_region = i830_set_draw_region;
->>>>>>> 1.6.12.10
- i830->intel.vtbl.update_texture_state = i830UpdateTextureState;
- i830->intel.vtbl.flush_cmd = i830_flush_cmd;
- i830->intel.vtbl.render_start = i830_render_start;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i915_context.c b/src/mesa/drivers/dri/i915-tex/i915_context.c
deleted file mode 100644
index e22d93ae8a0..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_context.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "i915_context.h"
-#include "imports.h"
-#include "intel_tex.h"
-#include "intel_tris.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "utils.h"
-#include "i915_reg.h"
-
-#include "intel_bufmgr.h"
-#include "intel_regions.h"
-#include "intel_batchbuffer.h"
-
-/***************************************
- * Mesa's Driver Functions
- ***************************************/
-
-static const struct dri_extension i915_extensions[] =
-{
- { "GL_ARB_depth_texture", NULL },
- { "GL_ARB_fragment_program", NULL },
- { "GL_ARB_shadow", NULL },
- { "GL_EXT_shadow_funcs", NULL },
- /* ARB extn won't work if not enabled */
- { "GL_SGIX_depth_texture", NULL },
- { NULL, NULL }
-};
-
-/* Override intel default.
- */
-static void i915InvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _tnl_invalidate_vertex_state( ctx, new_state );
- intel_context(ctx)->NewGLState |= new_state;
-
- /* Todo: gather state values under which tracked parameters become
- * invalidated, add callbacks for things like
- * ProgramLocalParameters, etc.
- */
- {
- struct i915_fragment_program *p =
- (struct i915_fragment_program *)ctx->FragmentProgram._Current;
- if (p && p->nr_params)
- p->params_uptodate = 0;
- }
-
- if (new_state & (_NEW_FOG|_NEW_HINT|_NEW_PROGRAM))
- i915_update_fog(ctx);
-}
-
-
-static void i915InitDriverFunctions( struct dd_function_table *functions )
-{
- intelInitDriverFunctions( functions );
- i915InitStateFunctions( functions );
- i915InitTextureFuncs( functions );
- i915InitFragProgFuncs( functions );
- functions->UpdateState = i915InvalidateState;
-}
-
-
-
-GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- struct dd_function_table functions;
- struct i915_context *i915 = (struct i915_context *) CALLOC_STRUCT(i915_context);
- struct intel_context *intel = &i915->intel;
- GLcontext *ctx = &intel->ctx;
- GLuint i;
-
- if (!i915) return GL_FALSE;
-
- _mesa_printf( "\ntexmem branch (i915, drop2)\n\n");
-
- i915InitVtbl( i915 );
- i915InitMetaFuncs( i915 );
-
- i915InitDriverFunctions( &functions );
-
- if (!intelInitContext( intel, mesaVis, driContextPriv,
- sharedContextPrivate, &functions )) {
- FREE(i915);
- return GL_FALSE;
- }
-
- ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
- ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS;
- ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS;
-
-
- /* Advertise the full hardware capabilities. The new memory
- * manager should cope much better with overload situations:
- */
-<<<<<<< i915_context.c
- ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
- i = driQueryOptioni( &intel->intelScreen->optionCache, "allow_large_textures");
- driCalculateMaxTextureLevels( intel->texture_heaps,
- intel->nr_heaps,
- &intel->ctx.Const,
- 4,
- 11, /* max 2D texture size is 2048x2048 */
- 8, /* 3D texture */
- 11, /* cube texture. */
- 11, /* rect texture */
- 12,
- GL_FALSE,
- i );
-=======
- ctx->Const.MaxTextureLevels = 12;
- ctx->Const.Max3DTextureLevels = 9;
- ctx->Const.MaxCubeTextureLevels = 12;
- ctx->Const.MaxTextureRectSize = (1<<11);
- ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
->>>>>>> 1.13.2.9
-
- /* GL_ARB_fragment_program limits - don't think Mesa actually
- * validates programs against these, and in any case one ARB
- * instruction can translate to more than one HW instruction, so
- * we'll still have to check and fallback each time.
- */
- ctx->Const.FragmentProgram.MaxNativeTemps = I915_MAX_TEMPORARY;
- ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* 8 tex, 2 color, fog */
- ctx->Const.FragmentProgram.MaxNativeParameters = I915_MAX_CONSTANT;
- ctx->Const.FragmentProgram.MaxNativeAluInstructions = I915_MAX_ALU_INSN;
- ctx->Const.FragmentProgram.MaxNativeTexInstructions = I915_MAX_TEX_INSN;
- ctx->Const.FragmentProgram.MaxNativeInstructions = (I915_MAX_ALU_INSN +
- I915_MAX_TEX_INSN);
- ctx->Const.FragmentProgram.MaxNativeTexIndirections = I915_MAX_TEX_INDIRECT;
- ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
-
-
- driInitExtensions( ctx, i915_extensions, GL_FALSE );
-
-
- _tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
- 36 * sizeof(GLfloat) );
-
- intel->verts = TNL_CONTEXT(ctx)->clipspace.vertex_buf;
-
- i915InitState( i915 );
-
- return GL_TRUE;
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/i915_context.h b/src/mesa/drivers/dri/i915-tex/i915_context.h
deleted file mode 100644
index eb3dcd84d0f..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_context.h
+++ /dev/null
@@ -1,373 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef I915CONTEXT_INC
-#define I915CONTEXT_INC
-
-#include "intel_context.h"
-
-#define I915_FALLBACK_TEXTURE 0x1000
-#define I915_FALLBACK_COLORMASK 0x2000
-#define I915_FALLBACK_STENCIL 0x4000
-#define I915_FALLBACK_STIPPLE 0x8000
-#define I915_FALLBACK_PROGRAM 0x10000
-#define I915_FALLBACK_LOGICOP 0x20000
-#define I915_FALLBACK_POLYGON_SMOOTH 0x40000
-#define I915_FALLBACK_POINT_SMOOTH 0x80000
-
-#define I915_UPLOAD_CTX 0x1
-#define I915_UPLOAD_BUFFERS 0x2
-#define I915_UPLOAD_STIPPLE 0x4
-#define I915_UPLOAD_PROGRAM 0x8
-#define I915_UPLOAD_CONSTANTS 0x10
-#define I915_UPLOAD_FOG 0x20
-#define I915_UPLOAD_INVARIENT 0x40
-#define I915_UPLOAD_DEFAULTS 0x80
-#define I915_UPLOAD_TEX(i) (0x00010000<<(i))
-#define I915_UPLOAD_TEX_ALL (0x00ff0000)
-#define I915_UPLOAD_TEX_0_SHIFT 16
-
-
-/* State structure offsets - these will probably disappear.
- */
-#define I915_DESTREG_CBUFADDR0 0
-#define I915_DESTREG_CBUFADDR1 1
-#define I915_DESTREG_DBUFADDR0 3
-#define I915_DESTREG_DBUFADDR1 4
-#define I915_DESTREG_DV0 6
-#define I915_DESTREG_DV1 7
-#define I915_DESTREG_SENABLE 8
-#define I915_DESTREG_SR0 9
-#define I915_DESTREG_SR1 10
-#define I915_DESTREG_SR2 11
-#define I915_DEST_SETUP_SIZE 12
-
-#define I915_CTXREG_STATE4 0
-#define I915_CTXREG_LI 1
-#define I915_CTXREG_LIS2 2
-#define I915_CTXREG_LIS4 3
-#define I915_CTXREG_LIS5 4
-#define I915_CTXREG_LIS6 5
-#define I915_CTXREG_IAB 6
-#define I915_CTXREG_BLENDCOLOR0 7
-#define I915_CTXREG_BLENDCOLOR1 8
-#define I915_CTX_SETUP_SIZE 9
-
-#define I915_FOGREG_COLOR 0
-#define I915_FOGREG_MODE0 1
-#define I915_FOGREG_MODE1 2
-#define I915_FOGREG_MODE2 3
-#define I915_FOGREG_MODE3 4
-#define I915_FOG_SETUP_SIZE 5
-
-#define I915_STPREG_ST0 0
-#define I915_STPREG_ST1 1
-#define I915_STP_SETUP_SIZE 2
-
-#define I915_TEXREG_MS3 1
-#define I915_TEXREG_MS4 2
-#define I915_TEXREG_SS2 3
-#define I915_TEXREG_SS3 4
-#define I915_TEXREG_SS4 5
-#define I915_TEX_SETUP_SIZE 6
-
-#define I915_DEFREG_C0 0
-#define I915_DEFREG_C1 1
-#define I915_DEFREG_S0 2
-#define I915_DEFREG_S1 3
-#define I915_DEFREG_Z0 4
-#define I915_DEFREG_Z1 5
-#define I915_DEF_SETUP_SIZE 6
-
-
-#define I915_MAX_CONSTANT 32
-#define I915_CONSTANT_SIZE (2+(4*I915_MAX_CONSTANT))
-
-
-#define I915_PROGRAM_SIZE 192
-
-
-/* Hardware version of a parsed fragment program. "Derived" from the
- * mesa fragment_program struct.
- */
-struct i915_fragment_program {
- struct fragment_program FragProg;
-
- GLboolean translated;
- GLboolean params_uptodate;
- GLboolean on_hardware;
- GLboolean error; /* If program is malformed for any reason. */
-
- GLuint nr_tex_indirect;
- GLuint nr_tex_insn;
- GLuint nr_alu_insn;
- GLuint nr_decl_insn;
-
-
-
-
- /* TODO: split between the stored representation of a program and
- * the state used to build that representation.
- */
- GLcontext *ctx;
-
- GLuint declarations[I915_PROGRAM_SIZE];
- GLuint program[I915_PROGRAM_SIZE];
-
- GLfloat constant[I915_MAX_CONSTANT][4];
- GLuint constant_flags[I915_MAX_CONSTANT];
- GLuint nr_constants;
-
- GLuint *csr; /* Cursor, points into program.
- */
-
- GLuint *decl; /* Cursor, points into declarations.
- */
-
- GLuint decl_s; /* flags for which s regs need to be decl'd */
- GLuint decl_t; /* flags for which t regs need to be decl'd */
-
- GLuint temp_flag; /* Tracks temporary regs which are in
- * use.
- */
-
- GLuint utemp_flag; /* Tracks TYPE_U temporary regs which are in
- * use.
- */
-
-
-
- /* Helpers for i915_fragprog.c:
- */
- GLuint wpos_tex;
- GLboolean depth_written;
-
- struct {
- GLuint reg; /* Hardware constant idx */
- const GLfloat *values; /* Pointer to tracked values */
- } param[I915_MAX_CONSTANT];
- GLuint nr_params;
-
-
- /* Helpers for i915_texprog.c:
- */
- GLuint src_texture; /* Reg containing sampled texture color,
- * else UREG_BAD.
- */
-
- GLuint src_previous; /* Reg containing color from previous
- * stage. May need to be decl'd.
- */
-
- GLuint last_tex_stage; /* Number of last enabled texture unit */
-
- struct vertex_buffer *VB;
-};
-
-
-
-
-
-
-
-#define I915_TEX_UNITS 8
-
-
-struct i915_hw_state {
- GLuint Ctx[I915_CTX_SETUP_SIZE];
- GLuint Buffer[I915_DEST_SETUP_SIZE];
- GLuint Stipple[I915_STP_SETUP_SIZE];
- GLuint Fog[I915_FOG_SETUP_SIZE];
- GLuint Defaults[I915_DEF_SETUP_SIZE];
- GLuint Tex[I915_TEX_UNITS][I915_TEX_SETUP_SIZE];
- GLuint Constant[I915_CONSTANT_SIZE];
- GLuint ConstantSize;
- GLuint Program[I915_PROGRAM_SIZE];
- GLuint ProgramSize;
-
- /* Region pointers for relocation:
- */
- struct intel_region *draw_region;
- struct intel_region *depth_region;
-/* struct intel_region *tex_region[I915_TEX_UNITS]; */
-
- /* Regions aren't actually that appropriate here as the memory may
- * be from a PBO or FBO. Just use the buffer id. Will have to do
- * this for draw and depth for FBO's...
- */
- GLuint tex_buffer[I915_TEX_UNITS];
- GLuint tex_offset[I915_TEX_UNITS];
-
-
- GLuint active; /* I915_UPLOAD_* */
- GLuint emitted; /* I915_UPLOAD_* */
-};
-
-#define I915_FOG_PIXEL 2
-#define I915_FOG_VERTEX 1
-#define I915_FOG_NONE 0
-
-struct i915_context
-{
- struct intel_context intel;
-
- GLuint last_ReallyEnabled;
- GLuint vertex_fog;
- GLuint lodbias_ss2[MAX_TEXTURE_UNITS];
-
-
- struct i915_fragment_program tex_program;
- struct i915_fragment_program *current_program;
-
- struct i915_hw_state meta, initial, state, *current;
-};
-
-
-#define I915_STATECHANGE(i915, flag) \
-do { \
- INTEL_FIREVERTICES( &(i915)->intel ); \
- (i915)->state.emitted &= ~(flag); \
-} while (0)
-
-#define I915_ACTIVESTATE(i915, flag, mode) \
-do { \
- INTEL_FIREVERTICES( &(i915)->intel ); \
- if (mode) \
- (i915)->state.active |= (flag); \
- else \
- (i915)->state.active &= ~(flag); \
-} while (0)
-
-
-/*======================================================================
- * i915_vtbl.c
- */
-extern void i915InitVtbl( struct i915_context *i915 );
-
-extern void
-i915_state_draw_region(struct intel_context *intel,
- struct i915_hw_state *state,
- struct intel_region *color_region,
- struct intel_region *depth_region);
-
-
-
-#define SZ_TO_HW(sz) ((sz-2)&0x3)
-#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
-#define EMIT_ATTR( ATTR, STYLE, S4, SZ ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = (ATTR); \
- intel->vertex_attrs[intel->vertex_attr_count].format = (STYLE); \
- s4 |= S4; \
- intel->vertex_attr_count++; \
- offset += (SZ); \
-} while (0)
-
-#define EMIT_PAD( N ) \
-do { \
- intel->vertex_attrs[intel->vertex_attr_count].attrib = 0; \
- intel->vertex_attrs[intel->vertex_attr_count].format = EMIT_PAD; \
- intel->vertex_attrs[intel->vertex_attr_count].offset = (N); \
- intel->vertex_attr_count++; \
- offset += (N); \
-} while (0)
-
-
-
-/*======================================================================
- * i915_context.c
- */
-extern GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-
-/*======================================================================
- * i915_texprog.c
- */
-extern void i915ValidateTextureProgram( struct i915_context *i915 );
-
-
-/*======================================================================
- * i915_debug.c
- */
-extern void i915_disassemble_program( const GLuint *program, GLuint sz );
-extern void i915_print_ureg( const char *msg, GLuint ureg );
-
-
-/*======================================================================
- * i915_state.c
- */
-extern void i915InitStateFunctions( struct dd_function_table *functions );
-<<<<<<< i915_context.h
-extern void i915InitState( i915ContextPtr i915 );
-=======
-extern void i915InitState( struct i915_context *i915 );
-extern void i915_update_fog( GLcontext *ctx );
->>>>>>> 1.3.4.8
-
-
-/*======================================================================
- * i915_tex.c
- */
-extern void i915UpdateTextureState( struct intel_context *intel );
-extern void i915InitTextureFuncs( struct dd_function_table *functions );
-
-/*======================================================================
- * i915_metaops.c
- */
-void i915InitMetaFuncs( struct i915_context *i915 );
-
-
-extern void
-i915RotateWindow(intelContextPtr intel, __DRIdrawablePrivate *dPriv,
- GLuint srcBuf);
-
-/*======================================================================
- * i915_fragprog.c
- */
-extern void i915ValidateFragmentProgram( struct i915_context *i915 );
-extern void i915InitFragProgFuncs( struct dd_function_table *functions );
-
-/*======================================================================
- * Inline conversion functions. These are better-typed than the
- * macros used previously:
- */
-static INLINE struct i915_context *
-i915_context( GLcontext *ctx )
-{
- return (struct i915_context *)ctx;
-}
-
-
-
-#define I915_CONTEXT(ctx) i915_context(ctx)
-
-
-
-#endif
-
diff --git a/src/mesa/drivers/dri/i915-tex/i915_debug.c b/src/mesa/drivers/dri/i915-tex/i915_debug.c
deleted file mode 100644
index 054b561605a..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_debug.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include <stdio.h>
-
-
-static const char *opcodes[0x20] = {
- "NOP",
- "ADD",
- "MOV",
- "MUL",
- "MAD",
- "DP2ADD",
- "DP3",
- "DP4",
- "FRC",
- "RCP",
- "RSQ",
- "EXP",
- "LOG",
- "CMP",
- "MIN",
- "MAX",
- "FLR",
- "MOD",
- "TRC",
- "SGE",
- "SLT",
- "TEXLD",
- "TEXLDP",
- "TEXLDB",
- "TEXKILL",
- "DCL",
- "0x1a",
- "0x1b",
- "0x1c",
- "0x1d",
- "0x1e",
- "0x1f",
-};
-
-
-static const int args[0x20] = {
- 0, /* 0 nop */
- 2, /* 1 add */
- 1, /* 2 mov */
- 2, /* 3 m ul */
- 3, /* 4 mad */
- 3, /* 5 dp2add */
- 2, /* 6 dp3 */
- 2, /* 7 dp4 */
- 1, /* 8 frc */
- 1, /* 9 rcp */
- 1, /* a rsq */
- 1, /* b exp */
- 1, /* c log */
- 3, /* d cmp */
- 2, /* e min */
- 2, /* f max */
- 1, /* 10 flr */
- 1, /* 11 mod */
- 1, /* 12 trc */
- 2, /* 13 sge */
- 2, /* 14 slt */
- 1,
- 1,
- 1,
- 1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-
-static const char *regname[0x8] = {
- "R",
- "T",
- "CONST",
- "S",
- "OC",
- "OD",
- "U",
- "UNKNOWN",
-};
-
-static void print_reg_type_nr( GLuint type, GLuint nr )
-{
- switch (type) {
- case REG_TYPE_T:
- switch (nr) {
- case T_DIFFUSE: fprintf(stderr, "T_DIFFUSE"); return;
- case T_SPECULAR: fprintf(stderr, "T_SPECULAR"); return;
- case T_FOG_W: fprintf(stderr, "T_FOG_W"); return;
- default: fprintf(stderr, "T_TEX%d", nr); return;
- }
- case REG_TYPE_OC:
- if (nr == 0) {
- fprintf(stderr, "oC");
- return;
- }
- break;
- case REG_TYPE_OD:
- if (nr == 0) {
- fprintf(stderr, "oD");
- return;
- }
- break;
- default:
- break;
- }
-
- fprintf(stderr, "%s[%d]", regname[type], nr);
-}
-
-#define REG_SWIZZLE_MASK 0x7777
-#define REG_NEGATE_MASK 0x8888
-
-#define REG_SWIZZLE_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \
- (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC2_CHANNEL_W_SHIFT))
-
-
-static void print_reg_neg_swizzle( GLuint reg )
-{
- int i;
-
- if ((reg & REG_SWIZZLE_MASK) == REG_SWIZZLE_XYZW &&
- (reg & REG_NEGATE_MASK) == 0)
- return;
-
- fprintf(stderr, ".");
-
- for (i = 3 ; i >= 0; i--) {
- if (reg & (1<<((i*4)+3)))
- fprintf(stderr, "-");
-
- switch ((reg>>(i*4)) & 0x7) {
- case 0: fprintf(stderr, "x"); break;
- case 1: fprintf(stderr, "y"); break;
- case 2: fprintf(stderr, "z"); break;
- case 3: fprintf(stderr, "w"); break;
- case 4: fprintf(stderr, "0"); break;
- case 5: fprintf(stderr, "1"); break;
- default: fprintf(stderr, "?"); break;
- }
- }
-}
-
-
-static void print_src_reg( GLuint dword )
-{
- GLuint nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK;
- GLuint type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK;
- print_reg_type_nr( type, nr );
- print_reg_neg_swizzle( dword );
-}
-
-void i915_print_ureg( const char *msg, GLuint ureg )
-{
- fprintf(stderr, "%s: ", msg);
- print_src_reg( ureg >> 8 );
- fprintf(stderr, "\n");
-}
-
-static void print_dest_reg( GLuint dword )
-{
- GLuint nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK;
- GLuint type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK;
- print_reg_type_nr( type, nr );
- if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL)
- return;
- fprintf(stderr, ".");
- if (dword & A0_DEST_CHANNEL_X) fprintf(stderr, "x");
- if (dword & A0_DEST_CHANNEL_Y) fprintf(stderr, "y");
- if (dword & A0_DEST_CHANNEL_Z) fprintf(stderr, "z");
- if (dword & A0_DEST_CHANNEL_W) fprintf(stderr, "w");
-}
-
-
-#define GET_SRC0_REG(r0, r1) ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT))
-#define GET_SRC1_REG(r0, r1) ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT))
-#define GET_SRC2_REG(r) (r)
-
-
-static void print_arith_op( GLuint opcode, const GLuint *program )
-{
- if (opcode != A0_NOP) {
- print_dest_reg(program[0]);
- if (program[0] & A0_DEST_SATURATE)
- fprintf(stderr, " = SATURATE ");
- else
- fprintf(stderr, " = ");
- }
-
- fprintf(stderr, "%s ", opcodes[opcode]);
-
- print_src_reg(GET_SRC0_REG(program[0], program[1]));
- if (args[opcode] == 1) {
- fprintf(stderr, "\n");
- return;
- }
-
- fprintf(stderr, ", ");
- print_src_reg(GET_SRC1_REG(program[1], program[2]));
- if (args[opcode] == 2) {
- fprintf(stderr, "\n");
- return;
- }
-
- fprintf(stderr, ", ");
- print_src_reg(GET_SRC2_REG(program[2]));
- fprintf(stderr, "\n");
- return;
-}
-
-
-static void print_tex_op( GLuint opcode, const GLuint *program )
-{
- print_dest_reg(program[0] | A0_DEST_CHANNEL_ALL);
- fprintf(stderr, " = ");
-
- fprintf(stderr, "%s ", opcodes[opcode]);
-
- fprintf(stderr, "S[%d],",
- program[0] & T0_SAMPLER_NR_MASK);
-
- print_reg_type_nr( (program[1]>>T1_ADDRESS_REG_TYPE_SHIFT) & REG_TYPE_MASK,
- (program[1]>>T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK );
- fprintf(stderr, "\n");
-}
-
-static void print_dcl_op( GLuint opcode, const GLuint *program )
-{
- fprintf(stderr, "%s ", opcodes[opcode]);
- print_dest_reg(program[0] | A0_DEST_CHANNEL_ALL);
- fprintf(stderr, "\n");
-}
-
-
-void i915_disassemble_program( const GLuint *program, GLuint sz )
-{
- GLuint size = program[0] & 0x1ff;
- GLint i;
-
- fprintf(stderr, "BEGIN\n");
-
- if (size+2 != sz) {
- fprintf(stderr, "%s: program size mismatch %d/%d\n", __FUNCTION__,
- size+2, sz);
- exit(1);
- }
-
- program ++;
- for (i = 1 ; i < sz ; i+=3, program+=3) {
- GLuint opcode = program[0] & (0x1f<<24);
-
- if ((GLint) opcode >= A0_NOP && opcode <= A0_SLT)
- print_arith_op(opcode >> 24, program);
- else if (opcode >= T0_TEXLD && opcode <= T0_TEXKILL)
- print_tex_op(opcode >> 24, program);
- else if (opcode == D0_DCL)
- print_dcl_op(opcode >> 24, program);
- else
- fprintf(stderr, "Unknown opcode 0x%x\n", opcode);
- }
-
- fprintf(stderr, "END\n\n");
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i915_fragprog.c b/src/mesa/drivers/dri/i915-tex/i915_fragprog.c
deleted file mode 100644
index f05d90298d7..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_fragprog.c
+++ /dev/null
@@ -1,1066 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_program.h"
-
-#include "program_instruction.h"
-#include "program.h"
-
-
-
-/* 1, -1/3!, 1/5!, -1/7! */
-static const GLfloat sin_constants[4] = { 1.0,
- -1.0/(3*2*1),
- 1.0/(5*4*3*2*1),
- -1.0/(7*6*5*4*3*2*1) };
-
-/* 1, -1/2!, 1/4!, -1/6! */
-static const GLfloat cos_constants[4] = { 1.0,
- -1.0/(2*1),
- 1.0/(4*3*2*1),
- -1.0/(6*5*4*3*2*1) };
-
-/**
- * Retrieve a ureg for the given source register. Will emit
- * constants, apply swizzling and negation as needed.
- */
-static GLuint src_vector( struct i915_fragment_program *p,
- const struct prog_src_register *source,
- const struct fragment_program *program )
-{
- GLuint src;
-
- switch (source->File) {
-
- /* Registers:
- */
- case PROGRAM_TEMPORARY:
- if (source->Index >= I915_MAX_TEMPORARY) {
- i915_program_error( p, "Exceeded max temporary reg" );
- return 0;
- }
- src = UREG( REG_TYPE_R, source->Index );
- break;
- case PROGRAM_INPUT:
- switch (source->Index) {
- case FRAG_ATTRIB_WPOS:
- src = i915_emit_decl( p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL );
- break;
- case FRAG_ATTRIB_COL0:
- src = i915_emit_decl( p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL );
- break;
- case FRAG_ATTRIB_COL1:
- src = i915_emit_decl( p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ );
- src = swizzle( src, X, Y, Z, ONE );
- break;
- case FRAG_ATTRIB_FOGC:
- src = i915_emit_decl( p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W );
- src = swizzle( src, W, W, W, W );
- break;
- case FRAG_ATTRIB_TEX0:
- case FRAG_ATTRIB_TEX1:
- case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
- case FRAG_ATTRIB_TEX4:
- case FRAG_ATTRIB_TEX5:
- case FRAG_ATTRIB_TEX6:
- case FRAG_ATTRIB_TEX7:
- src = i915_emit_decl( p, REG_TYPE_T,
- T_TEX0 + (source->Index - FRAG_ATTRIB_TEX0),
- D0_CHANNEL_ALL );
- break;
-
- default:
- i915_program_error( p, "Bad source->Index" );
- return 0;
- }
- break;
-
- /* Various paramters and env values. All emitted to
- * hardware as program constants.
- */
- case PROGRAM_LOCAL_PARAM:
- src = i915_emit_param4fv(
- p, program->Base.LocalParams[source->Index]);
- break;
-
- case PROGRAM_ENV_PARAM:
- src = i915_emit_param4fv(
- p, p->ctx->FragmentProgram.Parameters[source->Index]);
- break;
-
- case PROGRAM_STATE_VAR:
- case PROGRAM_NAMED_PARAM:
- src = i915_emit_param4fv(
- p, program->Base.Parameters->ParameterValues[source->Index] );
- break;
-
- default:
- i915_program_error( p, "Bad source->File" );
- return 0;
- }
-
- src = swizzle(src,
- GET_SWZ(source->Swizzle, 0),
- GET_SWZ(source->Swizzle, 1),
- GET_SWZ(source->Swizzle, 2),
- GET_SWZ(source->Swizzle, 3));
-
- if (source->NegateBase)
- src = negate( src,
- GET_BIT(source->NegateBase, 0),
- GET_BIT(source->NegateBase, 1),
- GET_BIT(source->NegateBase, 2),
- GET_BIT(source->NegateBase, 3));
-
- return src;
-}
-
-
-static GLuint get_result_vector( struct i915_fragment_program *p,
- const struct prog_instruction *inst )
-{
- switch (inst->DstReg.File) {
- case PROGRAM_OUTPUT:
- switch (inst->DstReg.Index) {
- case FRAG_RESULT_COLR:
- return UREG(REG_TYPE_OC, 0);
- case FRAG_RESULT_DEPR:
- p->depth_written = 1;
- return UREG(REG_TYPE_OD, 0);
- default:
- i915_program_error( p, "Bad inst->DstReg.Index" );
- return 0;
- }
- case PROGRAM_TEMPORARY:
- return UREG(REG_TYPE_R, inst->DstReg.Index);
- default:
- i915_program_error( p, "Bad inst->DstReg.File" );
- return 0;
- }
-}
-
-static GLuint get_result_flags( const struct prog_instruction *inst )
-{
- GLuint flags = 0;
-
- if (inst->SaturateMode == SATURATE_ZERO_ONE) flags |= A0_DEST_SATURATE;
- if (inst->DstReg.WriteMask & WRITEMASK_X) flags |= A0_DEST_CHANNEL_X;
- if (inst->DstReg.WriteMask & WRITEMASK_Y) flags |= A0_DEST_CHANNEL_Y;
- if (inst->DstReg.WriteMask & WRITEMASK_Z) flags |= A0_DEST_CHANNEL_Z;
- if (inst->DstReg.WriteMask & WRITEMASK_W) flags |= A0_DEST_CHANNEL_W;
-
- return flags;
-}
-
-static GLuint translate_tex_src_target( struct i915_fragment_program *p,
- GLubyte bit )
-{
- switch (bit) {
- case TEXTURE_1D_INDEX: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_2D_INDEX: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_RECT_INDEX: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_3D_INDEX: return D0_SAMPLE_TYPE_VOLUME;
- case TEXTURE_CUBE_INDEX: return D0_SAMPLE_TYPE_CUBE;
- default: i915_program_error(p, "TexSrcBit"); return 0;
- }
-}
-
-#define EMIT_TEX( OP ) \
-do { \
- GLuint dim = translate_tex_src_target( p, inst->TexSrcTarget ); \
- GLuint sampler = i915_emit_decl(p, REG_TYPE_S, \
- inst->TexSrcUnit, dim); \
- GLuint coord = src_vector( p, &inst->SrcReg[0], program); \
- /* Texel lookup */ \
- \
- i915_emit_texld( p, \
- get_result_vector( p, inst ), \
- get_result_flags( inst ), \
- sampler, \
- coord, \
- OP); \
-} while (0)
-
-#define EMIT_ARITH( OP, N ) \
-do { \
- i915_emit_arith( p, \
- OP, \
- get_result_vector( p, inst ), \
- get_result_flags( inst ), 0, \
- (N<1)?0:src_vector( p, &inst->SrcReg[0], program), \
- (N<2)?0:src_vector( p, &inst->SrcReg[1], program), \
- (N<3)?0:src_vector( p, &inst->SrcReg[2], program)); \
-} while (0)
-
-#define EMIT_1ARG_ARITH( OP ) EMIT_ARITH( OP, 1 )
-#define EMIT_2ARG_ARITH( OP ) EMIT_ARITH( OP, 2 )
-#define EMIT_3ARG_ARITH( OP ) EMIT_ARITH( OP, 3 )
-
-
-/* Possible concerns:
- *
- * SIN, COS -- could use another taylor step?
- * LIT -- results seem a little different to sw mesa
- * LOG -- different to mesa on negative numbers, but this is conformant.
- *
- * Parse failures -- Mesa doesn't currently give a good indication
- * internally whether a particular program string parsed or not. This
- * can lead to confusion -- hopefully we cope with it ok now.
- *
- */
-static void upload_program( struct i915_fragment_program *p )
-{
- const struct fragment_program *program = p->ctx->FragmentProgram._Current;
- const struct prog_instruction *inst = program->Base.Instructions;
-
-/* _mesa_debug_fp_inst(program->Base.NumInstructions, inst); */
-
- /* Is this a parse-failed program? Ensure a valid program is
- * loaded, as the flagging of an error isn't sufficient to stop
- * this being uploaded to hardware.
- */
- if (inst[0].Opcode == OPCODE_END) {
- GLuint tmp = i915_get_utemp( p );
- i915_emit_arith( p,
- A0_MOV,
- UREG(REG_TYPE_OC, 0),
- A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp,ONE,ZERO,ONE,ONE), 0, 0);
- return;
- }
-
- while (1) {
- GLuint src0, src1, src2, flags;
- GLuint tmp = 0;
-
- switch (inst->Opcode) {
- case OPCODE_ABS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- i915_emit_arith( p,
- A0_MAX,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- src0, negate(src0, 1,1,1,1), 0);
- break;
-
- case OPCODE_ADD:
- EMIT_2ARG_ARITH( A0_ADD );
- break;
-
- case OPCODE_CMP:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- src2 = src_vector( p, &inst->SrcReg[2], program);
- i915_emit_arith( p,
- A0_CMP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- src0, src2, src1); /* NOTE: order of src2, src1 */
- break;
-
- case OPCODE_COS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0,
- i915_emit_const1f(p, 1.0/(M_PI * 2)),
- 0);
-
- i915_emit_arith( p,
- A0_MOD,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- 0, 0 );
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- i915_emit_const1f(p, (M_PI * 2)),
- 0);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1
- * t0 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * result = DP4 t0, cos_constants
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X,X,ONE,ONE),
- swizzle(tmp, X,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,Y,X,ONE),
- swizzle(tmp, X,X,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,X,Z,ONE),
- swizzle(tmp, Z,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(tmp, ONE,Z,Y,X),
- i915_emit_const4fv( p, cos_constants ), 0);
-
- break;
-
- case OPCODE_DP3:
- EMIT_2ARG_ARITH( A0_DP3 );
- break;
-
- case OPCODE_DP4:
- EMIT_2ARG_ARITH( A0_DP4 );
- break;
-
- case OPCODE_DPH:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0, X,Y,Z,ONE), src1, 0);
- break;
-
- case OPCODE_DST:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
-
- /* result[0] = 1 * 1;
- * result[1] = a[1] * b[1];
- * result[2] = a[2] * 1;
- * result[3] = 1 * b[3];
- */
- i915_emit_arith( p,
- A0_MUL,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0, ONE, Y, Z, ONE),
- swizzle(src1, ONE, Y, ONE, W ),
- 0);
- break;
-
- case OPCODE_EX2:
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_EXP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case OPCODE_FLR:
- EMIT_1ARG_ARITH( A0_FLR );
- break;
-
- case OPCODE_FRC:
- EMIT_1ARG_ARITH( A0_FRC );
- break;
-
- case OPCODE_KIL:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_texld( p,
- tmp, A0_DEST_CHANNEL_ALL, /* use a dummy dest reg */
- 0,
- src0,
- T0_TEXKILL );
- break;
-
- case OPCODE_LG2:
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_LOG,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case OPCODE_LIT:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- /* tmp = max( a.xyzw, a.00zw )
- * XXX: Clamp tmp.w to -128..128
- * tmp.y = log(tmp.y)
- * tmp.y = tmp.w * tmp.y
- * tmp.y = exp(tmp.y)
- * result = cmp (a.11-x1, a.1x01, a.1xy1 )
- */
- i915_emit_arith( p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0,
- src0, swizzle(src0, ZERO, ZERO, Z, W), 0 );
-
- i915_emit_arith( p, A0_LOG, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, Y, Y, Y, Y), 0, 0 );
-
- i915_emit_arith( p, A0_MUL, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, ZERO, Y, ZERO, ZERO),
- swizzle(tmp, ZERO, W, ZERO, ZERO), 0 );
-
- i915_emit_arith( p, A0_EXP, tmp, A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp, Y, Y, Y, Y), 0, 0 );
-
- i915_emit_arith( p, A0_CMP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- negate(swizzle(tmp, ONE, ONE, X, ONE),0,0,1,0),
- swizzle(tmp, ONE, X, ZERO, ONE),
- swizzle(tmp, ONE, X, Y, ONE));
-
- break;
-
- case OPCODE_LRP:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- src2 = src_vector( p, &inst->SrcReg[2], program);
- flags = get_result_flags( inst );
- tmp = i915_get_utemp( p );
-
- /* b*a + c*(1-a)
- *
- * b*a + c - ca
- *
- * tmp = b*a + c,
- * result = (-c)*a + tmp
- */
- i915_emit_arith( p, A0_MAD, tmp,
- flags & A0_DEST_CHANNEL_ALL, 0,
- src1, src0, src2 );
-
- i915_emit_arith( p, A0_MAD,
- get_result_vector( p, inst ),
- flags, 0,
- negate(src2, 1,1,1,1), src0, tmp );
- break;
-
- case OPCODE_MAD:
- EMIT_3ARG_ARITH( A0_MAD );
- break;
-
- case OPCODE_MAX:
- EMIT_2ARG_ARITH( A0_MAX );
- break;
-
- case OPCODE_MIN:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- tmp = i915_get_utemp( p );
- flags = get_result_flags( inst );
-
- i915_emit_arith( p,
- A0_MAX,
- tmp, flags & A0_DEST_CHANNEL_ALL, 0,
- negate(src0,1,1,1,1),
- negate(src1,1,1,1,1), 0);
-
- i915_emit_arith( p,
- A0_MOV,
- get_result_vector( p, inst ),
- flags, 0,
- negate(tmp, 1,1,1,1), 0, 0);
- break;
-
- case OPCODE_MOV:
- EMIT_1ARG_ARITH( A0_MOV );
- break;
-
- case OPCODE_MUL:
- EMIT_2ARG_ARITH( A0_MUL );
- break;
-
- case OPCODE_POW:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- tmp = i915_get_utemp( p );
- flags = get_result_flags( inst );
-
- /* XXX: masking on intermediate values, here and elsewhere.
- */
- i915_emit_arith( p,
- A0_LOG,
- tmp, A0_DEST_CHANNEL_X, 0,
- swizzle(src0,X,X,X,X), 0, 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp, src1, 0);
-
-
- i915_emit_arith( p,
- A0_EXP,
- get_result_vector( p, inst ),
- flags, 0,
- swizzle(tmp,X,X,X,X), 0, 0);
-
- break;
-
- case OPCODE_RCP:
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_RCP,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case OPCODE_RSQ:
-
- src0 = src_vector( p, &inst->SrcReg[0], program);
-
- i915_emit_arith( p,
- A0_RSQ,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,X,X,X,X), 0, 0);
- break;
-
- case OPCODE_SCS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * scs.x = DP4 t1, sin_constants
- * t1 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * scs.y = DP4 t1, cos_constants
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(src0, X,X,ONE,ONE),
- swizzle(src0, X,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,X,Y),
- swizzle(tmp, X,X,ONE,ONE), 0);
-
- if (inst->DstReg.WriteMask & WRITEMASK_Y) {
- GLuint tmp1;
-
- if (inst->DstReg.WriteMask & WRITEMASK_X)
- tmp1 = i915_get_utemp( p );
- else
- tmp1 = tmp;
-
- i915_emit_arith( p,
- A0_MUL,
- tmp1, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,Y,W),
- swizzle(tmp, X,Z,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- A0_DEST_CHANNEL_Y, 0,
- swizzle(tmp1, W,Z,Y,X),
- i915_emit_const4fv( p, sin_constants ), 0);
- }
-
- if (inst->DstReg.WriteMask & WRITEMASK_X) {
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,X,Z,ONE),
- swizzle(tmp, Z,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- A0_DEST_CHANNEL_X, 0,
- swizzle(tmp, ONE,Z,Y,X),
- i915_emit_const4fv( p, cos_constants ), 0);
- }
- break;
-
- case OPCODE_SGE:
- EMIT_2ARG_ARITH( A0_SGE );
- break;
-
- case OPCODE_SIN:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0,
- i915_emit_const1f(p, 1.0/(M_PI * 2)),
- 0);
-
- i915_emit_arith( p,
- A0_MOD,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- 0, 0 );
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- i915_emit_const1f(p, (M_PI * 2)),
- 0);
-
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * result = DP4 t1.wzyx, sin_constants
- */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X,X,ONE,ONE),
- swizzle(tmp, X,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,X,Y),
- swizzle(tmp, X,X,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,Y,W),
- swizzle(tmp, X,Z,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(tmp, W, Z, Y, X ),
- i915_emit_const4fv( p, sin_constants ), 0);
- break;
-
- case OPCODE_SLT:
- EMIT_2ARG_ARITH( A0_SLT );
- break;
-
- case OPCODE_SUB:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
-
- i915_emit_arith( p,
- A0_ADD,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- src0, negate(src1, 1,1,1,1), 0);
- break;
-
- case OPCODE_SWZ:
- EMIT_1ARG_ARITH( A0_MOV ); /* extended swizzle handled natively */
- break;
-
- case OPCODE_TEX:
- EMIT_TEX( T0_TEXLD );
- break;
-
- case OPCODE_TXB:
- EMIT_TEX( T0_TEXLDB );
- break;
-
- case OPCODE_TXP:
- EMIT_TEX( T0_TEXLDP );
- break;
-
- case OPCODE_XPD:
- /* Cross product:
- * result.x = src0.y * src1.z - src0.z * src1.y;
- * result.y = src0.z * src1.x - src0.x * src1.z;
- * result.z = src0.x * src1.y - src0.y * src1.x;
- * result.w = undef;
- */
- src0 = src_vector( p, &inst->SrcReg[0], program);
- src1 = src_vector( p, &inst->SrcReg[1], program);
- tmp = i915_get_utemp( p );
-
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(src0,Z,X,Y,ONE),
- swizzle(src1,Y,Z,X,ONE), 0);
-
- i915_emit_arith( p,
- A0_MAD,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(src0,Y,Z,X,ONE),
- swizzle(src1,Z,X,Y,ONE),
- negate(tmp,1,1,1,0));
- break;
-
- case OPCODE_END:
- return;
-
- default:
- i915_program_error( p, "bad opcode" );
- return;
- }
-
- inst++;
- i915_release_utemps( p );
- }
-}
-
-/* Rather than trying to intercept and jiggle depth writes during
- * emit, just move the value into its correct position at the end of
- * the program:
- */
-static void fixup_depth_write( struct i915_fragment_program *p )
-{
- if (p->depth_written) {
- GLuint depth = UREG(REG_TYPE_OD, 0);
-
- i915_emit_arith( p,
- A0_MOV,
- depth, A0_DEST_CHANNEL_W, 0,
- swizzle(depth,X,Y,Z,Z),
- 0, 0);
- }
-}
-
-
-#define FRAG_BIT_TEX(n) (FRAG_BIT_TEX0 << (n))
-
-
-static void check_wpos( struct i915_fragment_program *p )
-{
- GLuint inputs = p->FragProg.Base.InputsRead;
- GLint i;
-
- p->wpos_tex = -1;
-
- for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
- if (inputs & FRAG_BIT_TEX(i))
- continue;
- else if (inputs & FRAG_BIT_WPOS) {
- p->wpos_tex = i;
- inputs &= ~FRAG_BIT_WPOS;
- }
- }
-
- if (inputs & FRAG_BIT_WPOS) {
- i915_program_error(p, "No free texcoord for wpos value");
- }
-}
-
-
-static void translate_program( struct i915_fragment_program *p )
-{
- struct i915_context *i915 = I915_CONTEXT(p->ctx);
-
- i915_init_program( i915, p );
- check_wpos( p );
- upload_program( p );
- fixup_depth_write( p );
- i915_fini_program( p );
-
- p->translated = 1;
-}
-
-
-static void track_params( struct i915_fragment_program *p )
-{
- GLint i;
-
- if (p->nr_params)
- _mesa_load_state_parameters(p->ctx, p->FragProg.Base.Parameters);
-
- for (i = 0; i < p->nr_params; i++) {
- GLint reg = p->param[i].reg;
- COPY_4V( p->constant[reg], p->param[i].values );
- }
-
- p->params_uptodate = 1;
- p->on_hardware = 0; /* overkill */
-}
-
-
-static void i915BindProgram( GLcontext *ctx,
- GLenum target,
- struct program *prog )
-{
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- struct i915_context *i915 = I915_CONTEXT(ctx);
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
-
- if (i915->current_program == p)
- return;
-
- if (i915->current_program) {
- i915->current_program->on_hardware = 0;
- i915->current_program->params_uptodate = 0;
- }
-
- i915->current_program = p;
-
- assert(p->on_hardware == 0);
- assert(p->params_uptodate == 0);
-
- /* Hack: make sure fog is correctly enabled according to this
- * fragment program's fog options.
- */
- ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
- ctx->FragmentProgram.Enabled );
- }
-}
-
-static struct program *i915NewProgram( GLcontext *ctx,
- GLenum target,
- GLuint id )
-{
- switch (target) {
- case GL_VERTEX_PROGRAM_ARB:
- return _mesa_init_vertex_program( ctx, CALLOC_STRUCT(vertex_program),
- target, id );
-
- case GL_FRAGMENT_PROGRAM_ARB: {
- struct i915_fragment_program *prog = CALLOC_STRUCT(i915_fragment_program);
- if (prog) {
- i915_init_program( I915_CONTEXT(ctx), prog );
-
- return _mesa_init_fragment_program( ctx, &prog->FragProg,
- target, id );
- }
- else
- return NULL;
- }
-
- default:
- /* Just fallback:
- */
- return _mesa_new_program( ctx, target, id );
- }
-}
-
-static void i915DeleteProgram( GLcontext *ctx,
- struct program *prog )
-{
- if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
- struct i915_context *i915 = I915_CONTEXT(ctx);
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
-
- if (i915->current_program == p)
- i915->current_program = 0;
- }
-
- _mesa_delete_program( ctx, prog );
-}
-
-
-static GLboolean i915IsProgramNative( GLcontext *ctx,
- GLenum target,
- struct program *prog )
-{
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
-
- if (!p->translated)
- translate_program( p );
-
- return !p->error;
- }
- else
- return GL_TRUE;
-}
-
-static void i915ProgramStringNotify( GLcontext *ctx,
- GLenum target,
- struct program *prog )
-{
- if (target == GL_FRAGMENT_PROGRAM_ARB) {
- struct i915_fragment_program *p = (struct i915_fragment_program *)prog;
- p->translated = 0;
-
- /* Hack: make sure fog is correctly enabled according to this
- * fragment program's fog options.
- */
- ctx->Driver.Enable( ctx, GL_FRAGMENT_PROGRAM_ARB,
- ctx->FragmentProgram.Enabled );
- }
-}
-
-
-void i915ValidateFragmentProgram( struct i915_context *i915 )
-{
- GLcontext *ctx = &i915->intel.ctx;
- struct intel_context *intel = intel_context(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
-
- struct i915_fragment_program *p =
- (struct i915_fragment_program *)ctx->FragmentProgram._Current;
-
- const GLuint inputsRead = p->FragProg.Base.InputsRead;
- GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
- GLuint s2 = S2_TEXCOORD_NONE;
- int i, offset = 0;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
-
- if (!p->translated)
- translate_program( p );
-
- intel->vertex_attr_count = 0;
- intel->wpos_offset = 0;
- intel->wpos_size = 0;
- intel->coloroffset = 0;
- intel->specoffset = 0;
-
- if (inputsRead & FRAG_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, S4_VFMT_XYZ, 12 );
- }
-
- if (inputsRead & FRAG_BIT_COL0) {
- intel->coloroffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4 );
- }
-
- if ((inputsRead & (FRAG_BIT_COL1|FRAG_BIT_FOGC)) ||
- i915->vertex_fog != I915_FOG_NONE) {
-
- if (inputsRead & FRAG_BIT_COL1) {
- intel->specoffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, S4_VFMT_SPEC_FOG, 3 );
- }
- else
- EMIT_PAD(3);
-
- if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, S4_VFMT_SPEC_FOG, 1 );
- else
- EMIT_PAD( 1 );
- }
-
-#if 0
- if ((inputsRead & FRAG_BIT_FOGC) || i915->vertex_fog != I915_FOG_NONE) {
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4 );
- }
-#endif
-
- for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
- if (inputsRead & FRAG_BIT_TEX(i)) {
- int sz = VB->TexCoordPtr[i]->size;
-
- s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
- s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz));
-
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0, sz * 4 );
- }
- else if (i == p->wpos_tex) {
-
- /* If WPOS is required, duplicate the XYZ position data in an
- * unused texture coordinate:
- */
- s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
- s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(3));
-
- intel->wpos_offset = offset;
- intel->wpos_size = 3 * sizeof(GLuint);
-
- EMIT_PAD( intel->wpos_size );
- }
- }
-
- if (s2 != i915->state.Ctx[I915_CTXREG_LIS2] ||
- s4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
- int k;
-
- I915_STATECHANGE( i915, I915_UPLOAD_CTX );
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- intel->vertex_size = _tnl_install_attrs( &intel->ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->vertex_size >>= 2;
-
- i915->state.Ctx[I915_CTXREG_LIS2] = s2;
- i915->state.Ctx[I915_CTXREG_LIS4] = s4;
-
- k = intel->vtbl.check_vertex_size( intel, intel->vertex_size );
- assert(k);
- }
-
- if (!p->params_uptodate)
- track_params( p );
-
- if (!p->on_hardware)
- i915_upload_program( i915, p );
-}
-
-void i915InitFragProgFuncs( struct dd_function_table *functions )
-{
- functions->BindProgram = i915BindProgram;
- functions->NewProgram = i915NewProgram;
- functions->DeleteProgram = i915DeleteProgram;
- functions->IsProgramNative = i915IsProgramNative;
- functions->ProgramStringNotify = i915ProgramStringNotify;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i915_metaops.c b/src/mesa/drivers/dri/i915-tex/i915_metaops.c
deleted file mode 100644
index 21f9199d10b..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_metaops.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "utils.h"
-
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-#include "intel_ioctl.h"
-<<<<<<< i915_metaops.c
-#include "intel_rotate.h"
-=======
-#include "intel_regions.h"
->>>>>>> 1.5.2.9
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-/* We touch almost everything:
- */
-#define ACTIVE (I915_UPLOAD_INVARIENT | \
- I915_UPLOAD_CTX | \
- I915_UPLOAD_BUFFERS | \
- I915_UPLOAD_STIPPLE | \
- I915_UPLOAD_PROGRAM | \
- I915_UPLOAD_FOG | \
- I915_UPLOAD_TEX(0))
-
-#define SET_STATE( i915, STATE ) \
-do { \
- i915->current->emitted &= ~ACTIVE; \
- i915->current = &i915->STATE; \
- i915->current->emitted &= ~ACTIVE; \
-} while (0)
-
-
-static void meta_no_stencil_write( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_FALSE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-static void meta_no_depth_write( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_FALSE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS6] &= ~(S6_DEPTH_TEST_ENABLE |
- S6_DEPTH_WRITE_ENABLE);
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-static void meta_depth_replace( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- /* ctx->Driver.Enable( ctx, GL_DEPTH_TEST, GL_TRUE )
- * ctx->Driver.DepthMask( ctx, GL_TRUE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS6] |= (S6_DEPTH_TEST_ENABLE |
- S6_DEPTH_WRITE_ENABLE);
-
- /* ctx->Driver.DepthFunc( ctx, GL_REPLACE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_TEST_FUNC_MASK;
- i915->meta.Ctx[I915_CTXREG_LIS6] |=
- COMPAREFUNC_ALWAYS << S6_DEPTH_TEST_FUNC_SHIFT;
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-/* Set stencil unit to replace always with the reference value.
- */
-static void meta_stencil_replace( struct intel_context *intel,
- GLuint s_mask,
- GLuint s_clear)
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- GLuint op = STENCILOP_REPLACE;
- GLuint func = COMPAREFUNC_ALWAYS;
-
- /* ctx->Driver.Enable( ctx, GL_STENCIL_TEST, GL_TRUE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS5] |= (S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
-
- /* ctx->Driver.StencilMask( ctx, s_mask )
- */
- i915->meta.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
-
- i915->meta.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(s_mask));
-
- /* ctx->Driver.StencilOp( ctx, GL_REPLACE, GL_REPLACE, GL_REPLACE )
- */
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_FAIL_MASK |
- S5_STENCIL_PASS_Z_FAIL_MASK |
- S5_STENCIL_PASS_Z_PASS_MASK);
-
- i915->meta.Ctx[I915_CTXREG_LIS5] |= ((op << S5_STENCIL_FAIL_SHIFT) |
- (op << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
- (op << S5_STENCIL_PASS_Z_PASS_SHIFT));
-
-
- /* ctx->Driver.StencilFunc( ctx, GL_ALWAYS, s_ref, ~0 )
- */
- i915->meta.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i915->meta.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff));
-
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_REF_MASK |
- S5_STENCIL_TEST_FUNC_MASK);
-
- i915->meta.Ctx[I915_CTXREG_LIS5] |= ((s_clear << S5_STENCIL_REF_SHIFT) |
- (func << S5_STENCIL_TEST_FUNC_SHIFT));
-
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-static void meta_color_mask( struct intel_context *intel, GLboolean state )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- const GLuint mask = (S5_WRITEDISABLE_RED |
- S5_WRITEDISABLE_GREEN |
- S5_WRITEDISABLE_BLUE |
- S5_WRITEDISABLE_ALPHA);
-
- /* Copy colormask state from "regular" hw context.
- */
- if (state) {
- i915->meta.Ctx[I915_CTXREG_LIS5] &= ~mask;
- i915->meta.Ctx[I915_CTXREG_LIS5] |=
- (i915->state.Ctx[I915_CTXREG_LIS5] & mask);
- }
- else
- i915->meta.Ctx[I915_CTXREG_LIS5] |= mask;
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-
-static void meta_import_pixel_state( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- memcpy(i915->meta.Fog, i915->state.Fog, I915_FOG_SETUP_SIZE * 4);
-
- i915->meta.Ctx[I915_CTXREG_LIS5] = i915->state.Ctx[I915_CTXREG_LIS5];
- i915->meta.Ctx[I915_CTXREG_LIS6] = i915->state.Ctx[I915_CTXREG_LIS6];
- i915->meta.Ctx[I915_CTXREG_STATE4] = i915->state.Ctx[I915_CTXREG_STATE4];
- i915->meta.Ctx[I915_CTXREG_BLENDCOLOR1] = i915->state.Ctx[I915_CTXREG_BLENDCOLOR1];
- i915->meta.Ctx[I915_CTXREG_IAB] = i915->state.Ctx[I915_CTXREG_IAB];
-
- i915->meta.Buffer[I915_DESTREG_SENABLE] = i915->state.Buffer[I915_DESTREG_SENABLE];
- i915->meta.Buffer[I915_DESTREG_SR1] = i915->state.Buffer[I915_DESTREG_SR1];
- i915->meta.Buffer[I915_DESTREG_SR2] = i915->state.Buffer[I915_DESTREG_SR2];
-
- i915->meta.emitted &= ~I915_UPLOAD_FOG;
- i915->meta.emitted &= ~I915_UPLOAD_BUFFERS;
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-
-
-#define REG( type, nr ) (((type)<<5)|(nr))
-
-#define REG_R(x) REG(REG_TYPE_R, x)
-#define REG_T(x) REG(REG_TYPE_T, x)
-#define REG_CONST(x) REG(REG_TYPE_CONST, x)
-#define REG_S(x) REG(REG_TYPE_S, x)
-#define REG_OC REG(REG_TYPE_OC, 0)
-#define REG_OD REG(REG_TYPE_OD, 0)
-#define REG_U(x) REG(REG_TYPE_U, x)
-
-#define REG_T_DIFFUSE REG(REG_TYPE_T, T_DIFFUSE)
-#define REG_T_SPECULAR REG(REG_TYPE_T, T_SPECULAR)
-#define REG_T_FOG_W REG(REG_TYPE_T, T_FOG_W)
-#define REG_T_TEX(x) REG(REG_TYPE_T, x)
-
-
-#define A0_DEST_REG( reg ) ( (reg) << A0_DEST_NR_SHIFT )
-#define A0_SRC0_REG( reg ) ( (reg) << A0_SRC0_NR_SHIFT )
-#define A1_SRC1_REG( reg ) ( (reg) << A1_SRC1_NR_SHIFT )
-#define A1_SRC2_REG( reg ) ( (reg) << A1_SRC2_NR_SHIFT )
-#define A2_SRC2_REG( reg ) ( (reg) << A2_SRC2_NR_SHIFT )
-#define D0_DECL_REG( reg ) ( (reg) << D0_NR_SHIFT )
-#define T0_DEST_REG( reg ) ( (reg) << T0_DEST_NR_SHIFT )
-
-#define T0_SAMPLER( unit ) ((unit)<<T0_SAMPLER_NR_SHIFT)
-
-#define T1_ADDRESS_REG( type, nr ) (((type)<<T1_ADDRESS_REG_TYPE_SHIFT)| \
- ((nr)<<T1_ADDRESS_REG_NR_SHIFT))
-
-
-#define A1_SRC0_XYZW ((SRC_X << A1_SRC0_CHANNEL_X_SHIFT) | \
- (SRC_Y << A1_SRC0_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A1_SRC0_CHANNEL_Z_SHIFT) | \
- (SRC_W << A1_SRC0_CHANNEL_W_SHIFT))
-
-#define A1_SRC1_XY ((SRC_X << A1_SRC1_CHANNEL_X_SHIFT) | \
- (SRC_Y << A1_SRC1_CHANNEL_Y_SHIFT))
-
-#define A2_SRC1_ZW ((SRC_Z << A2_SRC1_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC1_CHANNEL_W_SHIFT))
-
-#define A2_SRC2_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \
- (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \
- (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \
- (SRC_W << A2_SRC2_CHANNEL_W_SHIFT))
-
-
-
-
-
-static void meta_no_texture( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- static const GLuint prog[] = {
- _3DSTATE_PIXEL_SHADER_PROGRAM,
-
- /* Declare incoming diffuse color:
- */
- (D0_DCL |
- D0_DECL_REG( REG_T_DIFFUSE ) |
- D0_CHANNEL_ALL),
- D1_MBZ,
- D2_MBZ,
-
- /* output-color = mov(t_diffuse)
- */
- (A0_MOV |
- A0_DEST_REG( REG_OC ) |
- A0_DEST_CHANNEL_ALL |
- A0_SRC0_REG( REG_T_DIFFUSE )),
- (A1_SRC0_XYZW),
- 0,
- };
-
-
- memcpy( i915->meta.Program, prog, sizeof(prog) );
- i915->meta.ProgramSize = sizeof(prog) / sizeof(*prog);
- i915->meta.Program[0] |= i915->meta.ProgramSize - 2;
- i915->meta.emitted &= ~I915_UPLOAD_PROGRAM;
-}
-
-<<<<<<< i915_metaops.c
-
-static void enable_texture_blend_replace( i915ContextPtr i915 )
-=======
-static void meta_texture_blend_replace( struct intel_context *intel )
->>>>>>> 1.5.2.9
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- static const GLuint prog[] = {
- _3DSTATE_PIXEL_SHADER_PROGRAM,
-
- /* Declare the sampler:
- */
- (D0_DCL |
- D0_DECL_REG( REG_S(0) ) |
- D0_SAMPLE_TYPE_2D |
- D0_CHANNEL_NONE),
- D1_MBZ,
- D2_MBZ,
-
- /* Declare the interpolated texture coordinate:
- */
- (D0_DCL |
- D0_DECL_REG( REG_T_TEX(0) ) |
- D0_CHANNEL_ALL),
- D1_MBZ,
- D2_MBZ,
-
- /* output-color = texld(sample0, texcoord0)
- */
- (T0_TEXLD |
- T0_DEST_REG( REG_OC ) |
- T0_SAMPLER( 0 )),
- T1_ADDRESS_REG(REG_TYPE_T, 0),
- T2_MBZ
- };
-
- memcpy( i915->meta.Program, prog, sizeof(prog) );
- i915->meta.ProgramSize = sizeof(prog) / sizeof(*prog);
- i915->meta.Program[0] |= i915->meta.ProgramSize - 2;
- i915->meta.emitted &= ~I915_UPLOAD_PROGRAM;
-}
-
-
-
-
-
-/* Set up an arbitary piece of memory as a rectangular texture
- * (including the front or back buffer).
- */
-<<<<<<< i915_metaops.c
-static void set_tex_rect_source( i915ContextPtr i915,
- GLuint offset,
- GLuint width,
- GLuint height,
- GLuint pitch, /* in bytes! */
- GLuint textureFormat )
-=======
-static GLboolean meta_tex_rect_source( struct intel_context *intel,
- GLuint buffer,
- GLuint offset,
- GLuint pitch,
- GLuint height,
- GLenum format,
- GLenum type)
->>>>>>> 1.5.2.9
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- GLuint unit = 0;
- GLint numLevels = 1;
- GLuint *state = i915->meta.Tex[0];
- GLuint textureFormat;
- GLuint cpp;
-
-<<<<<<< i915_metaops.c
-#if 0
- printf("TexRect source offset 0x%x pitch %d\n", offset, pitch);
-#endif
-=======
- /* A full implementation of this would do the upload through
- * glTexImage2d, and get all the conversion operations at that
- * point. We are restricted, but still at least have access to the
- * fragment program swizzle.
- */
- switch (format) {
- case GL_BGRA:
- switch (type) {
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_BYTE:
- textureFormat = (MAPSURF_32BIT | MT_32BIT_ARGB8888);
- cpp = 4;
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_RGBA:
- switch (type) {
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_BYTE:
- textureFormat = (MAPSURF_32BIT | MT_32BIT_ABGR8888);
- cpp = 4;
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_BGR:
- switch (type) {
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- textureFormat = (MAPSURF_16BIT | MT_16BIT_RGB565);
- cpp = 2;
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_RGB:
- switch (type) {
- case GL_UNSIGNED_SHORT_5_6_5:
- textureFormat = (MAPSURF_16BIT | MT_16BIT_RGB565);
- cpp = 2;
- break;
- default:
- return GL_FALSE;
- }
- break;
-
- default:
- return GL_FALSE;
- }
-
-
- if ((pitch * cpp) & 3) {
- _mesa_printf("%s: texture is not dword pitch\n", __FUNCTION__);
- return GL_FALSE;
- }
->>>>>>> 1.5.2.9
-
-/* intel_region_release(intel, &i915->meta.tex_region[0]); */
-/* intel_region_reference(&i915->meta.tex_region[0], region); */
- i915->meta.tex_buffer[0] = buffer;
- i915->meta.tex_offset[0] = offset;
-
- state[I915_TEXREG_MS3] = (((height - 1) << MS3_HEIGHT_SHIFT) |
-<<<<<<< i915_metaops.c
- ((width - 1) << MS3_WIDTH_SHIFT) |
- textureFormat |
- MS3_USE_FENCE_REGS);
-
- state[I915_TEXREG_MS4] = ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) |
- ((((numLevels-1) * 4)) << MS4_MAX_LOD_SHIFT));
-=======
- ((pitch - 1) << MS3_WIDTH_SHIFT) |
- textureFormat |
- MS3_USE_FENCE_REGS);
-
- state[I915_TEXREG_MS4] = (((((pitch * cpp) / 4) - 1) << MS4_PITCH_SHIFT) |
- MS4_CUBE_FACE_ENA_MASK |
- ((((numLevels-1) * 4)) << MS4_MAX_LOD_SHIFT));
->>>>>>> 1.5.2.9
-
- state[I915_TEXREG_SS2] = ((FILTER_NEAREST << SS2_MIN_FILTER_SHIFT) |
- (MIPFILTER_NONE << SS2_MIP_FILTER_SHIFT) |
- (FILTER_NEAREST << SS2_MAG_FILTER_SHIFT));
-
- state[I915_TEXREG_SS3] = ((TEXCOORDMODE_WRAP << SS3_TCX_ADDR_MODE_SHIFT) |
- (TEXCOORDMODE_WRAP << SS3_TCY_ADDR_MODE_SHIFT) |
- (TEXCOORDMODE_WRAP << SS3_TCZ_ADDR_MODE_SHIFT) |
- (unit<<SS3_TEXTUREMAP_INDEX_SHIFT));
-
- state[I915_TEXREG_SS4] = 0;
-
- i915->meta.emitted &= ~I915_UPLOAD_TEX(0);
- return GL_TRUE;
-}
-<<<<<<< i915_metaops.c
-
-=======
->>>>>>> 1.5.2.9
-
-
-/**
- * Set the color and depth drawing region for meta ops.
- */
-<<<<<<< i915_metaops.c
-static void set_draw_region( i915ContextPtr i915, const intelRegion *region )
-=======
-static void meta_draw_region( struct intel_context *intel,
- struct intel_region *color_region,
- struct intel_region *depth_region )
->>>>>>> 1.5.2.9
-{
-<<<<<<< i915_metaops.c
-#if 0
- printf("Rotate into region: offset 0x%x pitch %d\n",
- region->offset, region->pitch);
-#endif
- i915->meta.Buffer[I915_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(region->pitch) | BUF_3D_USE_FENCE);
- i915->meta.Buffer[I915_DESTREG_CBUFADDR2] = region->offset;
- i915->meta.emitted &= ~I915_UPLOAD_BUFFERS;
-=======
- struct i915_context *i915 = i915_context(&intel->ctx);
- i915_state_draw_region(intel, &i915->meta, color_region, depth_region);
->>>>>>> 1.5.2.9
-}
-
-<<<<<<< i915_metaops.c
-
-#if 0
-/* Setup an arbitary draw format, useful for targeting texture or agp
- * memory.
- */
-static void set_draw_format( i915ContextPtr i915,
- GLuint format,
- GLuint depth_format)
-{
- i915->meta.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- format |
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- depth_format);
-=======
->>>>>>> 1.5.2.9
-
-static void set_vertex_format( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- i915->meta.Ctx[I915_CTXREG_LIS2] =
- (S2_TEXCOORD_FMT(0, TEXCOORDFMT_2D) |
- S2_TEXCOORD_FMT(1, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(2, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(3, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(4, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(5, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(6, TEXCOORDFMT_NOT_PRESENT) |
- S2_TEXCOORD_FMT(7, TEXCOORDFMT_NOT_PRESENT));
-
- i915->meta.Ctx[I915_CTXREG_LIS4] &= ~S4_VFMT_MASK;
-
- i915->meta.Ctx[I915_CTXREG_LIS4] |=
- (S4_VFMT_COLOR |
- S4_VFMT_XYZ);
-
- i915->meta.emitted &= ~I915_UPLOAD_CTX;
-}
-
-
-<<<<<<< i915_metaops.c
-static void draw_quad(i915ContextPtr i915,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha,
- GLfloat s0, GLfloat s1,
- GLfloat t0, GLfloat t1 )
-{
- GLuint vertex_size = 8;
- GLuint *vb = intelEmitInlinePrimitiveLocked( &i915->intel,
- PRIM3D_TRIFAN,
- 4 * vertex_size,
- vertex_size );
- intelVertex tmp;
- int i;
-
- if (0)
- fprintf(stderr, "%s: %f,%f-%f,%f 0x%x%x%x%x %f,%f-%f,%f\n",
- __FUNCTION__,
- x0,y0,x1,y1,red,green,blue,alpha,s0,t0,s1,t1);
-
-
- /* initial vertex, left bottom */
- tmp.v.x = x0;
- tmp.v.y = y0;
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
- tmp.v.u0 = s0;
- tmp.v.v0 = t0;
-
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- /* right bottom */
- vb += vertex_size;
- tmp.v.x = x1;
- tmp.v.u0 = s1;
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- /* right top */
- vb += vertex_size;
- tmp.v.y = y1;
- tmp.v.v0 = t1;
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- /* left top */
- vb += vertex_size;
- tmp.v.x = x0;
- tmp.v.u0 = s0;
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-}
-
-
-static void draw_poly(i915ContextPtr i915,
- GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha,
- GLuint numVerts,
- /*const*/ GLfloat verts[][2],
- /*const*/ GLfloat texcoords[][2])
-{
- GLuint vertex_size = 8;
- GLuint *vb = intelEmitInlinePrimitiveLocked( &i915->intel,
- PRIM3D_TRIFAN,
- numVerts * vertex_size,
- vertex_size );
- intelVertex tmp;
- int i, k;
-
- /* initial constant vertex fields */
- tmp.v.z = 1.0;
- tmp.v.w = 1.0;
- tmp.v.color.red = red;
- tmp.v.color.green = green;
- tmp.v.color.blue = blue;
- tmp.v.color.alpha = alpha;
- tmp.v.specular.red = 0;
- tmp.v.specular.green = 0;
- tmp.v.specular.blue = 0;
- tmp.v.specular.alpha = 0;
-
- for (k = 0; k < numVerts; k++) {
- tmp.v.x = verts[k][0];
- tmp.v.y = verts[k][1];
- tmp.v.u0 = texcoords[k][0];
- tmp.v.v0 = texcoords[k][1];
-
- for (i = 0 ; i < vertex_size ; i++)
- vb[i] = tmp.ui[i];
-
- vb += vertex_size;
- }
-}
-
-
-void
-i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- i915ContextPtr i915 = I915_CONTEXT( intel );
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- intelScreenPrivate *screen = intel->intelScreen;
- int x0, y0, x1, y1;
-
- SET_STATE( i915, meta );
- set_initial_state( i915 );
- set_no_texture( i915 );
- set_vertex_format( i915 );
-
- LOCK_HARDWARE(intel);
-
- if (!all) {
- x0 = cx;
- y0 = cy;
- x1 = x0 + cw;
- y1 = y0 + ch;
- } else {
- x0 = 0;
- y0 = 0;
- x1 = x0 + dPriv->w;
- y1 = y0 + dPriv->h;
- }
-=======
->>>>>>> 1.5.2.9
-
-/* Operations where the 3D engine is decoupled temporarily from the
- * current GL state and used for other purposes than simply rendering
- * incoming triangles.
- */
-static void install_meta_state( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- memcpy(&i915->meta, &i915->initial, sizeof(i915->meta) );
- i915->meta.active = ACTIVE;
- i915->meta.emitted = 0;
-
-<<<<<<< i915_metaops.c
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- set_no_depth_stencil_write( i915 );
- set_color_mask( i915, GL_TRUE );
- set_draw_region( i915, &screen->front );
-
- draw_quad(i915, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-=======
- SET_STATE(i915, meta);
- set_vertex_format(intel);
- meta_no_texture(intel);
-}
->>>>>>> 1.5.2.9
-
-<<<<<<< i915_metaops.c
- if (mask & BUFFER_BIT_BACK_LEFT) {
- set_no_depth_stencil_write( i915 );
- set_color_mask( i915, GL_TRUE );
- set_draw_region( i915, &screen->back );
-
- draw_quad(i915, x0, x1, y0, y1,
- intel->clear_red, intel->clear_green,
- intel->clear_blue, intel->clear_alpha,
- 0, 0, 0, 0);
- }
-
- if (mask & BUFFER_BIT_STENCIL) {
- set_stencil_replace( i915,
- intel->ctx.Stencil.WriteMask[0],
- intel->ctx.Stencil.Clear);
-
- set_color_mask( i915, GL_FALSE );
- set_draw_region( i915, &screen->front ); /* could be either? */
-=======
-static void leave_meta_state( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- intel_region_release(intel, &i915->meta.draw_region);
- intel_region_release(intel, &i915->meta.depth_region);
-/* intel_region_release(intel, &i915->meta.tex_region[0]); */
- SET_STATE(i915, state);
-}
->>>>>>> 1.5.2.9
-
-
-
-void i915InitMetaFuncs( struct i915_context *i915 )
-{
- i915->intel.vtbl.install_meta_state = install_meta_state;
- i915->intel.vtbl.leave_meta_state = leave_meta_state;
- i915->intel.vtbl.meta_no_depth_write = meta_no_depth_write;
- i915->intel.vtbl.meta_no_stencil_write = meta_no_stencil_write;
- i915->intel.vtbl.meta_stencil_replace = meta_stencil_replace;
- i915->intel.vtbl.meta_depth_replace = meta_depth_replace;
- i915->intel.vtbl.meta_color_mask = meta_color_mask;
- i915->intel.vtbl.meta_no_texture = meta_no_texture;
- i915->intel.vtbl.meta_texture_blend_replace = meta_texture_blend_replace;
- i915->intel.vtbl.meta_tex_rect_source = meta_tex_rect_source;
- i915->intel.vtbl.meta_draw_region = meta_draw_region;
- i915->intel.vtbl.meta_import_pixel_state = meta_import_pixel_state;
-}
-<<<<<<< i915_metaops.c
-
-
-/**
- * Copy the window contents named by dPriv to the rotated (or reflected)
- * color buffer.
- * srcBuf is BUFFER_BIT_FRONT_LEFT or BUFFER_BIT_BACK_LEFT to indicate the source.
- */
-void
-i915RotateWindow(intelContextPtr intel, __DRIdrawablePrivate *dPriv,
- GLuint srcBuf)
-{
- i915ContextPtr i915 = I915_CONTEXT( intel );
- intelScreenPrivate *screen = intel->intelScreen;
- const GLuint cpp = screen->cpp;
- drm_clip_rect_t fullRect;
- GLuint textureFormat, srcOffset, srcPitch;
- const drm_clip_rect_t *clipRects;
- int numClipRects;
- int i;
-
- int xOrig, yOrig;
- int origNumClipRects;
- drm_clip_rect_t *origRects;
-
- /*
- * set up hardware state
- */
- intelFlush( &intel->ctx );
-
- SET_STATE( i915, meta );
- set_initial_state( i915 );
- set_no_texture( i915 );
- set_vertex_format( i915 );
- set_no_depth_stencil_write( i915 );
- set_color_mask( i915, GL_TRUE );
-
- LOCK_HARDWARE(intel);
-
- /* save current drawing origin and cliprects (restored at end) */
- xOrig = intel->drawX;
- yOrig = intel->drawY;
- origNumClipRects = intel->numClipRects;
- origRects = intel->pClipRects;
-
- if (!intel->numClipRects)
- goto done;
-
- /*
- * set drawing origin, cliprects for full-screen access to rotated screen
- */
- fullRect.x1 = 0;
- fullRect.y1 = 0;
- fullRect.x2 = screen->rotatedWidth;
- fullRect.y2 = screen->rotatedHeight;
- intel->drawX = 0;
- intel->drawY = 0;
- intel->numClipRects = 1;
- intel->pClipRects = &fullRect;
-
- set_draw_region( i915, &screen->rotated );
-
- if (cpp == 4)
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- else
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
-
- if (srcBuf == BUFFER_BIT_FRONT_LEFT) {
- srcPitch = screen->front.pitch; /* in bytes */
- srcOffset = screen->front.offset; /* bytes */
- clipRects = dPriv->pClipRects;
- numClipRects = dPriv->numClipRects;
- }
- else {
- srcPitch = screen->back.pitch; /* in bytes */
- srcOffset = screen->back.offset; /* bytes */
- clipRects = dPriv->pBackClipRects;
- numClipRects = dPriv->numBackClipRects;
- }
-
- /* set the whole screen up as a texture to avoid alignment issues */
- set_tex_rect_source(i915,
- srcOffset,
- screen->width,
- screen->height,
- srcPitch,
- textureFormat);
-
- enable_texture_blend_replace(i915);
-
- /*
- * loop over the source window's cliprects
- */
- for (i = 0; i < numClipRects; i++) {
- int srcX0 = clipRects[i].x1;
- int srcY0 = clipRects[i].y1;
- int srcX1 = clipRects[i].x2;
- int srcY1 = clipRects[i].y2;
- GLfloat verts[4][2], tex[4][2];
- int j;
-
- /* build vertices for four corners of clip rect */
- verts[0][0] = srcX0; verts[0][1] = srcY0;
- verts[1][0] = srcX1; verts[1][1] = srcY0;
- verts[2][0] = srcX1; verts[2][1] = srcY1;
- verts[3][0] = srcX0; verts[3][1] = srcY1;
-
- /* .. and texcoords */
- tex[0][0] = srcX0; tex[0][1] = srcY0;
- tex[1][0] = srcX1; tex[1][1] = srcY0;
- tex[2][0] = srcX1; tex[2][1] = srcY1;
- tex[3][0] = srcX0; tex[3][1] = srcY1;
-
- /* transform coords to rotated screen coords */
- for (j = 0; j < 4; j++) {
- matrix23TransformCoordf(&screen->rotMatrix,
- &verts[j][0], &verts[j][1]);
- }
-
- /* draw polygon to map source image to dest region */
- draw_poly(i915, 255, 255, 255, 255, 4, verts, tex);
-
- } /* cliprect loop */
-
- intelFlushBatchLocked( intel, GL_FALSE, GL_FALSE, GL_FALSE );
-
- done:
- /* restore original drawing origin and cliprects */
- intel->drawX = xOrig;
- intel->drawY = yOrig;
- intel->numClipRects = origNumClipRects;
- intel->pClipRects = origRects;
-
- UNLOCK_HARDWARE(intel);
-
- SET_STATE( i915, state );
-}
-
-=======
->>>>>>> 1.5.2.9
diff --git a/src/mesa/drivers/dri/i915-tex/i915_program.c b/src/mesa/drivers/dri/i915-tex/i915_program.c
deleted file mode 100644
index 07ac8f09bb3..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_program.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include <strings.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_program.h"
-
-
-#define A0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define D0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define T0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT)
-#define A0_SRC0( reg ) (((reg)&UREG_MASK)>>UREG_A0_SRC0_SHIFT_LEFT)
-#define A1_SRC0( reg ) (((reg)&UREG_MASK)<<UREG_A1_SRC0_SHIFT_RIGHT)
-#define A1_SRC1( reg ) (((reg)&UREG_MASK)>>UREG_A1_SRC1_SHIFT_LEFT)
-#define A2_SRC1( reg ) (((reg)&UREG_MASK)<<UREG_A2_SRC1_SHIFT_RIGHT)
-#define A2_SRC2( reg ) (((reg)&UREG_MASK)>>UREG_A2_SRC2_SHIFT_LEFT)
-
-/* These are special, and don't have swizzle/negate bits.
- */
-#define T0_SAMPLER( reg ) (GET_UREG_NR(reg)<<T0_SAMPLER_NR_SHIFT)
-#define T1_ADDRESS_REG( reg ) ((GET_UREG_NR(reg)<<T1_ADDRESS_REG_NR_SHIFT) | \
- (GET_UREG_TYPE(reg)<<T1_ADDRESS_REG_TYPE_SHIFT))
-
-
-/* Macros for translating UREG's into the various register fields used
- * by the I915 programmable unit.
- */
-#define UREG_A0_DEST_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_DEST_TYPE_SHIFT)
-#define UREG_A0_SRC0_SHIFT_LEFT (UREG_TYPE_SHIFT - A0_SRC0_TYPE_SHIFT)
-#define UREG_A1_SRC0_SHIFT_RIGHT (A1_SRC0_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT)
-#define UREG_A1_SRC1_SHIFT_LEFT (UREG_TYPE_SHIFT - A1_SRC1_TYPE_SHIFT)
-#define UREG_A2_SRC1_SHIFT_RIGHT (A2_SRC1_CHANNEL_W_SHIFT - UREG_CHANNEL_W_SHIFT)
-#define UREG_A2_SRC2_SHIFT_LEFT (UREG_TYPE_SHIFT - A2_SRC2_TYPE_SHIFT)
-
-#define UREG_MASK 0xffffff00
-#define UREG_TYPE_NR_MASK ((REG_TYPE_MASK << UREG_TYPE_SHIFT) | \
- (REG_NR_MASK << UREG_NR_SHIFT))
-
-
-#define I915_CONSTFLAG_PARAM 0x1f
-
-GLuint i915_get_temp( struct i915_fragment_program *p )
-{
- int bit = ffs( ~p->temp_flag );
- if (!bit) {
- fprintf(stderr, "%s: out of temporaries\n", __FILE__);
- exit(1);
- }
-
- p->temp_flag |= 1<<(bit-1);
- return UREG(REG_TYPE_R, (bit-1));
-}
-
-
-GLuint i915_get_utemp( struct i915_fragment_program *p )
-{
- int bit = ffs( ~p->utemp_flag );
- if (!bit) {
- fprintf(stderr, "%s: out of temporaries\n", __FILE__);
- exit(1);
- }
-
- p->utemp_flag |= 1<<(bit-1);
- return UREG(REG_TYPE_U, (bit-1));
-}
-
-void i915_release_utemps( struct i915_fragment_program *p )
-{
- p->utemp_flag = ~0x7;
-}
-
-
-GLuint i915_emit_decl( struct i915_fragment_program *p,
- GLuint type, GLuint nr, GLuint d0_flags )
-{
- GLuint reg = UREG(type, nr);
-
- if (type == REG_TYPE_T) {
- if (p->decl_t & (1<<nr))
- return reg;
-
- p->decl_t |= (1<<nr);
- }
- else if (type == REG_TYPE_S) {
- if (p->decl_s & (1<<nr))
- return reg;
-
- p->decl_s |= (1<<nr);
- }
- else
- return reg;
-
- *(p->decl++) = (D0_DCL | D0_DEST( reg ) | d0_flags);
- *(p->decl++) = D1_MBZ;
- *(p->decl++) = D2_MBZ;
-
- p->nr_decl_insn++;
- return reg;
-}
-
-GLuint i915_emit_arith( struct i915_fragment_program *p,
- GLuint op,
- GLuint dest,
- GLuint mask,
- GLuint saturate,
- GLuint src0,
- GLuint src1,
- GLuint src2 )
-{
- GLuint c[3];
- GLuint nr_const = 0;
-
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest));
- assert(dest);
-
- if (GET_UREG_TYPE(src0) == REG_TYPE_CONST) c[nr_const++] = 0;
- if (GET_UREG_TYPE(src1) == REG_TYPE_CONST) c[nr_const++] = 1;
- if (GET_UREG_TYPE(src2) == REG_TYPE_CONST) c[nr_const++] = 2;
-
- /* Recursively call this function to MOV additional const values
- * into temporary registers. Use utemp registers for this -
- * currently shouldn't be possible to run out, but keep an eye on
- * this.
- */
- if (nr_const > 1) {
- GLuint s[3], first, i, old_utemp_flag;
-
- s[0] = src0;
- s[1] = src1;
- s[2] = src2;
- old_utemp_flag = p->utemp_flag;
-
- first = GET_UREG_NR(s[c[0]]);
- for (i = 1 ; i < nr_const ; i++) {
- if (GET_UREG_NR(s[c[i]]) != first) {
- GLuint tmp = i915_get_utemp(p);
-
- i915_emit_arith( p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0,
- s[c[i]], 0, 0 );
- s[c[i]] = tmp;
- }
- }
-
- src0 = s[0];
- src1 = s[1];
- src2 = s[2];
- p->utemp_flag = old_utemp_flag; /* restore */
- }
-
- *(p->csr++) = (op |
- A0_DEST( dest ) |
- mask |
- saturate |
- A0_SRC0( src0 ));
- *(p->csr++) = (A1_SRC0( src0 ) |
- A1_SRC1( src1 ));
- *(p->csr++) = (A2_SRC1( src1 ) |
- A2_SRC2( src2 ));
-
- p->nr_alu_insn++;
- return dest;
-}
-
-GLuint i915_emit_texld( struct i915_fragment_program *p,
- GLuint dest,
- GLuint destmask,
- GLuint sampler,
- GLuint coord,
- GLuint op )
-{
- assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
- dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest));
- assert(dest);
-
- if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
- p->nr_tex_indirect++;
- }
-
- *(p->csr++) = (op |
- T0_DEST( dest ) |
- destmask |
- T0_SAMPLER( sampler ));
-
- *(p->csr++) = T1_ADDRESS_REG( coord );
- *(p->csr++) = T2_MBZ;
-
- p->nr_tex_insn++;
- return dest;
-}
-
-
-GLuint i915_emit_const1f( struct i915_fragment_program *p, GLfloat c0 )
-{
- GLint reg, idx;
-
- if (c0 == 0.0) return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO);
- if (c0 == 1.0) return swizzle(UREG(REG_TYPE_R, 0), ONE, ONE, ONE, ONE );
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == I915_CONSTFLAG_PARAM)
- continue;
- for (idx = 0; idx < 4; idx++) {
- if (!(p->constant_flags[reg] & (1<<idx)) ||
- p->constant[reg][idx] == c0) {
- p->constant[reg][idx] = c0;
- p->constant_flags[reg] |= 1<<idx;
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return swizzle(UREG(REG_TYPE_CONST, reg),idx,ZERO,ZERO,ONE);
- }
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-GLuint i915_emit_const2f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1 )
-{
- GLint reg, idx;
-
- if (c0 == 0.0) return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W);
- if (c0 == 1.0) return swizzle(i915_emit_const1f(p, c1), ONE, X, Z, W);
-
- if (c1 == 0.0) return swizzle(i915_emit_const1f(p, c0), X, ZERO, Z, W);
- if (c1 == 1.0) return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W);
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0xf ||
- p->constant_flags[reg] == I915_CONSTFLAG_PARAM)
- continue;
- for (idx = 0; idx < 3; idx++) {
- if (!(p->constant_flags[reg] & (3<<idx))) {
- p->constant[reg][idx] = c0;
- p->constant[reg][idx+1] = c1;
- p->constant_flags[reg] |= 3<<idx;
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return swizzle(UREG(REG_TYPE_CONST, reg),idx,idx+1,ZERO,ONE);
- }
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-
-
-GLuint i915_emit_const4f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1, GLfloat c2, GLfloat c3 )
-{
- GLint reg;
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0xf &&
- p->constant[reg][0] == c0 &&
- p->constant[reg][1] == c1 &&
- p->constant[reg][2] == c2 &&
- p->constant[reg][3] == c3) {
- return UREG(REG_TYPE_CONST, reg);
- }
- else if (p->constant_flags[reg] == 0) {
- p->constant[reg][0] = c0;
- p->constant[reg][1] = c1;
- p->constant[reg][2] = c2;
- p->constant[reg][3] = c3;
- p->constant_flags[reg] = 0xf;
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return UREG(REG_TYPE_CONST, reg);
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-
-GLuint i915_emit_const4fv( struct i915_fragment_program *p, const GLfloat *c )
-{
- return i915_emit_const4f( p, c[0], c[1], c[2], c[3] );
-}
-
-
-GLuint i915_emit_param4fv( struct i915_fragment_program *p,
- const GLfloat *values )
-{
- GLint reg, i;
-
- for (i = 0; i < p->nr_params; i++) {
- if (p->param[i].values == values)
- return UREG(REG_TYPE_CONST, p->param[i].reg);
- }
-
-
- for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
- if (p->constant_flags[reg] == 0) {
- p->constant_flags[reg] = I915_CONSTFLAG_PARAM;
- i = p->nr_params++;
-
- p->param[i].values = values;
- p->param[i].reg = reg;
- p->params_uptodate = 0;
-
- if (reg+1 > p->nr_constants) p->nr_constants = reg+1;
- return UREG(REG_TYPE_CONST, reg);
- }
- }
-
- fprintf(stderr, "%s: out of constants\n", __FUNCTION__);
- p->error = 1;
- return 0;
-}
-
-
-
-
-void i915_program_error( struct i915_fragment_program *p, const char *msg )
-{
- /* XXX we shouldn't print anything to stdout, record GL error or
- * call _mesa_problem()
- */
- fprintf(stderr, "%s\n", msg);
- p->error = 1;
-}
-
-void i915_init_program( struct i915_context *i915, struct i915_fragment_program *p )
-{
- GLcontext *ctx = &i915->intel.ctx;
- TNLcontext *tnl = TNL_CONTEXT( ctx );
-
- p->translated = 0;
- p->params_uptodate = 0;
- p->on_hardware = 0;
- p->error = 0;
-
- p->nr_tex_indirect = 1; /* correct? */
- p->nr_tex_insn = 0;
- p->nr_alu_insn = 0;
- p->nr_decl_insn = 0;
-
- p->ctx = ctx;
- memset( p->constant_flags, 0, sizeof(p->constant_flags) );
-
- p->nr_constants = 0;
- p->csr = p->program;
- p->decl = p->declarations;
- p->decl_s = 0;
- p->decl_t = 0;
- p->temp_flag = 0xffff000;
- p->utemp_flag = ~0x7;
- p->wpos_tex = -1;
- p->depth_written = 0;
- p->nr_params = 0;
-
- p->src_texture = UREG_BAD;
- p->src_previous = UREG(REG_TYPE_T, T_DIFFUSE);
- p->last_tex_stage = 0;
- p->VB = &tnl->vb;
-
- *(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM;
-}
-
-
-void i915_fini_program( struct i915_fragment_program *p )
-{
- GLuint program_size = p->csr - p->program;
- GLuint decl_size = p->decl - p->declarations;
-
- if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT)
- i915_program_error(p, "Exceeded max nr indirect texture lookups");
-
- if (p->nr_tex_insn > I915_MAX_TEX_INSN)
- i915_program_error(p, "Exceeded max TEX instructions");
-
- if (p->nr_alu_insn > I915_MAX_ALU_INSN)
- i915_program_error(p, "Exceeded max ALU instructions");
-
- if (p->nr_decl_insn > I915_MAX_DECL_INSN)
- i915_program_error(p, "Exceeded max DECL instructions");
-
- if (p->error) {
- p->FragProg.Base.NumNativeInstructions = 0;
- p->FragProg.NumNativeAluInstructions = 0;
- p->FragProg.NumNativeTexInstructions = 0;
- p->FragProg.NumNativeTexIndirections = 0;
- }
- else {
- p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn +
- p->nr_tex_insn +
- p->nr_decl_insn);
- p->FragProg.NumNativeAluInstructions = p->nr_alu_insn;
- p->FragProg.NumNativeTexInstructions = p->nr_tex_insn;
- p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect;
- }
-
- p->declarations[0] |= program_size + decl_size - 2;
-}
-
-void i915_upload_program( struct i915_context *i915, struct i915_fragment_program *p )
-{
- GLuint program_size = p->csr - p->program;
- GLuint decl_size = p->decl - p->declarations;
-
- FALLBACK( &i915->intel, I915_FALLBACK_PROGRAM, p->error );
-
- /* Could just go straight to the batchbuffer from here:
- */
- if (i915->state.ProgramSize != (program_size + decl_size) ||
- memcmp(i915->state.Program + decl_size, p->program,
- program_size*sizeof(int)) != 0) {
- I915_STATECHANGE( i915, I915_UPLOAD_PROGRAM );
- memcpy(i915->state.Program, p->declarations, decl_size*sizeof(int));
- memcpy(i915->state.Program + decl_size, p->program,
- program_size*sizeof(int));
- i915->state.ProgramSize = decl_size + program_size;
- }
-
- /* Always seemed to get a failure if I used memcmp() to
- * shortcircuit this state upload. Needs further investigation?
- */
- if (p->nr_constants) {
- GLuint nr = p->nr_constants;
-
- I915_ACTIVESTATE( i915, I915_UPLOAD_CONSTANTS, 1 );
- I915_STATECHANGE( i915, I915_UPLOAD_CONSTANTS );
-
- i915->state.Constant[0] = _3DSTATE_PIXEL_SHADER_CONSTANTS | ((nr) * 4);
- i915->state.Constant[1] = (1<<(nr-1)) | ((1<<(nr-1))-1);
-
- memcpy(&i915->state.Constant[2], p->constant, 4*sizeof(int)*(nr));
- i915->state.ConstantSize = 2 + (nr) * 4;
-
- if (0) {
- GLuint i;
- for (i = 0; i < nr; i++) {
- fprintf(stderr, "const[%d]: %f %f %f %f\n", i,
- p->constant[i][0],
- p->constant[i][1],
- p->constant[i][2],
- p->constant[i][3]);
- }
- }
- }
- else {
- I915_ACTIVESTATE( i915, I915_UPLOAD_CONSTANTS, 0 );
- }
-
- p->on_hardware = 1;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i915_program.h b/src/mesa/drivers/dri/i915-tex/i915_program.h
deleted file mode 100644
index a0d2530ed52..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_program.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#ifndef I915_PROGRAM_H
-#define I915_PROGRAM_H
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-/* Having zero and one in here makes the definition of swizzle a lot
- * easier.
- */
-#define UREG_TYPE_SHIFT 29
-#define UREG_NR_SHIFT 24
-#define UREG_CHANNEL_X_NEGATE_SHIFT 23
-#define UREG_CHANNEL_X_SHIFT 20
-#define UREG_CHANNEL_Y_NEGATE_SHIFT 19
-#define UREG_CHANNEL_Y_SHIFT 16
-#define UREG_CHANNEL_Z_NEGATE_SHIFT 15
-#define UREG_CHANNEL_Z_SHIFT 12
-#define UREG_CHANNEL_W_NEGATE_SHIFT 11
-#define UREG_CHANNEL_W_SHIFT 8
-#define UREG_CHANNEL_ZERO_NEGATE_MBZ 5
-#define UREG_CHANNEL_ZERO_SHIFT 4
-#define UREG_CHANNEL_ONE_NEGATE_MBZ 1
-#define UREG_CHANNEL_ONE_SHIFT 0
-
-#define UREG_BAD 0xffffffff /* not a valid ureg */
-
-#define X SRC_X
-#define Y SRC_Y
-#define Z SRC_Z
-#define W SRC_W
-#define ZERO SRC_ZERO
-#define ONE SRC_ONE
-
-/* Construct a ureg:
- */
-#define UREG( type, nr ) (((type)<< UREG_TYPE_SHIFT) | \
- ((nr) << UREG_NR_SHIFT) | \
- (X << UREG_CHANNEL_X_SHIFT) | \
- (Y << UREG_CHANNEL_Y_SHIFT) | \
- (Z << UREG_CHANNEL_Z_SHIFT) | \
- (W << UREG_CHANNEL_W_SHIFT) | \
- (ZERO << UREG_CHANNEL_ZERO_SHIFT) | \
- (ONE << UREG_CHANNEL_ONE_SHIFT))
-
-#define GET_CHANNEL_SRC( reg, channel ) ((reg<<(channel*4)) & (0xf<<20))
-#define CHANNEL_SRC( src, channel ) (src>>(channel*4))
-
-#define GET_UREG_TYPE(reg) (((reg)>>UREG_TYPE_SHIFT)&REG_TYPE_MASK)
-#define GET_UREG_NR(reg) (((reg)>>UREG_NR_SHIFT)&REG_NR_MASK)
-
-
-
-#define UREG_XYZW_CHANNEL_MASK 0x00ffff00
-
-/* One neat thing about the UREG representation:
- */
-static INLINE int swizzle( int reg, int x, int y, int z, int w )
-{
- return ((reg & ~UREG_XYZW_CHANNEL_MASK) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, x ), 0 ) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, y ), 1 ) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, z ), 2 ) |
- CHANNEL_SRC( GET_CHANNEL_SRC( reg, w ), 3 ));
-}
-
-/* Another neat thing about the UREG representation:
- */
-static INLINE int negate( int reg, int x, int y, int z, int w )
-{
- return reg ^ (((x&1)<<UREG_CHANNEL_X_NEGATE_SHIFT)|
- ((y&1)<<UREG_CHANNEL_Y_NEGATE_SHIFT)|
- ((z&1)<<UREG_CHANNEL_Z_NEGATE_SHIFT)|
- ((w&1)<<UREG_CHANNEL_W_NEGATE_SHIFT));
-}
-
-
-extern GLuint i915_get_temp( struct i915_fragment_program *p );
-extern GLuint i915_get_utemp( struct i915_fragment_program *p );
-extern void i915_release_utemps( struct i915_fragment_program *p );
-
-
-extern GLuint i915_emit_texld( struct i915_fragment_program *p,
- GLuint dest,
- GLuint destmask,
- GLuint sampler,
- GLuint coord,
- GLuint op );
-
-extern GLuint i915_emit_arith( struct i915_fragment_program *p,
- GLuint op,
- GLuint dest,
- GLuint mask,
- GLuint saturate,
- GLuint src0,
- GLuint src1,
- GLuint src2 );
-
-extern GLuint i915_emit_decl( struct i915_fragment_program *p,
- GLuint type, GLuint nr, GLuint d0_flags );
-
-
-extern GLuint i915_emit_const1f( struct i915_fragment_program *p,
- GLfloat c0 );
-
-extern GLuint i915_emit_const2f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1 );
-
-extern GLuint i915_emit_const4fv( struct i915_fragment_program *p,
- const GLfloat *c );
-
-extern GLuint i915_emit_const4f( struct i915_fragment_program *p,
- GLfloat c0, GLfloat c1,
- GLfloat c2, GLfloat c3 );
-
-
-extern GLuint i915_emit_param4fv( struct i915_fragment_program *p,
- const GLfloat *values );
-
-extern void i915_program_error( struct i915_fragment_program *p,
- const char *msg );
-
-extern void i915_init_program( struct i915_context *i915,
- struct i915_fragment_program *p );
-
-extern void i915_upload_program( struct i915_context *i915,
- struct i915_fragment_program *p );
-
-extern void i915_fini_program( struct i915_fragment_program *p );
-
-
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/i915_reg.h b/src/mesa/drivers/dri/i915-tex/i915_reg.h
deleted file mode 100644
index f81b1264b7f..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_reg.h
+++ /dev/null
@@ -1,839 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#ifndef _I915_REG_H_
-#define _I915_REG_H_
-
-
-#include "intel_reg.h"
-
-#define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value)
-
-#define CMD_3D (0x3<<29)
-
-#define PRIM3D_INLINE (CMD_3D | (0x1f<<24))
-#define PRIM3D_TRILIST (0x0<<18)
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-#define PRIM3D_CLEAR_RECT (0xa<<18)
-#define PRIM3D_ZONE_INIT (0xd<<18)
-#define PRIM3D_MASK (0x1f<<18)
-
-/* p137 */
-#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24))
-#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16)
-#define AA_LINE_ECAAR_WIDTH_0_5 0
-#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14)
-#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14)
-#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14)
-#define AA_LINE_REGION_WIDTH_ENABLE (1<<8)
-#define AA_LINE_REGION_WIDTH_0_5 0
-#define AA_LINE_REGION_WIDTH_1_0 (1<<6)
-#define AA_LINE_REGION_WIDTH_2_0 (2<<6)
-#define AA_LINE_REGION_WIDTH_4_0 (3<<6)
-
-/* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/
-#define _3DSTATE_BACKFACE_STENCIL_OPS (CMD_3D | (0x8<<24))
-#define BFO_ENABLE_STENCIL_REF (1<<23)
-#define BFO_STENCIL_REF_SHIFT 15
-#define BFO_STENCIL_REF_MASK (0xff<<15)
-#define BFO_ENABLE_STENCIL_FUNCS (1<<14)
-#define BFO_STENCIL_TEST_SHIFT 11
-#define BFO_STENCIL_TEST_MASK (0x7<<11)
-#define BFO_STENCIL_FAIL_SHIFT 8
-#define BFO_STENCIL_FAIL_MASK (0x7<<8)
-#define BFO_STENCIL_PASS_Z_FAIL_SHIFT 5
-#define BFO_STENCIL_PASS_Z_FAIL_MASK (0x7<<5)
-#define BFO_STENCIL_PASS_Z_PASS_SHIFT 2
-#define BFO_STENCIL_PASS_Z_PASS_MASK (0x7<<2)
-#define BFO_ENABLE_STENCIL_TWO_SIDE (1<<1)
-#define BFO_STENCIL_TWO_SIDE (1<<0)
-
-
-/* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */
-#define _3DSTATE_BACKFACE_STENCIL_MASKS (CMD_3D | (0x9<<24))
-#define BFM_ENABLE_STENCIL_TEST_MASK (1<<17)
-#define BFM_ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define BFM_STENCIL_TEST_MASK_SHIFT 8
-#define BFM_STENCIL_TEST_MASK_MASK (0xff<<8)
-#define BFM_STENCIL_WRITE_MASK_SHIFT 0
-#define BFM_STENCIL_WRITE_MASK_MASK (0xff<<0)
-
-
-
-/* 3DSTATE_BIN_CONTROL p141 */
-
-/* p143 */
-#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1)
-/* Dword 1 */
-#define BUF_3D_ID_COLOR_BACK (0x3<<24)
-#define BUF_3D_ID_DEPTH (0x7<<24)
-#define BUF_3D_USE_FENCE (1<<23)
-#define BUF_3D_TILED_SURFACE (1<<22)
-#define BUF_3D_TILE_WALK_X 0
-#define BUF_3D_TILE_WALK_Y (1<<21)
-#define BUF_3D_PITCH(x) (((x)/4)<<2)
-/* Dword 2 */
-#define BUF_3D_ADDR(x) ((x) & ~0x3)
-
-
-/* 3DSTATE_CHROMA_KEY */
-
-/* 3DSTATE_CLEAR_PARAMETERS, p150 */
-
-/* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */
-#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16))
-
-
-
-/* 3DSTATE_COORD_SET_BINDINGS, p154 */
-#define _3DSTATE_COORD_SET_BINDINGS (CMD_3D | (0x16<<24))
-#define CSB_TCB(iunit, eunit) ((eunit)<<(iunit*3))
-
-/* p156 */
-#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16))
-
-/* p157 */
-#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16))
-
-/* p158 */
-#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16))
-
-
-/* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */
-#define _3DSTATE_DEPTH_OFFSET_SCALE (CMD_3D | (0x1d<<24) | (0x97<<16))
-/* scale in dword 1 */
-
-
-/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
-#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<19) | 0x2)
-
-/* p161 */
-#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
-/* Dword 1 */
-#define TEX_DEFAULT_COLOR_OGL (0<<30)
-#define TEX_DEFAULT_COLOR_D3D (1<<30)
-#define ZR_EARLY_DEPTH (1<<29)
-#define LOD_PRECLAMP_OGL (1<<28)
-#define LOD_PRECLAMP_D3D (0<<28)
-#define DITHER_FULL_ALWAYS (0<<26)
-#define DITHER_FULL_ON_FB_BLEND (1<<26)
-#define DITHER_CLAMPED_ALWAYS (2<<26)
-#define LINEAR_GAMMA_BLEND_32BPP (1<<25)
-#define DEBUG_DISABLE_ENH_DITHER (1<<24)
-#define DSTORG_HORT_BIAS(x) ((x)<<20)
-#define DSTORG_VERT_BIAS(x) ((x)<<16)
-#define COLOR_4_2_2_CHNL_WRT_ALL 0
-#define COLOR_4_2_2_CHNL_WRT_Y (1<<12)
-#define COLOR_4_2_2_CHNL_WRT_CR (2<<12)
-#define COLOR_4_2_2_CHNL_WRT_CB (3<<12)
-#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12)
-#define COLR_BUF_8BIT 0
-#define COLR_BUF_RGB555 (1<<8)
-#define COLR_BUF_RGB565 (2<<8)
-#define COLR_BUF_ARGB8888 (3<<8)
-#define DEPTH_FRMT_16_FIXED 0
-#define DEPTH_FRMT_16_FLOAT (1<<2)
-#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
-#define VERT_LINE_STRIDE_1 (1<<1)
-#define VERT_LINE_STRIDE_0 (0<<1)
-#define VERT_LINE_STRIDE_OFS_1 1
-#define VERT_LINE_STRIDE_OFS_0 0
-
-/* p166 */
-#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3)
-/* Dword 1 */
-#define DRAW_RECT_DIS_DEPTH_OFS (1<<30)
-#define DRAW_DITHER_OFS_X(x) ((x)<<26)
-#define DRAW_DITHER_OFS_Y(x) ((x)<<24)
-/* Dword 2 */
-#define DRAW_YMIN(x) ((x)<<16)
-#define DRAW_XMIN(x) (x)
-/* Dword 3 */
-#define DRAW_YMAX(x) ((x)<<16)
-#define DRAW_XMAX(x) (x)
-/* Dword 4 */
-#define DRAW_YORG(x) ((x)<<16)
-#define DRAW_XORG(x) (x)
-
-
-/* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */
-
-/* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */
-
-
-/* _3DSTATE_FOG_COLOR, p173 */
-#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24))
-#define FOG_COLOR_RED(x) ((x)<<16)
-#define FOG_COLOR_GREEN(x) ((x)<<8)
-#define FOG_COLOR_BLUE(x) (x)
-
-/* _3DSTATE_FOG_MODE, p174 */
-#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2)
-/* Dword 1 */
-#define FMC1_FOGFUNC_MODIFY_ENABLE (1<<31)
-#define FMC1_FOGFUNC_VERTEX (0<<28)
-#define FMC1_FOGFUNC_PIXEL_EXP (1<<28)
-#define FMC1_FOGFUNC_PIXEL_EXP2 (2<<28)
-#define FMC1_FOGFUNC_PIXEL_LINEAR (3<<28)
-#define FMC1_FOGFUNC_MASK (3<<28)
-#define FMC1_FOGINDEX_MODIFY_ENABLE (1<<27)
-#define FMC1_FOGINDEX_Z (0<<25)
-#define FMC1_FOGINDEX_W (1<<25)
-#define FMC1_C1_C2_MODIFY_ENABLE (1<<24)
-#define FMC1_DENSITY_MODIFY_ENABLE (1<<23)
-#define FMC1_C1_ONE (1<<13)
-#define FMC1_C1_MASK (0xffff<<4)
-/* Dword 2 */
-#define FMC2_C2_ONE (1<<16)
-/* Dword 3 */
-#define FMC3_D_ONE (1<<16)
-
-
-
-/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */
-#define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24))
-#define IAB_MODIFY_ENABLE (1<<23)
-#define IAB_ENABLE (1<<22)
-#define IAB_MODIFY_FUNC (1<<21)
-#define IAB_FUNC_SHIFT 16
-#define IAB_MODIFY_SRC_FACTOR (1<<11)
-#define IAB_SRC_FACTOR_SHIFT 6
-#define IAB_SRC_FACTOR_MASK (BLENDFACT_MASK<<6)
-#define IAB_MODIFY_DST_FACTOR (1<<5)
-#define IAB_DST_FACTOR_SHIFT 0
-#define IAB_DST_FACTOR_MASK (BLENDFACT_MASK<<0)
-
-
-#define BLENDFUNC_ADD 0x0
-#define BLENDFUNC_SUBTRACT 0x1
-#define BLENDFUNC_REVERSE_SUBTRACT 0x2
-#define BLENDFUNC_MIN 0x3
-#define BLENDFUNC_MAX 0x4
-#define BLENDFUNC_MASK 0x7
-
-/* 3DSTATE_LOAD_INDIRECT, p180 */
-
-#define _3DSTATE_LOAD_INDIRECT (CMD_3D|(0x1d<<24)|(0x7<<16))
-#define LI0_STATE_STATIC_INDIRECT (0x01<<8)
-#define LI0_STATE_DYNAMIC_INDIRECT (0x02<<8)
-#define LI0_STATE_SAMPLER (0x04<<8)
-#define LI0_STATE_MAP (0x08<<8)
-#define LI0_STATE_PROGRAM (0x10<<8)
-#define LI0_STATE_CONSTANTS (0x20<<8)
-
-#define SIS0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define SIS0_FORCE_LOAD (1<<1)
-#define SIS0_BUFFER_VALID (1<<0)
-#define SIS1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define DIS0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define DIS0_BUFFER_RESET (1<<1)
-#define DIS0_BUFFER_VALID (1<<0)
-
-#define SSB0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define SSB0_FORCE_LOAD (1<<1)
-#define SSB0_BUFFER_VALID (1<<0)
-#define SSB1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define MSB0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define MSB0_FORCE_LOAD (1<<1)
-#define MSB0_BUFFER_VALID (1<<0)
-#define MSB1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define PSP0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define PSP0_FORCE_LOAD (1<<1)
-#define PSP0_BUFFER_VALID (1<<0)
-#define PSP1_BUFFER_LENGTH(x) ((x)&0xff)
-
-#define PSC0_BUFFER_ADDRESS(x) ((x)&~0x3)
-#define PSC0_FORCE_LOAD (1<<1)
-#define PSC0_BUFFER_VALID (1<<0)
-#define PSC1_BUFFER_LENGTH(x) ((x)&0xff)
-
-
-
-
-
-/* _3DSTATE_RASTERIZATION_RULES */
-#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24))
-#define ENABLE_POINT_RASTER_RULE (1<<15)
-#define OGL_POINT_RASTER_RULE (1<<13)
-#define ENABLE_TEXKILL_3D_4D (1<<10)
-#define TEXKILL_3D (0<<9)
-#define TEXKILL_4D (1<<9)
-#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8)
-#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5)
-#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6)
-#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3)
-
-/* _3DSTATE_SCISSOR_ENABLE, p256 */
-#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19))
-#define ENABLE_SCISSOR_RECT ((1<<1) | 1)
-#define DISABLE_SCISSOR_RECT (1<<1)
-
-/* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */
-#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1)
-/* Dword 1 */
-#define SCISSOR_RECT_0_YMIN(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMIN(x) (x)
-/* Dword 2 */
-#define SCISSOR_RECT_0_YMAX(x) ((x)<<16)
-#define SCISSOR_RECT_0_XMAX(x) (x)
-
-/* p189 */
-#define _3DSTATE_LOAD_STATE_IMMEDIATE_1 ((0x3<<29)|(0x1d<<24)|(0x04<<16))
-#define I1_LOAD_S(n) (1<<(4+n))
-
-#define S0_VB_OFFSET_MASK 0xffffffc
-#define S0_AUTO_CACHE_INV_DISABLE (1<<0)
-
-#define S1_VERTEX_WIDTH_SHIFT 24
-#define S1_VERTEX_WIDTH_MASK (0x3f<<24)
-#define S1_VERTEX_PITCH_SHIFT 16
-#define S1_VERTEX_PITCH_MASK (0x3f<<16)
-
-#define TEXCOORDFMT_2D 0x0
-#define TEXCOORDFMT_3D 0x1
-#define TEXCOORDFMT_4D 0x2
-#define TEXCOORDFMT_1D 0x3
-#define TEXCOORDFMT_2D_16 0x4
-#define TEXCOORDFMT_4D_16 0x5
-#define TEXCOORDFMT_NOT_PRESENT 0xf
-#define S2_TEXCOORD_FMT0_MASK 0xf
-#define S2_TEXCOORD_FMT1_SHIFT 4
-#define S2_TEXCOORD_FMT(unit, type) ((type)<<(unit*4))
-#define S2_TEXCOORD_NONE (~0)
-
-/* S3 not interesting */
-
-#define S4_POINT_WIDTH_SHIFT 23
-#define S4_POINT_WIDTH_MASK (0x1ff<<23)
-#define S4_LINE_WIDTH_SHIFT 19
-#define S4_LINE_WIDTH_ONE (0x2<<19)
-#define S4_LINE_WIDTH_MASK (0xf<<19)
-#define S4_FLATSHADE_ALPHA (1<<18)
-#define S4_FLATSHADE_FOG (1<<17)
-#define S4_FLATSHADE_SPECULAR (1<<16)
-#define S4_FLATSHADE_COLOR (1<<15)
-#define S4_CULLMODE_BOTH (0<<13)
-#define S4_CULLMODE_NONE (1<<13)
-#define S4_CULLMODE_CW (2<<13)
-#define S4_CULLMODE_CCW (3<<13)
-#define S4_CULLMODE_MASK (3<<13)
-#define S4_VFMT_POINT_WIDTH (1<<12)
-#define S4_VFMT_SPEC_FOG (1<<11)
-#define S4_VFMT_COLOR (1<<10)
-#define S4_VFMT_DEPTH_OFFSET (1<<9)
-#define S4_VFMT_XYZ (1<<6)
-#define S4_VFMT_XYZW (2<<6)
-#define S4_VFMT_XY (3<<6)
-#define S4_VFMT_XYW (4<<6)
-#define S4_VFMT_XYZW_MASK (7<<6)
-#define S4_FORCE_DEFAULT_DIFFUSE (1<<5)
-#define S4_FORCE_DEFAULT_SPECULAR (1<<4)
-#define S4_LOCAL_DEPTH_OFFSET_ENABLE (1<<3)
-#define S4_VFMT_FOG_PARAM (1<<2)
-#define S4_SPRITE_POINT_ENABLE (1<<1)
-#define S4_LINE_ANTIALIAS_ENABLE (1<<0)
-
-#define S4_VFMT_MASK (S4_VFMT_POINT_WIDTH | \
- S4_VFMT_SPEC_FOG | \
- S4_VFMT_COLOR | \
- S4_VFMT_DEPTH_OFFSET | \
- S4_VFMT_XYZW_MASK | \
- S4_VFMT_FOG_PARAM)
-
-
-#define S5_WRITEDISABLE_ALPHA (1<<31)
-#define S5_WRITEDISABLE_RED (1<<30)
-#define S5_WRITEDISABLE_GREEN (1<<29)
-#define S5_WRITEDISABLE_BLUE (1<<28)
-#define S5_WRITEDISABLE_MASK (0xf<<28)
-#define S5_FORCE_DEFAULT_POINT_SIZE (1<<27)
-#define S5_LAST_PIXEL_ENABLE (1<<26)
-#define S5_GLOBAL_DEPTH_OFFSET_ENABLE (1<<25)
-#define S5_FOG_ENABLE (1<<24)
-#define S5_STENCIL_REF_SHIFT 16
-#define S5_STENCIL_REF_MASK (0xff<<16)
-#define S5_STENCIL_TEST_FUNC_SHIFT 13
-#define S5_STENCIL_TEST_FUNC_MASK (0x7<<13)
-#define S5_STENCIL_FAIL_SHIFT 10
-#define S5_STENCIL_FAIL_MASK (0x7<<10)
-#define S5_STENCIL_PASS_Z_FAIL_SHIFT 7
-#define S5_STENCIL_PASS_Z_FAIL_MASK (0x7<<7)
-#define S5_STENCIL_PASS_Z_PASS_SHIFT 4
-#define S5_STENCIL_PASS_Z_PASS_MASK (0x7<<4)
-#define S5_STENCIL_WRITE_ENABLE (1<<3)
-#define S5_STENCIL_TEST_ENABLE (1<<2)
-#define S5_COLOR_DITHER_ENABLE (1<<1)
-#define S5_LOGICOP_ENABLE (1<<0)
-
-
-#define S6_ALPHA_TEST_ENABLE (1<<31)
-#define S6_ALPHA_TEST_FUNC_SHIFT 28
-#define S6_ALPHA_TEST_FUNC_MASK (0x7<<28)
-#define S6_ALPHA_REF_SHIFT 20
-#define S6_ALPHA_REF_MASK (0xff<<20)
-#define S6_DEPTH_TEST_ENABLE (1<<19)
-#define S6_DEPTH_TEST_FUNC_SHIFT 16
-#define S6_DEPTH_TEST_FUNC_MASK (0x7<<16)
-#define S6_CBUF_BLEND_ENABLE (1<<15)
-#define S6_CBUF_BLEND_FUNC_SHIFT 12
-#define S6_CBUF_BLEND_FUNC_MASK (0x7<<12)
-#define S6_CBUF_SRC_BLEND_FACT_SHIFT 8
-#define S6_CBUF_SRC_BLEND_FACT_MASK (0xf<<8)
-#define S6_CBUF_DST_BLEND_FACT_SHIFT 4
-#define S6_CBUF_DST_BLEND_FACT_MASK (0xf<<4)
-#define S6_DEPTH_WRITE_ENABLE (1<<3)
-#define S6_COLOR_WRITE_ENABLE (1<<2)
-#define S6_TRISTRIP_PV_SHIFT 0
-#define S6_TRISTRIP_PV_MASK (0x3<<0)
-
-#define S7_DEPTH_OFFSET_CONST_MASK ~0
-
-/* 3DSTATE_MAP_DEINTERLACER_PARAMETERS */
-/* 3DSTATE_MAP_PALETTE_LOAD_32, p206 */
-
-
-/* _3DSTATE_MODES_4, p218 */
-#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x0d<<24))
-#define ENABLE_LOGIC_OP_FUNC (1<<23)
-#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK (0xf<<18)
-#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
-#define ENABLE_STENCIL_TEST_MASK (1<<17)
-#define STENCIL_TEST_MASK(x) (((x)&0xff)<<8)
-#define MODE4_ENABLE_STENCIL_WRITE_MASK ((1<<16)|(0x00ff))
-#define ENABLE_STENCIL_WRITE_MASK (1<<16)
-#define STENCIL_WRITE_MASK(x) ((x)&0xff)
-
-/* _3DSTATE_MODES_5, p220 */
-#define _3DSTATE_MODES_5_CMD (CMD_3D|(0x0c<<24))
-#define PIPELINE_FLUSH_RENDER_CACHE (1<<18)
-#define PIPELINE_FLUSH_TEXTURE_CACHE (1<<16)
-
-
-/* p221 */
-#define _3DSTATE_PIXEL_SHADER_CONSTANTS (CMD_3D|(0x1d<<24)|(0x6<<16))
-#define PS1_REG(n) (1<<(n))
-#define PS2_CONST_X(n) (n)
-#define PS3_CONST_Y(n) (n)
-#define PS4_CONST_Z(n) (n)
-#define PS5_CONST_W(n) (n)
-
-/* p222 */
-
-
-#define I915_MAX_TEX_INDIRECT 4
-#define I915_MAX_TEX_INSN 32
-#define I915_MAX_ALU_INSN 64
-#define I915_MAX_DECL_INSN 27
-#define I915_MAX_TEMPORARY 16
-
-
-/* Each instruction is 3 dwords long, though most don't require all
- * this space. Maximum of 123 instructions. Smaller maxes per insn
- * type.
- */
-#define _3DSTATE_PIXEL_SHADER_PROGRAM (CMD_3D|(0x1d<<24)|(0x5<<16))
-
-#define REG_TYPE_R 0 /* temporary regs, no need to
- * dcl, must be written before
- * read -- Preserved between
- * phases.
- */
-#define REG_TYPE_T 1 /* Interpolated values, must be
- * dcl'ed before use.
- *
- * 0..7: texture coord,
- * 8: diffuse spec,
- * 9: specular color,
- * 10: fog parameter in w.
- */
-#define REG_TYPE_CONST 2 /* Restriction: only one const
- * can be referenced per
- * instruction, though it may be
- * selected for multiple inputs.
- * Constants not initialized
- * default to zero.
- */
-#define REG_TYPE_S 3 /* sampler */
-#define REG_TYPE_OC 4 /* output color (rgba) */
-#define REG_TYPE_OD 5 /* output depth (w), xyz are
- * temporaries. If not written,
- * interpolated depth is used?
- */
-#define REG_TYPE_U 6 /* unpreserved temporaries */
-#define REG_TYPE_MASK 0x7
-#define REG_NR_MASK 0xf
-
-
-/* REG_TYPE_T:
- */
-#define T_TEX0 0
-#define T_TEX1 1
-#define T_TEX2 2
-#define T_TEX3 3
-#define T_TEX4 4
-#define T_TEX5 5
-#define T_TEX6 6
-#define T_TEX7 7
-#define T_DIFFUSE 8
-#define T_SPECULAR 9
-#define T_FOG_W 10 /* interpolated fog is in W coord */
-
-/* Arithmetic instructions */
-
-/* .replicate_swizzle == selection and replication of a particular
- * scalar channel, ie., .xxxx, .yyyy, .zzzz or .wwww
- */
-#define A0_NOP (0x0<<24) /* no operation */
-#define A0_ADD (0x1<<24) /* dst = src0 + src1 */
-#define A0_MOV (0x2<<24) /* dst = src0 */
-#define A0_MUL (0x3<<24) /* dst = src0 * src1 */
-#define A0_MAD (0x4<<24) /* dst = src0 * src1 + src2 */
-#define A0_DP2ADD (0x5<<24) /* dst.xyzw = src0.xy dot src1.xy + src2.replicate_swizzle */
-#define A0_DP3 (0x6<<24) /* dst.xyzw = src0.xyz dot src1.xyz */
-#define A0_DP4 (0x7<<24) /* dst.xyzw = src0.xyzw dot src1.xyzw */
-#define A0_FRC (0x8<<24) /* dst = src0 - floor(src0) */
-#define A0_RCP (0x9<<24) /* dst.xyzw = 1/(src0.replicate_swizzle) */
-#define A0_RSQ (0xa<<24) /* dst.xyzw = 1/(sqrt(abs(src0.replicate_swizzle))) */
-#define A0_EXP (0xb<<24) /* dst.xyzw = exp2(src0.replicate_swizzle) */
-#define A0_LOG (0xc<<24) /* dst.xyzw = log2(abs(src0.replicate_swizzle)) */
-#define A0_CMP (0xd<<24) /* dst = (src0 >= 0.0) ? src1 : src2 */
-#define A0_MIN (0xe<<24) /* dst = (src0 < src1) ? src0 : src1 */
-#define A0_MAX (0xf<<24) /* dst = (src0 >= src1) ? src0 : src1 */
-#define A0_FLR (0x10<<24) /* dst = floor(src0) */
-#define A0_MOD (0x11<<24) /* dst = src0 fmod 1.0 */
-#define A0_TRC (0x12<<24) /* dst = int(src0) */
-#define A0_SGE (0x13<<24) /* dst = src0 >= src1 ? 1.0 : 0.0 */
-#define A0_SLT (0x14<<24) /* dst = src0 < src1 ? 1.0 : 0.0 */
-#define A0_DEST_SATURATE (1<<22)
-#define A0_DEST_TYPE_SHIFT 19
-/* Allow: R, OC, OD, U */
-#define A0_DEST_NR_SHIFT 14
-/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
-#define A0_DEST_CHANNEL_X (1<<10)
-#define A0_DEST_CHANNEL_Y (2<<10)
-#define A0_DEST_CHANNEL_Z (4<<10)
-#define A0_DEST_CHANNEL_W (8<<10)
-#define A0_DEST_CHANNEL_ALL (0xf<<10)
-#define A0_DEST_CHANNEL_SHIFT 10
-#define A0_SRC0_TYPE_SHIFT 7
-#define A0_SRC0_NR_SHIFT 2
-
-#define A0_DEST_CHANNEL_XY (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y)
-#define A0_DEST_CHANNEL_XYZ (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z)
-
-
-#define SRC_X 0
-#define SRC_Y 1
-#define SRC_Z 2
-#define SRC_W 3
-#define SRC_ZERO 4
-#define SRC_ONE 5
-
-#define A1_SRC0_CHANNEL_X_NEGATE (1<<31)
-#define A1_SRC0_CHANNEL_X_SHIFT 28
-#define A1_SRC0_CHANNEL_Y_NEGATE (1<<27)
-#define A1_SRC0_CHANNEL_Y_SHIFT 24
-#define A1_SRC0_CHANNEL_Z_NEGATE (1<<23)
-#define A1_SRC0_CHANNEL_Z_SHIFT 20
-#define A1_SRC0_CHANNEL_W_NEGATE (1<<19)
-#define A1_SRC0_CHANNEL_W_SHIFT 16
-#define A1_SRC1_TYPE_SHIFT 13
-#define A1_SRC1_NR_SHIFT 8
-#define A1_SRC1_CHANNEL_X_NEGATE (1<<7)
-#define A1_SRC1_CHANNEL_X_SHIFT 4
-#define A1_SRC1_CHANNEL_Y_NEGATE (1<<3)
-#define A1_SRC1_CHANNEL_Y_SHIFT 0
-
-#define A2_SRC1_CHANNEL_Z_NEGATE (1<<31)
-#define A2_SRC1_CHANNEL_Z_SHIFT 28
-#define A2_SRC1_CHANNEL_W_NEGATE (1<<27)
-#define A2_SRC1_CHANNEL_W_SHIFT 24
-#define A2_SRC2_TYPE_SHIFT 21
-#define A2_SRC2_NR_SHIFT 16
-#define A2_SRC2_CHANNEL_X_NEGATE (1<<15)
-#define A2_SRC2_CHANNEL_X_SHIFT 12
-#define A2_SRC2_CHANNEL_Y_NEGATE (1<<11)
-#define A2_SRC2_CHANNEL_Y_SHIFT 8
-#define A2_SRC2_CHANNEL_Z_NEGATE (1<<7)
-#define A2_SRC2_CHANNEL_Z_SHIFT 4
-#define A2_SRC2_CHANNEL_W_NEGATE (1<<3)
-#define A2_SRC2_CHANNEL_W_SHIFT 0
-
-
-
-/* Texture instructions */
-#define T0_TEXLD (0x15<<24) /* Sample texture using predeclared
- * sampler and address, and output
- * filtered texel data to destination
- * register */
-#define T0_TEXLDP (0x16<<24) /* Same as texld but performs a
- * perspective divide of the texture
- * coordinate .xyz values by .w before
- * sampling. */
-#define T0_TEXLDB (0x17<<24) /* Same as texld but biases the
- * computed LOD by w. Only S4.6 two's
- * comp is used. This implies that a
- * float to fixed conversion is
- * done. */
-#define T0_TEXKILL (0x18<<24) /* Does not perform a sampling
- * operation. Simply kills the pixel
- * if any channel of the address
- * register is < 0.0. */
-#define T0_DEST_TYPE_SHIFT 19
-/* Allow: R, OC, OD, U */
-/* Note: U (unpreserved) regs do not retain their values between
- * phases (cannot be used for feedback)
- *
- * Note: oC and OD registers can only be used as the destination of a
- * texture instruction once per phase (this is an implementation
- * restriction).
- */
-#define T0_DEST_NR_SHIFT 14
-/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */
-#define T0_SAMPLER_NR_SHIFT 0 /* This field ignored for TEXKILL */
-#define T0_SAMPLER_NR_MASK (0xf<<0)
-
-#define T1_ADDRESS_REG_TYPE_SHIFT 24 /* Reg to use as texture coord */
-/* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */
-#define T1_ADDRESS_REG_NR_SHIFT 17
-#define T2_MBZ 0
-
-/* Declaration instructions */
-#define D0_DCL (0x19<<24) /* Declare a t (interpolated attrib)
- * register or an s (sampler)
- * register. */
-#define D0_SAMPLE_TYPE_SHIFT 22
-#define D0_SAMPLE_TYPE_2D (0x0<<22)
-#define D0_SAMPLE_TYPE_CUBE (0x1<<22)
-#define D0_SAMPLE_TYPE_VOLUME (0x2<<22)
-#define D0_SAMPLE_TYPE_MASK (0x3<<22)
-
-#define D0_TYPE_SHIFT 19
-/* Allow: T, S */
-#define D0_NR_SHIFT 14
-/* Allow T: 0..10, S: 0..15 */
-#define D0_CHANNEL_X (1<<10)
-#define D0_CHANNEL_Y (2<<10)
-#define D0_CHANNEL_Z (4<<10)
-#define D0_CHANNEL_W (8<<10)
-#define D0_CHANNEL_ALL (0xf<<10)
-#define D0_CHANNEL_NONE (0<<10)
-
-#define D0_CHANNEL_XY (D0_CHANNEL_X|D0_CHANNEL_Y)
-#define D0_CHANNEL_XYZ (D0_CHANNEL_XY|D0_CHANNEL_Z)
-
-/* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse
- * or specular declarations.
- *
- * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw)
- *
- * Must be zero for S (sampler) dcls
- */
-#define D1_MBZ 0
-#define D2_MBZ 0
-
-
-
-/* p207 */
-#define _3DSTATE_MAP_STATE (CMD_3D|(0x1d<<24)|(0x0<<16))
-
-#define MS1_MAPMASK_SHIFT 0
-#define MS1_MAPMASK_MASK (0x8fff<<0)
-
-#define MS2_UNTRUSTED_SURFACE (1<<31)
-#define MS2_ADDRESS_MASK 0xfffffffc
-#define MS2_VERTICAL_LINE_STRIDE (1<<1)
-#define MS2_VERTICAL_OFFSET (1<<1)
-
-#define MS3_HEIGHT_SHIFT 21
-#define MS3_WIDTH_SHIFT 10
-#define MS3_PALETTE_SELECT (1<<9)
-#define MS3_MAPSURF_FORMAT_SHIFT 7
-#define MS3_MAPSURF_FORMAT_MASK (0x7<<7)
-#define MAPSURF_8BIT (1<<7)
-#define MAPSURF_16BIT (2<<7)
-#define MAPSURF_32BIT (3<<7)
-#define MAPSURF_422 (5<<7)
-#define MAPSURF_COMPRESSED (6<<7)
-#define MAPSURF_4BIT_INDEXED (7<<7)
-#define MS3_MT_FORMAT_MASK (0x7 << 3)
-#define MS3_MT_FORMAT_SHIFT 3
-#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */
-#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */
-#define MT_8BIT_L8 (1<<3)
-#define MT_8BIT_A8 (4<<3)
-#define MT_8BIT_MONO8 (5<<3)
-#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */
-#define MT_16BIT_ARGB1555 (1<<3)
-#define MT_16BIT_ARGB4444 (2<<3)
-#define MT_16BIT_AY88 (3<<3)
-#define MT_16BIT_88DVDU (5<<3)
-#define MT_16BIT_BUMP_655LDVDU (6<<3)
-#define MT_16BIT_I16 (7<<3)
-#define MT_16BIT_L16 (8<<3)
-#define MT_16BIT_A16 (9<<3)
-#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
-#define MT_32BIT_ABGR8888 (1<<3)
-#define MT_32BIT_XRGB8888 (2<<3)
-#define MT_32BIT_XBGR8888 (3<<3)
-#define MT_32BIT_QWVU8888 (4<<3)
-#define MT_32BIT_AXVU8888 (5<<3)
-#define MT_32BIT_LXVU8888 (6<<3)
-#define MT_32BIT_XLVU8888 (7<<3)
-#define MT_32BIT_ARGB2101010 (8<<3)
-#define MT_32BIT_ABGR2101010 (9<<3)
-#define MT_32BIT_AWVU2101010 (0xA<<3)
-#define MT_32BIT_GR1616 (0xB<<3)
-#define MT_32BIT_VU1616 (0xC<<3)
-#define MT_32BIT_xI824 (0xD<<3)
-#define MT_32BIT_xA824 (0xE<<3)
-#define MT_32BIT_xL824 (0xF<<3)
-#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
-#define MT_422_YCRCB_NORMAL (1<<3)
-#define MT_422_YCRCB_SWAPUV (2<<3)
-#define MT_422_YCRCB_SWAPUVY (3<<3)
-#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */
-#define MT_COMPRESS_DXT2_3 (1<<3)
-#define MT_COMPRESS_DXT4_5 (2<<3)
-#define MT_COMPRESS_FXT1 (3<<3)
-#define MT_COMPRESS_DXT1_RGB (4<<3)
-#define MS3_USE_FENCE_REGS (1<<2)
-#define MS3_TILED_SURFACE (1<<1)
-#define MS3_TILE_WALK (1<<0)
-
-#define MS4_PITCH_SHIFT 21
-#define MS4_CUBE_FACE_ENA_NEGX (1<<20)
-#define MS4_CUBE_FACE_ENA_POSX (1<<19)
-#define MS4_CUBE_FACE_ENA_NEGY (1<<18)
-#define MS4_CUBE_FACE_ENA_POSY (1<<17)
-#define MS4_CUBE_FACE_ENA_NEGZ (1<<16)
-#define MS4_CUBE_FACE_ENA_POSZ (1<<15)
-#define MS4_CUBE_FACE_ENA_MASK (0x3f<<15)
-#define MS4_MAX_LOD_SHIFT 9
-#define MS4_MAX_LOD_MASK (0x3f<<9)
-#define MS4_MIP_LAYOUT_LEGACY (0<<8)
-#define MS4_MIP_LAYOUT_BELOW_LPT (0<<8)
-#define MS4_MIP_LAYOUT_RIGHT_LPT (1<<8)
-#define MS4_VOLUME_DEPTH_SHIFT 0
-#define MS4_VOLUME_DEPTH_MASK (0xff<<0)
-
-/* p244 */
-#define _3DSTATE_SAMPLER_STATE (CMD_3D|(0x1d<<24)|(0x1<<16))
-
-#define SS1_MAPMASK_SHIFT 0
-#define SS1_MAPMASK_MASK (0x8fff<<0)
-
-#define SS2_REVERSE_GAMMA_ENABLE (1<<31)
-#define SS2_PACKED_TO_PLANAR_ENABLE (1<<30)
-#define SS2_COLORSPACE_CONVERSION (1<<29)
-#define SS2_CHROMAKEY_SHIFT 27
-#define SS2_BASE_MIP_LEVEL_SHIFT 22
-#define SS2_BASE_MIP_LEVEL_MASK (0x1f<<22)
-#define SS2_MIP_FILTER_SHIFT 20
-#define SS2_MIP_FILTER_MASK (0x3<<20)
-#define MIPFILTER_NONE 0
-#define MIPFILTER_NEAREST 1
-#define MIPFILTER_LINEAR 3
-#define SS2_MAG_FILTER_SHIFT 17
-#define SS2_MAG_FILTER_MASK (0x7<<17)
-#define FILTER_NEAREST 0
-#define FILTER_LINEAR 1
-#define FILTER_ANISOTROPIC 2
-#define FILTER_4X4_1 3
-#define FILTER_4X4_2 4
-#define FILTER_4X4_FLAT 5
-#define FILTER_6X5_MONO 6 /* XXX - check */
-#define SS2_MIN_FILTER_SHIFT 14
-#define SS2_MIN_FILTER_MASK (0x7<<14)
-#define SS2_LOD_BIAS_SHIFT 5
-#define SS2_LOD_BIAS_ONE (0x10<<5)
-#define SS2_LOD_BIAS_MASK (0x1ff<<5)
-/* Shadow requires:
- * MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format
- * FILTER_4X4_x MIN and MAG filters
- */
-#define SS2_SHADOW_ENABLE (1<<4)
-#define SS2_MAX_ANISO_MASK (1<<3)
-#define SS2_MAX_ANISO_2 (0<<3)
-#define SS2_MAX_ANISO_4 (1<<3)
-#define SS2_SHADOW_FUNC_SHIFT 0
-#define SS2_SHADOW_FUNC_MASK (0x7<<0)
-/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */
-
-#define SS3_MIN_LOD_SHIFT 24
-#define SS3_MIN_LOD_ONE (0x10<<24)
-#define SS3_MIN_LOD_MASK (0xff<<24)
-#define SS3_KILL_PIXEL_ENABLE (1<<17)
-#define SS3_TCX_ADDR_MODE_SHIFT 12
-#define SS3_TCX_ADDR_MODE_MASK (0x7<<12)
-#define TEXCOORDMODE_WRAP 0
-#define TEXCOORDMODE_MIRROR 1
-#define TEXCOORDMODE_CLAMP_EDGE 2
-#define TEXCOORDMODE_CUBE 3
-#define TEXCOORDMODE_CLAMP_BORDER 4
-#define TEXCOORDMODE_MIRROR_ONCE 5
-#define SS3_TCY_ADDR_MODE_SHIFT 9
-#define SS3_TCY_ADDR_MODE_MASK (0x7<<9)
-#define SS3_TCZ_ADDR_MODE_SHIFT 6
-#define SS3_TCZ_ADDR_MODE_MASK (0x7<<6)
-#define SS3_NORMALIZED_COORDS (1<<5)
-#define SS3_TEXTUREMAP_INDEX_SHIFT 1
-#define SS3_TEXTUREMAP_INDEX_MASK (0xf<<1)
-#define SS3_DEINTERLACER_ENABLE (1<<0)
-
-#define SS4_BORDER_COLOR_MASK (~0)
-
-/* 3DSTATE_SPAN_STIPPLE, p258
- */
-#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
-#define ST1_ENABLE (1<<16)
-#define ST1_MASK (0xffff)
-
-#define _3DSTATE_DEFAULT_Z ((0x3<<29)|(0x1d<<24)|(0x98<<16))
-#define _3DSTATE_DEFAULT_DIFFUSE ((0x3<<29)|(0x1d<<24)|(0x99<<16))
-#define _3DSTATE_DEFAULT_SPECULAR ((0x3<<29)|(0x1d<<24)|(0x9a<<16))
-
-
-#define MI_FLUSH ((0<<29)|(4<<23))
-#define FLUSH_MAP_CACHE (1<<0)
-#define INHIBIT_FLUSH_RENDER_CACHE (1<<2)
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/i915_state.c b/src/mesa/drivers/dri/i915-tex/i915_state.c
deleted file mode 100644
index 8a7b4e9d827..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_state.c
+++ /dev/null
@@ -1,1006 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-#include "texmem.h"
-
-#include "intel_fbo.h"
-#include "intel_screen.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-static void
-i915StencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref,
- GLuint mask)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int test = intel_translate_compare_func( func );
-
- mask = mask & 0xff;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(func), ref, mask);
-
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
- i915->state.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(mask));
-
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_REF_MASK |
- S5_STENCIL_TEST_FUNC_MASK);
-
- i915->state.Ctx[I915_CTXREG_LIS5] |= ((ref << S5_STENCIL_REF_SHIFT) |
- (test << S5_STENCIL_TEST_FUNC_SHIFT));
-}
-
-static void
-i915StencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s : mask 0x%x\n", __FUNCTION__, mask);
-
- mask = mask & 0xff;
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK;
- i915->state.Ctx[I915_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(mask));
-}
-
-
-static void
-i915StencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail,
- GLenum zpass)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int fop = intel_translate_stencil_op(fail);
- int dfop = intel_translate_stencil_op(zfail);
- int dpop = intel_translate_stencil_op(zpass);
-
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(fail),
- _mesa_lookup_enum_by_nr(zfail),
- _mesa_lookup_enum_by_nr(zpass));
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_FAIL_MASK |
- S5_STENCIL_PASS_Z_FAIL_MASK |
- S5_STENCIL_PASS_Z_PASS_MASK);
-
- i915->state.Ctx[I915_CTXREG_LIS5] |= ((fop << S5_STENCIL_FAIL_SHIFT) |
- (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
- (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT));
-}
-
-static void i915AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int test = intel_translate_compare_func( func );
- GLubyte refByte;
-
- UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~(S6_ALPHA_TEST_FUNC_MASK |
- S6_ALPHA_REF_MASK);
- i915->state.Ctx[I915_CTXREG_LIS6] |= ((test << S6_ALPHA_TEST_FUNC_SHIFT) |
- (((GLuint)refByte) << S6_ALPHA_REF_SHIFT));
-}
-
-/* This function makes sure that the proper enables are
- * set for LogicOp, Independant Alpha Blend, and Blending.
- * It needs to be called from numerous places where we
- * could change the LogicOp or Independant Alpha Blend without subsequent
- * calls to glEnable.
- */
-static void i915EvalLogicOpBlendState(GLcontext *ctx)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- if (ctx->Color._LogicOpEnabled) {
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_LOGICOP_ENABLE;
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_CBUF_BLEND_ENABLE;
- } else {
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_LOGICOP_ENABLE;
-
- if (ctx->Color.BlendEnabled) {
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_CBUF_BLEND_ENABLE;
- } else {
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_CBUF_BLEND_ENABLE;
- }
- }
-}
-
-static void i915BlendColor(GLcontext *ctx, const GLfloat color[4])
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- GLubyte r, g, b, a;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(a, color[ACOMP]);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
-}
-
-
-#define DST_BLND_FACT(f) ((f)<<S6_CBUF_DST_BLEND_FACT_SHIFT)
-#define SRC_BLND_FACT(f) ((f)<<S6_CBUF_SRC_BLEND_FACT_SHIFT)
-#define DST_ABLND_FACT(f) ((f)<<IAB_DST_FACTOR_SHIFT)
-#define SRC_ABLND_FACT(f) ((f)<<IAB_SRC_FACTOR_SHIFT)
-
-
-
-static GLuint translate_blend_equation( GLenum mode )
-{
- switch (mode) {
- case GL_FUNC_ADD: return BLENDFUNC_ADD;
- case GL_MIN: return BLENDFUNC_MIN;
- case GL_MAX: return BLENDFUNC_MAX;
- case GL_FUNC_SUBTRACT: return BLENDFUNC_SUBTRACT;
- case GL_FUNC_REVERSE_SUBTRACT: return BLENDFUNC_REVERSE_SUBTRACT;
- default: return 0;
- }
-}
-
-static void i915UpdateBlendState( GLcontext *ctx )
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- GLuint iab = (i915->state.Ctx[I915_CTXREG_IAB] &
- ~(IAB_SRC_FACTOR_MASK |
- IAB_DST_FACTOR_MASK |
- (BLENDFUNC_MASK << IAB_FUNC_SHIFT) |
- IAB_ENABLE));
-
- GLuint lis6 = (i915->state.Ctx[I915_CTXREG_LIS6] &
- ~(S6_CBUF_SRC_BLEND_FACT_MASK |
- S6_CBUF_DST_BLEND_FACT_MASK |
- S6_CBUF_BLEND_FUNC_MASK));
-
- GLuint eqRGB = ctx->Color.BlendEquationRGB;
- GLuint eqA = ctx->Color.BlendEquationA;
- GLuint srcRGB = ctx->Color.BlendSrcRGB;
- GLuint dstRGB = ctx->Color.BlendDstRGB;
- GLuint srcA = ctx->Color.BlendSrcA;
- GLuint dstA = ctx->Color.BlendDstA;
-
- if (eqRGB == GL_MIN || eqRGB == GL_MAX) {
- srcRGB = dstRGB = GL_ONE;
- }
-
- if (eqA == GL_MIN || eqA == GL_MAX) {
- srcA = dstA = GL_ONE;
- }
-
- lis6 |= SRC_BLND_FACT(intel_translate_blend_factor(srcRGB));
- lis6 |= DST_BLND_FACT(intel_translate_blend_factor(dstRGB));
- lis6 |= translate_blend_equation( eqRGB ) << S6_CBUF_BLEND_FUNC_SHIFT;
-
- iab |= SRC_ABLND_FACT(intel_translate_blend_factor(srcA));
- iab |= DST_ABLND_FACT(intel_translate_blend_factor(dstA));
- iab |= translate_blend_equation( eqA ) << IAB_FUNC_SHIFT;
-
- if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB)
- iab |= IAB_ENABLE;
-
- if (iab != i915->state.Ctx[I915_CTXREG_IAB] ||
- lis6 != i915->state.Ctx[I915_CTXREG_LIS6]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_IAB] = iab;
- i915->state.Ctx[I915_CTXREG_LIS6] = lis6;
- }
-
- /* This will catch a logicop blend equation */
- i915EvalLogicOpBlendState(ctx);
-}
-
-
-static void i915BlendFuncSeparate(GLcontext *ctx, GLenum srcRGB,
- GLenum dstRGB, GLenum srcA,
- GLenum dstA )
-{
- i915UpdateBlendState( ctx );
-}
-
-
-static void i915BlendEquationSeparate(GLcontext *ctx, GLenum eqRGB,
- GLenum eqA)
-{
- i915UpdateBlendState( ctx );
-}
-
-
-static void i915DepthFunc(GLcontext *ctx, GLenum func)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int test = intel_translate_compare_func( func );
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_TEST_FUNC_MASK;
- i915->state.Ctx[I915_CTXREG_LIS6] |= test << S6_DEPTH_TEST_FUNC_SHIFT;
-}
-
-static void i915DepthMask(GLcontext *ctx, GLboolean flag)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s flag (%d)\n", __FUNCTION__, flag);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- if (flag && ctx->Depth.Test)
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_DEPTH_WRITE_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_WRITE_ENABLE;
-}
-
-/* =============================================================
- * Polygon stipple
- *
- * The i915 supports a 4x4 stipple natively, GL wants 32x32.
- * Fortunately stipple is usually a repeating pattern.
- */
-static void i915PolygonStipple( GLcontext *ctx, const GLubyte *mask )
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- const GLubyte *m = mask;
- GLubyte p[4];
- int i,j,k;
- int active = (ctx->Polygon.StippleFlag &&
- i915->intel.reduced_primitive == GL_TRIANGLES);
- GLuint newMask;
-
- if (active) {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- i915->state.Stipple[I915_STPREG_ST1] &= ~ST1_ENABLE;
- }
-
- p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
- p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
- p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
- p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
-
- for (k = 0 ; k < 8 ; k++)
- for (j = 3 ; j >= 0; j--)
- for (i = 0 ; i < 4 ; i++, m++)
- if (*m != p[j]) {
- i915->intel.hw_stipple = 0;
- return;
- }
-
- newMask = (((p[0] & 0xf) << 0) |
- ((p[1] & 0xf) << 4) |
- ((p[2] & 0xf) << 8) |
- ((p[3] & 0xf) << 12));
-
-
- if (newMask == 0xffff || newMask == 0x0) {
- /* this is needed to make conform pass */
- i915->intel.hw_stipple = 0;
- return;
- }
-
- i915->state.Stipple[I915_STPREG_ST1] &= ~0xffff;
- i915->state.Stipple[I915_STPREG_ST1] |= newMask;
- i915->intel.hw_stipple = 1;
-
- if (active)
- i915->state.Stipple[I915_STPREG_ST1] |= ST1_ENABLE;
-}
-
-
-/* =============================================================
- * Hardware clipping
- */
-static void i915Scissor(GLcontext *ctx, GLint x, GLint y,
- GLsizei w, GLsizei h)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int x1, y1, x2, y2;
-
- if (!ctx->DrawBuffer)
- return;
-
- x1 = x;
- y1 = ctx->DrawBuffer->Height - (y + h);
- x2 = x + w - 1;
- y2 = y1 + h - 1;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "[%s] x(%d) y(%d) w(%d) h(%d)\n", __FUNCTION__,
- x, y, w, h);
-
- x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1);
- y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1);
- x2 = CLAMP(x2, 0, ctx->DrawBuffer->Width - 1);
- y2 = CLAMP(y2, 0, ctx->DrawBuffer->Height - 1);
-
- I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- i915->state.Buffer[I915_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff);
- i915->state.Buffer[I915_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff);
-}
-
-static void i915LogicOp(GLcontext *ctx, GLenum opcode)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int tmp = intel_translate_logic_op(opcode);
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_STATE4] &= ~LOGICOP_MASK;
- i915->state.Ctx[I915_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
-}
-
-
-
-static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- GLuint mode;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!ctx->Polygon.CullFlag) {
- mode = S4_CULLMODE_NONE;
- }
- else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
- mode = S4_CULLMODE_CW;
-
- if (ctx->Polygon.CullFaceMode == GL_FRONT)
- mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
- if (ctx->Polygon.FrontFace != GL_CCW)
- mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
- }
- else {
- mode = S4_CULLMODE_BOTH;
- }
-
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS4] &= ~S4_CULLMODE_MASK;
- i915->state.Ctx[I915_CTXREG_LIS4] |= mode;
-}
-
-static void i915LineWidth( GLcontext *ctx, GLfloat widthf )
-{
- struct i915_context *i915 = I915_CONTEXT( ctx );
- int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_LINE_WIDTH_MASK;
- int width;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- width = (int)(widthf * 2);
- CLAMP_SELF(width, 1, 0xf);
- lis4 |= width << S4_LINE_WIDTH_SHIFT;
-
- if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS4] = lis4;
- }
-}
-
-static void i915PointSize(GLcontext *ctx, GLfloat size)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK;
- GLint point_size = (int)size;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- CLAMP_SELF(point_size, 1, 255);
- lis4 |= point_size << S4_POINT_WIDTH_SHIFT;
-
- if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS4] = lis4;
- }
-}
-
-
-/* =============================================================
- * Color masks
- */
-
-static void i915ColorMask(GLcontext *ctx,
- GLboolean r, GLboolean g,
- GLboolean b, GLboolean a)
-{
- struct i915_context *i915 = I915_CONTEXT( ctx );
- GLuint tmp = i915->state.Ctx[I915_CTXREG_LIS5] & ~S5_WRITEDISABLE_MASK;
-
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a);
-
- if (!r) tmp |= S5_WRITEDISABLE_RED;
- if (!g) tmp |= S5_WRITEDISABLE_GREEN;
- if (!b) tmp |= S5_WRITEDISABLE_BLUE;
- if (!a) tmp |= S5_WRITEDISABLE_ALPHA;
-
- if (tmp != i915->state.Ctx[I915_CTXREG_LIS5]) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- i915->state.Ctx[I915_CTXREG_LIS5] = tmp;
- }
-}
-
-static void update_specular( GLcontext *ctx )
-{
- /* A hack to trigger the rebuild of the fragment program.
- */
- intel_context(ctx)->NewGLState |= _NEW_TEXTURE;
- I915_CONTEXT(ctx)->tex_program.translated = 0;
-}
-
-static void i915LightModelfv(GLcontext *ctx, GLenum pname,
- const GLfloat *param)
-{
- if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
- update_specular( ctx );
- }
-}
-
-static void i915ShadeModel(GLcontext *ctx, GLenum mode)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
-
- if (mode == GL_SMOOTH) {
- i915->state.Ctx[I915_CTXREG_LIS4] &= ~(S4_FLATSHADE_ALPHA |
- S4_FLATSHADE_COLOR |
- S4_FLATSHADE_SPECULAR);
- } else {
- i915->state.Ctx[I915_CTXREG_LIS4] |= (S4_FLATSHADE_ALPHA |
- S4_FLATSHADE_COLOR |
- S4_FLATSHADE_SPECULAR);
- }
-}
-
-/* =============================================================
- * Fog
- */
-void i915_update_fog( GLcontext *ctx )
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
- GLenum mode;
- GLboolean enabled;
- GLboolean try_pixel_fog;
-
- if (ctx->FragmentProgram._Active) {
- /* Pull in static fog state from program */
-
- mode = ctx->FragmentProgram._Current->FogOption;
- enabled = (mode != GL_NONE);
- try_pixel_fog = 0;
- }
- else {
- enabled = ctx->Fog.Enabled;
- mode = ctx->Fog.Mode;
-
- try_pixel_fog = (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT &&
- ctx->Hint.Fog == GL_NICEST &&
- 0); /* XXX - DISABLE -- Need ortho fallback */
- }
-
- if (!enabled) {
- i915->vertex_fog = I915_FOG_NONE;
- }
- else if (try_pixel_fog) {
-
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
- i915->vertex_fog = I915_FOG_PIXEL;
-
- switch (mode) {
- case GL_LINEAR:
- if (ctx->Fog.End <= ctx->Fog.Start) {
- /* XXX - this won't work with fragment programs. Need to
- * either fallback or append fog instructions to end of
- * program in the case of linear fog.
- */
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX;
- i915->vertex_fog = I915_FOG_VERTEX;
- }
- else {
- GLfloat c1 = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- GLfloat c2 = 1.0/(ctx->Fog.End-ctx->Fog.Start);
-
- i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_C1_MASK;
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_LINEAR;
- i915->state.Fog[I915_FOGREG_MODE1] |=
- ((GLuint)(c1 * FMC1_C1_ONE)) & FMC1_C1_MASK;
-
- if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
- i915->state.Fog[I915_FOGREG_MODE2] = (GLuint)(c2 * FMC2_C2_ONE);
- }
- else {
- union { float f; int i; } fi;
- fi.f = c2;
- i915->state.Fog[I915_FOGREG_MODE2] = fi.i;
- }
- }
- break;
- case GL_EXP:
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_EXP;
- break;
- case GL_EXP2:
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_PIXEL_EXP2;
- break;
- default:
- break;
- }
- }
- else /* if (i915->vertex_fog != I915_FOG_VERTEX) */ {
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_MODE1] &= ~FMC1_FOGFUNC_MASK;
- i915->state.Fog[I915_FOGREG_MODE1] |= FMC1_FOGFUNC_VERTEX;
- i915->vertex_fog = I915_FOG_VERTEX;
- }
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- I915_ACTIVESTATE(i915, I915_UPLOAD_FOG, enabled);
- if (enabled)
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_FOG_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_FOG_ENABLE;
- }
-
- if (enabled) {
- _tnl_allow_vertex_fog( ctx, (i915->vertex_fog == I915_FOG_VERTEX) );
- _tnl_allow_pixel_fog( ctx, (i915->vertex_fog != I915_FOG_VERTEX) );
- }
-}
-
-static void i915Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
-
- switch (pname) {
- case GL_FOG_COORDINATE_SOURCE_EXT:
- case GL_FOG_MODE:
- case GL_FOG_START:
- case GL_FOG_END:
- break;
-
- case GL_FOG_DENSITY:
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
-
- if (i915->state.Fog[I915_FOGREG_MODE1] & FMC1_FOGINDEX_Z) {
- i915->state.Fog[I915_FOGREG_MODE3] = (GLuint)(ctx->Fog.Density *
- FMC3_D_ONE);
- }
- else {
- union { float f; int i; } fi;
- fi.f = ctx->Fog.Density;
- i915->state.Fog[I915_FOGREG_MODE3] = fi.i;
- }
- break;
-
- case GL_FOG_COLOR:
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_COLOR] =
- (_3DSTATE_FOG_COLOR_CMD |
- ((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
- ((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
- ((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
- break;
-
- default:
- break;
- }
-}
-
-static void i915Hint(GLcontext *ctx, GLenum target, GLenum state)
-{
- switch (target) {
- case GL_FOG_HINT:
- break;
- default:
- break;
- }
-}
-
-/* =============================================================
- */
-
-static void i915Enable(GLcontext *ctx, GLenum cap, GLboolean state)
-{
- struct i915_context *i915 = I915_CONTEXT(ctx);
-
- switch(cap) {
- case GL_TEXTURE_2D:
- break;
-
- case GL_LIGHTING:
- case GL_COLOR_SUM:
- update_specular( ctx );
- break;
-
- case GL_ALPHA_TEST:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_ALPHA_TEST_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_ALPHA_TEST_ENABLE;
- break;
-
- case GL_BLEND:
- i915EvalLogicOpBlendState(ctx);
- break;
-
- case GL_COLOR_LOGIC_OP:
- i915EvalLogicOpBlendState(ctx);
-
- /* Logicop doesn't seem to work at 16bpp:
- */
- if (i915->intel.intelScreen->cpp == 2) /* XXX FBO fix */
- FALLBACK( &i915->intel, I915_FALLBACK_LOGICOP, state );
- break;
-
- case GL_FRAGMENT_PROGRAM_ARB:
- break;
-
- case GL_DITHER:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_COLOR_DITHER_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~S5_COLOR_DITHER_ENABLE;
- break;
-
- case GL_DEPTH_TEST:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS6] |= S6_DEPTH_TEST_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS6] &= ~S6_DEPTH_TEST_ENABLE;
-
- i915DepthMask( ctx, ctx->Depth.Mask );
- break;
-
- case GL_SCISSOR_TEST:
- I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- if (state)
- i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- ENABLE_SCISSOR_RECT);
- else
- i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- break;
-
- case GL_LINE_SMOOTH:
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS4] |= S4_LINE_ANTIALIAS_ENABLE;
- else
- i915->state.Ctx[I915_CTXREG_LIS4] &= ~S4_LINE_ANTIALIAS_ENABLE;
- break;
-
- case GL_FOG:
- break;
-
- case GL_CULL_FACE:
- i915CullFaceFrontFace(ctx, 0);
- break;
-
- case GL_STENCIL_TEST:
- {
- GLboolean hw_stencil = GL_FALSE;
- if (ctx->DrawBuffer) {
- struct intel_renderbuffer *irbStencil
- = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
- hw_stencil = (irbStencil && irbStencil->region);
- }
- if (hw_stencil) {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- if (state)
- i915->state.Ctx[I915_CTXREG_LIS5] |= (S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
- else
- i915->state.Ctx[I915_CTXREG_LIS5] &= ~(S5_STENCIL_TEST_ENABLE |
- S5_STENCIL_WRITE_ENABLE);
- } else {
- FALLBACK( &i915->intel, I915_FALLBACK_STENCIL, state );
- }
- }
- break;
-
- case GL_POLYGON_STIPPLE:
- /* The stipple command worked on my 855GM box, but not my 845G.
- * I'll do more testing later to find out exactly which hardware
- * supports it. Disabled for now.
- */
- if (i915->intel.hw_stipple &&
- i915->intel.reduced_primitive == GL_TRIANGLES)
- {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- if (state)
- i915->state.Stipple[I915_STPREG_ST1] |= ST1_ENABLE;
- else
- i915->state.Stipple[I915_STPREG_ST1] &= ~ST1_ENABLE;
- }
- break;
-
- case GL_POLYGON_SMOOTH:
- FALLBACK( &i915->intel, I915_FALLBACK_POLYGON_SMOOTH, state );
- break;
-
- case GL_POINT_SMOOTH:
- FALLBACK( &i915->intel, I915_FALLBACK_POINT_SMOOTH, state );
- break;
-
- default:
- ;
- }
-}
-
-
-static void i915_init_packets( struct i915_context *i915 )
-{
- intelScreenPrivate *screen = i915->intel.intelScreen;
-
- /* Zero all state */
- memset(&i915->state, 0, sizeof(i915->state));
-
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_CTX);
- /* Probably don't want to upload all this stuff every time one
- * piece changes.
- */
- i915->state.Ctx[I915_CTXREG_LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
- I1_LOAD_S(2) |
- I1_LOAD_S(4) |
- I1_LOAD_S(5) |
- I1_LOAD_S(6) |
- (4));
- i915->state.Ctx[I915_CTXREG_LIS2] = 0;
- i915->state.Ctx[I915_CTXREG_LIS4] = 0;
- i915->state.Ctx[I915_CTXREG_LIS5] = 0;
-
- if (screen->cpp == 2) /* XXX FBO fix */
- i915->state.Ctx[I915_CTXREG_LIS5] |= S5_COLOR_DITHER_ENABLE;
-
-
- i915->state.Ctx[I915_CTXREG_LIS6] = (S6_COLOR_WRITE_ENABLE |
- (2 << S6_TRISTRIP_PV_SHIFT));
-
- i915->state.Ctx[I915_CTXREG_STATE4] = (_3DSTATE_MODES_4_CMD |
- ENABLE_LOGIC_OP_FUNC |
- LOGIC_OP_FUNC(LOGICOP_COPY) |
- ENABLE_STENCIL_TEST_MASK |
- STENCIL_TEST_MASK(0xff) |
- ENABLE_STENCIL_WRITE_MASK |
- STENCIL_WRITE_MASK(0xff));
-
- i915->state.Ctx[I915_CTXREG_IAB] = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD |
- IAB_MODIFY_ENABLE |
- IAB_MODIFY_FUNC |
- IAB_MODIFY_SRC_FACTOR |
- IAB_MODIFY_DST_FACTOR);
-
- i915->state.Ctx[I915_CTXREG_BLENDCOLOR0] = _3DSTATE_CONST_BLEND_COLOR_CMD;
- i915->state.Ctx[I915_CTXREG_BLENDCOLOR1] = 0;
-
- }
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- i915->state.Stipple[I915_STPREG_ST0] = _3DSTATE_STIPPLE;
- }
-
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_FOG);
- i915->state.Fog[I915_FOGREG_MODE0] = _3DSTATE_FOG_MODE_CMD;
- i915->state.Fog[I915_FOGREG_MODE1] = (FMC1_FOGFUNC_MODIFY_ENABLE |
- FMC1_FOGFUNC_VERTEX |
- FMC1_FOGINDEX_MODIFY_ENABLE |
- FMC1_FOGINDEX_W |
- FMC1_C1_C2_MODIFY_ENABLE |
- FMC1_DENSITY_MODIFY_ENABLE);
- i915->state.Fog[I915_FOGREG_COLOR] = _3DSTATE_FOG_COLOR_CMD;
- }
-
-
- {
- I915_STATECHANGE(i915, I915_UPLOAD_BUFFERS);
- /* color buffer offset/stride */
- i915->state.Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- /* XXX FBO: remove this? Also get set in i915_set_draw_region() */
- i915->state.Buffer[I915_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK |
-<<<<<<< i915_state.c
- BUF_3D_PITCH(screen->front.pitch) | /* pitch in bytes */
-=======
- BUF_3D_PITCH(screen->front.pitch * screen->cpp) | /* XXX FBO fix */
->>>>>>> 1.7.2.9
- BUF_3D_USE_FENCE);
- /*i915->state.Buffer[I915_DESTREG_CBUFADDR2] is the offset */
-
-<<<<<<< i915_state.c
-
- /* depth/Z buffer offset/stride */
-=======
->>>>>>> 1.7.2.9
- i915->state.Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- /* XXX FBO: remove this? Also get set in i915_set_draw_region() */
- i915->state.Buffer[I915_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH |
-<<<<<<< i915_state.c
- BUF_3D_PITCH(screen->depth.pitch) | /* pitch in bytes */
-=======
- BUF_3D_PITCH(screen->depth.pitch * screen->cpp) | /* XXX FBO fix */
->>>>>>> 1.7.2.9
- BUF_3D_USE_FENCE);
-
- i915->state.Buffer[I915_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD;
-
-<<<<<<< i915_state.c
- /* color/depth pixel format */
-=======
- /* XXX FBO: remove this? Also get set in i915_set_draw_region() */
-#if 0 /* seems we don't need this */
->>>>>>> 1.7.2.9
- switch (screen->fbFormat) {
- case DV_PF_565:
- i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- DITHER_FULL_ALWAYS |
- screen->fbFormat |
- DEPTH_FRMT_16_FIXED);
- break;
- case DV_PF_8888:
- i915->state.Buffer[I915_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL |
- screen->fbFormat |
- DEPTH_FRMT_24_FIXED_8_OTHER);
- break;
- }
-<<<<<<< i915_state.c
-
- /* scissor */
-=======
-#endif
-
->>>>>>> 1.7.2.9
- i915->state.Buffer[I915_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
- i915->state.Buffer[I915_DESTREG_SR0] = _3DSTATE_SCISSOR_RECT_0_CMD;
- i915->state.Buffer[I915_DESTREG_SR1] = 0;
- i915->state.Buffer[I915_DESTREG_SR2] = 0;
- }
-
-
-#if 0
- {
- I915_STATECHANGE(i915, I915_UPLOAD_DEFAULTS);
- i915->state.Default[I915_DEFREG_C0] = _3DSTATE_DEFAULT_DIFFUSE;
- i915->state.Default[I915_DEFREG_C1] = 0;
- i915->state.Default[I915_DEFREG_S0] = _3DSTATE_DEFAULT_SPECULAR;
- i915->state.Default[I915_DEFREG_S1] = 0;
- i915->state.Default[I915_DEFREG_Z0] = _3DSTATE_DEFAULT_Z;
- i915->state.Default[I915_DEFREG_Z1] = 0;
- }
-#endif
-
-
- /* These will be emitted every at the head of every buffer, unless
- * we get hardware contexts working.
- */
- i915->state.active = (I915_UPLOAD_PROGRAM |
- I915_UPLOAD_STIPPLE |
- I915_UPLOAD_CTX |
- I915_UPLOAD_BUFFERS |
- I915_UPLOAD_INVARIENT);
-}
-
-void i915InitStateFunctions( struct dd_function_table *functions )
-{
- functions->AlphaFunc = i915AlphaFunc;
- functions->BlendColor = i915BlendColor;
- functions->BlendEquationSeparate = i915BlendEquationSeparate;
- functions->BlendFuncSeparate = i915BlendFuncSeparate;
- functions->ColorMask = i915ColorMask;
- functions->CullFace = i915CullFaceFrontFace;
- functions->DepthFunc = i915DepthFunc;
- functions->DepthMask = i915DepthMask;
- functions->Enable = i915Enable;
- functions->Fogfv = i915Fogfv;
- functions->FrontFace = i915CullFaceFrontFace;
- functions->Hint = i915Hint;
- functions->LightModelfv = i915LightModelfv;
- functions->LineWidth = i915LineWidth;
- functions->LogicOpcode = i915LogicOp;
- functions->PointSize = i915PointSize;
- functions->PolygonStipple = i915PolygonStipple;
- functions->Scissor = i915Scissor;
- functions->ShadeModel = i915ShadeModel;
- functions->StencilFuncSeparate = i915StencilFuncSeparate;
- functions->StencilMaskSeparate = i915StencilMaskSeparate;
- functions->StencilOpSeparate = i915StencilOpSeparate;
-}
-
-
-void i915InitState( struct i915_context *i915 )
-{
- GLcontext *ctx = &i915->intel.ctx;
-
- i915_init_packets( i915 );
-
- intelInitState( ctx );
-
- memcpy( &i915->initial, &i915->state, sizeof(i915->state) );
- i915->current = &i915->state;
-}
-
-
-
-
-
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/i915_tex.c b/src/mesa/drivers/dri/i915-tex/i915_tex.c
deleted file mode 100644
index 6ae92c0b910..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_tex.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "simple_list.h"
-#include "enums.h"
-#include "image.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "texmem.h"
-#include "swrast/swrast.h"
-
-#include "mm.h"
-
-#include "intel_ioctl.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-
-static void i915TexEnv( GLcontext *ctx, GLenum target,
- GLenum pname, const GLfloat *param )
-{
- struct i915_context *i915 = I915_CONTEXT( ctx );
-
- switch (pname) {
- case GL_TEXTURE_ENV_COLOR: /* Should be a tracked param */
- case GL_TEXTURE_ENV_MODE:
- case GL_COMBINE_RGB:
- case GL_COMBINE_ALPHA:
- case GL_SOURCE0_RGB:
- case GL_SOURCE1_RGB:
- case GL_SOURCE2_RGB:
- case GL_SOURCE0_ALPHA:
- case GL_SOURCE1_ALPHA:
- case GL_SOURCE2_ALPHA:
- case GL_OPERAND0_RGB:
- case GL_OPERAND1_RGB:
- case GL_OPERAND2_RGB:
- case GL_OPERAND0_ALPHA:
- case GL_OPERAND1_ALPHA:
- case GL_OPERAND2_ALPHA:
- case GL_RGB_SCALE:
- case GL_ALPHA_SCALE:
- i915->tex_program.translated = 0;
- break;
-
- case GL_TEXTURE_LOD_BIAS: {
- GLuint unit = ctx->Texture.CurrentUnit;
- GLint b = (int) ((*param) * 16.0);
- if (b > 255) b = 255;
- if (b < -256) b = -256;
- I915_STATECHANGE(i915, I915_UPLOAD_TEX(unit));
- i915->lodbias_ss2[unit] = ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK);
- break;
- }
-
- default:
- break;
- }
-}
-
-
-static void i915BindTexture( GLcontext *ctx, GLenum target,
- struct gl_texture_object *texobj )
-{
-<<<<<<< i915_tex.c
- i915TextureObjectPtr tex;
-
- if (!texObj->DriverData)
- i915AllocTexObj( texObj );
-
- tex = (i915TextureObjectPtr)texObj->DriverData;
-
- if (tex->lastTarget != texObj->Target) {
- tex->intel.dirty = I915_UPLOAD_TEX_ALL;
- tex->lastTarget = texObj->Target;
- }
-
-=======
->>>>>>> 1.3.10.2
- /* Need this if image format changes between bound textures.
- * Could try and shortcircuit by checking for differences in
- * state between incoming and outgoing textures:
- */
- I915_CONTEXT(ctx)->tex_program.translated = 0;
-}
-
-
-
-void i915InitTextureFuncs( struct dd_function_table *functions )
-{
- functions->BindTexture = i915BindTexture;
- functions->TexEnv = i915TexEnv;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i915_tex_layout.c b/src/mesa/drivers/dri/i915-tex/i915_tex_layout.c
deleted file mode 100644
index 3f263597b01..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_tex_layout.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-/* Code to layout images in a mipmap tree for i915 and i945
- * respectively.
- */
-
-#include "intel_mipmap_tree.h"
-#include "macros.h"
-
-static GLint initial_offsets[6][2] = { {0,0},
- {0,2},
- {1,0},
- {1,2},
- {1,1},
- {1,3} };
-
-
-static GLint step_offsets[6][2] = { {0,2},
- {0,2},
- {-1,2},
- {-1,2},
- {-1,1},
- {-1,1} };
-
-static GLuint minify( GLuint d )
-{
- return MAX2(1, d>>1);
-}
-
-GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt )
-{
- GLint i;
-
- switch (mt->target) {
- case GL_TEXTURE_CUBE_MAP: {
- const GLuint dim = mt->width0;
- GLuint face;
-
- /* double pitch for cube layouts */
- mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
- mt->total_height = dim * 4;
-
- for ( face = 0 ; face < 6 ; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
-
- for (i = mt->first_level; i <= mt->last_level; i++) {
- intel_miptree_set_image_offset(mt, face, i,
- x, y,
- d, d, 1);
-
- if (d == 0)
- _mesa_printf("cube mipmap %d/%d (%d..%d) is 0x0\n",
- face, i, mt->first_level, mt->last_level);
-
- d >>= 1;
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- }
- }
- break;
- }
- case GL_TEXTURE_3D: {
- GLuint width = mt->width0;
- GLuint height = mt->height0;
- GLuint depth = mt->depth0;
-
- /* Calculate the size of a single slice.
- */
- mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
- mt->total_height = 0;
-
- /* XXX: hardware expects/requires 9 levels at minimum.
- */
- for ( i = mt->first_level ; i <= MAX2(8, mt->last_level) ; i++ ) {
- intel_miptree_set_image_offset(mt, 0, i,
- 0, mt->total_height,
- width, height, depth);
-
- mt->total_height += MAX2(2, height);
-
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
- }
-
- /* Fixup depth_image_stride:
- */
- for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
- mt->offset[0][i].depth_image_stride = mt->total_height * mt->pitch * mt->cpp;
- }
-
-
- /* Multiply slice size by texture depth for total size. It's
- * remarkable how wasteful of memory the i915 texture layouts
- * are. They are largely fixed in the i945.
- */
- mt->total_height *= mt->depth0;
- break;
- }
-
- default: {
- GLuint width = mt->width0;
- GLuint height = mt->height0;
-
- mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
- mt->total_height = 0;
-
- for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
- intel_miptree_set_image_offset(mt, 0, i,
- 0, mt->total_height,
- width, height, 1);
-
- if (mt->compressed)
- mt->total_height += MAX2(1, height/4);
- else
- mt->total_height += MAX2(2, height);
-
- width = minify(width);
- height = minify(height);
- }
- break;
- }
- }
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- mt->pitch,
- mt->total_height,
- mt->cpp,
- mt->pitch * mt->total_height * mt->cpp );
-
- return GL_TRUE;
-}
-
-
-GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt )
-{
- GLint i;
-
- switch (mt->target) {
- case GL_TEXTURE_CUBE_MAP: {
- const GLuint dim = mt->width0;
- GLuint face;
-
- /* Depending on the size of the largest images, pitch can be
- * determined either by the old-style packing of cubemap faces,
- * or the final row of 4x4, 2x2 and 1x1 faces below this.
- */
- if (dim > 32)
- mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp;
- else
- mt->pitch = 14 * 8;
-
- mt->total_height = dim * 4 + 4;
-
-
- for ( face = 0 ; face < 6 ; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
-
- if (dim == 4 && face >= 4) {
- y = mt->total_height - 4;
- x = (face - 4) * 8;
- }
- else if (dim < 4) {
- y = mt->total_height - 4;
- x = face * 8;
- }
-
- for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
- intel_miptree_set_image_offset(mt, face, i,
- x, y,
- d, d, 1);
-
- d >>= 1;
-
- switch (d) {
- case 4:
- switch (face) {
- case FACE_POS_X:
- case FACE_NEG_X:
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- break;
- case FACE_POS_Y:
- case FACE_NEG_Y:
- y += 12;
- x -= 8;
- break;
- case FACE_POS_Z:
- case FACE_NEG_Z:
- y = mt->total_height - 4;
- x = (face - 4) * 8;
- break;
- }
-
- case 2:
- y = mt->total_height - 4;
- x = 16 + face * 8;
- break;
-
- case 1:
- x += 48;
- break;
-
- default:
- x += step_offsets[face][0] * d;
- y += step_offsets[face][1] * d;
- break;
- }
- }
- }
- break;
- }
- case GL_TEXTURE_3D: {
- GLuint width = mt->width0;
- GLuint height = mt->height0;
- GLuint depth = mt->depth0;
- GLuint depth_pack_pitch;
- GLuint depth_packing = 0;
-
- mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
- mt->total_height = 0;
-
- depth_pack_pitch = mt->pitch * mt->cpp;
-
- for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
-
- intel_miptree_set_image_offset(mt, 0, i,
- 0, mt->total_height,
- width, height, depth);
-
-
-
- mt->total_height += MAX2(2, height) * MAX2((depth >> depth_packing), 1);
-
- /* When alignment dominates, can't increase depth packing?
- * Or does pitch grow??? What are the alignment constraints,
- * anyway?
- */
- if (depth_pack_pitch > 4) {
- depth_packing++;
- depth_pack_pitch >>= 2; /* KW: is this right?? */
- }
-
- width = minify(width);
- height = minify(height);
- depth = minify(depth);
-
- /* XXX: Not sure how 3d textures work on i945 - where did
- * t->depth_pitch get set in the old code. Did it ever work?
- * Fix up later.
- */
- }
- break;
- }
-
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_RECTANGLE_ARB: {
- GLuint x = 0;
- GLuint y = 0;
- GLuint width = mt->width0;
- GLuint height = mt->height0;
-
- mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
- mt->total_height = 0;
-
- for ( i = mt->first_level ; i <= mt->last_level ; i++ ) {
- intel_miptree_set_image_offset(mt, 0, i,
- x, y,
- width, height, 1);
-
-
- /* LPT change: step right after second mipmap.
- */
- if (i == 1)
- x += mt->pitch / 2;
- else {
- GLuint img_height;
-
- if (mt->compressed)
- img_height = MAX2(1, height/4);
- else
- img_height = MAX2(2, height);
-
- y += img_height;
- }
-
- /* Because the images are packed better, the final offset
- * might not be the maximal one:
- */
- mt->total_height = MAX2(mt->total_height, y);
-
- width = minify(width);
- height = minify(height);
- }
- break;
- }
- default:
- _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()");
- }
-
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- mt->pitch,
- mt->total_height,
- mt->cpp,
- mt->pitch * mt->total_height * mt->cpp );
-
- return GL_TRUE;
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/i915_texprog.c b/src/mesa/drivers/dri/i915-tex/i915_texprog.c
deleted file mode 100644
index 5a84c473473..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_texprog.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include <strings.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "intel_batchbuffer.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-#include "i915_program.h"
-
-static GLuint translate_tex_src_bit( struct i915_fragment_program *p,
- GLubyte bit )
-{
- switch (bit) {
- case TEXTURE_1D_BIT: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_2D_BIT: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_RECT_BIT: return D0_SAMPLE_TYPE_2D;
- case TEXTURE_3D_BIT: return D0_SAMPLE_TYPE_VOLUME;
- case TEXTURE_CUBE_BIT: return D0_SAMPLE_TYPE_CUBE;
- default: i915_program_error(p, "TexSrcBit"); return 0;
- }
-}
-
-static GLuint get_source( struct i915_fragment_program *p,
- GLenum src, GLuint unit )
-{
- switch (src) {
- case GL_TEXTURE:
- if (p->src_texture == UREG_BAD) {
-
- /* TODO: Use D0_CHANNEL_XY where possible.
- */
- GLuint dim = translate_tex_src_bit( p, p->ctx->Texture.Unit[unit]._ReallyEnabled);
- GLuint sampler = i915_emit_decl(p, REG_TYPE_S, unit, dim);
- GLuint texcoord = i915_emit_decl(p, REG_TYPE_T, unit, D0_CHANNEL_ALL);
- GLuint tmp = i915_get_temp( p );
- GLuint op = T0_TEXLD;
-
- if (p->VB->TexCoordPtr[unit]->size == 4)
- op = T0_TEXLDP;
-
- p->src_texture = i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL,
- sampler, texcoord, op );
- }
-
- return p->src_texture;
-
- /* Crossbar: */
- case GL_TEXTURE0:
- case GL_TEXTURE1:
- case GL_TEXTURE2:
- case GL_TEXTURE3:
- case GL_TEXTURE4:
- case GL_TEXTURE5:
- case GL_TEXTURE6:
- case GL_TEXTURE7: {
- return UREG_BAD;
- }
-
- case GL_CONSTANT:
- return i915_emit_const4fv( p, p->ctx->Texture.Unit[unit].EnvColor );
- case GL_PRIMARY_COLOR:
- return i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
- case GL_PREVIOUS:
- default:
- i915_emit_decl(p,
- GET_UREG_TYPE(p->src_previous),
- GET_UREG_NR(p->src_previous), D0_CHANNEL_ALL);
- return p->src_previous;
- }
-}
-
-
-static GLuint emit_combine_source( struct i915_fragment_program *p,
- GLuint mask,
- GLuint unit,
- GLenum source,
- GLenum operand )
-{
- GLuint arg, src;
-
- src = get_source(p, source, unit);
-
- switch (operand) {
- case GL_ONE_MINUS_SRC_COLOR:
- /* Get unused tmp,
- * Emit tmp = 1.0 + arg.-x-y-z-w
- */
- arg = i915_get_temp( p );
- return i915_emit_arith( p, A0_ADD, arg, mask, 0,
- swizzle(src, ONE, ONE, ONE, ONE ),
- negate(src, 1,1,1,1), 0);
-
- case GL_SRC_ALPHA:
- if (mask == A0_DEST_CHANNEL_W)
- return src;
- else
- return swizzle( src, W, W, W, W );
- case GL_ONE_MINUS_SRC_ALPHA:
- /* Get unused tmp,
- * Emit tmp = 1.0 + arg.-w-w-w-w
- */
- arg = i915_get_temp( p );
- return i915_emit_arith( p, A0_ADD, arg, mask, 0,
- swizzle(src, ONE, ONE, ONE, ONE ),
- negate( swizzle(src,W,W,W,W), 1,1,1,1), 0);
- case GL_SRC_COLOR:
- default:
- return src;
- }
-}
-
-
-
-static int nr_args( GLenum mode )
-{
- switch (mode) {
- case GL_REPLACE: return 1;
- case GL_MODULATE: return 2;
- case GL_ADD: return 2;
- case GL_ADD_SIGNED: return 2;
- case GL_INTERPOLATE: return 3;
- case GL_SUBTRACT: return 2;
- case GL_DOT3_RGB_EXT: return 2;
- case GL_DOT3_RGBA_EXT: return 2;
- case GL_DOT3_RGB: return 2;
- case GL_DOT3_RGBA: return 2;
- default: return 0;
- }
-}
-
-
-static GLboolean args_match( struct gl_texture_unit *texUnit )
-{
- int i, nr = nr_args(texUnit->Combine.ModeRGB);
-
- for (i = 0 ; i < nr ; i++) {
- if (texUnit->Combine.SourceA[i] != texUnit->Combine.SourceRGB[i])
- return GL_FALSE;
-
- switch(texUnit->Combine.OperandA[i]) {
- case GL_SRC_ALPHA:
- switch(texUnit->Combine.OperandRGB[i]) {
- case GL_SRC_COLOR:
- case GL_SRC_ALPHA:
- break;
- default:
- return GL_FALSE;
- }
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- switch(texUnit->Combine.OperandRGB[i]) {
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_ONE_MINUS_SRC_ALPHA:
- break;
- default:
- return GL_FALSE;
- }
- break;
- default:
- return GL_FALSE; /* impossible */
- }
- }
-
- return GL_TRUE;
-}
-
-
-static GLuint emit_combine( struct i915_fragment_program *p,
- GLuint dest,
- GLuint mask,
- GLuint saturate,
- GLuint unit,
- GLenum mode,
- const GLenum *source,
- const GLenum *operand)
-{
- int tmp, src[3], nr = nr_args(mode);
- int i;
-
- for (i = 0; i < nr; i++)
- src[i] = emit_combine_source( p, mask, unit, source[i], operand[i] );
-
- switch (mode) {
- case GL_REPLACE:
- if (mask == A0_DEST_CHANNEL_ALL && !saturate)
- return src[0];
- else
- return i915_emit_arith( p, A0_MOV, dest, mask, saturate, src[0], 0, 0 );
- case GL_MODULATE:
- return i915_emit_arith( p, A0_MUL, dest, mask, saturate,
- src[0], src[1], 0 );
- case GL_ADD:
- return i915_emit_arith( p, A0_ADD, dest, mask, saturate,
- src[0], src[1], 0 );
- case GL_ADD_SIGNED:
- /* tmp = arg0 + arg1
- * result = tmp + -.5
- */
- tmp = i915_emit_const1f(p, .5);
- tmp = negate(swizzle(tmp,X,X,X,X),1,1,1,1);
- i915_emit_arith( p, A0_ADD, dest, mask, 0, src[0], src[1], 0 );
- i915_emit_arith( p, A0_ADD, dest, mask, saturate, dest, tmp, 0 );
- return dest;
- case GL_INTERPOLATE: /* TWO INSTRUCTIONS */
- /* Arg0 * (Arg2) + Arg1 * (1-Arg2)
- *
- * Arg0*Arg2 + Arg1 - Arg1Arg2
- *
- * tmp = Arg0*Arg2 + Arg1,
- * result = (-Arg1)Arg2 + tmp
- */
- tmp = i915_get_temp( p );
- i915_emit_arith( p, A0_MAD, tmp, mask, 0, src[0], src[2], src[1] );
- i915_emit_arith( p, A0_MAD, dest, mask, saturate,
- negate(src[1], 1,1,1,1), src[2], tmp );
- return dest;
- case GL_SUBTRACT:
- /* negate src[1] */
- return i915_emit_arith( p, A0_ADD, dest, mask, saturate, src[0],
- negate(src[1],1,1,1,1), 0 );
-
- case GL_DOT3_RGBA:
- case GL_DOT3_RGBA_EXT:
- case GL_DOT3_RGB_EXT:
- case GL_DOT3_RGB: {
- GLuint tmp0 = i915_get_temp( p );
- GLuint tmp1 = i915_get_temp( p );
- GLuint neg1 = negate(swizzle(i915_emit_const1f(p, 1),X,X,X,X), 1,1,1,1);
- GLuint two = swizzle(i915_emit_const1f(p, 2),X,X,X,X);
- i915_emit_arith( p, A0_MAD, tmp0, A0_DEST_CHANNEL_ALL, 0,
- two, src[0], neg1);
- if (src[0] == src[1])
- tmp1 = tmp0;
- else
- i915_emit_arith( p, A0_MAD, tmp1, A0_DEST_CHANNEL_ALL, 0,
- two, src[1], neg1);
- i915_emit_arith( p, A0_DP3, dest, mask, saturate, tmp0, tmp1, 0);
- return dest;
- }
-
- default:
- return src[0];
- }
-}
-
-static GLuint get_dest( struct i915_fragment_program *p, int unit )
-{
- if (p->ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- return i915_get_temp( p );
- else if (unit != p->last_tex_stage)
- return i915_get_temp( p );
- else
- return UREG(REG_TYPE_OC, 0);
-}
-
-
-
-static GLuint emit_texenv( struct i915_fragment_program *p, int unit )
-{
- struct gl_texture_unit *texUnit = &p->ctx->Texture.Unit[unit];
- GLenum envMode = texUnit->EnvMode;
- struct gl_texture_object *tObj = texUnit->_Current;
- GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
- GLuint saturate = unit < p->last_tex_stage ? A0_DEST_SATURATE : 0;
-
- switch(envMode) {
- case GL_BLEND: {
- const int cf = get_source(p, GL_PREVIOUS, unit);
- const int cc = get_source(p, GL_CONSTANT, unit);
- const int cs = get_source(p, GL_TEXTURE, unit);
- const int out = get_dest(p, unit);
-
- if (format == GL_INTENSITY) {
- /* cv = cf(1 - cs) + cc.cs
- * cv = cf - cf.cs + cc.cs
- */
- /* u[2] = MAD( -cf * cs + cf )
- * cv = MAD( cc * cs + u[2] )
- */
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, 0,
- negate(cf,1,1,1,1), cs, cf );
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- cc, cs, out );
-
- return out;
- } else {
- /* cv = cf(1 - cs) + cc.cs
- * cv = cf - cf.cs + cc.cs
- * av = af.as
- */
- /* u[2] = MAD( cf.-x-y-zw * cs.xyzw + cf.xyz0 )
- * oC = MAD( cc.xyz0 * cs.xyz0 + u[2].xyzw )
- */
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, 0,
- negate(cf,1,1,1,0),
- cs,
- swizzle(cf,X,Y,Z,ZERO) );
-
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cc,X,Y,Z,ZERO),
- swizzle(cs,X,Y,Z,ZERO),
- out );
-
- return out;
- }
- }
-
- case GL_DECAL: {
- if (format == GL_RGB ||
- format == GL_RGBA) {
- int cf = get_source( p, GL_PREVIOUS, unit );
- int cs = get_source( p, GL_TEXTURE, unit );
- int out = get_dest(p, unit);
-
- /* cv = cf(1-as) + cs.as
- * cv = cf.(-as) + cf + cs.as
- * av = af
- */
-
- /* u[2] = mad( cf.xyzw * cs.-w-w-w1 + cf.xyz0 )
- * oc = mad( cs.xyz0 * cs.www0 + u[2].xyzw )
- */
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, 0,
- cf,
- negate(swizzle(cs,W,W,W,ONE),1,1,1,0),
- swizzle(cf,X,Y,Z,ZERO) );
-
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cs,X,Y,Z,ZERO),
- swizzle(cs,W,W,W,ZERO),
- out );
- return out;
- }
- else {
- return get_source( p, GL_PREVIOUS, unit );
- }
- }
-
- case GL_REPLACE: {
- const int cs = get_source( p, GL_TEXTURE, unit ); /* saturated */
- switch (format) {
- case GL_ALPHA: {
- const int cf = get_source( p, GL_PREVIOUS, unit ); /* saturated */
- i915_emit_arith( p, A0_MOV, cs, A0_DEST_CHANNEL_XYZ, 0, cf, 0, 0 );
- return cs;
- }
- case GL_RGB:
- case GL_LUMINANCE: {
- const int cf = get_source( p, GL_PREVIOUS, unit ); /* saturated */
- i915_emit_arith( p, A0_MOV, cs, A0_DEST_CHANNEL_W, 0, cf, 0, 0 );
- return cs;
- }
- default:
- return cs;
- }
- }
-
- case GL_MODULATE: {
- const int cf = get_source( p, GL_PREVIOUS, unit );
- const int cs = get_source( p, GL_TEXTURE, unit );
- const int out = get_dest(p, unit);
- switch (format) {
- case GL_ALPHA:
- i915_emit_arith( p, A0_MUL, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cs, ONE, ONE, ONE, W), cf, 0 );
- break;
- default:
- i915_emit_arith( p, A0_MUL, out, A0_DEST_CHANNEL_ALL, saturate,
- cs, cf, 0 );
- break;
- }
- return out;
- }
- case GL_ADD: {
- int cf = get_source( p, GL_PREVIOUS, unit );
- int cs = get_source( p, GL_TEXTURE, unit );
- const int out = get_dest( p, unit );
-
- if (format == GL_INTENSITY) {
- /* output-color.rgba = add( incoming, u[1] )
- */
- i915_emit_arith( p, A0_ADD, out, A0_DEST_CHANNEL_ALL, saturate,
- cs, cf, 0 );
- return out;
- }
- else {
- /* cv.xyz = cf.xyz + cs.xyz
- * cv.w = cf.w * cs.w
- *
- * cv.xyzw = MAD( cf.111w * cs.xyzw + cf.xyz0 )
- */
- i915_emit_arith( p, A0_MAD, out, A0_DEST_CHANNEL_ALL, saturate,
- swizzle(cf,ONE,ONE,ONE,W),
- cs,
- swizzle(cf,X,Y,Z,ZERO) );
- return out;
- }
- break;
- }
- case GL_COMBINE: {
- GLuint rgb_shift, alpha_shift, out, shift;
- GLuint dest = get_dest(p, unit);
-
- /* The EXT version of the DOT3 extension does not support the
- * scale factor, but the ARB version (and the version in OpenGL
- * 1.3) does.
- */
- switch (texUnit->Combine.ModeRGB) {
- case GL_DOT3_RGB_EXT:
- alpha_shift = texUnit->Combine.ScaleShiftA;
- rgb_shift = 0;
- break;
-
- case GL_DOT3_RGBA_EXT:
- alpha_shift = 0;
- rgb_shift = 0;
- break;
-
- default:
- rgb_shift = texUnit->Combine.ScaleShiftRGB;
- alpha_shift = texUnit->Combine.ScaleShiftA;
- break;
- }
-
-
- /* Emit the RGB and A combine ops
- */
- if (texUnit->Combine.ModeRGB == texUnit->Combine.ModeA &&
- args_match( texUnit )) {
- out = emit_combine( p, dest, A0_DEST_CHANNEL_ALL, saturate,
- unit,
- texUnit->Combine.ModeRGB,
- texUnit->Combine.SourceRGB,
- texUnit->Combine.OperandRGB );
- }
- else if (texUnit->Combine.ModeRGB == GL_DOT3_RGBA_EXT ||
- texUnit->Combine.ModeRGB == GL_DOT3_RGBA) {
-
- out = emit_combine( p, dest, A0_DEST_CHANNEL_ALL, saturate,
- unit,
- texUnit->Combine.ModeRGB,
- texUnit->Combine.SourceRGB,
- texUnit->Combine.OperandRGB );
- }
- else {
- /* Need to do something to stop from re-emitting identical
- * argument calculations here:
- */
- out = emit_combine( p, dest, A0_DEST_CHANNEL_XYZ, saturate,
- unit,
- texUnit->Combine.ModeRGB,
- texUnit->Combine.SourceRGB,
- texUnit->Combine.OperandRGB );
- out = emit_combine( p, dest, A0_DEST_CHANNEL_W, saturate,
- unit,
- texUnit->Combine.ModeA,
- texUnit->Combine.SourceA,
- texUnit->Combine.OperandA );
- }
-
- /* Deal with the final shift:
- */
- if (alpha_shift || rgb_shift) {
- if (rgb_shift == alpha_shift) {
- shift = i915_emit_const1f(p, 1<<rgb_shift);
- shift = swizzle(shift,X,X,X,X);
- }
- else {
- shift = i915_emit_const2f(p, 1<<rgb_shift, 1<<alpha_shift);
- shift = swizzle(shift,X,X,X,Y);
- }
- return i915_emit_arith( p, A0_MUL, dest, A0_DEST_CHANNEL_ALL,
- saturate, out, shift, 0 );
- }
-
- return out;
- }
-
- default:
- return get_source(p, GL_PREVIOUS, 0);
- }
-}
-
-static void emit_program_fini( struct i915_fragment_program *p )
-{
- int cf = get_source( p, GL_PREVIOUS, 0 );
- int out = UREG( REG_TYPE_OC, 0 );
-
- if (p->ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
- /* Emit specular add.
- */
- GLuint s = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_ALL);
- i915_emit_arith( p, A0_ADD, out, A0_DEST_CHANNEL_ALL, 0, cf,
- swizzle(s, X,Y,Z,ZERO), 0 );
- }
- else if (cf != out) {
- /* Will wind up in here if no texture enabled or a couple of
- * other scenarios (GL_REPLACE for instance).
- */
- i915_emit_arith( p, A0_MOV, out, A0_DEST_CHANNEL_ALL, 0, cf, 0, 0 );
- }
-}
-
-
-static void i915EmitTextureProgram( struct i915_context *i915 )
-{
- GLcontext *ctx = &i915->intel.ctx;
- struct i915_fragment_program *p = &i915->tex_program;
- GLuint unit;
-
- if (0) fprintf(stderr, "%s\n", __FUNCTION__);
-
- i915_init_program( i915, p );
-
- if (ctx->Texture._EnabledUnits) {
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- p->last_tex_stage = unit;
- }
-
- for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++)
- if (ctx->Texture.Unit[unit]._ReallyEnabled) {
- p->src_previous = emit_texenv( p, unit );
- p->src_texture = UREG_BAD;
- p->temp_flag = 0xffff000;
- p->temp_flag |= 1 << GET_UREG_NR(p->src_previous);
- }
- }
-
- emit_program_fini( p );
-
- i915_fini_program( p );
- i915_upload_program( i915, p );
-
- p->translated = 1;
-}
-
-
-void i915ValidateTextureProgram( struct i915_context *i915 )
-{
- struct intel_context *intel = &i915->intel;
- GLcontext *ctx = &intel->ctx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint index = tnl->render_inputs;
- int i, offset;
- GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
- GLuint s2 = S2_TEXCOORD_NONE;
-
- /* Important:
- */
- VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
- intel->vertex_attr_count = 0;
- intel->coloroffset = 0;
- intel->specoffset = 0;
- offset = 0;
-
- if (i915->vertex_fog == I915_FOG_PIXEL) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- index &= ~_TNL_BIT_FOG;
- }
- else if (index & _TNL_BITS_TEX_ANY) {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16 );
- }
- else {
- EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F_VIEWPORT, S4_VFMT_XYZ, 12 );
- }
-
- /* How undefined is undefined? */
- if (index & _TNL_BIT_POINTSIZE) {
- EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, S4_VFMT_POINT_WIDTH, 4 );
- }
-
- intel->coloroffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4 );
-
- if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
- if (index & _TNL_BIT_COLOR1) {
- intel->specoffset = offset / 4;
- EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, S4_VFMT_SPEC_FOG, 3 );
- } else
- EMIT_PAD( 3 );
-
- if (index & _TNL_BIT_FOG)
- EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F, S4_VFMT_SPEC_FOG, 1 );
- else
- EMIT_PAD( 1 );
- }
-
- if (index & _TNL_BITS_TEX_ANY) {
- for (i = 0; i < 8; i++) {
- if (index & _TNL_BIT_TEX(i)) {
- int sz = VB->TexCoordPtr[i]->size;
-
- s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK);
- s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz));
-
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0, sz * 4 );
- }
- }
- }
-
- /* Only need to change the vertex emit code if there has been a
- * statechange to a new hardware vertex format:
- */
- if (s2 != i915->state.Ctx[I915_CTXREG_LIS2] ||
- s4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
- int k;
-
- I915_STATECHANGE( i915, I915_UPLOAD_CTX );
-
- i915->tex_program.translated = 0;
-
- /* Must do this *after* statechange, so as not to affect
- * buffered vertices reliant on the old state:
- */
- intel->vertex_size = _tnl_install_attrs( ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->vertex_size >>= 2;
-
- i915->state.Ctx[I915_CTXREG_LIS2] = s2;
- i915->state.Ctx[I915_CTXREG_LIS4] = s4;
-
- k = intel->vtbl.check_vertex_size( intel, intel->vertex_size );
- assert(k);
- }
-
- if (!i915->tex_program.translated ||
- i915->last_ReallyEnabled != ctx->Texture._EnabledUnits) {
- i915EmitTextureProgram( i915 );
- i915->last_ReallyEnabled = ctx->Texture._EnabledUnits;
- }
-}
diff --git a/src/mesa/drivers/dri/i915-tex/i915_texstate.c b/src/mesa/drivers/dri/i915-tex/i915_texstate.c
deleted file mode 100644
index 17c1b7a3a69..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_texstate.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "mtypes.h"
-#include "enums.h"
-#include "texformat.h"
-
-#include "intel_mipmap_tree.h"
-#include "intel_tex.h"
-
-#include "i915_context.h"
-#include "i915_reg.h"
-
-
-static GLuint translate_texture_format( GLuint mesa_format )
-{
- switch (mesa_format) {
- case MESA_FORMAT_L8:
- return MAPSURF_8BIT | MT_8BIT_L8;
- case MESA_FORMAT_I8:
- return MAPSURF_8BIT | MT_8BIT_I8;
- case MESA_FORMAT_A8:
- return MAPSURF_8BIT | MT_8BIT_A8;
- case MESA_FORMAT_AL88:
- return MAPSURF_16BIT | MT_16BIT_AY88;
- case MESA_FORMAT_RGB565:
- return MAPSURF_16BIT | MT_16BIT_RGB565;
- case MESA_FORMAT_ARGB1555:
- return MAPSURF_16BIT | MT_16BIT_ARGB1555;
- case MESA_FORMAT_ARGB4444:
- return MAPSURF_16BIT | MT_16BIT_ARGB4444;
- case MESA_FORMAT_ARGB8888:
- return MAPSURF_32BIT | MT_32BIT_ARGB8888;
- case MESA_FORMAT_YCBCR_REV:
- return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
- case MESA_FORMAT_YCBCR:
- return (MAPSURF_422 | MT_422_YCRCB_SWAPY);
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
- case MESA_FORMAT_DEPTH_COMPONENT16:
- return (MAPSURF_16BIT | MT_16BIT_L16);
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGB_DXT1:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- case MESA_FORMAT_RGBA_DXT3:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- case MESA_FORMAT_RGBA_DXT5:
- return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
- default:
- fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__,
- mesa_format);
- abort();
- return 0;
- }
-}
-
-
-<<<<<<< i915_texstate.c
- if (i915->intel.intelScreen->deviceID == PCI_CHIP_I945_G ||
- i915->intel.intelScreen->deviceID == PCI_CHIP_I945_GM)
- i945LayoutTextureImages( i915, tObj );
- else
- i915LayoutTextureImages( i915, tObj );
-
- t->Setup[I915_TEXREG_MS3] =
- (((tObj->Image[0][t->intel.base.firstLevel]->Height - 1) << MS3_HEIGHT_SHIFT) |
- ((tObj->Image[0][t->intel.base.firstLevel]->Width - 1) << MS3_WIDTH_SHIFT) |
- textureFormat |
- MS3_USE_FENCE_REGS);
-
- t->Setup[I915_TEXREG_MS4] =
- ((((t->intel.Pitch / 4) - 1) << MS4_PITCH_SHIFT) |
- MS4_CUBE_FACE_ENA_MASK |
- (((t->intel.max_level * 4)) << MS4_MAX_LOD_SHIFT) |
- ((tObj->Image[0][t->intel.base.firstLevel]->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
-
- t->Setup[I915_TEXREG_SS2] &= ~(SS2_COLORSPACE_CONVERSION);
- t->Setup[I915_TEXREG_SS2] |= ss2;
-
- t->intel.dirty = I915_UPLOAD_TEX_ALL;
-
-}
-=======
->>>>>>> 1.9.2.9
-
-
-/* The i915 (and related graphics cores) do not support GL_CLAMP. The
- * Intel drivers for "other operating systems" implement GL_CLAMP as
- * GL_CLAMP_TO_EDGE, so the same is done here.
- */
-static GLuint translate_wrap_mode( GLenum wrap )
-{
- switch( wrap ) {
- case GL_REPEAT:
- return TEXCOORDMODE_WRAP;
- case GL_CLAMP:
- return TEXCOORDMODE_CLAMP_EDGE; /* not quite correct */
- case GL_CLAMP_TO_EDGE:
- return TEXCOORDMODE_CLAMP_EDGE;
- case GL_CLAMP_TO_BORDER:
- return TEXCOORDMODE_CLAMP_BORDER;
- case GL_MIRRORED_REPEAT:
- return TEXCOORDMODE_MIRROR;
- default:
- return TEXCOORDMODE_WRAP;
- }
-}
-
-
-
-/* Recalculate all state from scratch. Perhaps not the most
- * efficient, but this has gotten complex enough that we need
- * something which is understandable and reliable.
- */
-static GLboolean i915_update_tex_unit( struct intel_context *intel,
- GLuint unit,
- GLuint ss3 )
-{
- GLcontext *ctx = &intel->ctx;
- struct i915_context *i915 = i915_context(ctx);
- struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
- struct gl_texture_image *firstImage;
- GLuint *state = i915->state.Tex[unit];
-
- memset(state, 0, sizeof(state));
-
-/* intel_region_release(intel, &i915->state.tex_region[unit]); */
-
- if (!intel_finalize_mipmap_tree(intel, unit))
- return GL_FALSE;
-
- /* Get first image here, since intelObj->firstLevel will get set in
- * the intel_finalize_mipmap_tree() call above.
- */
- firstImage = tObj->Image[0][intelObj->firstLevel];
-
-/* intel_region_reference(&i915->state.tex_region[unit], */
-/* intelObj->mt->region); */
-
- i915->state.tex_buffer[unit] = intelObj->mt->region->buffer;
- i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
- intelObj->firstLevel);
-
-
- state[I915_TEXREG_MS3] =
- (((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
- ((firstImage->Width - 1) << MS3_WIDTH_SHIFT) |
- translate_texture_format( firstImage->TexFormat->MesaFormat ) |
- MS3_USE_FENCE_REGS);
-
- state[I915_TEXREG_MS4] =
- (((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) - 1) << MS4_PITCH_SHIFT) |
- MS4_CUBE_FACE_ENA_MASK |
- ((((intelObj->lastLevel - intelObj->firstLevel) * 4)) << MS4_MAX_LOD_SHIFT) |
- ((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
-
-
- {
- GLuint minFilt, mipFilt, magFilt;
-
- switch (tObj->MinFilter) {
- case GL_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_NEAREST;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- minFilt = FILTER_NEAREST;
- mipFilt = MIPFILTER_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- minFilt = FILTER_LINEAR;
- mipFilt = MIPFILTER_LINEAR;
- break;
- default:
- return GL_FALSE;
- }
-
- if ( tObj->MaxAnisotropy > 1.0 ) {
- minFilt = FILTER_ANISOTROPIC;
- magFilt = FILTER_ANISOTROPIC;
- }
- else {
- switch (tObj->MagFilter) {
- case GL_NEAREST:
- magFilt = FILTER_NEAREST;
- break;
- case GL_LINEAR:
- magFilt = FILTER_LINEAR;
- break;
- default:
- return GL_FALSE;
- }
- }
-
- state[I915_TEXREG_SS2] = i915->lodbias_ss2[unit];
-
- /* YUV conversion:
- */
- if (firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR ||
- firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV)
- state[I915_TEXREG_SS2] |= SS2_COLORSPACE_CONVERSION;
-
- /* Shadow:
- */
- if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB &&
- tObj->Target != GL_TEXTURE_3D) {
-
- state[I915_TEXREG_SS2] |=
- (SS2_SHADOW_ENABLE |
- intel_translate_compare_func( tObj->CompareFunc ));
-
- minFilt = FILTER_4X4_FLAT;
- magFilt = FILTER_4X4_FLAT;
- }
-
- state[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) |
- (mipFilt << SS2_MIP_FILTER_SHIFT) |
- (magFilt << SS2_MAG_FILTER_SHIFT));
- }
-
- {
- GLenum ws = tObj->WrapS;
- GLenum wt = tObj->WrapT;
- GLenum wr = tObj->WrapR;
-
-
- /* 3D textures don't seem to respect the border color.
- * Fallback if there's ever a danger that they might refer to
- * it.
- *
- * Effectively this means fallback on 3D clamp or
- * clamp_to_border.
- */
- if (tObj->Target == GL_TEXTURE_3D &&
- (tObj->MinFilter != GL_NEAREST ||
- tObj->MagFilter != GL_NEAREST) &&
- (ws == GL_CLAMP ||
- wt == GL_CLAMP ||
- wr == GL_CLAMP ||
- ws == GL_CLAMP_TO_BORDER ||
- wt == GL_CLAMP_TO_BORDER ||
- wr == GL_CLAMP_TO_BORDER))
- return GL_FALSE;
-
-
- state[I915_TEXREG_SS3] = ss3; /* SS3_NORMALIZED_COORDS */
-
- state[I915_TEXREG_SS3] |= ((translate_wrap_mode(ws) << SS3_TCX_ADDR_MODE_SHIFT) |
- (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) |
- (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT));
-
- state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
- }
-
-
- state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
- tObj->_BorderChan[1],
- tObj->_BorderChan[2],
- tObj->_BorderChan[3]);
-
-
- I915_ACTIVESTATE(i915, I915_UPLOAD_TEX(unit), GL_TRUE);
- /* memcmp was already disabled, but definitely won't work as the
- * region might now change and that wouldn't be detected:
- */
- I915_STATECHANGE( i915, I915_UPLOAD_TEX(unit) );
-
-
-#if 0
- DBG(TEXTURE, "state[I915_TEXREG_SS2] = 0x%x\n", state[I915_TEXREG_SS2]);
- DBG(TEXTURE, "state[I915_TEXREG_SS3] = 0x%x\n", state[I915_TEXREG_SS3]);
- DBG(TEXTURE, "state[I915_TEXREG_SS4] = 0x%x\n", state[I915_TEXREG_SS4]);
- DBG(TEXTURE, "state[I915_TEXREG_MS2] = 0x%x\n", state[I915_TEXREG_MS2]);
- DBG(TEXTURE, "state[I915_TEXREG_MS3] = 0x%x\n", state[I915_TEXREG_MS3]);
- DBG(TEXTURE, "state[I915_TEXREG_MS4] = 0x%x\n", state[I915_TEXREG_MS4]);
-#endif
-
- return GL_TRUE;
-}
-
-
-
-
-void i915UpdateTextureState( struct intel_context *intel )
-{
- GLboolean ok = GL_TRUE;
- GLuint i;
-
- for (i = 0 ; i < I915_TEX_UNITS && ok ; i++) {
- switch (intel->ctx.Texture.Unit[i]._ReallyEnabled) {
- case TEXTURE_1D_BIT:
- case TEXTURE_2D_BIT:
- case TEXTURE_CUBE_BIT:
- case TEXTURE_3D_BIT:
- ok = i915_update_tex_unit( intel, i, SS3_NORMALIZED_COORDS );
- break;
- case TEXTURE_RECT_BIT:
- ok = i915_update_tex_unit( intel, i, 0 );
- break;
- case 0: {
- struct i915_context *i915 = i915_context(&intel->ctx);
- if (i915->state.active & I915_UPLOAD_TEX(i))
- I915_ACTIVESTATE(i915, I915_UPLOAD_TEX(i), GL_FALSE);
- break;
- }
- default:
- ok = GL_FALSE;
- break;
- }
- }
-
- FALLBACK( intel, I915_FALLBACK_TEXTURE, !ok );
-}
-
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/i915_vtbl.c b/src/mesa/drivers/dri/i915-tex/i915_vtbl.c
deleted file mode 100644
index 1c56422a579..00000000000
--- a/src/mesa/drivers/dri/i915-tex/i915_vtbl.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-
-#include "glheader.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "macros.h"
-#include "colormac.h"
-
-#include "tnl/t_context.h"
-#include "tnl/t_vertex.h"
-
-#include "intel_batchbuffer.h"
-#include "intel_tex.h"
-#include "intel_regions.h"
-
-#include "i915_reg.h"
-#include "i915_context.h"
-
-static void i915_render_start( struct intel_context *intel )
-{
- GLcontext *ctx = &intel->ctx;
- struct i915_context *i915 = i915_context(&intel->ctx);
-
- if (ctx->FragmentProgram._Active)
- i915ValidateFragmentProgram( i915 );
- else
- i915ValidateTextureProgram( i915 );
-}
-
-
-static void i915_reduced_primitive_state( struct intel_context *intel,
- GLenum rprim )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- GLuint st1 = i915->state.Stipple[I915_STPREG_ST1];
-
- st1 &= ~ST1_ENABLE;
-
- switch (rprim) {
- case GL_TRIANGLES:
- if (intel->ctx.Polygon.StippleFlag &&
- intel->hw_stipple)
- st1 |= ST1_ENABLE;
- break;
- case GL_LINES:
- case GL_POINTS:
- default:
- break;
- }
-
- i915->intel.reduced_primitive = rprim;
-
- if (st1 != i915->state.Stipple[I915_STPREG_ST1]) {
- I915_STATECHANGE(i915, I915_UPLOAD_STIPPLE);
- i915->state.Stipple[I915_STPREG_ST1] = st1;
- }
-}
-
-
-/* Pull apart the vertex format registers and figure out how large a
- * vertex is supposed to be.
- */
-static GLboolean i915_check_vertex_size( struct intel_context *intel,
- GLuint expected )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- int lis2 = i915->current->Ctx[I915_CTXREG_LIS2];
- int lis4 = i915->current->Ctx[I915_CTXREG_LIS4];
- int i, sz = 0;
-
- switch (lis4 & S4_VFMT_XYZW_MASK) {
- case S4_VFMT_XY: sz = 2; break;
- case S4_VFMT_XYZ: sz = 3; break;
- case S4_VFMT_XYW: sz = 3; break;
- case S4_VFMT_XYZW: sz = 4; break;
- default:
- fprintf(stderr, "no xyzw specified\n");
- return 0;
- }
-
- if (lis4 & S4_VFMT_SPEC_FOG) sz++;
- if (lis4 & S4_VFMT_COLOR) sz++;
- if (lis4 & S4_VFMT_DEPTH_OFFSET) sz++;
- if (lis4 & S4_VFMT_POINT_WIDTH) sz++;
- if (lis4 & S4_VFMT_FOG_PARAM) sz++;
-
- for (i = 0 ; i < 8 ; i++) {
- switch (lis2 & S2_TEXCOORD_FMT0_MASK) {
- case TEXCOORDFMT_2D: sz += 2; break;
- case TEXCOORDFMT_3D: sz += 3; break;
- case TEXCOORDFMT_4D: sz += 4; break;
- case TEXCOORDFMT_1D: sz += 1; break;
- case TEXCOORDFMT_2D_16: sz += 1; break;
- case TEXCOORDFMT_4D_16: sz += 2; break;
- case TEXCOORDFMT_NOT_PRESENT: break;
- default:
- fprintf(stderr, "bad texcoord fmt %d\n", i);
- return GL_FALSE;
- }
- lis2 >>= S2_TEXCOORD_FMT1_SHIFT;
- }
-
- if (sz != expected)
- fprintf(stderr, "vertex size mismatch %d/%d\n", sz, expected);
-
- return sz == expected;
-}
-
-
-static void i915_emit_invarient_state( struct intel_context *intel )
-{
- BATCH_LOCALS;
-
- BEGIN_BATCH( 200, 0 );
-
- OUT_BATCH(_3DSTATE_AA_CMD |
- AA_LINE_ECAAR_WIDTH_ENABLE |
- AA_LINE_ECAAR_WIDTH_1_0 |
- AA_LINE_REGION_WIDTH_ENABLE |
- AA_LINE_REGION_WIDTH_1_0);
-
- OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DFLT_Z_CMD);
- OUT_BATCH(0);
-
- /* Don't support texture crossbar yet */
- OUT_BATCH(_3DSTATE_COORD_SET_BINDINGS |
- CSB_TCB(0, 0) |
- CSB_TCB(1, 1) |
- CSB_TCB(2, 2) |
- CSB_TCB(3, 3) |
- CSB_TCB(4, 4) |
- CSB_TCB(5, 5) |
- CSB_TCB(6, 6) |
- CSB_TCB(7, 7));
-
- OUT_BATCH(_3DSTATE_RASTER_RULES_CMD |
- ENABLE_POINT_RASTER_RULE |
- OGL_POINT_RASTER_RULE |
- ENABLE_LINE_STRIP_PROVOKE_VRTX |
- ENABLE_TRI_FAN_PROVOKE_VRTX |
- LINE_STRIP_PROVOKE_VRTX(1) |
- TRI_FAN_PROVOKE_VRTX(2) |
- ENABLE_TEXKILL_3D_4D |
- TEXKILL_4D);
-
- /* Need to initialize this to zero.
- */
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
- I1_LOAD_S(3) |
- (1));
- OUT_BATCH(0);
-
- /* XXX: Use this */
- OUT_BATCH(_3DSTATE_SCISSOR_ENABLE_CMD |
- DISABLE_SCISSOR_RECT);
-
- OUT_BATCH(_3DSTATE_SCISSOR_RECT_0_CMD);
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE);
-
- OUT_BATCH(_3DSTATE_LOAD_INDIRECT | 0); /* disable indirect state */
- OUT_BATCH(0);
-
-
- /* Don't support twosided stencil yet */
- OUT_BATCH(_3DSTATE_BACKFACE_STENCIL_OPS |
- BFO_ENABLE_STENCIL_TWO_SIDE |
- 0 );
-
- ADVANCE_BATCH();
-}
-
-
-#define emit(intel, state, size ) \
- intel_batchbuffer_data(intel->batch, state, size, 0 )
-
-static GLuint get_dirty( struct i915_hw_state *state )
-{
- GLuint dirty;
-
- /* Workaround the multitex hang - if one texture unit state is
- * modified, emit all texture units.
- */
- dirty = state->active & ~state->emitted;
- if (dirty & I915_UPLOAD_TEX_ALL)
- state->emitted &= ~I915_UPLOAD_TEX_ALL;
- dirty = state->active & ~state->emitted;
-
- return dirty;
-}
-
-
-static GLuint get_state_size( struct i915_hw_state *state )
-{
- GLuint dirty = get_dirty(state);
- GLuint i;
- GLuint sz = 0;
-
- if (dirty & I915_UPLOAD_CTX)
- sz += sizeof(state->Ctx);
-
- if (dirty & I915_UPLOAD_BUFFERS)
- sz += sizeof(state->Buffer);
-
- if (dirty & I915_UPLOAD_STIPPLE)
- sz += sizeof(state->Stipple);
-
- if (dirty & I915_UPLOAD_FOG)
- sz += sizeof(state->Fog);
-
- if (dirty & I915_UPLOAD_TEX_ALL) {
- int nr = 0;
- for (i = 0; i < I915_TEX_UNITS; i++)
- if (dirty & I915_UPLOAD_TEX(i))
- nr++;
-
- sz += (2+nr*3) * sizeof(GLuint) * 2;
- }
-
- if (dirty & I915_UPLOAD_CONSTANTS)
- sz += state->ConstantSize * sizeof(GLuint);
-
- if (dirty & I915_UPLOAD_PROGRAM)
- sz += state->ProgramSize * sizeof(GLuint);
-
- return sz;
-}
-
-
-/* Push the state into the sarea and/or texture memory.
- */
-static void i915_emit_state( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- struct i915_hw_state *state = i915->current;
- int i;
- GLuint dirty = get_dirty(state);
- GLuint counter = intel->batch.counter;
- BATCH_LOCALS;
-
- if (intel->batch.space < get_state_size(state)) {
- intelFlushBatch(intel, GL_TRUE);
- dirty = get_dirty(state);
- counter = intel->batch.counter;
- }
-
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "%s dirty: %x\n", __FUNCTION__, dirty);
-
- if (dirty & I915_UPLOAD_INVARIENT) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_INVARIENT:\n");
- i915_emit_invarient_state( intel );
- }
-
- if (dirty & I915_UPLOAD_CTX) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_CTX:\n");
- emit(intel, state->Ctx, sizeof(state->Ctx) );
- }
-
- if (dirty & I915_UPLOAD_BUFFERS) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_BUFFERS:\n");
- BEGIN_BATCH(I915_DEST_SETUP_SIZE+2, 0);
- OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR0]);
- OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR1]);
- OUT_RELOC(state->draw_region->buffer, DRM_MM_TT|DRM_MM_WRITE,
- state->draw_region->draw_offset);
-
- if (state->depth_region) {
- OUT_BATCH(state->Buffer[I915_DESTREG_DBUFADDR0]);
- OUT_BATCH(state->Buffer[I915_DESTREG_DBUFADDR1]);
- OUT_RELOC(state->depth_region->buffer, DRM_MM_TT|DRM_MM_WRITE,
- state->depth_region->draw_offset);
- }
-
- OUT_BATCH(state->Buffer[I915_DESTREG_DV0]);
- OUT_BATCH(state->Buffer[I915_DESTREG_DV1]);
- OUT_BATCH(state->Buffer[I915_DESTREG_SENABLE]);
- OUT_BATCH(state->Buffer[I915_DESTREG_SR0]);
- OUT_BATCH(state->Buffer[I915_DESTREG_SR1]);
- OUT_BATCH(state->Buffer[I915_DESTREG_SR2]);
- ADVANCE_BATCH();
- }
-
- if (dirty & I915_UPLOAD_STIPPLE) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_STIPPLE:\n");
- emit(intel, state->Stipple, sizeof(state->Stipple) );
- }
-
- if (dirty & I915_UPLOAD_FOG) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_FOG:\n");
- emit(intel, state->Fog, sizeof(state->Fog) );
- }
-
- /* Combine all the dirty texture state into a single command to
- * avoid lockups on I915 hardware.
- */
- if (dirty & I915_UPLOAD_TEX_ALL) {
- int nr = 0;
-
- for (i = 0; i < I915_TEX_UNITS; i++)
- if (dirty & I915_UPLOAD_TEX(i))
- nr++;
-
- BEGIN_BATCH(2+nr*3, 0);
- OUT_BATCH(_3DSTATE_MAP_STATE | (3*nr));
- OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
- for (i = 0 ; i < I915_TEX_UNITS ; i++)
- if (dirty & I915_UPLOAD_TEX(i)) {
-
- if (state->tex_buffer[i]) {
- OUT_RELOC(state->tex_buffer[i],
- DRM_MM_TT|DRM_MM_READ,
- state->tex_offset[i]);
- }
- else {
- assert(i == 0);
- assert(state == &i915->meta);
- OUT_BATCH(0);
- }
-
- OUT_BATCH(state->Tex[i][I915_TEXREG_MS3]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_MS4]);
- }
- ADVANCE_BATCH();
-
- BEGIN_BATCH(2+nr*3, 0);
- OUT_BATCH(_3DSTATE_SAMPLER_STATE | (3*nr));
- OUT_BATCH((dirty & I915_UPLOAD_TEX_ALL) >> I915_UPLOAD_TEX_0_SHIFT);
- for (i = 0 ; i < I915_TEX_UNITS ; i++)
- if (dirty & I915_UPLOAD_TEX(i)) {
- OUT_BATCH(state->Tex[i][I915_TEXREG_SS2]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_SS3]);
- OUT_BATCH(state->Tex[i][I915_TEXREG_SS4]);
- }
- ADVANCE_BATCH();
- }
-
- if (dirty & I915_UPLOAD_CONSTANTS) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_CONSTANTS:\n");
- emit(intel, state->Constant, state->ConstantSize * sizeof(GLuint) );
- }
-
- if (dirty & I915_UPLOAD_PROGRAM) {
- if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_PROGRAM:\n");
-
- assert((state->Program[0] & 0x1ff)+2 == state->ProgramSize);
-
- emit(intel, state->Program, state->ProgramSize * sizeof(GLuint) );
- if (INTEL_DEBUG & DEBUG_STATE)
- i915_disassemble_program( state->Program, state->ProgramSize );
- }
-
- state->emitted |= dirty;
- intel->batch.last_emit_state = counter;
- assert(counter == intel->batch.counter);
-}
-
-static void i915_destroy_context( struct intel_context *intel )
-{
- _tnl_free_vertices(&intel->ctx);
-}
-
-<<<<<<< i915_vtbl.c
-
-/**
- * Set the color buffer drawing region.
- */
-static void
-i915_set_color_region( intelContextPtr intel, const intelRegion *region)
-=======
-
-/**
- * Set the drawing regions for the color and depth/stencil buffers.
- * This involves setting the pitch, cpp and buffer ID/location.
- * Also set pixel format for color and Z rendering
- * Used for setting both regular and meta state.
- */
-void
-i915_state_draw_region(struct intel_context *intel,
- struct i915_hw_state *state,
- struct intel_region *color_region,
- struct intel_region *depth_region)
->>>>>>> 1.5.4.17
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- GLuint value;
-
- ASSERT(state == &i915->state || state == &i915->meta);
-
- if (state->draw_region != color_region) {
- intel_region_release(intel, &state->draw_region);
- intel_region_reference(&state->draw_region, color_region);
- }
- if (state->depth_region != depth_region) {
- intel_region_release(intel, &state->depth_region);
- intel_region_reference(&state->depth_region, depth_region);
- }
-
- /*
- * Set stride/cpp values
- */
- if (color_region) {
- state->Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- state->Buffer[I915_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK |
- BUF_3D_PITCH(color_region->pitch * color_region->cpp) |
- BUF_3D_USE_FENCE);
- }
-
- if (depth_region) {
- state->Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
- state->Buffer[I915_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH |
- BUF_3D_PITCH(depth_region->pitch * depth_region->cpp) |
- BUF_3D_USE_FENCE);
- }
-
- /*
- * Compute/set I915_DESTREG_DV1 value
- */
- value = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- LOD_PRECLAMP_OGL |
- TEX_DEFAULT_COLOR_OGL);
- if (color_region && color_region->cpp == 4) {
- value |= DV_PF_8888;
- }
- else {
- value |= (DITHER_FULL_ALWAYS | DV_PF_565);
- }
- if (depth_region && depth_region->cpp == 4) {
- value |= DEPTH_FRMT_24_FIXED_8_OTHER;
- }
- else {
- value |= DEPTH_FRMT_16_FIXED;
- }
- state->Buffer[I915_DESTREG_DV1] = value;
-
- I915_STATECHANGE( i915, I915_UPLOAD_BUFFERS );
-<<<<<<< i915_vtbl.c
- i915->state.Buffer[I915_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(region->pitch) | BUF_3D_USE_FENCE);
- i915->state.Buffer[I915_DESTREG_CBUFADDR2] = region->offset;
-=======
->>>>>>> 1.5.4.17
-}
-
-<<<<<<< i915_vtbl.c
-
-/**
- * specify the z-buffer/stencil region
- */
-static void
-i915_set_z_region( intelContextPtr intel, const intelRegion *region)
-{
- i915ContextPtr i915 = I915_CONTEXT(intel);
- I915_STATECHANGE( i915, I915_UPLOAD_BUFFERS );
- i915->state.Buffer[I915_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH | BUF_3D_PITCH(region->pitch) | BUF_3D_USE_FENCE);
- i915->state.Buffer[I915_DESTREG_DBUFADDR2] = region->offset;
-}
-
-
-/**
- * Set both the color and Z/stencil drawing regions.
- * Similar to two previous functions, but don't use I915_STATECHANGE()
- */
-static void
-i915_update_color_z_regions(intelContextPtr intel,
- const intelRegion *colorRegion,
- const intelRegion *depthRegion)
-{
- i915ContextPtr i915 = I915_CONTEXT(intel);
-
- i915->state.Buffer[I915_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(colorRegion->pitch) | BUF_3D_USE_FENCE);
- i915->state.Buffer[I915_DESTREG_CBUFADDR2] = colorRegion->offset;
-
- i915->state.Buffer[I915_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH |
- BUF_3D_PITCH(depthRegion->pitch) | /* pitch in bytes */
- BUF_3D_USE_FENCE);
- i915->state.Buffer[I915_DESTREG_DBUFADDR2] = depthRegion->offset;
-}
-
-
-static void i915_lost_hardware( intelContextPtr intel )
-=======
-
-static void
-i915_set_draw_region(struct intel_context *intel,
- struct intel_region *color_region,
- struct intel_region *depth_region)
->>>>>>> 1.5.4.17
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- i915_state_draw_region(intel, &i915->state, color_region, depth_region);
-}
-
-
-
-static void i915_lost_hardware( struct intel_context *intel )
-{
- struct i915_context *i915 = i915_context(&intel->ctx);
- i915->state.emitted = 0;
-}
-
-static GLuint i915_flush_cmd( void )
-{
- return MI_FLUSH | FLUSH_MAP_CACHE;
-}
-
-
-void i915InitVtbl( struct i915_context *i915 )
-{
- i915->intel.vtbl.check_vertex_size = i915_check_vertex_size;
-<<<<<<< i915_vtbl.c
- i915->intel.vtbl.clear_with_tris = i915ClearWithTris;
- i915->intel.vtbl.rotate_window = i915RotateWindow;
-=======
->>>>>>> 1.5.4.17
- i915->intel.vtbl.destroy = i915_destroy_context;
- i915->intel.vtbl.emit_state = i915_emit_state;
- i915->intel.vtbl.lost_hardware = i915_lost_hardware;
- i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state;
- i915->intel.vtbl.render_start = i915_render_start;
-<<<<<<< i915_vtbl.c
- i915->intel.vtbl.set_color_region = i915_set_color_region;
- i915->intel.vtbl.set_z_region = i915_set_z_region;
- i915->intel.vtbl.update_color_z_regions = i915_update_color_z_regions;
-=======
- i915->intel.vtbl.set_draw_region = i915_set_draw_region;
->>>>>>> 1.5.4.17
- i915->intel.vtbl.update_texture_state = i915UpdateTextureState;
- i915->intel.vtbl.flush_cmd = i915_flush_cmd;
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_batchbuffer.c b/src/mesa/drivers/dri/i915-tex/intel_batchbuffer.c
deleted file mode 100644
index 35a8cad51f2..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_batchbuffer.c
+++ /dev/null
@@ -1,759 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-<<<<<<< intel_batchbuffer.c
-
-#include <stdio.h>
-#include <errno.h>
-
-#include "mtypes.h"
-#include "context.h"
-#include "enums.h"
-#include "vblank.h"
-
-#include "intel_reg.h"
-=======
->>>>>>> 1.4.2.16
-#include "intel_batchbuffer.h"
-#include "intel_ioctl.h"
-#include "intel_bufmgr.h"
-
-/* Relocations in kernel space:
- * - pass dma buffer seperately
- * - memory manager knows how to patch
- * - pass list of dependent buffers
- * - pass relocation list
- *
- * Either:
- * - get back an offset for buffer to fire
- * - memory manager knows how to fire buffer
- *
- * Really want the buffer to be AGP and pinned.
- *
- */
-
-/* Cliprect fence: The highest fence protecting a dma buffer
- * containing explicit cliprect information. Like the old drawable
- * lock but irq-driven. X server must wait for this fence to expire
- * before changing cliprects [and then doing sw rendering?]. For
- * other dma buffers, the scheduler will grab current cliprect info
- * and mix into buffer. X server must hold the lock while changing
- * cliprects??? Make per-drawable. Need cliprects in shared memory
- * -- beats storing them with every cmd buffer in the queue.
- *
- * ==> X server must wait for this fence to expire before touching the
- * framebuffer with new cliprects.
- *
- * ==> Cliprect-dependent buffers associated with a
- * cliprect-timestamp. All of the buffers associated with a timestamp
- * must go to hardware before any buffer with a newer timestamp.
- *
- * ==> Dma should be queued per-drawable for correct X/GL
- * synchronization. Or can fences be used for this?
- *
- * Applies to: Blit operations, metaops, X server operations -- X
- * server automatically waits on its own dma to complete before
- * modifying cliprects ???
- */
-
-static void intel_dump_batchbuffer( GLuint offset,
- GLuint *ptr,
- GLuint count )
-{
- int i;
- fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count/4);
- for (i = 0; i < count/4; i += 4)
- fprintf(stderr, "0x%x:\t0x%08x 0x%08x 0x%08x 0x%08x\n",
- offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
- fprintf(stderr, "END BATCH\n\n\n");
-}
-
-
-static void intel_batchbuffer_reset( struct intel_batchbuffer *batch )
-{
- bmBufferData(batch->bm,
- batch->buffer,
- BATCH_SZ,
- NULL,
- 0);
-
- if (!batch->list)
- batch->list = bmNewBufferList();
-
- drmMMClearBufList(batch->list);
- batch->list_count = 0;
- batch->nr_relocs = 0;
- batch->flags = 0;
-
- bmAddBuffer( batch->bm,
- batch->list,
- batch->buffer,
- DRM_MM_TT,
- NULL,
- &batch->offset[batch->list_count++]);
-
- batch->map = bmMapBuffer(batch->bm, batch->buffer, DRM_MM_WRITE);
- batch->ptr = batch->map;
-}
-
-/*======================================================================
- * Public functions
- */
-<<<<<<< intel_batchbuffer.c
-
-static void intel_fill_box( intelContextPtr intel,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLubyte r, GLubyte g, GLubyte b )
-{
- x += intel->drawX;
- y += intel->drawY;
-
- if (x >= 0 && y >= 0 &&
- x+w < intel->intelScreen->width &&
- y+h < intel->intelScreen->height)
- intelEmitFillBlitLocked( intel,
- intel->intelScreen->cpp,
- intel->intelScreen->back.pitch,
- intel->intelScreen->back.offset,
- x, y, w, h,
- INTEL_PACKCOLOR(intel->intelScreen->fbFormat,
- r,g,b,0xff));
-}
-
-static void intel_draw_performance_boxes( intelContextPtr intel )
-=======
-struct intel_batchbuffer *intel_batchbuffer_alloc( struct intel_context *intel )
->>>>>>> 1.4.2.16
-{
- struct intel_batchbuffer *batch = calloc(sizeof(*batch), 1);
-
- batch->intel = intel;
- batch->bm = intel->bm;
-
- bmGenBuffers(intel->bm, 1, &batch->buffer, BM_BATCHBUFFER);
- intel_batchbuffer_reset( batch );
- return batch;
-}
-
-void intel_batchbuffer_free( struct intel_batchbuffer *batch )
-{
- if (batch->map)
- bmUnmapBuffer(batch->bm, batch->buffer);
-
- free(batch);
-}
-
-/* TODO: Push this whole function into bufmgr.
- */
-static void do_flush_locked( struct intel_batchbuffer *batch,
- GLuint used,
- GLboolean ignore_cliprects,
- GLboolean allow_unlock)
-{
- GLuint *ptr;
- GLuint i;
-
- bmValidateBufferList( batch->bm,
- batch->list,
- DRM_MM_TT );
-
- /* Apply the relocations. This nasty map indicates to me that the
- * whole task should be done internally by the memory manager, and
- * that dma buffers probably need to be pinned within agp space.
- */
- ptr = (GLuint *)bmMapBuffer(batch->bm, batch->buffer, DRM_MM_WRITE);
-
-
- for (i = 0; i < batch->nr_relocs; i++) {
- struct buffer_reloc *r = &batch->reloc[i];
-
- assert(r->elem < batch->list_count);
- ptr[r->offset/4] = batch->offset[r->elem] + r->delta;
- }
-
- if (INTEL_DEBUG & DEBUG_DMA)
- intel_dump_batchbuffer( 0, ptr, used );
-
- bmUnmapBuffer(batch->bm, batch->buffer);
-
- /* Fire the batch buffer, which was uploaded above:
- */
-<<<<<<< intel_batchbuffer.c
- intel->vtbl.emit_state( intel );
-
- /* Make sure there is some space in this buffer:
- */
- if (intel->vertex_size * 10 * sizeof(GLuint) >= intel->batch.space) {
- intelFlushBatch(intel, GL_TRUE);
- intel->vtbl.emit_state( intel );
- }
-=======
->>>>>>> 1.4.2.16
-
-#if 1
- intel_batch_ioctl(batch->intel,
- batch->offset[0],
- used,
- ignore_cliprects,
- allow_unlock);
-#endif
-<<<<<<< intel_batchbuffer.c
-
- /* Emit a slot which will be filled with the inline primitive
- * command later.
- */
- BEGIN_BATCH(2);
- OUT_BATCH( 0 );
-
- intel->prim.start_ptr = batch_ptr;
- intel->prim.primitive = prim;
- intel->prim.flush = intel_flush_inline_primitive;
- intel->batch.contains_geometry = 1;
-
- OUT_BATCH( 0 );
- ADVANCE_BATCH();
-}
-
-
-void intelRestartInlinePrimitive( intelContextPtr intel )
-{
- GLuint prim = intel->prim.primitive;
-
- intel_flush_inline_primitive( &intel->ctx );
- if (1) intelFlushBatch(intel, GL_TRUE); /* GL_TRUE - is critical */
- intelStartInlinePrimitive( intel, prim );
-=======
- batch->last_fence = bmFenceBufferList(batch->bm, batch->list);
->>>>>>> 1.4.2.16
-}
-
-
-
-GLuint intel_batchbuffer_flush( struct intel_batchbuffer *batch )
-{
- struct intel_context *intel = batch->intel;
- GLuint used = batch->ptr - batch->map;
-
- if (used == 0)
- return batch->last_fence;
-
- /* Add the MI_BATCH_BUFFER_END. Always add an MI_FLUSH - this is a
- * performance drain that we would like to avoid.
- */
-<<<<<<< intel_batchbuffer.c
- intel->vtbl.emit_state( intel );
-
- if ((1+dwords)*4 >= intel->batch.space) {
- intelFlushBatch(intel, GL_TRUE);
- intel->vtbl.emit_state( intel );
- }
-
-
- if (1) {
- int used = dwords * 4;
- int vertcount;
-=======
- if (used & 4) {
- ((int *)batch->ptr)[0] = intel->vtbl.flush_cmd();
- ((int *)batch->ptr)[1] = 0;
- ((int *)batch->ptr)[2] = MI_BATCH_BUFFER_END;
- used += 12;
- }
- else {
- ((int *)batch->ptr)[0] = intel->vtbl.flush_cmd() ;
- ((int *)batch->ptr)[1] = MI_BATCH_BUFFER_END;
- used += 8;
- }
->>>>>>> 1.4.2.16
-
- bmUnmapBuffer(batch->bm, batch->buffer);
- batch->ptr = NULL;
- batch->map = NULL;
-
- /* TODO: Just pass the relocation list and dma buffer up to the
- * kernel.
- */
-<<<<<<< intel_batchbuffer.c
- BEGIN_BATCH(1 + dwords);
- OUT_BATCH( _3DPRIMITIVE |
- primitive |
- (dwords-1) );
-
- tmp = (GLuint *)batch_ptr;
- batch_ptr += dwords * 4;
-
- ADVANCE_BATCH();
-
- intel->batch.contains_geometry = 1;
-
- do_discard:
- return tmp;
-}
-
-
-static void intelWaitForFrameCompletion( intelContextPtr intel )
-{
- drm_i915_sarea_t *sarea = (drm_i915_sarea_t *)intel->sarea;
-
- if (intel->do_irqs) {
- if (intelGetLastFrame(intel) < sarea->last_dispatch) {
- if (!intel->irqsEmitted) {
- while (intelGetLastFrame (intel) < sarea->last_dispatch)
- ;
- }
- else {
- UNLOCK_HARDWARE( intel );
- intelWaitIrq( intel, intel->alloc.irq_emitted );
- LOCK_HARDWARE( intel );
- }
- intel->irqsEmitted = 10;
- }
-
- if (intel->irqsEmitted) {
- intelEmitIrqLocked( intel );
- intel->irqsEmitted--;
- }
- }
- else {
- while (intelGetLastFrame (intel) < sarea->last_dispatch) {
- UNLOCK_HARDWARE( intel );
- if (intel->do_usleeps)
- DO_USLEEP( 1 );
- LOCK_HARDWARE( intel );
- }
- }
-}
-
-/*
- * Copy the back buffer to the front buffer.
- */
-void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- intelContextPtr intel;
- GLboolean missed_target;
- int64_t ust;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
-
- intelFlush( &intel->ctx );
-
- LOCK_HARDWARE( intel );
- intelWaitForFrameCompletion( intel );
- UNLOCK_HARDWARE( intel );
- driWaitForVBlank( dPriv, &intel->vbl_seq, intel->vblank_flags, & missed_target );
-
- LOCK_HARDWARE( intel );
-=======
- if (!intel->locked)
->>>>>>> 1.4.2.16
- {
-<<<<<<< intel_batchbuffer.c
- const intelScreenPrivate *intelScreen = intel->intelScreen;
- const __DRIdrawablePrivate *dPriv = intel->driDrawable;
- const int nbox = dPriv->numClipRects;
- const drm_clip_rect_t *pbox = dPriv->pClipRects;
- const int cpp = intelScreen->cpp;
- const int pitch = intelScreen->front.pitch; /* in bytes */
- int i;
- GLuint CMD, BR13;
- BATCH_LOCALS;
-
- switch(cpp) {
- case 2:
- BR13 = (pitch) | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- case 4:
- BR13 = (pitch) | (0xCC << 16) | (1<<24) | (1<<25);
- CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB);
- break;
- default:
- BR13 = (pitch) | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- }
-
- if (0)
- intel_draw_performance_boxes( intel );
-
- for (i = 0 ; i < nbox; i++, pbox++)
- {
- if (pbox->x1 > pbox->x2 ||
- pbox->y1 > pbox->y2 ||
- pbox->x2 > intelScreen->width ||
- pbox->y2 > intelScreen->height) {
- _mesa_warning(&intel->ctx, "Bad cliprect in intelCopyBuffer()");
- continue;
- }
-
- BEGIN_BATCH( 8);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
- OUT_BATCH( (pbox->y2 << 16) | pbox->x2 );
-
- if (intel->sarea->pf_current_page == 0)
- OUT_BATCH( intelScreen->front.offset );
- else
- OUT_BATCH( intelScreen->back.offset );
-
- OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
- OUT_BATCH( BR13 & 0xffff );
-
- if (intel->sarea->pf_current_page == 0)
- OUT_BATCH( intelScreen->back.offset );
- else
- OUT_BATCH( intelScreen->front.offset );
-=======
- assert(!(batch->flags & INTEL_BATCH_NO_CLIPRECTS));
->>>>>>> 1.4.2.16
-
- LOCK_HARDWARE(intel);
- do_flush_locked(batch, used, GL_FALSE, GL_TRUE);
- UNLOCK_HARDWARE(intel);
- }
-<<<<<<< intel_batchbuffer.c
- intelFlushBatchLocked( intel, GL_TRUE, GL_TRUE, GL_TRUE );
- UNLOCK_HARDWARE( intel );
-
- intel->swap_count++;
- (*dri_interface->getUST)(&ust);
- if (missed_target) {
- intel->swap_missed_count++;
- intel->swap_missed_ust = ust - intel->swap_ust;
- }
-
- intel->swap_ust = ust;
-}
-
-
-
-
-void intelEmitFillBlitLocked( intelContextPtr intel,
- GLuint cpp,
- GLshort dst_pitch, /* in bytes */
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLuint color )
-{
- GLuint BR13, CMD;
- BATCH_LOCALS;
-
- switch(cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = dst_pitch | (0xF0 << 16) | (1<<24);
- CMD = XY_COLOR_BLT_CMD;
- break;
- case 4:
- BR13 = dst_pitch | (0xF0 << 16) | (1<<24) | (1<<25);
- CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- break;
- default:
- return;
-=======
- else {
- GLboolean ignore_cliprects = !(batch->flags & INTEL_BATCH_CLIPRECTS);
- do_flush_locked(batch, used, ignore_cliprects, GL_FALSE);
->>>>>>> 1.4.2.16
- }
-
- /* Reset the buffer:
- */
- intel_batchbuffer_reset( batch );
- return batch->last_fence;
-}
-
-void intel_batchbuffer_finish( struct intel_batchbuffer *batch )
-{
- bmFinishFence(batch->bm,
- intel_batchbuffer_flush(batch));
-}
-<<<<<<< intel_batchbuffer.c
-
-
-
-void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch)
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- intelScreenPrivate *intelScreen = intel->intelScreen;
- GLuint clear_depth, clear_color;
- GLint cx, cy;
- GLint pitch;
- GLint cpp = intelScreen->cpp;
- GLint i;
- GLuint BR13, CMD, D_CMD;
- BATCH_LOCALS;
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
-
- pitch = intelScreen->front.pitch;
-
- clear_color = intel->ClearColor;
- clear_depth = 0;
-=======
-
->>>>>>> 1.4.2.16
-
-/* This is the only way buffers get added to the validate list.
- */
-GLboolean intel_batchbuffer_emit_reloc( struct intel_batchbuffer *batch,
- GLuint buffer,
- GLuint flags,
- GLuint delta )
-{
- GLuint i;
-
- assert(batch->nr_relocs <= MAX_RELOCS);
-
- i = bmScanBufferList(batch->bm, batch->list, buffer);
- if (i == -1) {
- i = batch->list_count;
- bmAddBuffer(batch->bm,
- batch->list,
- buffer,
- flags,
- NULL,
- &batch->offset[batch->list_count++]);
- }
-
-<<<<<<< intel_batchbuffer.c
- if (flags & BUFFER_BIT_STENCIL) {
- clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
- }
-
- switch(cpp) {
- case 2:
- BR13 = (0xF0 << 16) | (pitch) | (1<<24);
- D_CMD = CMD = XY_COLOR_BLT_CMD;
- break;
- case 4:
- BR13 = (0xF0 << 16) | (pitch) | (1<<24) | (1<<25);
- CMD = (XY_COLOR_BLT_CMD |
- XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- D_CMD = XY_COLOR_BLT_CMD;
- if (flags & BUFFER_BIT_DEPTH) D_CMD |= XY_COLOR_BLT_WRITE_RGB;
- if (flags & BUFFER_BIT_STENCIL) D_CMD |= XY_COLOR_BLT_WRITE_ALPHA;
- break;
- default:
- BR13 = (0xF0 << 16) | (pitch) | (1<<24);
- D_CMD = CMD = XY_COLOR_BLT_CMD;
- break;
-=======
- {
- struct buffer_reloc *r = &batch->reloc[batch->nr_relocs++];
- r->offset = batch->ptr - batch->map;
- r->delta = delta;
- r->elem = i;
->>>>>>> 1.4.2.16
- }
-
-<<<<<<< intel_batchbuffer.c
- {
- /* flip top to bottom */
- cy = intel->driDrawable->h-cy1-ch;
- cx = cx1 + intel->drawX;
- cy += intel->drawY;
-
- /* adjust for page flipping */
- if ( intel->sarea->pf_current_page == 1 ) {
- GLuint tmp = flags;
-
- flags &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
- if ( tmp & BUFFER_BIT_FRONT_LEFT ) flags |= BUFFER_BIT_BACK_LEFT;
- if ( tmp & BUFFER_BIT_BACK_LEFT ) flags |= BUFFER_BIT_FRONT_LEFT;
- }
-
- for (i = 0 ; i < intel->numClipRects ; i++)
- {
- drm_clip_rect_t *box = &intel->pClipRects[i];
- drm_clip_rect_t b;
-
- if (!all) {
- GLint x = box[i].x1;
- GLint y = box[i].y1;
- GLint w = box[i].x2 - x;
- GLint h = box[i].y2 - y;
-
- if (x < cx) w -= cx - x, x = cx;
- if (y < cy) h -= cy - y, y = cy;
- if (x + w > cx + cw) w = cx + cw - x;
- if (y + h > cy + ch) h = cy + ch - y;
- if (w <= 0) continue;
- if (h <= 0) continue;
-
- b.x1 = x;
- b.y1 = y;
- b.x2 = x + w;
- b.y2 = y + h;
- } else {
- b = *box;
- }
-
-
- if (b.x1 > b.x2 ||
- b.y1 > b.y2 ||
- b.x2 > intelScreen->width ||
- b.y2 > intelScreen->height)
- continue;
-
- if ( flags & BUFFER_BIT_FRONT_LEFT ) {
- BEGIN_BATCH( 6);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_BATCH( intelScreen->front.offset );
- OUT_BATCH( clear_color );
- ADVANCE_BATCH();
- }
-
- if ( flags & BUFFER_BIT_BACK_LEFT ) {
- BEGIN_BATCH( 6);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_BATCH( intelScreen->back.offset );
- OUT_BATCH( clear_color );
- ADVANCE_BATCH();
- }
-
- if ( flags & (BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH) ) {
- BEGIN_BATCH( 6);
- OUT_BATCH( D_CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_BATCH( intelScreen->depth.offset );
- OUT_BATCH( clear_depth );
- ADVANCE_BATCH();
- }
- }
- }
- intelFlushBatchLocked( intel, GL_TRUE, GL_FALSE, GL_TRUE );
- UNLOCK_HARDWARE( intel );
-=======
- batch->ptr += 4;
- return GL_TRUE;
->>>>>>> 1.4.2.16
-}
-
-
-
-void intel_batchbuffer_data(struct intel_batchbuffer *batch,
- const void *data,
- GLuint bytes,
- GLuint flags)
-{
-<<<<<<< intel_batchbuffer.c
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- if (intel->alloc.offset) {
- intelFreeAGP( intel, intel->alloc.ptr );
- intel->alloc.ptr = NULL;
- intel->alloc.offset = 0;
- }
- else if (intel->alloc.ptr) {
- free(intel->alloc.ptr);
- intel->alloc.ptr = NULL;
- }
-
- memset(&intel->batch, 0, sizeof(intel->batch));
-=======
- assert((bytes & 3) == 0);
- intel_batchbuffer_require_space(batch, bytes, flags);
- __memcpy(batch->ptr, data, bytes);
- batch->ptr += bytes;
->>>>>>> 1.4.2.16
-}
-
-<<<<<<< intel_batchbuffer.c
-
-void intelInitBatchBuffer( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- /* This path isn't really safe with rotate:
- */
- if (getenv("INTEL_BATCH") && intel->intelScreen->allow_batchbuffer) {
- switch (intel->intelScreen->deviceID) {
- case PCI_CHIP_I865_G:
- /* HW bug? Seems to crash if batchbuffer crosses 4k boundary.
- */
- intel->alloc.size = 8 * 1024;
- break;
- default:
- /* This is the smallest amount of memory the kernel deals with.
- * We'd ideally like to make this smaller.
- */
- intel->alloc.size = 1 << intel->intelScreen->logTextureGranularity;
- break;
- }
-
- /* KW: temporary - this make crashes & lockups more frequent, so
- * leave in until they are solved.
- */
- intel->alloc.size = 8 * 1024;
-
- intel->alloc.ptr = intelAllocateAGP( intel, intel->alloc.size );
- if (intel->alloc.ptr)
- intel->alloc.offset =
- intelAgpOffsetFromVirtual( intel, intel->alloc.ptr );
- else
- intel->alloc.offset = 0; /* OK? */
- }
-
- /* The default is now to use a local buffer and pass that to the
- * kernel. This is also a fallback if allocation fails on the
- * above path:
- */
- if (!intel->alloc.ptr) {
- intel->alloc.size = 8 * 1024;
- intel->alloc.ptr = malloc( intel->alloc.size );
- intel->alloc.offset = 0;
- }
-
- assert(intel->alloc.ptr);
-}
-=======
->>>>>>> 1.4.2.16
diff --git a/src/mesa/drivers/dri/i915-tex/intel_batchbuffer.h b/src/mesa/drivers/dri/i915-tex/intel_batchbuffer.h
deleted file mode 100644
index 322ec944190..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_batchbuffer.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef INTEL_BATCHBUFFER_H
-#define INTEL_BATCHBUFFER_H
-
-#include "mtypes.h"
-#include "intel_bufmgr.h"
-
-struct intel_context;
-
-#define BATCH_SZ 4096
-#define BATCH_RESERVED 16
-
-#define MAX_RELOCS 100
-
-#define INTEL_BATCH_NO_CLIPRECTS 0x1
-#define INTEL_BATCH_CLIPRECTS 0x2
-
-struct buffer_reloc {
- GLuint offset;
- GLuint elem; /* elem in buffer list, not buffer id */
- GLuint delta; /* not needed? */
-};
-
-struct intel_batchbuffer {
- struct bufmgr *bm;
- struct intel_context *intel;
-
- GLuint buffer;
- GLuint last_fence;
- GLuint flags;
-
- /* In progress:
- */
- unsigned long offset[MAX_RELOCS];
- struct _drmMMBufList *list;
- GLuint list_count;
- GLubyte *map;
- GLubyte *ptr;
-
- struct buffer_reloc reloc[MAX_RELOCS];
- GLuint nr_relocs;
-};
-
-struct intel_batchbuffer *intel_batchbuffer_alloc( struct intel_context *intel );
-
-void intel_batchbuffer_free( struct intel_batchbuffer *batch );
-
-
-<<<<<<< intel_batchbuffer.h
-#define BEGIN_BATCH(n) \
-do { \
- if (VERBOSE) fprintf(stderr, \
- "BEGIN_BATCH(%d) in %s, %d dwords free\n", \
- (n), __FUNCTION__, intel->batch.space/4); \
- if (intel->batch.space < (n)*4) \
- intelFlushBatch(intel, GL_TRUE); \
- if (intel->batch.space == intel->batch.size) intel->batch.func = __FUNCTION__; \
- batch_ptr = intel->batch.ptr; \
-} while (0)
-=======
-void intel_batchbuffer_finish( struct intel_batchbuffer *batch );
->>>>>>> 1.2.12.12
-
-GLuint intel_batchbuffer_flush( struct intel_batchbuffer *batch );
-
-
-/* Unlike bmBufferData, this currently requires the buffer be mapped.
- * Consider it a convenience function wrapping multple
- * intel_buffer_dword() calls.
- */
-void intel_batchbuffer_data(struct intel_batchbuffer *batch,
- const void *data,
- GLuint bytes,
- GLuint flags);
-
-void intel_batchbuffer_release_space(struct intel_batchbuffer *batch,
- GLuint bytes);
-
-GLboolean intel_batchbuffer_emit_reloc( struct intel_batchbuffer *batch,
- GLuint buffer,
- GLuint flags,
- GLuint offset );
-
-/* Inline functions - might actually be better off with these
- * non-inlined. Certainly better off switching all command packets to
- * be passed as structs rather than dwords, but that's a little bit of
- * work...
- */
-static INLINE GLuint
-intel_batchbuffer_space( struct intel_batchbuffer *batch )
-{
- return (BATCH_SZ - BATCH_RESERVED) - (batch->ptr - batch->map);
-}
-
-
-static INLINE void
-intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch,
- GLuint dword)
-{
- assert(batch->map);
- assert(intel_batchbuffer_space(batch) >= 4);
- *(GLuint *)(batch->ptr) = dword;
- batch->ptr += 4;
-}
-
-static INLINE void
-intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
- GLuint sz,
- GLuint flags)
-{
- assert(sz < BATCH_SZ - 8);
- if (intel_batchbuffer_space(batch) < sz ||
- (batch->flags != 0 && flags != 0 && batch->flags != flags))
- intel_batchbuffer_flush(batch);
-
- batch->flags |= flags;
-}
-
-/* Here are the crusty old macros, to be removed:
- */
-#define BATCH_LOCALS
-
-#define BEGIN_BATCH(n, flags) do { \
- assert(!intel->prim.flush); \
- intel_batchbuffer_require_space(intel->batch, (n)*4, flags); \
-} while (0)
-
-#define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
-
-#define OUT_RELOC(buf,flags,delta) do { \
- assert((delta) >= 0); \
- intel_batchbuffer_emit_reloc(intel->batch, buf, flags, delta); \
-} while (0)
-
-#define ADVANCE_BATCH() do { } while(0)
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_blit.c b/src/mesa/drivers/dri/i915-tex/intel_blit.c
deleted file mode 100644
index aefc3b39187..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_blit.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include <stdio.h>
-#include <errno.h>
-
-#include "mtypes.h"
-#include "context.h"
-#include "enums.h"
-
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_buffers.h"
-#include "intel_context.h"
-#include "intel_fbo.h"
-#include "intel_reg.h"
-#include "intel_regions.h"
-
-#include "intel_bufmgr.h"
-
-
-/**
- * Copy the back color buffer to the front color buffer.
- * Used for SwapBuffers().
- */
-void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
-{
- GET_CURRENT_CONTEXT(ctx);
- struct intel_context *intel;
-
- DBG("%s\n", __FUNCTION__);
-
- assert(dPriv);
-
- /* We need a rendering context in order to issue the blit cmd.
- * Use the current context.
- * XXX need to fix this someday.
- */
- if (!ctx) {
- _mesa_problem(NULL, "No current context in intelCopyBuffer()");
- return;
- }
- intel = (struct intel_context *) ctx;
-
- bmFinishFence(intel->bm, intel->last_swap_fence);
-
- /* The LOCK_HARDWARE is required for the cliprects. Buffer offsets
- * should work regardless.
- */
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable &&
- intel->driDrawable->numClipRects)
- {
- const intelScreenPrivate *intelScreen = intel->intelScreen;
- struct gl_framebuffer *fb
- = (struct gl_framebuffer *) dPriv->driverPrivate;
- const struct intel_region *frontRegion
- = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
- const struct intel_region *backRegion
- = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
- const int nbox = dPriv->numClipRects;
- const drm_clip_rect_t *pbox = dPriv->pClipRects;
- const int pitch = frontRegion->pitch;
- const int cpp = frontRegion->cpp;
- int BR13, CMD;
- int i;
-
- ASSERT(fb);
- ASSERT(fb->Name == 0); /* Not a user-created FBO */
- ASSERT(frontRegion);
- ASSERT(backRegion);
- ASSERT(frontRegion->pitch == backRegion->pitch);
- ASSERT(frontRegion->cpp == backRegion->cpp);
-
- if (cpp == 2) {
- BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- }
- else {
- BR13 = (pitch * cpp) | (0xCC << 16) | (1<<24) | (1<<25);
- CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB);
- }
-
- for (i = 0 ; i < nbox; i++, pbox++)
- {
- if (pbox->x1 > pbox->x2 ||
- pbox->y1 > pbox->y2 ||
- pbox->x2 > intelScreen->width ||
- pbox->y2 > intelScreen->height)
- continue;
-
- BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
- OUT_BATCH( (pbox->y2 << 16) | pbox->x2 );
-
- if (intel->sarea->pf_current_page == 0)
- OUT_RELOC( frontRegion->buffer, DRM_MM_TT|DRM_MM_WRITE, 0 );
- else
- OUT_RELOC( backRegion->buffer, DRM_MM_TT|DRM_MM_WRITE, 0 );
- OUT_BATCH( (pbox->y1 << 16) | pbox->x1 );
- OUT_BATCH( BR13 & 0xffff );
-
- if (intel->sarea->pf_current_page == 0)
- OUT_RELOC( backRegion->buffer, DRM_MM_TT|DRM_MM_READ, 0 );
- else
- OUT_RELOC( frontRegion->buffer, DRM_MM_TT|DRM_MM_READ, 0 );
-
- ADVANCE_BATCH();
- }
-
- intel->last_swap_fence = intel_batchbuffer_flush( intel->batch );
- }
- UNLOCK_HARDWARE( intel );
-}
-
-
-
-
-void intelEmitFillBlit( struct intel_context *intel,
- GLuint cpp,
- GLshort dst_pitch,
- GLuint dst_buffer,
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLuint color )
-{
- GLuint BR13, CMD;
- BATCH_LOCALS;
-
- dst_pitch *= cpp;
-
- switch(cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = dst_pitch | (0xF0 << 16) | (1<<24);
- CMD = XY_COLOR_BLT_CMD;
- break;
- case 4:
- BR13 = dst_pitch | (0xF0 << 16) | (1<<24) | (1<<25);
- CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- break;
- default:
- return;
- }
-
- BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (y << 16) | x );
- OUT_BATCH( ((y+h) << 16) | (x+w) );
- OUT_RELOC( dst_buffer, DRM_MM_TT|DRM_MM_WRITE, dst_offset );
- OUT_BATCH( color );
- ADVANCE_BATCH();
-}
-
-
-/* Copy BitBlt
- */
-void intelEmitCopyBlit( struct intel_context *intel,
- GLuint cpp,
- GLshort src_pitch,
- GLuint src_buffer,
- GLuint src_offset,
- GLshort dst_pitch,
- GLuint dst_buffer,
- GLuint dst_offset,
- GLshort src_x, GLshort src_y,
- GLshort dst_x, GLshort dst_y,
- GLshort w, GLshort h )
-{
- GLuint CMD, BR13;
- int dst_y2 = dst_y + h;
- int dst_x2 = dst_x + w;
- BATCH_LOCALS;
-
-
- DBG("%s src:buf(%d)/%d+%d %d,%d dst:buf(%d)/%d+%d %d,%d sz:%dx%d\n",
- __FUNCTION__,
- src_buffer, src_pitch, src_offset, src_x, src_y,
- dst_buffer, dst_pitch, dst_offset, dst_x, dst_y,
- w,h);
-
- src_pitch *= cpp;
- dst_pitch *= cpp;
-
- switch(cpp) {
- case 1:
- case 2:
- case 3:
- BR13 = (((GLint)dst_pitch)&0xffff) | (0xCC << 16) | (1<<24);
- CMD = XY_SRC_COPY_BLT_CMD;
- break;
- case 4:
- BR13 = (((GLint)dst_pitch)&0xffff) | (0xCC << 16) | (1<<24) | (1<<25);
- CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
- XY_SRC_COPY_BLT_WRITE_RGB);
- break;
- default:
- return;
- }
-
- if (dst_y2 < dst_y ||
- dst_x2 < dst_x) {
- return;
- }
-
- /* Initial y values don't seem to work with negative pitches. If
- * we adjust the offsets manually (below), it seems to work fine.
- *
- * On the other hand, if we always adjust, the hardware doesn't
- * know which blit directions to use, so overlapping copypixels get
- * the wrong result.
- */
- if ( dst_pitch > 0 &&
- src_pitch > 0) {
- BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (dst_y << 16) | dst_x );
- OUT_BATCH( (dst_y2 << 16) | dst_x2 );
- OUT_RELOC( dst_buffer, DRM_MM_TT|DRM_MM_WRITE, dst_offset );
- OUT_BATCH( (src_y << 16) | src_x );
- OUT_BATCH( ((GLint)src_pitch&0xffff) );
- OUT_RELOC( src_buffer, DRM_MM_TT|DRM_MM_READ, src_offset );
- ADVANCE_BATCH();
- }
- else {
- BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (0 << 16) | dst_x );
- OUT_BATCH( (h << 16) | dst_x2 );
- OUT_RELOC( dst_buffer, DRM_MM_TT|DRM_MM_WRITE, dst_offset + dst_y * dst_pitch );
- OUT_BATCH( (0 << 16) | src_x );
- OUT_BATCH( ((GLint)src_pitch&0xffff) );
- OUT_RELOC( src_buffer, DRM_MM_TT|DRM_MM_READ, src_offset + src_y * src_pitch );
- ADVANCE_BATCH();
- }
-}
-
-
-/**
- * Use blitting to clear the renderbuffers named by 'flags'.
- * Note: we can't use the ctx->DrawBuffer->_ColorDrawBufferMask field
- * since that might include software renderbuffers or renderbuffers
- * which we're clearing with triangles.
- * \param mask bitmask of BUFFER_BIT_* values indicating buffers to clear
- */
-void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- struct intel_context *intel = intel_context( ctx );
- GLuint clear_depth;
- GLbitfield skipBuffers = 0;
- BATCH_LOCALS;
-
- if (INTEL_DEBUG & DEBUG_DRI)
- _mesa_printf("%s %x\n", __FUNCTION__, mask);
-
- /*
- * Compute values for clearing the buffers.
- */
- clear_depth = 0;
- if (mask & BUFFER_BIT_DEPTH) {
- clear_depth = (GLuint) (ctx->DrawBuffer->_DepthMax * ctx->Depth.Clear);
- }
- if (mask & BUFFER_BIT_STENCIL) {
- clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
- }
-
- /* If clearing both depth and stencil, skip BUFFER_BIT_STENCIL in
- * the loop below.
- */
- if ((mask & BUFFER_BIT_DEPTH) && (mask & BUFFER_BIT_STENCIL)) {
- skipBuffers = BUFFER_BIT_STENCIL;
- }
-
- /* XXX Move this flush/lock into the following conditional? */
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
-
- if (intel->numClipRects)
- {
- drm_clip_rect_t clear;
- int i;
-
- if (intel->ctx.DrawBuffer->Name == 0) {
- /* clearing a window */
-
- /* flip top to bottom */
- clear.x1 = cx + intel->drawX;
- clear.y1 = intel->driDrawable->y + intel->driDrawable->h - cy - ch;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
-
- /* adjust for page flipping */
- if ( intel->sarea->pf_current_page == 1 ) {
- const GLuint tmp = mask;
- mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
- if ( tmp & BUFFER_BIT_FRONT_LEFT ) mask |= BUFFER_BIT_BACK_LEFT;
- if ( tmp & BUFFER_BIT_BACK_LEFT ) mask |= BUFFER_BIT_FRONT_LEFT;
- }
- }
- else {
- /* clearing FBO */
- ASSERT(intel->numClipRects == 1);
- ASSERT(intel->pClipRects == &intel->fboRect);
- clear.x1 = cx;
- clear.y1 = intel->ctx.DrawBuffer->Height - cy - ch;
- clear.x2 = clear.y1 + cw;
- clear.y2 = clear.y1 + ch;
- /* no change to mask */
- }
-
- for (i = 0 ; i < intel->numClipRects ; i++)
- {
- const drm_clip_rect_t *box = &intel->pClipRects[i];
- drm_clip_rect_t b;
- GLuint buf;
- GLuint clearMask = mask; /* use copy, since we modify it below */
-
- if (!all) {
- intel_intersect_cliprects(&b, &clear, box);
- } else {
- b = *box;
- }
-
- if (0)
- _mesa_printf("clear %d,%d..%d,%d, mask %x\n",
- b.x1, b.y1,
- b.x2, b.y2,
- mask);
-
- /* Loop over all renderbuffers */
- for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) {
- const GLbitfield bufBit = 1 << buf;
- if ((clearMask & bufBit) && !(bufBit & skipBuffers)) {
- /* OK, clear this renderbuffer */
- const struct intel_renderbuffer *irb
- = intel_renderbuffer(ctx->DrawBuffer->
- Attachment[buf].Renderbuffer);
- GLuint clearVal;
- GLint pitch, cpp;
- GLuint BR13, CMD;
-
- ASSERT(irb);
- ASSERT(irb->region);
-
- pitch = irb->region->pitch;
- cpp = irb->region->cpp;
-
- /* Setup the blit command */
- if (cpp == 4) {
- BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24) | (1<<25);
- if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
- CMD = XY_COLOR_BLT_CMD;
- if (clearMask & BUFFER_BIT_DEPTH)
- CMD |= XY_COLOR_BLT_WRITE_RGB;
- if (clearMask & BUFFER_BIT_STENCIL)
- CMD |= XY_COLOR_BLT_WRITE_ALPHA;
- }
- else {
- /* clearing RGBA */
- CMD = (XY_COLOR_BLT_CMD |
- XY_COLOR_BLT_WRITE_ALPHA |
- XY_COLOR_BLT_WRITE_RGB);
- }
- }
- else {
- ASSERT(cpp == 2 || cpp == 0);
- BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24);
- CMD = XY_COLOR_BLT_CMD;
- }
-
- if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
- clearVal = clear_depth;
- }
- else {
- clearVal = (cpp == 4)
- ? intel->ClearColor8888 : intel->ClearColor565;
- }
- /*
- _mesa_debug(ctx, "hardware blit clear buf %d rb id %d\n",
- buf, irb->Base.Name);
- */
- BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS);
- OUT_BATCH( CMD );
- OUT_BATCH( BR13 );
- OUT_BATCH( (b.y1 << 16) | b.x1 );
- OUT_BATCH( (b.y2 << 16) | b.x2 );
- OUT_RELOC( irb->region->buffer, DRM_MM_TT|DRM_MM_WRITE,
- irb->region->draw_offset );
- OUT_BATCH( clearVal );
- ADVANCE_BATCH();
- clearMask &= ~bufBit; /* turn off bit, for faster loop exit */
- }
- }
- }
- intel_batchbuffer_flush( intel->batch );
- }
-
- UNLOCK_HARDWARE( intel );
-}
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_blit.h b/src/mesa/drivers/dri/i915-tex/intel_blit.h
deleted file mode 100644
index 0bbdb0a7ed8..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_blit.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_BLIT_H
-#define INTEL_BLIT_H
-
-#include "intel_context.h"
-#include "intel_ioctl.h"
-
-extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv );
-extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx1, GLint cy1, GLint cw, GLint ch);
-
-extern void intelEmitCopyBlit( struct intel_context *intel,
- GLuint cpp,
- GLshort src_pitch,
- GLuint src_buffer,
- GLuint src_offset,
- GLshort dst_pitch,
- GLuint dst_buffer,
- GLuint dst_offset,
- GLshort srcx, GLshort srcy,
- GLshort dstx, GLshort dsty,
- GLshort w, GLshort h );
-
-extern void intelEmitFillBlit( struct intel_context *intel,
- GLuint cpp,
- GLshort dst_pitch,
- GLuint dst_buffer,
- GLuint dst_offset,
- GLshort x, GLshort y,
- GLshort w, GLshort h,
- GLuint color );
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_buffer_objects.c b/src/mesa/drivers/dri/i915-tex/intel_buffer_objects.c
deleted file mode 100644
index 9ef14268d5c..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_buffer_objects.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include "imports.h"
-#include "mtypes.h"
-#include "bufferobj.h"
-
-#include "intel_context.h"
-#include "intel_buffer_objects.h"
-#include "intel_bufmgr.h"
-
-
-/**
- * There is some duplication between mesa's bufferobjects and our
- * bufmgr buffers. Both have an integer handle and a hashtable to
- * lookup an opaque structure. It would be nice if the handles and
- * internal structure where somehow shared.
- */
-static struct gl_buffer_object *intel_bufferobj_alloc( GLcontext *ctx,
- GLuint name,
- GLenum target )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *obj = MALLOC_STRUCT(intel_buffer_object);
-
- _mesa_initialize_buffer_object(&obj->Base, name, target);
-
- /* XXX: We generate our own handle, which is different to 'name' above.
- */
- bmGenBuffers(intel->bm, 1, &obj->buffer, 0);
-
- return &obj->Base;
-}
-
-
-/**
- * Deallocate/free a vertex/pixel buffer object.
- * Called via glDeleteBuffersARB().
- */
-static void intel_bufferobj_free( GLcontext *ctx,
- struct gl_buffer_object *obj )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-
- assert(intel_obj);
-
- if (intel_obj->buffer)
- bmDeleteBuffers( intel->bm, 1, &intel_obj->buffer );
-
- _mesa_free(intel_obj);
-}
-
-
-
-/**
- * Allocate space for and store data in a buffer object. Any data that was
- * previously stored in the buffer object is lost. If data is NULL,
- * memory will be allocated, but no copy will occur.
- * Called via glBufferDataARB().
- */
-static void intel_bufferobj_data( GLcontext *ctx,
- GLenum target,
- GLsizeiptrARB size,
- const GLvoid *data,
- GLenum usage,
- struct gl_buffer_object *obj )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-
- /* XXX: do something useful with 'usage' (eg. populate flags
- * argument below)
- */
- assert(intel_obj);
-
- obj->Size = size;
- obj->Usage = usage;
-
- bmBufferData(intel->bm, intel_obj->buffer, size, data, 0);
-}
-
-
-/**
- * Replace data in a subrange of buffer object. If the data range
- * specified by size + offset extends beyond the end of the buffer or
- * if data is NULL, no copy is performed.
- * Called via glBufferSubDataARB().
- */
-static void intel_bufferobj_subdata( GLcontext *ctx,
- GLenum target,
- GLintptrARB offset,
- GLsizeiptrARB size,
- const GLvoid * data,
- struct gl_buffer_object * obj )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-
- assert(intel_obj);
- bmBufferSubData(intel->bm, intel_obj->buffer, offset, size, data);
-}
-
-
-/**
- * Called via glGetBufferSubDataARB().
- */
-static void intel_bufferobj_get_subdata( GLcontext *ctx,
- GLenum target,
- GLintptrARB offset,
- GLsizeiptrARB size,
- GLvoid * data,
- struct gl_buffer_object * obj )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-
- assert(intel_obj);
- bmBufferGetSubData(intel->bm, intel_obj->buffer, offset, size, data);
-}
-
-
-
-/**
- * Called via glMapBufferARB().
- */
-static void *intel_bufferobj_map( GLcontext *ctx,
- GLenum target,
- GLenum access,
- struct gl_buffer_object *obj )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-
- /* XXX: Translate access to flags arg below:
- */
- assert(intel_obj);
- obj->Pointer = bmMapBuffer(intel->bm, intel_obj->buffer, 0);
- return obj->Pointer;
-}
-
-
-/**
- * Called via glMapBufferARB().
- */
-static GLboolean intel_bufferobj_unmap( GLcontext *ctx,
- GLenum target,
- struct gl_buffer_object *obj )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
-
- assert(intel_obj);
- assert(obj->Pointer);
- bmUnmapBuffer(intel->bm, intel_obj->buffer);
- obj->Pointer = NULL;
- return GL_TRUE;
-}
-
-GLuint intel_bufferobj_buffer( const struct intel_buffer_object *intel_obj )
-{
- return intel_obj->buffer;
-}
-
-void intel_bufferobj_init( struct intel_context *intel )
-{
- GLcontext *ctx = &intel->ctx;
-
- ctx->Driver.NewBufferObject = intel_bufferobj_alloc;
- ctx->Driver.DeleteBuffer = intel_bufferobj_free;
- ctx->Driver.BufferData = intel_bufferobj_data;
- ctx->Driver.BufferSubData = intel_bufferobj_subdata;
- ctx->Driver.GetBufferSubData = intel_bufferobj_get_subdata;
- ctx->Driver.MapBuffer = intel_bufferobj_map;
- ctx->Driver.UnmapBuffer = intel_bufferobj_unmap;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_buffer_objects.h b/src/mesa/drivers/dri/i915-tex/intel_buffer_objects.h
deleted file mode 100644
index 2b7c13d75fe..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_buffer_objects.h
+++ /dev/null
@@ -1,70 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2005 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_BUFFEROBJ_H
-#define INTEL_BUFFEROBJ_H
-
-#include "mtypes.h"
-
-struct intel_context;
-struct gl_buffer_object;
-
-
-/**
- * Intel vertex/pixel buffer object, derived from Mesa's gl_buffer_object.
- */
-struct intel_buffer_object {
- struct gl_buffer_object Base;
- GLuint buffer; /* the low-level buffer manager's buffer handle */
-};
-
-
-/* Get the bm buffer associated with a GL bufferobject:
- */
-GLuint intel_bufferobj_buffer( const struct intel_buffer_object *obj );
-
-/* Hook the bufferobject implementation into mesa:
- */
-void intel_bufferobj_init( struct intel_context *intel );
-
-
-
-/* Are the obj->Name tests necessary? Unfortunately yes, mesa
- * allocates a couple of gl_buffer_object structs statically, and
- * the Name == 0 test is the only way to identify them and avoid
- * casting them erroneously to our structs.
- */
-static INLINE struct intel_buffer_object *
-intel_buffer_object( struct gl_buffer_object *obj )
-{
- if (obj->Name)
- return (struct intel_buffer_object *)obj;
- else
- return NULL;
-}
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_buffers.c b/src/mesa/drivers/dri/i915-tex/intel_buffers.c
deleted file mode 100644
index 223b9c6ee21..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_buffers.c
+++ /dev/null
@@ -1,730 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_blit.h"
-#include "intel_buffers.h"
-#include "intel_depthstencil.h"
-#include "intel_fbo.h"
-#include "intel_tris.h"
-#include "intel_regions.h"
-#include "intel_batchbuffer.h"
-#include "context.h"
-#include "framebuffer.h"
-#include "swrast/swrast.h"
-
-
-/**
- * XXX move this into a new dri/common/cliprects.c file.
- */
-GLboolean intel_intersect_cliprects( drm_clip_rect_t *dst,
- const drm_clip_rect_t *a,
- const drm_clip_rect_t *b )
-{
- GLint bx = b->x1;
- GLint by = b->y1;
- GLint bw = b->x2 - bx;
- GLint bh = b->y2 - by;
-
- if (bx < a->x1) bw -= a->x1 - bx, bx = a->x1;
- if (by < a->y1) bh -= a->y1 - by, by = a->y1;
- if (bx + bw > a->x2) bw = a->x2 - bx;
- if (by + bh > a->y2) bh = a->y2 - by;
- if (bw <= 0) return GL_FALSE;
- if (bh <= 0) return GL_FALSE;
-
- dst->x1 = bx;
- dst->y1 = by;
- dst->x2 = bx + bw;
- dst->y2 = by + bh;
-
- return GL_TRUE;
-}
-
-/**
- * Return pointer to current color drawing region, or NULL.
- */
-struct intel_region *intel_drawbuf_region( struct intel_context *intel )
-{
- struct intel_renderbuffer *irbColor =
- intel_renderbuffer(intel->ctx.DrawBuffer->_ColorDrawBuffers[0][0]);
- if (irbColor)
- return irbColor->region;
- else
- return NULL;
-}
-
-/**
- * Return pointer to current color reading region, or NULL.
- */
-struct intel_region *intel_readbuf_region( struct intel_context *intel )
-{
- struct intel_renderbuffer *irb
- = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
- if (irb)
- return irb->region;
- else
- return NULL;
-}
-
-
-
-static void intelBufferSize(GLframebuffer *buffer,
- GLuint *width,
- GLuint *height)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct intel_context *intel = intel_context(ctx);
- /* Need to lock to make sure the driDrawable is uptodate. This
- * information is used to resize Mesa's software buffers, so it has
- * to be correct.
- */
- /* XXX This isn't 100% correct, the given buffer might not be
- * bound to the current context!
- */
- LOCK_HARDWARE(intel);
- if (intel->driDrawable) {
- *width = intel->driDrawable->w;
- *height = intel->driDrawable->h;
- }
- else {
- *width = 0;
- *height = 0;
- }
- UNLOCK_HARDWARE(intel);
-}
-
-
-
-/**
- * Update the following fields for rendering to a user-created FBO:
- * intel->numClipRects
- * intel->pClipRects
- * intel->drawX
- * intel->drawY
- */
-static void intelSetRenderbufferClipRects( struct intel_context *intel )
-{
- assert(intel->ctx.DrawBuffer->Width > 0);
- assert(intel->ctx.DrawBuffer->Height > 0);
- intel->fboRect.x1 = 0;
- intel->fboRect.y1 = 0;
- intel->fboRect.x2 = intel->ctx.DrawBuffer->Width;
- intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;
- intel->numClipRects = 1;
- intel->pClipRects = &intel->fboRect;
- intel->drawX = 0;
- intel->drawY = 0;
-}
-
-
-/**
- * As above, but for rendering to front buffer of a window.
- * \sa intelSetRenderbufferClipRects
- */
-static void intelSetFrontClipRects( struct intel_context *intel )
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
- if (!dPriv) return;
-
- intel->numClipRects = dPriv->numClipRects;
- intel->pClipRects = dPriv->pClipRects;
- intel->drawX = dPriv->x;
- intel->drawY = dPriv->y;
-}
-
-
-/**
- * As above, but for rendering to back buffer of a window.
- */
-static void intelSetBackClipRects( struct intel_context *intel )
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
- if (!dPriv) return;
-
- if (intel->sarea->pf_enabled == 0 && dPriv->numBackClipRects == 0) {
- /* use the front clip rects */
- intel->numClipRects = dPriv->numClipRects;
- intel->pClipRects = dPriv->pClipRects;
- intel->drawX = dPriv->x;
- intel->drawY = dPriv->y;
- } else {
- /* use the back clip rects */
- intel->numClipRects = dPriv->numBackClipRects;
- intel->pClipRects = dPriv->pBackClipRects;
- intel->drawX = dPriv->backX;
- intel->drawY = dPriv->backY;
-
- if (dPriv->numBackClipRects == 1 &&
- dPriv->x == dPriv->backX &&
- dPriv->y == dPriv->backY) {
-
- /* Repeat the calculation of the back cliprect dimensions here
- * as early versions of dri.a in the Xserver are incorrect. Try
- * very hard not to restrict future versions of dri.a which
- * might eg. allocate truly private back buffers.
- */
- int x1, y1;
- int x2, y2;
-
- x1 = dPriv->x;
- y1 = dPriv->y;
- x2 = dPriv->x + dPriv->w;
- y2 = dPriv->y + dPriv->h;
-
- if (x1 < 0) x1 = 0;
- if (y1 < 0) y1 = 0;
- if (x2 > intel->intelScreen->width) x2 = intel->intelScreen->width;
- if (y2 > intel->intelScreen->height) y2 = intel->intelScreen->height;
-
- if (x1 == dPriv->pBackClipRects[0].x1 &&
- y1 == dPriv->pBackClipRects[0].y1) {
-
- dPriv->pBackClipRects[0].x2 = x2;
- dPriv->pBackClipRects[0].y2 = y2;
- }
- }
- }
-}
-
-
-/**
- * This will be called whenever the currently bound window is moved/resized.
- * XXX: actually, it seems to NOT be called when the window is only moved (BP).
- */
-void intelWindowMoved( struct intel_context *intel )
-{
- GLcontext *ctx = &intel->ctx;
-
- if (!intel->ctx.DrawBuffer) {
- /* when would this happen? -BP */
- intelSetFrontClipRects( intel );
- }
- else if (intel->ctx.DrawBuffer->Name != 0) {
- /* drawing to user-created FBO - do nothing */
- /* Cliprects would be set from intelDrawBuffer() */
- }
- else {
- /* drawing to a window */
- switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
- intelSetFrontClipRects( intel );
- break;
- case BUFFER_BIT_BACK_LEFT:
- intelSetBackClipRects( intel );
- break;
- default:
- /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
- intelSetFrontClipRects( intel );
- }
- }
-
- /* this update Mesa's notion of window size */
- if (ctx->WinSysDrawBuffer) {
- _mesa_resize_framebuffer(ctx, ctx->WinSysDrawBuffer,
- intel->driDrawable->w, intel->driDrawable->h);
- }
-
- /* Update hardware scissor */
- ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height );
-}
-
-
-
-/* A true meta version of this would be very simple and additionally
- * machine independent. Maybe we'll get there one day.
- */
-static void intelClearWithTris(struct intel_context *intel,
- GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy,
- GLint cw, GLint ch)
-{
- GLcontext *ctx = &intel->ctx;
- drm_clip_rect_t clear;
-
- if (INTEL_DEBUG & DEBUG_DRI)
- _mesa_printf("%s 0x%x\n", __FUNCTION__, mask);
-
- LOCK_HARDWARE(intel);
-
- /* XXX FBO: was: intel->driDrawable->numClipRects */
- if (intel->numClipRects) {
- GLuint buf;
-
- intel->vtbl.install_meta_state(intel);
-
- /* note: regardless of 'all', cx, cy, cw, ch are correct */
- clear.x1 = cx;
- clear.y1 = cy;
- clear.x2 = cx + cw;
- clear.y2 = cy + ch;
-
- /* Back and stencil cliprects are the same. Try and do both
- * buffers at once:
- */
- if (mask & (BUFFER_BIT_BACK_LEFT|BUFFER_BIT_STENCIL|BUFFER_BIT_DEPTH)) {
- struct intel_region *backRegion
- = intel_get_rb_region(ctx->DrawBuffer, BUFFER_BACK_LEFT);
- struct intel_region *depthRegion
- = intel_get_rb_region(ctx->DrawBuffer, BUFFER_DEPTH);
- const GLuint clearColor = (backRegion && backRegion->cpp == 4)
- ? intel->ClearColor8888 : intel->ClearColor565;
-
- intel->vtbl.meta_draw_region(intel, backRegion, depthRegion );
-
- if (mask & BUFFER_BIT_BACK_LEFT)
- intel->vtbl.meta_color_mask(intel, GL_TRUE );
- else
- intel->vtbl.meta_color_mask(intel, GL_FALSE );
-
- if (mask & BUFFER_BIT_STENCIL)
- intel->vtbl.meta_stencil_replace( intel,
- intel->ctx.Stencil.WriteMask[0],
- intel->ctx.Stencil.Clear);
- else
- intel->vtbl.meta_no_stencil_write(intel);
-
- if (mask & BUFFER_BIT_DEPTH)
- intel->vtbl.meta_depth_replace( intel );
- else
- intel->vtbl.meta_no_depth_write(intel);
-
- /* XXX: Using INTEL_BATCH_NO_CLIPRECTS here is dangerous as the
- * drawing origin may not be correctly emitted.
- */
- intel_meta_draw_quad(intel,
- clear.x1, clear.x2,
- clear.y1, clear.y2,
- intel->ctx.Depth.Clear,
- clearColor,
- 0, 0, 0, 0); /* texcoords */
-
- mask &= ~(BUFFER_BIT_BACK_LEFT|BUFFER_BIT_STENCIL|BUFFER_BIT_DEPTH);
- }
-
- /* clear the remaining (color) renderbuffers */
- for (buf = 0; buf < BUFFER_COUNT && mask; buf++) {
- const GLuint bufBit = 1 << buf;
- if (mask & bufBit) {
- struct intel_renderbuffer *irbColor =
- intel_renderbuffer(ctx->DrawBuffer->
- Attachment[buf].Renderbuffer);
- GLuint color = (irbColor->region->cpp == 4)
- ? intel->ClearColor8888 : intel->ClearColor565;
-
- ASSERT(irbColor);
-
- intel->vtbl.meta_no_depth_write(intel);
- intel->vtbl.meta_no_stencil_write(intel);
- intel->vtbl.meta_color_mask(intel, GL_TRUE );
- intel->vtbl.meta_draw_region(intel, irbColor->region, NULL);
-
- /* XXX: Using INTEL_BATCH_NO_CLIPRECTS here is dangerous as the
- * drawing origin may not be correctly emitted.
- */
- intel_meta_draw_quad(intel,
- clear.x1, clear.x2,
- clear.y1, clear.y2,
- 0, /* depth clear val */
- color,
- 0, 0, 0, 0); /* texcoords */
-
- mask &= ~bufBit;
- }
- }
-
- intel->vtbl.leave_meta_state( intel );
- intel_batchbuffer_flush( intel->batch );
- }
- UNLOCK_HARDWARE(intel);
-}
-
-
-
-/**
- * Called by ctx->Driver.Clear.
- */
-static void intelClear(GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint cx, GLint cy,
- GLint cw, GLint ch)
-{
- struct intel_context *intel = intel_context( ctx );
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- GLbitfield tri_mask = 0;
- GLbitfield blit_mask = 0;
- GLbitfield swrast_mask = 0;
- GLuint i;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* HW color buffers (front, back, aux, generic FBO, etc) */
- if (colorMask == ~0) {
- /* clear all R,G,B,A */
- /* XXX FBO: need to check if colorbuffers are software RBOs! */
- blit_mask |= (mask & BUFFER_BITS_COLOR);
- }
- else {
- /* glColorMask in effect */
- tri_mask |= (mask & BUFFER_BITS_COLOR);
- }
-
- /* HW stencil */
- if (mask & BUFFER_BIT_STENCIL) {
- const struct intel_region *stencilRegion
- = intel_get_rb_region(ctx->DrawBuffer, BUFFER_STENCIL);
- if (stencilRegion) {
- /* have hw stencil */
- if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) {
- /* not clearing all stencil bits, so use triangle clearing */
- tri_mask |= BUFFER_BIT_STENCIL;
- }
- else {
- /* clearing all stencil bits, use blitting */
- blit_mask |= BUFFER_BIT_STENCIL;
- }
- }
- }
-
- /* HW depth */
- if (mask & BUFFER_BIT_DEPTH) {
- /* clear depth with whatever method is used for stencil (see above) */
- if (tri_mask & BUFFER_BIT_STENCIL)
- tri_mask |= BUFFER_BIT_DEPTH;
- else
- blit_mask |= BUFFER_BIT_DEPTH;
- }
-
- /* SW fallback clearing */
- swrast_mask = mask & ~tri_mask & ~blit_mask;
-
- for (i = 0; i < BUFFER_COUNT; i++) {
- GLuint bufBit = 1 << i;
- if ((blit_mask | tri_mask) & bufBit) {
- if (!ctx->DrawBuffer->Attachment[i].Renderbuffer->ClassID) {
- blit_mask &= ~bufBit;
- tri_mask &= ~bufBit;
- swrast_mask |= bufBit;
- }
- }
- }
-
-
- intelFlush( ctx ); /* XXX intelClearWithBlit also does this */
-
- if (blit_mask)
- intelClearWithBlit( ctx, blit_mask, all, cx, cy, cw, ch );
-
- if (tri_mask)
- intelClearWithTris( intel, tri_mask, all, cx, cy, cw, ch);
-
- if (swrast_mask)
- _swrast_Clear( ctx, swrast_mask, all, cx, cy, cw, ch );
-}
-
-
-
-/* Flip the front & back buffers
- */
-static void intelPageFlip( const __DRIdrawablePrivate *dPriv )
-{
-#if 0
- struct intel_context *intel;
- int tmp, ret;
-
- if (INTEL_DEBUG & DEBUG_IOCTL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- assert(dPriv);
- assert(dPriv->driContextPriv);
- assert(dPriv->driContextPriv->driverPrivate);
-
- intel = (struct intel_context *) dPriv->driContextPriv->driverPrivate;
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
-
- if (dPriv->pClipRects) {
- *(drm_clip_rect_t *)intel->sarea->boxes = dPriv->pClipRects[0];
- intel->sarea->nbox = 1;
- }
-
- ret = drmCommandNone(intel->driFd, DRM_I830_FLIP);
- if (ret) {
- fprintf(stderr, "%s: %d\n", __FUNCTION__, ret);
- UNLOCK_HARDWARE( intel );
- exit(1);
- }
-
- tmp = intel->sarea->last_enqueue;
- intelRefillBatchLocked( intel );
- UNLOCK_HARDWARE( intel );
-
-
- intelSetDrawBuffer( &intel->ctx, intel->ctx.Color.DriverDrawBuffer );
-#endif
-}
-
-
-void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driverPrivate) {
- const struct gl_framebuffer *fb
- = (struct gl_framebuffer *) dPriv->driverPrivate;
- if (fb->Visual.doubleBufferMode) {
- GET_CURRENT_CONTEXT(ctx);
- if (ctx && ctx->DrawBuffer == fb) {
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering */
- }
- if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
- intelPageFlip( dPriv );
- } else {
- intelCopyBuffer( dPriv );
- }
- }
- }
- else {
- _mesa_problem(NULL,
- "dPriv has no gl_framebuffer pointer in intelSwapBuffers");
- }
-}
-
-
-/**
- * Update the hardware state for drawing into a window or framebuffer object.
- *
- * Called by glDrawBuffer, glBindFramebufferEXT, MakeCurrent, and other
- * places within the driver.
- *
- * Basically, this needs to be called any time the current framebuffer
- * changes, the renderbuffers change, or we need to draw into different
- * color buffers.
- */
-void
-intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_region *colorRegion, *depthRegion = NULL;
- struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
- int front = 0; /* drawing to front color buffer? */
-
- if (!fb) {
- /* this can happen during the initial context initialization */
- return;
- }
-
- /* Do this here, note core Mesa, since this function is called from
- * many places within the driver.
- */
- if (ctx->NewState & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) {
- /* this updates the DrawBuffer->_NumColorDrawBuffers fields, etc */
- _mesa_update_framebuffer(ctx);
- /* this updates the DrawBuffer's Width/Height if it's a FBO */
- _mesa_update_draw_buffer_bounds(ctx);
- }
-
- if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- /* this may occur when we're called by glBindFrameBuffer() during
- * the process of someone setting up renderbuffers, etc.
- */
- _mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");
- return;
- }
-
- if (fb->Name)
- intel_validate_paired_depth_stencil(ctx, fb);
-
- /*
- * How many color buffers are we drawing into?
- */
- if (fb->_NumColorDrawBuffers[0] != 1
-#if 0
- /* XXX FBO temporary - always use software rendering */
- || 1
-#endif
- ) {
- /* writing to 0 or 2 or 4 color buffers */
- /*_mesa_debug(ctx, "Software rendering\n");*/
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
- front = 1; /* might not have back color buffer */
- }
- else {
- /* draw to exactly one color buffer */
- /*_mesa_debug(ctx, "Hardware rendering\n");*/
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
- if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
- front = 1;
- }
- }
-
- /*
- * Get the intel_renderbuffer for the colorbuffer we're drawing into.
- * And set up cliprects.
- */
- if (fb->Name == 0) {
- /* drawing to window system buffer */
- if (intel->sarea->pf_current_page == 1 ) {
- /* page flipped back/front */
- front ^= 1;
- }
- if (front) {
- intelSetFrontClipRects( intel );
- colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
- }
- else {
- intelSetBackClipRects( intel );
- colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
- }
- }
- else {
- /* drawing to user-created FBO */
- struct intel_renderbuffer *irb;
- intelSetRenderbufferClipRects(intel);
- irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
- colorRegion = (irb && irb->region) ? irb->region : NULL;
- }
-
- if (!colorRegion) {
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
- }
- else {
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
- }
-
- /***
- *** Get depth buffer region and check if we need a software fallback.
- *** Note that the depth buffer is usually a DEPTH_STENCIL buffer.
- ***/
- if (fb->_DepthBuffer && fb->_DepthBuffer->Wrapped) {
- irbDepth = intel_renderbuffer(fb->_DepthBuffer->Wrapped);
- if (irbDepth->region) {
- FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_FALSE);
- depthRegion = irbDepth->region;
- }
- else {
- FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_TRUE);
- depthRegion = NULL;
- }
- }
- else {
- /* not using depth buffer */
- FALLBACK(intel, INTEL_FALLBACK_DEPTH_BUFFER, GL_FALSE);
- depthRegion = NULL;
- }
-
- /***
- *** Stencil buffer
- *** This can only be hardware accelerated if we're using a
- *** combined DEPTH_STENCIL buffer (for now anyway).
- ***/
- if (fb->_StencilBuffer && fb->_StencilBuffer->Wrapped) {
- irbStencil = intel_renderbuffer(fb->_StencilBuffer->Wrapped);
- if (irbStencil && irbStencil->region) {
- ASSERT(irbStencil->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE);
- /* need to re-compute stencil hw state */
- ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
- if (!depthRegion)
- depthRegion = irbStencil->region;
- }
- else {
- FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_TRUE);
- }
- }
- else {
- /* XXX FBO: instead of FALSE, pass ctx->Stencil.Enabled ??? */
- FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE);
- /* need to re-compute stencil hw state */
- ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
- }
-
-
- /**
- ** Release old regions, reference new regions
- **/
-#if 0 /* XXX FBO: this seems to be redundant with i915_state_draw_region() */
- if (intel->draw_region != colorRegion) {
- intel_region_release(intel, &intel->draw_region);
- intel_region_reference(&intel->draw_region, colorRegion);
- }
- if (intel->depth_region != depthRegion) {
- intel_region_release(intel, &intel->depth_region);
- intel_region_reference(&intel->depth_region, depthRegion);
- }
-#endif
-
- intel->vtbl.set_draw_region( intel, colorRegion, depthRegion );
-
- /* update viewport since it depends on window size */
- ctx->Driver.Viewport(ctx, ctx->Viewport.X, ctx->Viewport.Y,
- ctx->Viewport.Width, ctx->Viewport.Height);
-
- /* Update hardware scissor */
- ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height );
-}
-
-
-static void
-intelDrawBuffer(GLcontext *ctx, GLenum mode)
-{
- intel_draw_buffer(ctx, ctx->DrawBuffer);
-}
-
-
-static void
-intelReadBuffer( GLcontext *ctx, GLenum mode )
-{
- if (ctx->ReadBuffer == ctx->DrawBuffer) {
- /* This will update FBO completeness status.
- * A framebuffer will be incomplete if the GL_READ_BUFFER setting
- * refers to a missing renderbuffer. Calling glReadBuffer can set
- * that straight and can make the drawing buffer complete.
- */
- intel_draw_buffer(ctx, ctx->DrawBuffer);
- }
- /* Generally, functions which read pixels (glReadPixels, glCopyPixels, etc)
- * reference ctx->ReadBuffer and do appropriate state checks.
- */
-}
-
-
-void intelInitBufferFuncs( struct dd_function_table *functions )
-{
- functions->Clear = intelClear;
- functions->GetBufferSize = intelBufferSize;
- functions->ResizeBuffers = _mesa_resize_framebuffer;
- functions->DrawBuffer = intelDrawBuffer;
- functions->ReadBuffer = intelReadBuffer;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_buffers.h b/src/mesa/drivers/dri/i915-tex/intel_buffers.h
deleted file mode 100644
index 309022b0739..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_buffers.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_BUFFERS_H
-#define INTEL_BUFFERS_H
-
-
-struct intel_context;
-
-
-extern GLboolean
-intel_intersect_cliprects(drm_clip_rect_t *dest,
- const drm_clip_rect_t *a,
- const drm_clip_rect_t *b);
-
-extern struct intel_region *
-intel_readbuf_region(struct intel_context *intel);
-
-extern struct intel_region *
-intel_drawbuf_region(struct intel_context *intel);
-
-extern void
-intelSwapBuffers( __DRIdrawablePrivate *dPriv);
-
-extern void
-intelWindowMoved(struct intel_context *intel);
-
-extern void
-intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
-
-extern void
-intelInitBufferFuncs(struct dd_function_table *functions);
-
-#endif /* INTEL_BUFFERS_H */
diff --git a/src/mesa/drivers/dri/i915-tex/intel_bufmgr.c b/src/mesa/drivers/dri/i915-tex/intel_bufmgr.c
deleted file mode 100644
index 46631555dc2..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_bufmgr.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Steamboat Springs, CO.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-#include "intel_bufmgr.h"
-
-#include "intel_context.h"
-#include "intel_ioctl.h"
-
-#include "hash.h"
-#include "simple_list.h"
-#include "mm.h"
-#include "imports.h"
-#include "glthread.h"
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <drm.h>
-
-struct _mesa_HashTable;
-
-/* The buffer manager is really part of the gl_shared_state struct.
- * TODO: Organize for the bufmgr to be created/deleted with the shared
- * state and stored within the DriverData of that struct. Currently
- * there are no mesa callbacks for this.
- */
-
-#define BM_MAX 16
-static struct bufmgr
-{
- _glthread_Mutex mutex; /**< for thread safety */
- int driFd;
- int refcount;
- struct _mesa_HashTable *hash;
-
- unsigned buf_nr; /* for generating ids */
- drmMMPool batchPool;
-
-} bufmgr_pool[BM_MAX];
-
-static int nr_bms;
-
-#define LOCK(bm) _glthread_LOCK_MUTEX(bm->mutex)
-#define UNLOCK(bm) _glthread_UNLOCK_MUTEX(bm->mutex)
-
-static void
-bmError(int val, const char *file, const char *function, int line)
-{
- _mesa_printf("Fatal video memory manager error \"%s\".\n"
- "Check kernel logs or set the LIBGL_DEBUG\n"
- "environment variable to \"verbose\" for more info.\n"
- "Detected in file %s, line %d, function %s.\n",
- strerror(-val), file, line, function);
-#ifndef NDEBUG
- exit(-1);
-#else
- abort();
-#endif
-}
-
-#define BM_CKFATAL(val) \
- do{ \
- int tstVal = (val); \
- if (tstVal) \
- bmError(tstVal, __FILE__, __FUNCTION__, __LINE__); \
- } while(0);
-
-/***********************************************************************
- * Public functions
- */
-
-/* The initialization functions are skewed in the fake implementation.
- * This call would be to attach to an existing manager, rather than to
- * create a local one.
- */
-
-struct bufmgr *
-bm_intel_Attach(struct intel_context *intel)
-{
- GLuint i;
-
- for (i = 0; i < nr_bms; i++)
- if (bufmgr_pool[i].driFd == intel->driFd) {
- bufmgr_pool[i].refcount++;
- _mesa_printf("retrieive old bufmgr for fd %d\n",
- bufmgr_pool[i].driFd);
- return &bufmgr_pool[i];
- }
-
- if (nr_bms < BM_MAX) {
- struct bufmgr *bm = &bufmgr_pool[nr_bms++];
-
- _mesa_printf("create new bufmgr for fd %d\n", intel->driFd);
- bm->driFd = intel->driFd;
- bm->hash = _mesa_NewHashTable();
- bm->refcount = 1;
- _glthread_INIT_MUTEX(bm->mutex);
-
- drmGetLock(bm->driFd, intel->hHWContext, 0);
- BM_CKFATAL(drmMMAllocBufferPool(bm->driFd, mmPoolRing, 0,
- DRM_MM_TT | DRM_MM_NO_EVICT |
- DRM_MM_READ | DRM_MM_EXE |
- BM_BATCHBUFFER, 1024 * 1024, 4096,
- &bm->batchPool));
-
- drmUnlock(bm->driFd, intel->hHWContext);
- return bm;
- }
-
- _mesa_printf("failed to create new bufmgr for fd %d\n", intel->driFd);
- return NULL;
-}
-
-void
-bmGenBuffers(struct bufmgr *bm, unsigned n, unsigned *buffers, unsigned flags)
-{
- LOCK(bm);
- {
- unsigned i;
- unsigned bFlags =
- (flags) ? flags : DRM_MM_TT | DRM_MM_VRAM | DRM_MM_SYSTEM;
-
- for (i = 0; i < n; i++) {
- drmMMBuf *buf = calloc(sizeof(*buf), 1);
-
- BM_CKFATAL(drmMMInitBuffer(bm->driFd, bFlags, 12, buf));
- buf->client_priv = ++bm->buf_nr;
- buffers[i] = buf->client_priv;
- _mesa_HashInsert(bm->hash, buffers[i], buf);
- }
- }
- UNLOCK(bm);
-}
-
-void
-bmSetShared(struct bufmgr *bm, unsigned buffer, unsigned flags,
- unsigned long offset, void *virtual)
-{
- LOCK(bm);
- {
- drmMMBuf *buf = _mesa_HashLookup(bm->hash, buffer);
-
- assert(buf);
-
- buf->flags = DRM_MM_NO_EVICT | DRM_MM_SHARED
- | DRM_MM_WRITE | DRM_MM_READ;
- buf->flags |= flags & DRM_MM_MEMTYPE_MASK;
- buf->offset = offset;
- buf->virtual = virtual;
- BM_CKFATAL(drmMMAllocBuffer(bm->driFd, 0, NULL, 0, buf));
- }
- UNLOCK(bm);
-}
-
-void
-bmDeleteBuffers(struct bufmgr *bm, unsigned n, unsigned *buffers)
-{
- LOCK(bm);
- {
- unsigned i;
-
- for (i = 0; i < n; i++) {
- drmMMBuf *buf = _mesa_HashLookup(bm->hash, buffers[i]);
-
- if (buf) {
- BM_CKFATAL(drmMMFreeBuffer(bm->driFd, buf));
-
- _mesa_HashRemove(bm->hash, buffers[i]);
- }
- }
- }
- UNLOCK(bm);
-}
-
-/* If buffer size changes, free and reallocate. Otherwise update in
- * place.
- */
-
-void
-bmBufferData(struct bufmgr *bm,
- unsigned buffer, unsigned size, const void *data, unsigned flags)
-{
- LOCK(bm);
- {
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- DBG("bmBufferData %d sz 0x%x data: %p\n", buffer, size, data);
-
- assert(buf);
- assert(!buf->mapped);
-
- if (buf->flags & BM_BATCHBUFFER) {
- BM_CKFATAL(drmMMFreeBuffer(bm->driFd, buf));
- BM_CKFATAL(drmMMAllocBuffer
- (bm->driFd, size, &bm->batchPool, 1, buf));
- } else if (!(buf->flags & DRM_MM_SHARED)) {
-
- if (buf->block && (buf->size < size || drmBufIsBusy(bm->driFd, buf))) {
- BM_CKFATAL(drmMMFreeBuffer(bm->driFd, buf));
- }
- if (!buf->block) {
- BM_CKFATAL(drmMMAllocBuffer(bm->driFd, size, NULL, 0, buf));
- }
-
- }
-
- if (data != NULL) {
-
- memcpy(drmMMMapBuffer(bm->driFd, buf), data, size);
- drmMMUnmapBuffer(bm->driFd, buf);
-
- }
- }
- UNLOCK(bm);
-}
-
-/* Update the buffer in place, in whatever space it is currently resident:
- */
-void
-bmBufferSubData(struct bufmgr *bm,
- unsigned buffer,
- unsigned offset, unsigned size, const void *data)
-{
- LOCK(bm);
- {
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- DBG("bmBufferSubdata %d offset 0x%x sz 0x%x\n", buffer, offset, size);
-
- assert(buf);
- drmBufWaitBusy(bm->driFd, buf);
-
- if (size) {
- memcpy((unsigned char *) drmMMMapBuffer(bm->driFd, buf) + offset,
- data, size);
- drmMMUnmapBuffer(bm->driFd, buf);
- }
- }
- UNLOCK(bm);
-}
-
-/* Extract data from the buffer:
- */
-void
-bmBufferGetSubData(struct bufmgr *bm,
- unsigned buffer,
- unsigned offset, unsigned size, void *data)
-{
- LOCK(bm);
- {
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- DBG("bmBufferSubdata %d offset 0x%x sz 0x%x\n", buffer, offset, size);
-
- assert(buf);
- drmBufWaitBusy(bm->driFd, buf);
-
- if (size) {
- memcpy(data,
- (unsigned char *) drmMMMapBuffer(bm->driFd, buf) + offset,
- size);
- drmMMUnmapBuffer(bm->driFd, buf);
- }
- }
- UNLOCK(bm);
-}
-
-/* Return a pointer to whatever space the buffer is currently resident in:
- */
-void *
-bmMapBuffer(struct bufmgr *bm, unsigned buffer, unsigned flags)
-{
- void *retval;
-
- LOCK(bm);
- {
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- DBG("bmMapBuffer %d\n", buffer);
- DBG("Map: Block is 0x%x\n", &buf->block);
-
- assert(buf);
- /* assert(!buf->mapped); */
- retval = drmMMMapBuffer(bm->driFd, buf);
- }
- UNLOCK(bm);
-
- return retval;
-}
-
-void
-bmUnmapBuffer(struct bufmgr *bm, unsigned buffer)
-{
- LOCK(bm);
- {
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- if (!buf)
- goto out;
-
- DBG("bmUnmapBuffer %d\n", buffer);
-
- drmMMUnmapBuffer(bm->driFd, buf);
- }
- out:
- UNLOCK(bm);
-}
-
-/* Build the list of buffers to validate. Note that the buffer list
- * isn't a shared structure so we don't need mutexes when manipulating
- * it.
- *
- * XXX: need refcounting for drmMMBuf structs so that they can't be
- * deleted while on these lists.
- */
-struct _drmMMBufList *
-bmNewBufferList(void)
-{
- return drmMMInitListHead();
-}
-
-int
-bmAddBuffer(struct bufmgr *bm,
- struct _drmMMBufList *list,
- unsigned buffer,
- unsigned flags,
- unsigned *memtype_return, unsigned long *offset_return)
-{
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- assert(buf);
- return drmMMBufListAdd(list, buf, 0, flags, memtype_return, offset_return);
-}
-
-void
-bmFreeBufferList(struct _drmMMBufList *list)
-{
- drmMMFreeBufList(list);
-}
-
-int
-bmScanBufferList(struct bufmgr *bm,
- struct _drmMMBufList *list, unsigned buffer)
-{
- drmMMBuf *buf = (drmMMBuf *) _mesa_HashLookup(bm->hash, buffer);
-
- assert(buf);
- return drmMMScanBufList(list, buf);
-}
-
-/* To be called prior to emitting commands to hardware which reference
- * these buffers. The buffer_usage list provides information on where
- * the buffers should be placed and whether their contents need to be
- * preserved on copying. The offset and pool data elements are return
- * values from this function telling the driver exactly where the
- * buffers are currently located.
- */
-
-int
-bmValidateBufferList(struct bufmgr *bm,
- struct _drmMMBufList *list, unsigned flags)
-{
- BM_CKFATAL(drmMMValidateBuffers(bm->driFd, list));
- return 0;
-}
-
-/* After commands are emitted but before unlocking, this must be
- * called so that the buffer manager can correctly age the buffers.
- * The buffer manager keeps track of the list of validated buffers, so
- * already knows what to apply the fence to.
- *
- * The buffer manager knows how to emit and test fences directly
- * through the drm and without callbacks or whatever into the driver.
- */
-unsigned
-bmFenceBufferList(struct bufmgr *bm, struct _drmMMBufList *list)
-{
- drmFence fence;
-
- BM_CKFATAL(drmMMFenceBuffers(bm->driFd, list));
- BM_CKFATAL(drmEmitFence(bm->driFd, 0, &fence));
-
- return fence.fenceSeq;
-}
-
-/* This functionality is used by the buffer manager, not really sure
- * if we need to be exposing it in this way, probably libdrm will
- * offer equivalent calls.
- *
- * For now they can stay, but will likely change/move before final:
- */
-unsigned
-bmSetFence(struct bufmgr *bm)
-{
- drmFence dFence;
-
- BM_CKFATAL(drmEmitFence(bm->driFd, 0, &dFence));
-
- return dFence.fenceSeq;
-}
-
-int
-bmTestFence(struct bufmgr *bm, unsigned fence)
-{
- drmFence dFence;
- int retired;
-
- dFence.fenceType = 0;
- dFence.fenceSeq = fence;
- BM_CKFATAL(drmTestFence(bm->driFd, dFence, 0, &retired));
- return retired;
-}
-
-void
-bmFinishFence(struct bufmgr *bm, unsigned fence)
-{
- drmFence dFence;
- dFence.fenceType = 0;
- dFence.fenceSeq = fence;
- BM_CKFATAL(drmWaitFence(bm->driFd, dFence));
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_bufmgr.h b/src/mesa/drivers/dri/i915-tex/intel_bufmgr.h
deleted file mode 100644
index f323611c48c..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_bufmgr.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 Tungsten Graphics, Inc., Steamboat Springs, CO.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-#ifndef BUFMGR_H
-#define BUFMGR_H
-
-#include "intel_context.h"
-
-/* Note that this is destined to be external to Mesa, so don't use GL
- * types like GLuint, etc.
- */
-
-/* The buffer manager context. Opaque.
- */
-struct bufmgr;
-
-struct bufmgr *bm_intel_Attach(struct intel_context *intel);
-
-#define BM_BATCHBUFFER 0x10000000 /* for map - pointer will be accessed
- * without dri lock */
-
-/* Stick closely to ARB_vbo semantics - they're well defined and
- * understood, and drivers can just pass the calls through without too
- * much thunking.
- */
-void bmGenBuffers(struct bufmgr *, unsigned n, unsigned *buffers,
- unsigned flags);
-
-void bmDeleteBuffers(struct bufmgr *, unsigned n, unsigned *buffers);
-
-/* The driver has more intimate knowledge of the hardare than a GL
- * client would, so flags here is more proscriptive than the usage
- * values in the ARB_vbo interface:
- */
-void bmBufferData(struct bufmgr *,
- unsigned buffer,
- unsigned size, const void *data, unsigned flags);
-
-void bmBufferSubData(struct bufmgr *,
- unsigned buffer,
- unsigned offset, unsigned size, const void *data);
-
-void bmBufferGetSubData(struct bufmgr *,
- unsigned buffer,
- unsigned offset, unsigned size, void *data);
-
-void *bmMapBuffer(struct bufmgr *, unsigned buffer, unsigned access);
-
-void bmUnmapBuffer(struct bufmgr *, unsigned buffer);
-
-/* To be called prior to emitting commands to hardware which reference
- * these buffers.
- *
- * NewBufferList() and AddBuffer() build up a list of buffers to be
- * validated. The buffer list provides information on where the
- * buffers should be placed and whether their contents need to be
- * preserved on copying. The offset data elements are return values
- * from this function telling the driver exactly where the buffers are
- * currently located.
- *
- * ValidateBufferList() performs the actual validation and returns the
- * buffer pools and offsets within the pools.
- *
- * FenceBufferList() must be called to set fences and other
- * housekeeping before unlocking after a successful call to
- * ValidateBufferList(). The buffer manager knows how to emit and test
- * fences directly through the drm and without callbacks to the
- * driver.
- */
-struct _drmMMBufList *bmNewBufferList(void);
-
-int bmAddBuffer(struct bufmgr *bm,
- struct _drmMMBufList *list,
- unsigned buffer,
- unsigned flags,
- unsigned *pool_return, unsigned long *offset_return);
-
-int bmValidateBufferList(struct bufmgr *,
- struct _drmMMBufList *, unsigned flags);
-
-unsigned bmFenceBufferList(struct bufmgr *, struct _drmMMBufList *);
-
-void bmFreeBufferList(struct _drmMMBufList *);
-
-int bmScanBufferList(struct bufmgr *bm,
- struct _drmMMBufList *list, unsigned buffer);
-
-/* This functionality is used by the buffer manager, not really sure
- * if we need to be exposing it in this way, probably libdrm will
- * offer equivalent calls.
- *
- * For now they can stay, but will likely change/move before final:
- */
-unsigned bmSetFence(struct bufmgr *);
-int bmTestFence(struct bufmgr *, unsigned fence);
-void bmFinishFence(struct bufmgr *, unsigned fence);
-
-void bmSetShared(struct bufmgr *bm, unsigned buffer,
- unsigned flags, unsigned long offset, void *virtual);
-
-extern int INTEL_DEBUG;
-
-#define DEBUG_BUFMGR 0x2000
-
-#define DBG(...) do { if (INTEL_DEBUG & DEBUG_BUFMGR) _mesa_printf(__VA_ARGS__); } while(0)
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_context.c b/src/mesa/drivers/dri/i915-tex/intel_context.c
deleted file mode 100644
index c1a968ba1a1..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_context.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include "glheader.h"
-#include "context.h"
-#include "matrix.h"
-#include "simple_list.h"
-#include "extensions.h"
-#include "framebuffer.h"
-#include "imports.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "array_cache/acache.h"
-
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
-#include "drivers/common/driverfuncs.h"
-
-#include "intel_screen.h"
-
-#include "i830_dri.h"
-
-#include "intel_buffers.h"
-#include "intel_tex.h"
-#include "intel_span.h"
-#include "intel_tris.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_pixel.h"
-#include "intel_regions.h"
-#include "intel_buffer_objects.h"
-#include "intel_fbo.h"
-
-#include "intel_bufmgr.h"
-
-#include "vblank.h"
-#include "utils.h"
-#include "xmlpool.h" /* for symbolic values of enum-type options */
-#ifndef INTEL_DEBUG
-int INTEL_DEBUG = (0);
-#endif
-
-#define need_GL_ARB_multisample
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_secondary_color
-#define need_GL_NV_vertex_program
-#include "extension_helper.h"
-
-
-#define DRIVER_DATE "20060212"
-
-static const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
-{
- const char * chipset;
- static char buffer[128];
-
- switch (name) {
- case GL_VENDOR:
- return (GLubyte *)"Tungsten Graphics, Inc";
- break;
-
- case GL_RENDERER:
- switch (intel_context(ctx)->intelScreen->deviceID) {
- case PCI_CHIP_845_G:
- chipset = "Intel(R) 845G"; break;
- case PCI_CHIP_I830_M:
- chipset = "Intel(R) 830M"; break;
- case PCI_CHIP_I855_GM:
- chipset = "Intel(R) 852GM/855GM"; break;
- case PCI_CHIP_I865_G:
- chipset = "Intel(R) 865G"; break;
- case PCI_CHIP_I915_G:
- chipset = "Intel(R) 915G"; break;
- case PCI_CHIP_I915_GM:
- chipset = "Intel(R) 915GM"; break;
- case PCI_CHIP_I945_G:
- chipset = "Intel(R) 945G"; break;
- case PCI_CHIP_I945_GM:
- chipset = "Intel(R) 945GM"; break;
- default:
- chipset = "Unknown Intel Chipset"; break;
- }
-
- (void) driGetRendererString( buffer, chipset, DRIVER_DATE, 0 );
- return (GLubyte *) buffer;
-
- default:
- return NULL;
- }
-}
-
-
-/**
- * Extension strings exported by the intel driver.
- *
- * \note
- * It appears that ARB_texture_env_crossbar has "disappeared" compared to the
- * old i830-specific driver.
- */
-const struct dri_extension card_extensions[] =
-{
- { "GL_ARB_multisample", GL_ARB_multisample_functions },
- { "GL_ARB_multitexture", NULL },
- { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
- { "GL_ARB_texture_border_clamp", NULL },
- { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
- { "GL_ARB_texture_cube_map", NULL },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_ARB_texture_env_combine", NULL },
- { "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_ARB_texture_rectangle", NULL },
- { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
- { "GL_ARB_pixel_buffer_object", NULL },
- { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
- { "GL_ARB_window_pos", GL_ARB_window_pos_functions },
- { "GL_EXT_blend_color", GL_EXT_blend_color_functions },
- { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
- { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
- { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
- { "GL_EXT_blend_subtract", NULL },
- { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions },
- { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
- { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
-#if 1 /* XXX FBO temporary? */
- { "GL_EXT_packed_depth_stencil", NULL },
-#endif
- { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
- { "GL_EXT_stencil_wrap", NULL },
- { "GL_EXT_texture_edge_clamp", NULL },
- { "GL_EXT_texture_env_combine", NULL },
- { "GL_EXT_texture_env_dot3", NULL },
- { "GL_EXT_texture_filter_anisotropic", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_3DFX_texture_compression_FXT1", NULL },
- { "GL_APPLE_client_storage", NULL },
- { "GL_MESA_pack_invert", NULL },
- { "GL_MESA_ycbcr_texture", NULL },
- { "GL_NV_blend_square", NULL },
- { "GL_NV_vertex_program", GL_NV_vertex_program_functions },
- { "GL_NV_vertex_program1_1", NULL },
-/* { "GL_SGIS_generate_mipmap", NULL }, */
- { NULL, NULL }
-};
-
-extern const struct tnl_pipeline_stage _intel_render_stage;
-
-static const struct tnl_pipeline_stage *intel_pipeline[] = {
- &_tnl_vertex_transform_stage,
- &_tnl_vertex_cull_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage,
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_tnl_arb_vertex_program_stage,
- &_tnl_vertex_program_stage,
-#if 1
- &_intel_render_stage, /* ADD: unclipped rastersetup-to-dma */
-#endif
- &_tnl_render_stage,
- 0,
-};
-
-
-static const struct dri_debug_control debug_control[] =
-{
- { "fall", DEBUG_FALLBACKS },
- { "tex", DEBUG_TEXTURE },
- { "ioctl", DEBUG_IOCTL },
- { "prim", DEBUG_PRIMS },
- { "vert", DEBUG_VERTS },
- { "state", DEBUG_STATE },
- { "verb", DEBUG_VERBOSE },
- { "dri", DEBUG_DRI },
- { "dma", DEBUG_DMA },
- { "san", DEBUG_SANITY },
- { "sync", DEBUG_SYNC },
- { "sleep", DEBUG_SLEEP },
- { "pix", DEBUG_PIXEL },
- { "buf", DEBUG_BUFMGR },
- { NULL, 0 }
-};
-
-
-static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _tnl_invalidate_vertex_state( ctx, new_state );
- intel_context(ctx)->NewGLState |= new_state;
-}
-
-
-void intelFlush( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context( ctx );
-
- if (intel->Fallback)
- _swrast_flush( ctx );
-
- INTEL_FIREVERTICES( intel );
-
- if (intel->batch->map != intel->batch->ptr)
- intel_batchbuffer_flush( intel->batch );
-
- /* XXX: Need to do an MI_FLUSH here. Actually, the bufmgr_fake.c
- * code will have done one already.
- */
-}
-
-void intelFinish( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context( ctx );
- intelFlush( ctx );
- bmFinishFence( intel->bm, intel->batch->last_fence );
-}
-
-
-void intelInitDriverFunctions( struct dd_function_table *functions )
-{
- _mesa_init_driver_functions( functions );
-
-<<<<<<< intel_context.c
- functions->Clear = intelClear;
- functions->Flush = intelglFlush;
-=======
- functions->Flush = intelFlush;
->>>>>>> 1.20.2.25
- functions->Finish = intelFinish;
- functions->GetString = intelGetString;
- functions->UpdateState = intelInvalidateState;
- functions->CopyColorTable = _swrast_CopyColorTable;
- functions->CopyColorSubTable = _swrast_CopyColorSubTable;
- functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- intelInitTextureFuncs( functions );
- intelInitPixelFuncs( functions );
- intelInitStateFuncs( functions );
- intelInitBufferFuncs( functions );
-}
-
-static void intel_emit_invarient_state( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
-
- intel->vtbl.emit_invarient_state( intel );
- intel->prim.flush = 0;
-
- /* Make sure this gets to the hardware, even if we have no cliprects:
- */
- LOCK_HARDWARE( intel );
- intelFlushBatchLocked( intel, GL_TRUE, GL_FALSE, GL_TRUE );
- UNLOCK_HARDWARE( intel );
-}
-
-
-
-GLboolean intelInitContext( struct intel_context *intel,
- const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate,
- struct dd_function_table *functions )
-{
- GLcontext *ctx = &intel->ctx;
- GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
- drmI830Sarea *saPriv = (drmI830Sarea *)
- (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset);
- int fthrottle_mode;
-
- if (!_mesa_initialize_context(&intel->ctx,
- mesaVis, shareCtx,
- functions,
- (void*) intel))
- return GL_FALSE;
-
- driContextPriv->driverPrivate = intel;
- intel->intelScreen = intelScreen;
- intel->driScreen = sPriv;
- intel->sarea = saPriv;
-
-
-<<<<<<< intel_context.c
- (void) memset( intel->texture_heaps, 0, sizeof( intel->texture_heaps ) );
- make_empty_list( & intel->swapped );
-
- driParseConfigFiles (&intel->optionCache, &intelScreen->optionCache,
- intel->driScreen->myNum, "i915");
-
-=======
->>>>>>> 1.20.2.25
- ctx->Const.MaxTextureMaxAnisotropy = 2.0;
-
- ctx->Const.MinLineWidth = 1.0;
- ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 3.0;
- ctx->Const.MaxLineWidthAA = 3.0;
- ctx->Const.LineWidthGranularity = 1.0;
-
- ctx->Const.MinPointSize = 1.0;
- ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 255.0;
- ctx->Const.MaxPointSizeAA = 3.0;
- ctx->Const.PointSizeGranularity = 1.0;
-
- ctx->Const.MaxColorAttachments = 4; /* XXX FBO: review this */
-
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext( ctx );
- _ac_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
-
- /* Install the customized pipeline: */
- _tnl_destroy_pipeline( ctx );
- _tnl_install_pipeline( ctx, intel_pipeline );
-
- /* Configure swrast to match hardware characteristics: */
- _swrast_allow_pixel_fog( ctx, GL_FALSE );
- _swrast_allow_vertex_fog( ctx, GL_TRUE );
-
- /* Dri stuff */
- intel->hHWContext = driContextPriv->hHWContext;
- intel->driFd = sPriv->fd;
- intel->driHwLock = (drmLock *) &sPriv->pSAREA->lock;
-
- intel->hw_stipple = 1;
-
- /* XXX FBO: this doesn't seem to be used anywhere */
- switch(mesaVis->depthBits) {
- case 0: /* what to do in this case? */
- case 16:
- intel->polygon_offset_scale = 1.0/0xffff;
- break;
- case 24:
- intel->polygon_offset_scale = 2.0/0xffffff; /* req'd to pass glean */
- break;
- default:
- assert(0);
- break;
- }
-
- /* Initialize swrast, tnl driver tables: */
- intelInitSpanFuncs( ctx );
- intelInitTriFuncs( ctx );
-
-
- intel->RenderIndex = ~0;
-
- fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode");
- intel->iw.irq_seq = -1;
- intel->irqsEmitted = 0;
-
- intel->do_irqs = (intel->intelScreen->irq_active &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS);
-
- intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
- intel->vblank_flags = (intel->intelScreen->irq_active != 0)
- ? driGetDefaultVBlankFlags(&intelScreen->optionCache) : VBLANK_FLAG_NO_IRQ;
-
- (*dri_interface->getUST)(&intel->swap_ust);
- _math_matrix_ctr (&intel->ViewportMatrix);
-
- /* Disable imaging extension until convolution is working in
- * teximage paths:
- */
- driInitExtensions( ctx, card_extensions,
-/* GL_TRUE, */
- GL_FALSE);
-
-
- /* Buffer manager:
- */
- intel->bm = bm_intel_Attach( intel );
-#if 0
- bmInitPool(intel->bm,
- intel->intelScreen->tex.offset, /* low offset */
- intel->intelScreen->tex.map, /* low virtual */
- intel->intelScreen->tex.size,
- DRM_MM_TT);
-#endif
-
- /* XXX FBO: these have to go away!
- * FBO regions should be setup when creating the drawable. */
-
- /* These are still static, but create regions for them.
- */
- intel->front_region =
- intel_region_create_static(intel,
- DRM_MM_TT,
- intelScreen->front.offset,
- intelScreen->front.map,
- intelScreen->cpp,
- intelScreen->front.pitch,
- intelScreen->height);
-
-
- intel->back_region =
- intel_region_create_static(intel,
- DRM_MM_TT,
- intelScreen->back.offset,
- intelScreen->back.map,
- intelScreen->cpp,
- intelScreen->back.pitch,
- intelScreen->height);
-
- /* Still assuming front.cpp == depth.cpp
- */
- intel->depth_region =
- intel_region_create_static(intel,
- DRM_MM_TT,
- intelScreen->depth.offset,
- intelScreen->depth.map,
- intelScreen->cpp,
- intelScreen->depth.pitch,
- intelScreen->height);
-
- intel->batch = intel_batchbuffer_alloc( intel );
- intel_bufferobj_init( intel );
- intel_fbo_init( intel );
-
- if (intel->ctx.Mesa_DXTn) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- _mesa_enable_extension( ctx, "GL_S3_s3tc" );
- }
- else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) {
- _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
- }
-
-<<<<<<< intel_context.c
-/* driInitTextureObjects( ctx, & intel->swapped, */
-/* DRI_TEXMGR_DO_TEXTURE_1D | */
-/* DRI_TEXMGR_DO_TEXTURE_2D | */
-/* DRI_TEXMGR_DO_TEXTURE_RECT ); */
-
-
- intelInitBatchBuffer(&intel->ctx);
- intel->prim.flush = intel_emit_invarient_state;
-=======
->>>>>>> 1.20.2.25
- intel->prim.primitive = ~0;
-
-
-#if DO_DEBUG
- INTEL_DEBUG = driParseDebugString( getenv( "INTEL_DEBUG" ),
- debug_control );
-#endif
-
- if (getenv("INTEL_NO_RAST")) {
- fprintf(stderr, "disabling 3D rasterization\n");
- FALLBACK(intel, INTEL_FALLBACK_USER, 1);
- }
-
- return GL_TRUE;
-}
-
-void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
-{
- struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
-
- assert(intel); /* should never be null */
- if (intel) {
- GLboolean release_texture_heaps;
-
-
- intel->vtbl.destroy( intel );
-
- release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
- _swsetup_DestroyContext (&intel->ctx);
- _tnl_DestroyContext (&intel->ctx);
- _ac_DestroyContext (&intel->ctx);
-
- _swrast_DestroyContext (&intel->ctx);
- intel->Fallback = 0; /* don't call _swrast_Flush later */
-
- intel_batchbuffer_free(intel->batch);
-
-
- if ( release_texture_heaps ) {
- /* This share group is about to go away, free our private
- * texture object data.
- */
- fprintf(stderr, "do something to free texture heaps\n");
- }
-
- /* free the Mesa context */
- _mesa_free_context_data(&intel->ctx);
- }
-}
-
-GLboolean intelUnbindContext(__DRIcontextPrivate *driContextPriv)
-{
- return GL_TRUE;
-}
-
-GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
-{
-
- if (driContextPriv) {
- struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
- GLframebuffer *drawFb = (GLframebuffer *) driDrawPriv->driverPrivate;
- GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
-
- if ( intel->driDrawable != driDrawPriv ) {
- /* Shouldn't the readbuffer be stored also? */
- driDrawableInitVBlank( driDrawPriv, intel->vblank_flags );
-
- intel->driDrawable = driDrawPriv;
- intelWindowMoved( intel );
- }
-
- /* XXX FBO temporary fix-ups! */
- /* if the renderbuffers don't have regions, init them from the context */
- {
- struct intel_renderbuffer *irbFront
- = intel_get_renderbuffer(drawFb, BUFFER_FRONT_LEFT);
- struct intel_renderbuffer *irbBack
- = intel_get_renderbuffer(drawFb, BUFFER_BACK_LEFT);
- struct intel_renderbuffer *irbDepth
- = intel_get_renderbuffer(drawFb, BUFFER_DEPTH);
- struct intel_renderbuffer *irbStencil
- = intel_get_renderbuffer(drawFb, BUFFER_STENCIL);
-
- if (irbFront && !irbFront->region) {
- intel_region_reference(&irbFront->region, intel->front_region);
- }
- if (irbBack && !irbBack->region) {
- intel_region_reference(&irbBack->region, intel->back_region);
- }
- if (irbDepth && !irbDepth->region) {
- intel_region_reference(&irbDepth->region, intel->depth_region);
- }
- if (irbStencil && !irbStencil->region) {
- intel_region_reference(&irbStencil->region, intel->depth_region);
- }
- }
-
- _mesa_make_current(&intel->ctx, drawFb, readFb);
-
- intel_draw_buffer(&intel->ctx, drawFb);
- }
- else {
- _mesa_make_current(NULL, NULL, NULL);
- }
-
- return GL_TRUE;
-}
-
-<<<<<<< intel_context.c
-/**
- * Use the information in the sarea to update the screen parameters
- * related to screen rotation.
- */
-static void
-intelUpdateScreenRotation(intelContextPtr intel,
- __DRIscreenPrivate *sPriv,
- drmI830Sarea *sarea)
-{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
- intelRegion *colorBuf;
-
- intelUnmapScreenRegions(intelScreen);
-
- intelUpdateScreenFromSAREA(intelScreen, sarea);
-
- /* update the current hw offsets for the color and depth buffers */
- if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
- colorBuf = &intelScreen->back;
- else
- colorBuf = &intelScreen->front;
- intel->vtbl.update_color_z_regions(intel, colorBuf, &intelScreen->depth);
-
- if (!intelMapScreenRegions(sPriv)) {
- fprintf(stderr, "ERROR Remapping screen regions!!!\n");
- }
-}
-
-void intelGetLock( intelContextPtr intel, GLuint flags )
-=======
-void intelGetLock( struct intel_context *intel, GLuint flags )
->>>>>>> 1.20.2.25
-{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- __DRIscreenPrivate *sPriv = intel->driScreen;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
- drmI830Sarea * sarea = intel->sarea;
-<<<<<<< intel_context.c
- unsigned i;
-=======
- int me = intel->hHWContext;
->>>>>>> 1.20.2.25
-
- drmGetLock(intel->driFd, intel->hHWContext, flags);
-
- /* If the window moved, may need to set a new cliprect now.
- *
- * NOTE: This releases and regains the hw lock, so all state
- * checking must be done *after* this call:
- */
- if (dPriv)
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
-
-<<<<<<< intel_context.c
- if (dPriv && intel->lastStamp != dPriv->lastStamp) {
- intelWindowMoved( intel );
- intel->lastStamp = dPriv->lastStamp;
- }
-
- /* If we lost context, need to dump all registers to hardware.
- * Note that we don't care about 2d contexts, even if they perform
- * accelerated commands, so the DRI locking in the X server is even
- * more broken than usual.
-=======
- /* Lost context?
->>>>>>> 1.20.2.25
- */
-<<<<<<< intel_context.c
-
- if (sarea->width != intelScreen->width ||
- sarea->height != intelScreen->height ||
- sarea->rotation != intelScreen->current_rotation) {
- intelUpdateScreenRotation(intel, sPriv, sarea);
-
- /* This will drop the outstanding batchbuffer on the floor */
- intel->batch.ptr -= (intel->batch.size - intel->batch.space);
- intel->batch.space = intel->batch.size;
- /* lose all primitives */
- intel->prim.primitive = ~0;
- intel->prim.start_ptr = 0;
- intel->prim.flush = 0;
- intel->vtbl.lost_hardware( intel );
-
- intel->lastStamp = 0; /* force window update */
-
- /* Release batch buffer
- */
- intelDestroyBatchBuffer(&intel->ctx);
- intelInitBatchBuffer(&intel->ctx);
- intel->prim.flush = intel_emit_invarient_state;
-
- /* Still need to reset the global LRU?
- */
- intel_driReinitTextureHeap( intel->texture_heaps[0], intel->intelScreen->tex.size );
-=======
- if (sarea->ctxOwner != me) {
- intel->perf_boxes |= I830_BOX_LOST_CONTEXT;
- sarea->ctxOwner = me;
->>>>>>> 1.20.2.25
- }
-
- /* Drawable changed?
- */
-<<<<<<< intel_context.c
- for ( i = 0 ; i < intel->nr_heaps ; i++ ) {
- DRI_AGE_TEXTURES( intel->texture_heaps[ i ] );
- }
-}
-
-=======
- if (dPriv && intel->lastStamp != dPriv->lastStamp) {
- intelWindowMoved( intel );
- intel->lastStamp = dPriv->lastStamp;
- }
-}
->>>>>>> 1.20.2.25
-
-<<<<<<< intel_context.c
-void intelSwapBuffers( __DRIdrawablePrivate *dPriv )
-{
- if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
- intelContextPtr intel;
- GLcontext *ctx;
- intel = (intelContextPtr) dPriv->driContextPriv->driverPrivate;
- ctx = &intel->ctx;
- if (ctx->Visual.doubleBufferMode) {
- intelScreenPrivate *screen = intel->intelScreen;
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
- if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
- intelPageFlip( dPriv );
- } else {
- intelCopyBuffer( dPriv );
- }
- if (screen->current_rotation != 0) {
- intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
- }
- }
- } else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
- }
-}
-
-
-void intelInitState( GLcontext *ctx )
-{
- /* Mesa should do this for us:
- */
- ctx->Driver.AlphaFunc( ctx,
- ctx->Color.AlphaFunc,
- ctx->Color.AlphaRef);
-
- ctx->Driver.BlendColor( ctx,
- ctx->Color.BlendColor );
-
- ctx->Driver.BlendEquationSeparate( ctx,
- ctx->Color.BlendEquationRGB,
- ctx->Color.BlendEquationA);
-
- ctx->Driver.BlendFuncSeparate( ctx,
- ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB,
- ctx->Color.BlendSrcA,
- ctx->Color.BlendDstA);
-
- ctx->Driver.ColorMask( ctx,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode );
- ctx->Driver.DepthFunc( ctx, ctx->Depth.Func );
- ctx->Driver.DepthMask( ctx, ctx->Depth.Mask );
-
- ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled );
- ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled );
- ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag );
- ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test );
- ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag );
- ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled );
- ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled );
- ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
- ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag );
- ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
- ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
- ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE );
-
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
-
- ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace );
-
- {
- GLfloat f = (GLfloat)ctx->Light.Model.ColorControl;
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f );
- }
-=======
->>>>>>> 1.20.2.25
-
-<<<<<<< intel_context.c
- ctx->Driver.LineWidth( ctx, ctx->Line.Width );
- ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
- ctx->Driver.PointSize( ctx, ctx->Point.Size );
- ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple );
- ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height );
- ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel );
- ctx->Driver.StencilFuncSeparate( ctx, GL_FRONT,
- ctx->Stencil.Function[0],
- ctx->Stencil.Ref[0],
- ctx->Stencil.ValueMask[0] );
- ctx->Driver.StencilFuncSeparate( ctx, GL_BACK,
- ctx->Stencil.Function[1],
- ctx->Stencil.Ref[1],
- ctx->Stencil.ValueMask[1] );
- ctx->Driver.StencilMaskSeparate( ctx, GL_FRONT, ctx->Stencil.WriteMask[0] );
- ctx->Driver.StencilMaskSeparate( ctx, GL_BACK, ctx->Stencil.WriteMask[1] );
- ctx->Driver.StencilOpSeparate( ctx, GL_FRONT,
- ctx->Stencil.FailFunc[0],
- ctx->Stencil.ZFailFunc[0],
- ctx->Stencil.ZPassFunc[0]);
- ctx->Driver.StencilOpSeparate( ctx, GL_BACK,
- ctx->Stencil.FailFunc[1],
- ctx->Stencil.ZFailFunc[1],
- ctx->Stencil.ZPassFunc[1]);
-
-
- ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
-}
-
-
-=======
->>>>>>> 1.20.2.25
diff --git a/src/mesa/drivers/dri/i915-tex/intel_context.h b/src/mesa/drivers/dri/i915-tex/intel_context.h
deleted file mode 100644
index 01955871bfb..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_context.h
+++ /dev/null
@@ -1,615 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef INTELCONTEXT_INC
-#define INTELCONTEXT_INC
-
-
-
-#include "mtypes.h"
-#include "drm.h"
-#include "mm.h"
-#include "texmem.h"
-
-#include "intel_screen.h"
-#include "i915_drm.h"
-#include "i830_common.h"
-#include "tnl/t_vertex.h"
-
-#define TAG(x) intel##x
-#include "tnl_dd/t_dd_vertex.h"
-#undef TAG
-
-#define DV_PF_555 (1<<8)
-#define DV_PF_565 (2<<8)
-#define DV_PF_8888 (3<<8)
-
-struct intel_region;
-struct intel_context;
-
-typedef void (*intel_tri_func)(struct intel_context *, intelVertex *, intelVertex *,
- intelVertex *);
-typedef void (*intel_line_func)(struct intel_context *, intelVertex *, intelVertex *);
-typedef void (*intel_point_func)(struct intel_context *, intelVertex *);
-
-#define INTEL_FALLBACK_DRAW_BUFFER 0x1
-#define INTEL_FALLBACK_READ_BUFFER 0x2
-#define INTEL_FALLBACK_DEPTH_BUFFER 0x4
-#define INTEL_FALLBACK_STENCIL_BUFFER 0x8
-#define INTEL_FALLBACK_USER 0x10
-#define INTEL_FALLBACK_RENDERMODE 0x20
-
-extern void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode );
-#define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode )
-
-
-
-struct intel_texture_object
-{
- struct gl_texture_object base; /* The "parent" object */
-
- /* The mipmap tree must include at least these levels once
- * validated:
- */
- GLuint firstLevel;
- GLuint lastLevel;
-
- /* Offset for firstLevel image:
- */
- GLuint textureOffset;
-
- /* On validation any active images held in main memory or in other
- * regions will be copied to this region and the old storage freed.
- */
- struct intel_mipmap_tree *mt;
-};
-
-
-
-struct intel_texture_image
-{
- struct gl_texture_image base;
-
- /* These aren't stored in gl_texture_image
- */
- GLuint level;
- GLuint face;
-
- /* If intelImage->mt != NULL, image data is stored here.
- * Else if intelImage->base.Data != NULL, image is stored there.
- * Else there is no image data.
- */
- struct intel_mipmap_tree *mt;
-};
-
-
-#define INTEL_MAX_FIXUP 64
-
-struct intel_context
-{
- GLcontext ctx; /* the parent class */
-
- struct {
- void (*destroy)( struct intel_context *intel );
- void (*emit_state)( struct intel_context *intel );
- void (*lost_hardware)( struct intel_context *intel );
- void (*update_texture_state)( struct intel_context *intel );
-
- void (*render_start)( struct intel_context *intel );
- void (*set_draw_region)( struct intel_context *intel,
- struct intel_region *draw_region,
- struct intel_region *depth_region );
-
- GLuint (*flush_cmd)( void );
-
-<<<<<<< intel_context.h
- void (*render_start)( intelContextPtr intel );
- void (*set_color_region)( intelContextPtr intel, const intelRegion *reg );
- void (*set_z_region)( intelContextPtr intel, const intelRegion *reg );
- void (*update_color_z_regions)(intelContextPtr intel,
- const intelRegion *colorRegion,
- const intelRegion *depthRegion);
- void (*emit_flush)( intelContextPtr intel );
- void (*reduced_primitive_state)( intelContextPtr intel, GLenum rprim );
-=======
- void (*reduced_primitive_state)( struct intel_context *intel, GLenum rprim );
-
- GLboolean (*check_vertex_size)( struct intel_context *intel, GLuint expected );
->>>>>>> 1.8.2.25
-
-
- /* Metaops:
- */
- void (*install_meta_state)( struct intel_context *intel );
- void (*leave_meta_state)( struct intel_context *intel );
-
-<<<<<<< intel_context.h
- void (*rotate_window)( intelContextPtr intel,
- __DRIdrawablePrivate *dPriv, GLuint srcBuf);
-
- intelTextureObjectPtr (*alloc_tex_obj)( struct gl_texture_object *tObj );
-=======
- void (*meta_draw_region)( struct intel_context *intel,
- struct intel_region *draw_region,
- struct intel_region *depth_region );
-
- void (*meta_color_mask)( struct intel_context *intel,
- GLboolean );
-
- void (*meta_stencil_replace)( struct intel_context *intel,
- GLuint mask,
- GLuint clear );
-
- void (*meta_depth_replace)( struct intel_context *intel );
-
- void (*meta_texture_blend_replace)( struct intel_context *intel );
-
- void (*meta_no_stencil_write)( struct intel_context *intel );
- void (*meta_no_depth_write)( struct intel_context *intel );
- void (*meta_no_texture)( struct intel_context *intel );
-
- void (*meta_import_pixel_state)( struct intel_context *intel );
-
- GLboolean (*meta_tex_rect_source)( struct intel_context *intel,
- GLuint buffer,
- GLuint offset,
- GLuint pitch,
- GLuint height,
- GLenum format,
- GLenum type);
->>>>>>> 1.8.2.25
-
- } vtbl;
-
- GLint refcount;
- GLuint Fallback;
- GLuint NewGLState;
-
-<<<<<<< intel_context.h
- struct {
- GLuint start_offset;
- GLint size;
- GLint space;
- GLubyte *ptr;
- GLuint counter;
- GLuint last_emit_state;
- GLboolean contains_geometry;
- const char *func;
- GLuint last_swap;
- } batch;
-
- struct {
- void *ptr;
- GLint size;
- GLuint offset;
- GLuint active_buf;
- GLuint irq_emitted;
- } alloc;
-=======
- GLuint last_fence;
- GLuint last_swap_fence;
-
- struct intel_batchbuffer *batch;
->>>>>>> 1.8.2.25
-
- struct {
- GLuint id;
- GLuint primitive;
- GLubyte *start_ptr;
- void (*flush)( struct intel_context * );
- } prim;
-
- GLboolean locked;
- char *prevLockFile;
- int prevLockLine;
-
- GLuint ClearColor565;
- GLuint ClearColor8888;
-
- /* Offsets of fields within the current vertex:
- */
- GLuint coloroffset;
- GLuint specoffset;
- GLuint wpos_offset;
- GLuint wpos_size;
-
- struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
- GLuint vertex_attr_count;
-
- GLfloat polygon_offset_scale; /* dependent on depth_scale, bpp */
-
- GLboolean hw_stipple;
-
- /* AGP memory buffer manager:
- */
- struct bufmgr *bm;
-
-
- /* State for intelvb.c and inteltris.c.
- */
- GLuint RenderIndex;
- GLmatrix ViewportMatrix;
- GLenum render_primitive;
- GLenum reduced_primitive;
- GLuint vertex_size;
- GLubyte *verts; /* points to tnl->clipspace.vertex_buf */
-
-
- struct intel_region *front_region; /* XXX FBO: obsolete */
- struct intel_region *back_region; /* XXX FBO: obsolete */
- struct intel_region *draw_region; /* XXX FBO: rename to color_region */
- struct intel_region *depth_region; /**< currently bound depth/Z region */
-
-
- /* Fallback rasterization functions
- */
- intel_point_func draw_point;
- intel_line_func draw_line;
- intel_tri_func draw_tri;
-
-<<<<<<< intel_context.h
- /* Drawing buffer state
-=======
- /* These refer to the current drawing buffer:
->>>>>>> 1.8.2.25
- */
-<<<<<<< intel_context.h
- intelRegion *drawRegion; /* current drawing buffer */
- intelRegion *readRegion; /* current reading buffer */
-
- int drawX; /* origin of drawable in draw buffer */
- int drawY;
- GLuint numClipRects; /* cliprects for that buffer */
-=======
- int drawX, drawY; /**< origin of drawing area within region */
- GLuint numClipRects; /**< cliprects for drawing */
->>>>>>> 1.8.2.25
- drm_clip_rect_t *pClipRects;
- drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
-
- int perf_boxes;
-
- GLuint do_usleeps;
- int do_irqs;
- GLuint irqsEmitted;
- drm_i915_irq_wait_t iw;
-
- /* XXX these seem to be unused */
-#if 0
- GLboolean scissor;
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
-#endif
-
- drm_context_t hHWContext;
- drmLock *driHwLock;
- int driFd;
-
- __DRIdrawablePrivate *driDrawable;
- __DRIscreenPrivate *driScreen;
- intelScreenPrivate *intelScreen;
- drmI830Sarea *sarea;
-
- GLuint lastStamp;
-
- /**
- * Configuration cache
- */
- driOptionCache optionCache;
-
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
- int64_t swap_ust;
- int64_t swap_missed_ust;
-
- GLuint swap_count;
- GLuint swap_missed_count;
-};
-
-
-#define DEBUG_LOCKING 1
-
-#if DEBUG_LOCKING
-
-#define DEBUG_LOCK() \
- do { \
- intel->prevLockFile = (__FILE__); \
- intel->prevLockLine = (__LINE__); \
- } while (0)
-
-#define DEBUG_RESET() \
- do { \
- intel->prevLockFile = 0; \
- intel->prevLockLine = 0; \
- } while (0)
-
-/* Slightly less broken way of detecting recursive locking in a
- * threaded environment. The right way to do this would be to make
- * prevLockFile, prevLockLine thread-local.
- *
- * This technique instead checks to see if the same context is
- * requesting the lock twice -- this will not catch application
- * breakages where the same context is active in two different threads
- * at once, but it will catch driver breakages (recursive locking) in
- * threaded apps.
- */
-#define DEBUG_CHECK_LOCK() \
- do { \
- if ( *((volatile int *)intel->driHwLock) == \
- (DRM_LOCK_HELD | intel->hHWContext) ) { \
- fprintf( stderr, \
- "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \
- intel->prevLockFile, intel->prevLockLine, \
- __FILE__, __LINE__ ); \
- abort(); \
- } \
- } while (0)
-
-#else
-
-#define DEBUG_LOCK()
-#define DEBUG_RESET()
-#define DEBUG_CHECK_LOCK()
-
-#endif
-
-
-
-
-/* Lock the hardware and validate our state.
- */
-#define LOCK_HARDWARE( intel ) \
-do { \
- char __ret=0; \
- DEBUG_CHECK_LOCK(); \
- assert(!(intel)->locked); \
- DRM_CAS((intel)->driHwLock, (intel)->hHWContext, \
- (DRM_LOCK_HELD|(intel)->hHWContext), __ret); \
- if (__ret) \
- intelGetLock( (intel), 0 ); \
- DEBUG_LOCK(); \
- (intel)->locked = 1; \
-}while (0)
-
-
- /* Unlock the hardware using the global current context
- */
-#define UNLOCK_HARDWARE(intel) \
-do { \
- intel->locked = 0; \
- if (0) { \
- intel->perf_boxes |= intel->sarea->perf_boxes; \
- intel->sarea->perf_boxes = 0; \
- } \
- DRM_UNLOCK((intel)->driFd, (intel)->driHwLock, (intel)->hHWContext); \
- DEBUG_RESET(); \
-} while (0)
-
-
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-#define INTEL_FIREVERTICES(intel) \
-do { \
- assert(!(intel)->prim.flush); \
-} while (0)
-
-/* ================================================================
- * Color packing:
- */
-
-#define INTEL_PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define INTEL_PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define INTEL_PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define INTEL_PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-
-/* ================================================================
- * From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- * XXX Put this in src/mesa/main/imports.h ???
- */
-#if defined(i386) || defined(__i386__)
-static INLINE void * __memcpy(void * to, const void * from, size_t n)
-{
- int d0, d1, d2;
- __asm__ __volatile__(
- "rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n"
- "2:"
- : "=&c" (d0), "=&D" (d1), "=&S" (d2)
- :"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
- : "memory");
- return (to);
-}
-#else
-#define __memcpy(a,b,c) memcpy(a,b,c)
-#endif
-
-
-
-/* ================================================================
- * Debugging:
- */
-#define DO_DEBUG 1
-#if DO_DEBUG
-extern int INTEL_DEBUG;
-#else
-#define INTEL_DEBUG 0
-#endif
-
-#define DEBUG_TEXTURE 0x1
-#define DEBUG_STATE 0x2
-#define DEBUG_IOCTL 0x4
-#define DEBUG_PRIMS 0x8
-#define DEBUG_VERTS 0x10
-#define DEBUG_FALLBACKS 0x20
-#define DEBUG_VERBOSE 0x40
-#define DEBUG_DRI 0x80
-#define DEBUG_DMA 0x100
-#define DEBUG_SANITY 0x200
-#define DEBUG_SYNC 0x400
-#define DEBUG_SLEEP 0x800
-#define DEBUG_PIXEL 0x1000
-
-
-#define PCI_CHIP_845_G 0x2562
-#define PCI_CHIP_I830_M 0x3577
-#define PCI_CHIP_I855_GM 0x3582
-#define PCI_CHIP_I865_G 0x2572
-#define PCI_CHIP_I915_G 0x2582
-#define PCI_CHIP_I915_GM 0x2592
-#define PCI_CHIP_I945_G 0x2772
-#define PCI_CHIP_I945_GM 0x27A2
-
-
-/* ================================================================
- * intel_context.c:
- */
-
-extern GLboolean intelInitContext( struct intel_context *intel,
- const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate,
- struct dd_function_table *functions );
-
-extern void intelGetLock(struct intel_context *intel, GLuint flags);
-
-extern void intelInitState( GLcontext *ctx );
-extern void intelFinish( GLcontext *ctx );
-extern void intelFlush( GLcontext *ctx );
-
-extern void intelInitDriverFunctions( struct dd_function_table *functions );
-
-
-/* ================================================================
- * intel_state.c:
- */
-extern void intelInitStateFuncs( struct dd_function_table *functions );
-
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
-
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
-
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
-
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#define BLENDFACT_MASK 0x0f
-
-#define MI_BATCH_BUFFER_END (0xA<<23)
-
-
-extern int intel_translate_compare_func( GLenum func );
-extern int intel_translate_stencil_op( GLenum op );
-extern int intel_translate_blend_factor( GLenum factor );
-extern int intel_translate_logic_op( GLenum opcode );
-
-
-/*======================================================================
- * Inline conversion functions.
- * These are better-typed than the macros used previously:
- */
-static INLINE struct intel_context *intel_context( GLcontext *ctx )
-{
- return (struct intel_context *)ctx;
-}
-
-static INLINE struct intel_texture_object *intel_texture_object( struct gl_texture_object *obj )
-{
- return (struct intel_texture_object *)obj;
-}
-
-static INLINE struct intel_texture_image *intel_texture_image( struct gl_texture_image *img )
-{
- return (struct intel_texture_image *)img;
-}
-
-extern struct intel_renderbuffer *intel_renderbuffer( struct gl_renderbuffer *rb );
-
-
-#endif
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_depthstencil.c b/src/mesa/drivers/dri/i915-tex/intel_depthstencil.c
deleted file mode 100644
index 51eb799f920..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_depthstencil.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "imports.h"
-#include "context.h"
-#include "depthstencil.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "hash.h"
-#include "mtypes.h"
-#include "renderbuffer.h"
-
-#include "intel_context.h"
-#include "intel_fbo.h"
-#include "intel_depthstencil.h"
-#include "intel_regions.h"
-
-
-/**
- * The GL_EXT_framebuffer_object allows the user to create their own
- * framebuffer objects consisting of color renderbuffers (0 or more),
- * depth renderbuffers (0 or 1) and stencil renderbuffers (0 or 1).
- *
- * The spec considers depth and stencil renderbuffers to be totally independent
- * buffers. In reality, most graphics hardware today uses a combined
- * depth+stencil buffer (one 32-bit pixel = 24 bits of Z + 8 bits of stencil).
- *
- * This causes difficulty because the user may create some number of depth
- * renderbuffers and some number of stencil renderbuffers and bind them
- * together in framebuffers in any combination.
- *
- * This code manages all that.
- *
- * 1. Depth renderbuffers are always allocated in hardware as 32bpp
- * GL_DEPTH24_STENCIL8 buffers.
- *
- * 2. Stencil renderbuffers are initially allocated in software as 8bpp
- * GL_STENCIL_INDEX8 buffers.
- *
- * 3. Depth and Stencil renderbuffers use the PairedStencil and PairedDepth
- * fields (respectively) to indicate if the buffer's currently paired
- * with another stencil or depth buffer (respectively).
- *
- * 4. When a depth and stencil buffer are initially both attached to the
- * current framebuffer, we merge the stencil buffer values into the
- * depth buffer (really a depth+stencil buffer). The then hardware uses
- * the combined buffer.
- *
- * 5. Whenever a depth or stencil buffer is reallocated (with
- * glRenderbufferStorage) we undo the pairing and copy the stencil values
- * from the combined depth/stencil buffer back to the stencil-only buffer.
- *
- * 6. We also undo the pairing when we find a change in buffer bindings.
- *
- * 7. If a framebuffer is only using a depth renderbuffer (no stencil), we
- * just use the combined depth/stencil buffer and ignore the stencil values.
- *
- * 8. If a framebuffer is only using a stencil renderbuffer (no depth) we have
- * to promote the 8bpp software stencil buffer to a 32bpp hardware
- * depth+stencil buffer.
- *
- */
-
-
-
-static void
-map_regions(GLcontext *ctx,
- struct intel_renderbuffer *depthRb,
- struct intel_renderbuffer *stencilRb)
-{
- struct intel_context *intel = intel_context(ctx);
- if (depthRb && depthRb->region) {
- intel_region_map(intel, depthRb->region);
- depthRb->pfMap = depthRb->region->map;
- depthRb->pfPitch = depthRb->region->pitch;
- }
- if (stencilRb && stencilRb->region) {
- intel_region_map(intel, stencilRb->region);
- stencilRb->pfMap = stencilRb->region->map;
- stencilRb->pfPitch = stencilRb->region->pitch;
- }
-}
-
-static void
-unmap_regions(GLcontext *ctx,
- struct intel_renderbuffer *depthRb,
- struct intel_renderbuffer *stencilRb)
-{
- struct intel_context *intel = intel_context(ctx);
- if (depthRb && depthRb->region) {
- intel_region_unmap(intel, depthRb->region);
- depthRb->pfMap = NULL;
- depthRb->pfPitch = 0;
- }
- if (stencilRb && stencilRb->region) {
- intel_region_unmap(intel, stencilRb->region);
- stencilRb->pfMap = NULL;
- stencilRb->pfPitch = 0;
- }
-}
-
-
-
-/**
- * Undo the pairing/interleaving between depth and stencil buffers.
- * irb should be a depth/stencil or stencil renderbuffer.
- */
-void
-intel_unpair_depth_stencil(GLcontext *ctx, struct intel_renderbuffer *irb)
-{
- if (irb->PairedStencil) {
- /* irb is a depth/stencil buffer */
- struct gl_renderbuffer *stencilRb;
- struct intel_renderbuffer *stencilIrb;
-
- ASSERT(irb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
-
- stencilRb = _mesa_lookup_renderbuffer(ctx, irb->PairedStencil);
- stencilIrb = intel_renderbuffer(stencilRb);
- if (stencilIrb) {
- /* need to extract stencil values from the depth buffer */
- ASSERT(stencilIrb->PairedDepth == irb->Base.Name);
- map_regions(ctx, irb, stencilIrb);
- _mesa_extract_stencil(ctx, &irb->Base, &stencilIrb->Base);
- unmap_regions(ctx, irb, stencilIrb);
- stencilIrb->PairedDepth = 0;
- }
- irb->PairedStencil = 0;
- }
- else if (irb->PairedDepth) {
- /* irb is a stencil buffer */
- struct gl_renderbuffer *depthRb;
- struct intel_renderbuffer *depthIrb;
-
- ASSERT(irb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT ||
- irb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
-
- depthRb = _mesa_lookup_renderbuffer(ctx, irb->PairedDepth);
- depthIrb = intel_renderbuffer(depthRb);
- if (depthIrb) {
- /* need to extract stencil values from the depth buffer */
- ASSERT(depthIrb->PairedStencil == irb->Base.Name);
- map_regions(ctx, depthIrb, irb);
- _mesa_extract_stencil(ctx, &depthIrb->Base, &irb->Base);
- unmap_regions(ctx, depthIrb, irb);
- depthIrb->PairedStencil = 0;
- }
- irb->PairedDepth = 0;
- }
- else {
- _mesa_problem(ctx, "Problem in undo_depth_stencil_pairing");
- }
-
- ASSERT(irb->PairedStencil == 0);
- ASSERT(irb->PairedDepth == 0);
-}
-
-
-/**
- * Examine the depth and stencil renderbuffers which are attached to the
- * framebuffer. If both depth and stencil are attached, make sure that the
- * renderbuffers are 'paired' (combined). If only depth or only stencil is
- * attached, undo any previous pairing.
- *
- * Must be called if NewState & _NEW_BUFFER (when renderbuffer attachments
- * change, for example).
- */
-void
-intel_validate_paired_depth_stencil(GLcontext *ctx, struct gl_framebuffer *fb)
-{
- struct intel_renderbuffer *depthRb, *stencilRb;
-
- depthRb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
- stencilRb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
-
- if (depthRb && stencilRb) {
- if (depthRb == stencilRb) {
- /* Using a user-created combined depth/stencil buffer.
- * Nothing to do.
- */
- ASSERT(depthRb->Base._BaseFormat == GL_DEPTH_STENCIL_EXT);
- ASSERT(depthRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- }
- else {
- /* Separate depth/stencil buffers, need to interleave now */
- ASSERT(depthRb->Base._BaseFormat == GL_DEPTH_COMPONENT);
- ASSERT(stencilRb->Base._BaseFormat == GL_STENCIL_INDEX);
- /* may need to interleave depth/stencil now */
- if (depthRb->PairedStencil == stencilRb->Base.Name) {
- /* OK, the depth and stencil buffers are already interleaved */
- ASSERT(stencilRb->PairedDepth == depthRb->Base.Name);
- }
- else {
- /* need to setup new pairing/interleaving */
- if (depthRb->PairedStencil) {
- intel_unpair_depth_stencil(ctx, depthRb);
- }
- if (stencilRb->PairedDepth) {
- intel_unpair_depth_stencil(ctx, stencilRb);
- }
-
- ASSERT(depthRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- ASSERT(stencilRb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT ||
- stencilRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
-
- /* establish new pairing: interleave stencil into depth buffer */
- map_regions(ctx, depthRb, stencilRb);
- _mesa_insert_stencil(ctx, &depthRb->Base, &stencilRb->Base);
- unmap_regions(ctx, depthRb, stencilRb);
- depthRb->PairedStencil = stencilRb->Base.Name;
- stencilRb->PairedDepth = depthRb->Base.Name;
- }
-
- }
- }
- else if (depthRb) {
- /* Depth buffer but no stencil buffer.
- * We'll use a GL_DEPTH24_STENCIL8 buffer and ignore the stencil bits.
- */
- /* can't assert this until storage is allocated:
- ASSERT(depthRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- */
- /* intel_undo any previous pairing */
- if (depthRb->PairedStencil) {
- intel_unpair_depth_stencil(ctx, depthRb);
- }
- }
- else if (stencilRb) {
- /* Stencil buffer but no depth buffer.
- * Since h/w doesn't typically support just 8bpp stencil w/out Z,
- * we'll use a GL_DEPTH24_STENCIL8 buffer and ignore the depth bits.
- */
- /* undo any previous pairing */
- if (stencilRb->PairedDepth) {
- intel_unpair_depth_stencil(ctx, stencilRb);
- }
- if (stencilRb->Base._ActualFormat == GL_STENCIL_INDEX8_EXT) {
- /* promote buffer to GL_DEPTH24_STENCIL8 for hw rendering */
- _mesa_promote_stencil(ctx, &stencilRb->Base);
- ASSERT(stencilRb->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT);
- }
- }
-
- /* Finally, update the fb->_DepthBuffer and fb->_StencilBuffer fields */
- _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
- if (depthRb && depthRb->PairedStencil)
- _mesa_update_stencil_buffer(ctx, fb, BUFFER_DEPTH);
- else
- _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
-
-
- /* The hardware should use fb->Attachment[BUFFER_DEPTH].Renderbuffer
- * first, if present, then fb->Attachment[BUFFER_STENCIL].Renderbuffer
- * if present.
- */
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_depthstencil.h b/src/mesa/drivers/dri/i915-tex/intel_depthstencil.h
deleted file mode 100644
index 33699535664..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_depthstencil.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-#ifndef INTEL_DEPTH_STENCIL_H
-#define INTEL_DEPTH_STENCIL_H
-
-
-extern void
-intel_unpair_depth_stencil(GLcontext *ctx, struct intel_renderbuffer *irb);
-
-extern void
-intel_validate_paired_depth_stencil(GLcontext *ctx, struct gl_framebuffer *fb);
-
-
-#endif /* INTEL_DEPTH_STENCIL_H */
diff --git a/src/mesa/drivers/dri/i915-tex/intel_fbo.c b/src/mesa/drivers/dri/i915-tex/intel_fbo.c
deleted file mode 100644
index dbbc1bd9b23..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_fbo.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-
-#include "imports.h"
-#include "mtypes.h"
-#include "fbobject.h"
-#include "framebuffer.h"
-#include "renderbuffer.h"
-#include "context.h"
-#include "texformat.h"
-#include "texrender.h"
-
-#include "intel_context.h"
-#include "intel_buffers.h"
-#include "intel_bufmgr.h"
-#include "intel_depthstencil.h"
-#include "intel_fbo.h"
-#include "intel_mipmap_tree.h"
-#include "intel_regions.h"
-#include "intel_span.h"
-
-#define INTEL_RB_CLASS 0x12345678
-
-
-/* XXX FBO: move this to intel_context.h (inlined) */
-/**
- * Return a gl_renderbuffer ptr casted to intel_renderbuffer.
- * NULL will be returned if the rb isn't really an intel_renderbuffer.
- * This is determiend by checking the ClassID.
- */
-struct intel_renderbuffer *intel_renderbuffer( struct gl_renderbuffer *rb )
-{
- struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
- if (irb && irb->Base.ClassID == INTEL_RB_CLASS) {
- /*_mesa_warning(NULL, "Returning non-intel Rb\n");*/
- return irb;
- }
- else
- return NULL;
-}
-
-
-struct intel_renderbuffer *
-intel_get_renderbuffer(struct gl_framebuffer *fb, GLuint attIndex)
-{
- return intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer);
-}
-
-
-struct intel_region *
-intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex)
-{
- struct intel_renderbuffer *irb
- = intel_renderbuffer(fb->Attachment[attIndex].Renderbuffer);
- if (irb)
- return irb->region;
- else
- return NULL;
-}
-
-
-
-/**
- * Create a new framebuffer object.
- */
-static struct gl_framebuffer *
-intel_new_framebuffer(GLcontext *ctx, GLuint name)
-{
- /* there's no intel_framebuffer at this time, just use Mesa's class */
- return _mesa_new_framebuffer(ctx, name);
-}
-
-
-static void
-intel_delete_renderbuffer(struct gl_renderbuffer *rb)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct intel_context *intel = intel_context(ctx);
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
-
- ASSERT(irb);
-
- if (irb->PairedStencil || irb->PairedDepth) {
- intel_unpair_depth_stencil(ctx, irb);
- }
-
- if (intel && irb->region) {
- intel_region_release(intel, &irb->region);
- }
-
- _mesa_free(irb);
-}
-
-
-
-/**
- * Return a pointer to a specific pixel in a renderbuffer.
- */
-static void *
-intel_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLint x, GLint y)
-{
- /* By returning NULL we force all software rendering to go through
- * the span routines.
- */
- return NULL;
-}
-
-
-
-/**
- * Called via glRenderbufferStorageEXT() to set the format and allocate
- * storage for a user-created renderbuffer.
- */
-static GLboolean
-intel_alloc_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- GLboolean softwareBuffer = GL_FALSE;
- int cpp;
-
- ASSERT(rb->Name != 0);
-
- switch (internalFormat) {
- case GL_R3_G3_B2:
- case GL_RGB4:
- case GL_RGB5:
- rb->_ActualFormat = GL_RGB5;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->RedBits = 5;
- rb->GreenBits = 6;
- rb->BlueBits = 5;
- cpp = 2;
- break;
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- rb->_ActualFormat = GL_RGBA8;
- rb->DataType = GL_UNSIGNED_BYTE;
- rb->RedBits = 8;
- rb->GreenBits = 8;
- rb->BlueBits = 8;
- rb->AlphaBits = 8;
- cpp = 4;
- break;
- case GL_STENCIL_INDEX:
- case GL_STENCIL_INDEX1_EXT:
- case GL_STENCIL_INDEX4_EXT:
- case GL_STENCIL_INDEX8_EXT:
- case GL_STENCIL_INDEX16_EXT:
- /* alloc a depth+stencil buffer */
- rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->StencilBits = 8;
- cpp = 4;
- break;
- case GL_DEPTH_COMPONENT16:
- rb->_ActualFormat = GL_DEPTH_COMPONENT16;
- rb->DataType = GL_UNSIGNED_SHORT;
- rb->DepthBits = 16;
- cpp = 2;
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->DepthBits = 24;
- cpp = 4;
- break;
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
- rb->DepthBits = 24;
- rb->StencilBits = 8;
- cpp = 4;
- break;
- default:
- _mesa_problem(ctx, "Unexpected format in intel_alloc_renderbuffer_storage");
- return GL_FALSE;
- }
-
- intelFlush(ctx);
-
- /* free old region */
- if (irb->region) {
- /*LOCK_HARDWARE(intel);*/
- intel_region_release(intel, &irb->region);
- /*UNLOCK_HARDWARE(intel);*/
- }
-
- /* allocate new memory region/renderbuffer */
- if (softwareBuffer) {
- return _mesa_soft_renderbuffer_storage(ctx, rb, internalFormat,
- width, height);
- }
- else {
- /* Choose a pitch to match hardware requirements:
- */
- GLuint pitch = ((cpp * width + 63) & ~63) / cpp;
-
- /* alloc hardware renderbuffer */
- _mesa_debug(ctx, "Allocating %d x %d Intel RBO (pitch %d)\n", width, height, pitch);
-
- irb->region = intel_region_alloc(intel, cpp, pitch, height);
- if (!irb->region)
- return GL_FALSE; /* out of memory? */
-
- ASSERT(irb->region->buffer);
-
- rb->Width = width;
- rb->Height = height;
-
- /* This sets the Get/PutRow/Value functions */
- intel_set_span_functions(&irb->Base);
-
- return GL_TRUE;
- }
-}
-
-
-
-/**
- * Called for each hardware renderbuffer when a _window_ is resized.
- * Just update fields.
- * Not used for user-created renderbuffers!
- */
-static GLboolean
-intel_alloc_window_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height)
-{
- ASSERT(rb->Name == 0);
- rb->Width = width;
- rb->Height = height;
- rb->_ActualFormat = internalFormat;
- return GL_TRUE;
-}
-
-
-static GLboolean
-intel_nop_alloc_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height)
-{
- _mesa_problem(ctx, "intel_op_alloc_storage should never be called.");
- return GL_FALSE;
-}
-
-
-
-/**
- * Create a new intel_renderbuffer which corresponds to an on-screen window,
- * not a user-created renderbuffer.
- * \param width the screen width
- * \param height the screen height
- */
-struct intel_renderbuffer *
-intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height,
- int offset, int pitch, int cpp, void *map)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- struct intel_renderbuffer *irb;
- const GLuint name = 0;
-
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
- return NULL;
- }
-
- _mesa_init_renderbuffer(&irb->Base, name);
- irb->Base.ClassID = INTEL_RB_CLASS;
-
- switch (intFormat) {
- case GL_RGB5:
- irb->Base._ActualFormat = GL_RGB5;
- irb->Base._BaseFormat = GL_RGBA;
- irb->Base.RedBits = 5;
- irb->Base.GreenBits = 6;
- irb->Base.BlueBits = 5;
- irb->Base.DataType = GL_UNSIGNED_BYTE;
- cpp = 2;
- break;
- case GL_RGBA8:
- irb->Base._ActualFormat = GL_RGBA8;
- irb->Base._BaseFormat = GL_RGBA;
- irb->Base.RedBits = 8;
- irb->Base.GreenBits = 8;
- irb->Base.BlueBits = 8;
- irb->Base.AlphaBits = 8;
- irb->Base.DataType = GL_UNSIGNED_BYTE;
- cpp = 4;
- break;
- case GL_STENCIL_INDEX8_EXT:
- irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT;
- irb->Base._BaseFormat = GL_STENCIL_INDEX;
- irb->Base.StencilBits = 8;
- irb->Base.DataType = GL_UNSIGNED_BYTE;
- cpp = 1;
- break;
- case GL_DEPTH_COMPONENT16:
- irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
- irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- irb->Base.DepthBits = 16;
- irb->Base.DataType = GL_UNSIGNED_SHORT;
- cpp = 2;
- break;
- case GL_DEPTH_COMPONENT24:
- irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- irb->Base.DepthBits = 24;
- irb->Base.DataType = GL_UNSIGNED_INT;
- cpp = 4;
- break;
- case GL_DEPTH24_STENCIL8_EXT:
- irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
- irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
- irb->Base.DepthBits = 24;
- irb->Base.StencilBits = 8;
- irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- cpp = 4;
- break;
- default:
- _mesa_problem(NULL, "Unexpected intFormat in intel_create_renderbuffer");
- return NULL;
- }
-
- irb->Base.InternalFormat = intFormat;
-
- /* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_window_storage;
- irb->Base.GetPointer = intel_get_pointer;
- /* This sets the Get/PutRow/Value functions */
- intel_set_span_functions(&irb->Base);
-
- irb->pfMap = map;
- irb->pfPitch = pitch;
-
-#if 00
- irb->region = intel_region_create_static(intel,
- DRM_MM_TT,
- offset,
- map,
- cpp,
- width, height);
-#endif
-
- return irb;
-}
-
-
-/**
- * Create a new renderbuffer object.
- * Typically called via glBindRenderbufferEXT().
- */
-static struct gl_renderbuffer *
-intel_new_renderbuffer(GLcontext *ctx, GLuint name)
-{
- /*struct intel_context *intel = intel_context(ctx);*/
- struct intel_renderbuffer *irb;
-
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
- return NULL;
- }
-
- _mesa_init_renderbuffer(&irb->Base, name);
- irb->Base.ClassID = INTEL_RB_CLASS;
-
- /* intel-specific methods */
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
- irb->Base.GetPointer = intel_get_pointer;
- /* span routines set in alloc_storage function */
-
- return &irb->Base;
-}
-
-
-/**
- * Called via glBindFramebufferEXT().
- */
-static void
-intel_bind_framebuffer(GLcontext *ctx, GLenum target,
- struct gl_framebuffer *fb)
-{
- /*
- _mesa_debug(ctx, "%s %d\n", __FUNCTION__, fb->Name);
- */
- /* XXX FBO: putting this flush here fixes a rendering offset bug.
- * Not sure why this is needed when _mesa_BindFrameBuffer does
- * a FLUSH_VERTICES().
- */
- intelFlush(ctx);
-
- if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
- intel_draw_buffer(ctx, fb);
- /* Integer depth range depends on depth buffer bits */
- ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
- }
- else {
- /* don't need to do anything if target == GL_READ_FRAMEBUFFER_EXT */
- }
-}
-
-
-/**
- * Called via glFramebufferRenderbufferEXT().
- */
-static void
-intel_framebuffer_renderbuffer(GLcontext *ctx,
- struct gl_framebuffer *fb,
- GLenum attachment,
- struct gl_renderbuffer *rb)
-{
- /*
- _mesa_debug(ctx, "Intel FramebufferRenderbuffer %u %u\n",
- fb->Name, rb ? rb->Name : 0);
- */
-
- intelFlush(ctx);
-
- _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
- intel_draw_buffer(ctx, fb);
-}
-
-
-/**
- * When glFramebufferTexture[123]D is called this function sets up the
- * gl_renderbuffer wrapp around the texture image.
- * This will have the region info needed for hardware rendering.
- */
-static struct intel_renderbuffer *
-intel_wrap_texture(GLcontext *ctx, struct gl_texture_image *texImage)
-{
- const GLuint name = ~0; /* not significant, but distinct for debugging */
- struct intel_renderbuffer *irb;
-
- /* make an intel_renderbuffer to wrap the texture image */
- irb = CALLOC_STRUCT(intel_renderbuffer);
- if (!irb) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture");
- return NULL;
- }
-
- _mesa_init_renderbuffer(&irb->Base, name);
- irb->Base.ClassID = INTEL_RB_CLASS;
-
- if (texImage->TexFormat == &_mesa_texformat_argb8888) {
- irb->Base._ActualFormat = GL_RGBA8;
- irb->Base._BaseFormat = GL_RGBA;
- _mesa_debug(ctx, "Render to RGBA8 texture OK\n");
- }
- else if (texImage->TexFormat == &_mesa_texformat_rgb565) {
- irb->Base._ActualFormat = GL_RGB5;
- irb->Base._BaseFormat = GL_RGB;
- _mesa_debug(ctx, "Render to RGB5 texture OK\n");
- }
- else if (texImage->TexFormat == &_mesa_texformat_depth_component16) {
- irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
- irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
- _mesa_debug(ctx, "Render to DEPTH16 texture OK\n");
- }
- else {
- _mesa_debug(ctx, "Render to texture BAD FORMAT %d\n", texImage->TexFormat->MesaFormat);
- _mesa_free(irb);
- return NULL;
- }
-
- irb->Base.InternalFormat = irb->Base._ActualFormat;
- irb->Base.Width = texImage->Width;
- irb->Base.Height = texImage->Height;
- irb->Base.DataType = GL_UNSIGNED_BYTE; /* FBO XXX fix */
- irb->Base.RedBits = texImage->TexFormat->RedBits;
- irb->Base.GreenBits = texImage->TexFormat->GreenBits;
- irb->Base.BlueBits = texImage->TexFormat->BlueBits;
- irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
- irb->Base.DepthBits = texImage->TexFormat->DepthBits;
-
- irb->Base.Delete = intel_delete_renderbuffer;
- irb->Base.AllocStorage = intel_nop_alloc_storage;
- intel_set_span_functions(&irb->Base);
-
- irb->RenderToTexture = GL_TRUE;
-
- return irb;
-}
-
-
-/**
- * Called by glFramebufferTexture[123]DEXT() (and other places) to
- * prepare for rendering into texture memory. This might be called
- * many times to choose different texture levels, cube faces, etc
- * before intel_finish_render_texture() is ever called.
- */
-static void
-intel_render_texture(GLcontext *ctx,
- struct gl_framebuffer *fb,
- struct gl_renderbuffer_attachment *att)
-{
- struct gl_texture_image *newImage
- = att->Texture->Image[att->CubeMapFace][att->TextureLevel];
- struct intel_renderbuffer *irb
- = intel_renderbuffer(att->Renderbuffer);
- struct intel_texture_image *intel_image;
- GLuint imageOffset;
-
- (void) fb;
-
- ASSERT(newImage);
-
- if (!irb) {
- irb = intel_wrap_texture(ctx, newImage);
- if (irb) {
- /* bind the wrapper to the attachment point */
- att->Renderbuffer = &irb->Base;
- }
- else {
- /* fallback to software rendering */
- _mesa_render_texture(ctx, fb, att);
- return;
- }
- }
-
- /*
- _mesa_debug(ctx, "Begin render texture tex=%u w=%d h=%d refcount=%d\n",
- att->Texture->Name, newImage->Width, newImage->Height,
- irb->Base.RefCount);
- */
-
- /* point the renderbufer's region to the texture image region */
- intel_image = intel_texture_image(newImage);
- if (irb->region != intel_image->mt->region)
- intel_region_reference(&irb->region, intel_image->mt->region);
-
- /* compute offset of the particular 2D image within the texture region */
- imageOffset = intel_miptree_image_offset(intel_image->mt,
- att->CubeMapFace,
- att->TextureLevel);
- if (att->Texture->Target == GL_TEXTURE_3D) {
- GLuint imgStride = intel_miptree_depth_image_stride(intel_image->mt,
- att->CubeMapFace,
- att->TextureLevel);
- imageOffset += imgStride * att->Zoffset;
- }
- /* store that offset in the region */
- intel_image->mt->region->draw_offset = imageOffset;
-
- /* update drawing region, etc */
- intel_draw_buffer(ctx, fb);
-}
-
-
-/**
- * Called by Mesa when rendering to a texture is done.
- */
-static void
-intel_finish_render_texture(GLcontext *ctx,
- struct gl_renderbuffer_attachment *att)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_renderbuffer *irb
- = intel_renderbuffer(att->Renderbuffer);
-
- /*
- _mesa_debug(ctx, "End render texture (tid %u) tex %u\n",
- _glthread_GetID(), att->Texture->Name);
- */
-
- if (irb) {
- /* just release the region */
- intel_region_release(intel, &irb->region);
- }
- else if (att->Renderbuffer) {
- /* software fallback */
- _mesa_finish_render_texture(ctx, att);
- /* XXX FBO: Need to unmap the buffer (or in intelSpanRenderStart???) */
- }
-}
-
-
-/**
- * Do one-time context initializations related to GL_EXT_framebuffer_object.
- * Hook in device driver functions.
- */
-void
-intel_fbo_init( struct intel_context *intel )
-{
- intel->ctx.Driver.NewFramebuffer = intel_new_framebuffer;
- intel->ctx.Driver.NewRenderbuffer = intel_new_renderbuffer;
- intel->ctx.Driver.BindFramebuffer = intel_bind_framebuffer;
- intel->ctx.Driver.FramebufferRenderbuffer = intel_framebuffer_renderbuffer;
- intel->ctx.Driver.RenderTexture = intel_render_texture;
- intel->ctx.Driver.FinishRenderTexture = intel_finish_render_texture;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_fbo.h b/src/mesa/drivers/dri/i915-tex/intel_fbo.h
deleted file mode 100644
index 980726763ab..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_fbo.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_FBO_H
-#define INTEL_FBO_H
-
-
-struct intel_context;
-struct intel_region;
-
-
-/**
- * Intel renderbuffer, derived from gl_renderbuffer.
- * Note: The PairedDepth and PairedStencil fields use renderbuffer IDs,
- * not pointers because in some circumstances a deleted renderbuffer could
- * result in a dangling pointer here.
- */
-struct intel_renderbuffer {
- struct gl_renderbuffer Base;
- struct intel_region *region;
- void *pfMap; /* possibly paged flipped map pointer */
- GLuint pfPitch; /* possibly paged flipped pitch */
- GLboolean RenderToTexture; /* RTT? */
-
- GLuint PairedDepth; /**< only used if this is a depth renderbuffer */
- GLuint PairedStencil; /**< only used if this is a stencil renderbuffer */
-};
-
-
-extern struct intel_renderbuffer *
-intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height,
- int offset, int pitch, int cpp, void *map);
-
-
-extern void
-intel_fbo_init( struct intel_context *intel );
-
-
-/* XXX make inline or macro */
-extern struct intel_renderbuffer *
-intel_get_renderbuffer(struct gl_framebuffer *fb, GLuint attIndex);
-
-
-/* XXX make inline or macro */
-extern struct intel_region *
-intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex);
-
-
-
-
-#endif /* INTEL_FBO_H */
diff --git a/src/mesa/drivers/dri/i915-tex/intel_ioctl.c b/src/mesa/drivers/dri/i915-tex/intel_ioctl.c
deleted file mode 100644
index 2f06d47b912..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_ioctl.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sched.h>
-
-#include "mtypes.h"
-#include "context.h"
-#include "swrast/swrast.h"
-
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_regions.h"
-#include "drm.h"
-#include "intel_bufmgr.h"
-
-u_int32_t intelGetLastFrame (intelContextPtr intel)
-{
- int ret;
- u_int32_t frame;
- drm_i915_getparam_t gp;
-
- gp.param = I915_PARAM_LAST_DISPATCH;
- gp.value = (int *)&frame;
- ret = drmCommandWriteRead( intel->driFd, DRM_I915_GETPARAM,
- &gp, sizeof(gp) );
- return frame;
-}
-
-<<<<<<< intel_ioctl.c
-int intelEmitIrqLocked( intelContextPtr intel )
-=======
-int intelEmitIrqLocked( struct intel_context *intel )
->>>>>>> 1.10.2.11
-{
- drmI830IrqEmit ie;
- int ret, seq;
-
- assert(((*(int *)intel->driHwLock) & ~DRM_LOCK_CONT) ==
- (DRM_LOCK_HELD|intel->hHWContext));
-
- ie.irq_seq = &seq;
-
- ret = drmCommandWriteRead( intel->driFd, DRM_I830_IRQ_EMIT,
- &ie, sizeof(ie) );
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqEmit: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-
- if (0)
- fprintf(stderr, "%s --> %d\n", __FUNCTION__, seq );
-
- return seq;
-}
-
-<<<<<<< intel_ioctl.c
-void intelWaitIrq( intelContextPtr intel, int seq )
-=======
-void intelWaitIrq( struct intel_context *intel, int seq )
->>>>>>> 1.10.2.11
-{
- int ret;
-
- if (0)
- fprintf(stderr, "%s %d\n", __FUNCTION__, seq );
-
- intel->iw.irq_seq = seq;
-
- do {
- ret = drmCommandWrite( intel->driFd, DRM_I830_IRQ_WAIT, &intel->iw, sizeof(intel->iw) );
- } while (ret == -EAGAIN || ret == -EINTR);
-
- if ( ret ) {
- fprintf( stderr, "%s: drmI830IrqWait: %d\n", __FUNCTION__, ret );
- exit(1);
- }
-}
-
-
-<<<<<<< intel_ioctl.c
-
-static void age_intel( intelContextPtr intel, int age )
-{
- GLuint i;
-
- for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
- if (intel->CurrentTexObj[i])
- intel->CurrentTexObj[i]->age = age;
-}
-
-void intel_dump_batchbuffer( long offset,
- int *ptr,
- int count )
-{
- int i;
- fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count);
- for (i = 0; i < count/4; i += 4)
- fprintf(stderr, "\t0x%x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
- (unsigned int)offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
- fprintf(stderr, "END BATCH\n\n\n");
-}
-
-void intelRefillBatchLocked( intelContextPtr intel, GLboolean allow_unlock )
-{
- GLuint last_irq = intel->alloc.irq_emitted;
- GLuint half = intel->alloc.size / 2;
- GLuint buf = (intel->alloc.active_buf ^= 1);
-
- intel->alloc.irq_emitted = intelEmitIrqLocked( intel );
-
- if (last_irq) {
- if (allow_unlock) UNLOCK_HARDWARE( intel );
- intelWaitIrq( intel, last_irq );
- if (allow_unlock) LOCK_HARDWARE( intel );
- }
-
- if (0)
- fprintf(stderr, "%s: now using half %d\n", __FUNCTION__, buf);
-
- intel->batch.start_offset = intel->alloc.offset + buf * half;
- intel->batch.ptr = (char *)intel->alloc.ptr + buf * half;
- intel->batch.size = half - 8;
- intel->batch.space = half - 8;
- assert(intel->batch.space >= 0);
-}
-
-#define MI_BATCH_BUFFER_END (0xA<<23)
-
-
-void intelFlushBatchLocked( intelContextPtr intel,
- GLboolean ignore_cliprects,
- GLboolean refill,
- GLboolean allow_unlock)
-=======
-void intel_batch_ioctl( struct intel_context *intel,
- GLuint start_offset,
- GLuint used,
- GLboolean ignore_cliprects,
- GLboolean allow_unlock)
->>>>>>> 1.10.2.11
-{
- drmI830BatchBuffer batch;
-
- assert(intel->locked);
- assert(used);
-
- if (0)
-<<<<<<< intel_ioctl.c
- fprintf(stderr, "%s used %d of %d offset %x..%x refill %d (started in %s)\n",
-=======
- fprintf(stderr, "%s used %d offset %x..%x ignore_cliprects %d\n",
->>>>>>> 1.10.2.11
- __FUNCTION__,
-<<<<<<< intel_ioctl.c
- (intel->batch.size - intel->batch.space),
- intel->batch.size,
- intel->batch.start_offset,
- intel->batch.start_offset +
- (intel->batch.size - intel->batch.space),
- refill,
- intel->batch.func);
-=======
- used,
- start_offset,
- start_offset + used,
- ignore_cliprects);
->>>>>>> 1.10.2.11
-
- /* Throw away non-effective packets. Won't work once we have
- * hardware contexts which would preserve statechanges beyond a
- * single buffer.
- */
- if (intel->numClipRects == 0 && !ignore_cliprects) {
- if (allow_unlock) {
- UNLOCK_HARDWARE(intel);
- sched_yield();
- LOCK_HARDWARE(intel);
- }
- intel->vtbl.lost_hardware( intel );
- return;
- }
-
-<<<<<<< intel_ioctl.c
- if (intel->batch.space != intel->batch.size) {
-
- if (intel->sarea->ctxOwner != intel->hHWContext) {
- intel->perf_boxes |= I830_BOX_LOST_CONTEXT;
- intel->sarea->ctxOwner = intel->hHWContext;
- }
-
- batch.start = intel->batch.start_offset;
- batch.used = intel->batch.size - intel->batch.space;
- batch.cliprects = intel->pClipRects;
- batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
- batch.DR1 = 0;
- batch.DR4 = ((((GLuint)intel->drawX) & 0xffff) |
- (((GLuint)intel->drawY) << 16));
-=======
- batch.start = start_offset;
- batch.used = used;
- batch.cliprects = intel->pClipRects;
- batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
- batch.DR1 = 0;
- batch.DR4 = ((((GLuint)intel->drawX) & 0xffff) |
- (((GLuint)intel->drawY) << 16));
->>>>>>> 1.10.2.11
-
-<<<<<<< intel_ioctl.c
- if (intel->alloc.offset) {
- if ((batch.used & 0x4) == 0) {
- ((int *)intel->batch.ptr)[0] = 0;
- ((int *)intel->batch.ptr)[1] = MI_BATCH_BUFFER_END;
- batch.used += 0x8;
- intel->batch.ptr += 0x8;
- }
- else {
- ((int *)intel->batch.ptr)[0] = MI_BATCH_BUFFER_END;
- batch.used += 0x4;
- intel->batch.ptr += 0x4;
- }
- }
-
- if (0)
- intel_dump_batchbuffer( batch.start,
- (int *)(intel->batch.ptr - batch.used),
- batch.used );
-
- intel->batch.start_offset += batch.used;
- intel->batch.size -= batch.used;
-
- if (intel->batch.size < 8) {
- refill = GL_TRUE;
- intel->batch.space = intel->batch.size = 0;
- }
- else {
- intel->batch.size -= 8;
- intel->batch.space = intel->batch.size;
- }
-
-
- assert(intel->batch.space >= 0);
- assert(batch.start >= intel->alloc.offset);
- assert(batch.start < intel->alloc.offset + intel->alloc.size);
- assert(batch.start + batch.used > intel->alloc.offset);
- assert(batch.start + batch.used <=
- intel->alloc.offset + intel->alloc.size);
-
-
- if (intel->alloc.offset) {
- if (drmCommandWrite (intel->driFd, DRM_I830_BATCHBUFFER, &batch,
- sizeof(batch))) {
- fprintf(stderr, "DRM_I830_BATCHBUFFER: %d\n", -errno);
- UNLOCK_HARDWARE(intel);
- exit(1);
- }
- } else {
- drmI830CmdBuffer cmd;
- cmd.buf = (char *)intel->alloc.ptr + batch.start;
- cmd.sz = batch.used;
- cmd.DR1 = batch.DR1;
- cmd.DR4 = batch.DR4;
- cmd.num_cliprects = batch.num_cliprects;
- cmd.cliprects = batch.cliprects;
-
- if (drmCommandWrite (intel->driFd, DRM_I830_CMDBUFFER, &cmd,
- sizeof(cmd))) {
- fprintf(stderr, "DRM_I830_CMDBUFFER: %d\n", -errno);
- UNLOCK_HARDWARE(intel);
- exit(1);
- }
- }
-
-
- age_intel(intel, intel->sarea->last_enqueue);
-
- /* FIXME: use hardware contexts to avoid 'losing' hardware after
- * each buffer flush.
- */
- if (intel->batch.contains_geometry)
- assert(intel->batch.last_emit_state == intel->batch.counter);
-
- intel->batch.counter++;
- intel->batch.contains_geometry = 0;
- intel->batch.func = 0;
- intel->vtbl.lost_hardware( intel );
- }
-
- if (refill)
- intelRefillBatchLocked( intel, allow_unlock );
-}
-
-void intelFlushBatch( intelContextPtr intel, GLboolean refill )
-{
- if (intel->locked) {
- intelFlushBatchLocked( intel, GL_FALSE, refill, GL_FALSE );
- }
- else {
- LOCK_HARDWARE(intel);
- intelFlushBatchLocked( intel, GL_FALSE, refill, GL_TRUE );
- UNLOCK_HARDWARE(intel);
- }
-}
-
-
-void intelWaitForIdle( intelContextPtr intel )
-{
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intel->vtbl.emit_flush( intel );
- intelFlushBatch( intel, GL_TRUE );
-
- /* Use an irq to wait for dma idle -- Need to track lost contexts
- * to shortcircuit consecutive calls to this function:
- */
- intelWaitIrq( intel, intel->alloc.irq_emitted );
- intel->alloc.irq_emitted = 0;
-}
-
-
-/**
- * Check if we need to rotate/warp the front color buffer to the
- * rotated screen. We generally need to do this when we get a glFlush
- * or glFinish after drawing to the front color buffer.
- */
-static void
-intelCheckFrontRotate(GLcontext *ctx)
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
- intelScreenPrivate *screen = intel->intelScreen;
- if (screen->current_rotation != 0) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT);
- }
- }
-}
-
-
-/**
- * NOT directly called via glFlush.
- */
-void intelFlush( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
-
- if (intel->Fallback)
- _swrast_flush( ctx );
-
- INTEL_FIREVERTICES( intel );
-
- if (intel->batch.size != intel->batch.space)
- intelFlushBatch( intel, GL_FALSE );
-}
-
-
-/**
- * Called via glFlush.
- */
-void intelglFlush( GLcontext *ctx )
-{
- intelFlush(ctx);
- intelCheckFrontRotate(ctx);
-}
-
-
-void intelFinish( GLcontext *ctx )
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- intelFlush( ctx );
- intelWaitForIdle( intel );
- intelCheckFrontRotate(ctx);
-}
-
-
-void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch)
-{
- intelContextPtr intel = INTEL_CONTEXT( ctx );
- const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
- GLbitfield tri_mask = 0;
- GLbitfield blit_mask = 0;
- GLbitfield swrast_mask = 0;
-
- if (0)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Take care of cliprects, which are handled differently for
- * clears, etc.
- */
- intelFlush( &intel->ctx );
-
- if (mask & BUFFER_BIT_FRONT_LEFT) {
- if (colorMask == ~0) {
- blit_mask |= BUFFER_BIT_FRONT_LEFT;
- }
- else {
- tri_mask |= BUFFER_BIT_FRONT_LEFT;
- }
- }
-
- if (mask & BUFFER_BIT_BACK_LEFT) {
- if (colorMask == ~0) {
- blit_mask |= BUFFER_BIT_BACK_LEFT;
- }
- else {
- tri_mask |= BUFFER_BIT_BACK_LEFT;
- }
- }
-
- if (mask & BUFFER_BIT_DEPTH) {
- blit_mask |= BUFFER_BIT_DEPTH;
- }
-
- if (mask & BUFFER_BIT_STENCIL) {
- if (!intel->hw_stencil) {
- swrast_mask |= BUFFER_BIT_STENCIL;
- }
- else if (ctx->Stencil.WriteMask[0] != 0xff) {
- tri_mask |= BUFFER_BIT_STENCIL;
- }
- else {
- blit_mask |= BUFFER_BIT_STENCIL;
- }
- }
-
- swrast_mask |= (mask & BUFFER_BIT_ACCUM);
-
- if (blit_mask)
- intelClearWithBlit( ctx, blit_mask, all, cx, cy, cw, ch );
-
- if (tri_mask)
- intel->vtbl.clear_with_tris( intel, tri_mask, all, cx, cy, cw, ch);
-
- if (swrast_mask)
- _swrast_Clear( ctx, swrast_mask, all, cx, cy, cw, ch );
-}
-
-
-void
-intelRotateWindow(intelContextPtr intel, __DRIdrawablePrivate *dPriv,
- GLuint srcBuffer)
-{
- if (intel->vtbl.rotate_window) {
- intel->vtbl.rotate_window(intel, dPriv, srcBuffer);
- }
-}
-
-
-void *intelAllocateAGP( intelContextPtr intel, GLsizei size )
-{
- int region_offset;
- drmI830MemAlloc alloc;
- int ret;
-
- if (0)
- fprintf(stderr, "%s: %d bytes\n", __FUNCTION__, size);
-
- alloc.region = I830_MEM_REGION_AGP;
- alloc.alignment = 0;
- alloc.size = size;
- alloc.region_offset = &region_offset;
-
- LOCK_HARDWARE(intel);
-
- /* Make sure the global heap is initialized
- */
- if (intel->texture_heaps[0])
- driAgeTextures( intel->texture_heaps[0] );
-
-
- ret = drmCommandWriteRead( intel->driFd,
- DRM_I830_ALLOC,
- &alloc, sizeof(alloc));
-
- if (ret) {
- fprintf(stderr, "%s: DRM_I830_ALLOC ret %d\n", __FUNCTION__, ret);
-=======
- if (INTEL_DEBUG & DEBUG_DMA)
- fprintf(stderr, "%s: 0x%x..0x%x DR4: %x cliprects: %d\n",
- __FUNCTION__,
- batch.start,
- batch.start + batch.used * 4,
- batch.DR4, batch.num_cliprects);
-#if 1
- if (drmCommandWrite (intel->driFd, DRM_I830_BATCHBUFFER, &batch,
- sizeof(batch))) {
- fprintf(stderr, "DRM_I830_BATCHBUFFER: %d\n", -errno);
->>>>>>> 1.10.2.11
- UNLOCK_HARDWARE(intel);
- exit(1);
- }
-#endif
-
- /* FIXME: use hardware contexts to avoid 'losing' hardware after
- * each buffer flush.
- */
- intel->vtbl.lost_hardware( intel );
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_ioctl.h b/src/mesa/drivers/dri/i915-tex/intel_ioctl.h
deleted file mode 100644
index 0a090af0733..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_ioctl.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_IOCTL_H
-#define INTEL_IOCTL_H
-
-#include "intel_context.h"
-
-void intelWaitIrq( struct intel_context *intel, int seq );
-int intelEmitIrqLocked( struct intel_context *intel );
-
-<<<<<<< intel_ioctl.h
-extern void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch);
-
-extern void intelPageFlip( const __DRIdrawablePrivate *dpriv );
-
-extern void intelRotateWindow(intelContextPtr intel,
- __DRIdrawablePrivate *dPriv, GLuint srcBuffer);
-
-extern void intelWaitForIdle( intelContextPtr intel );
-extern void intelFlushBatch( intelContextPtr intel, GLboolean refill );
-extern void intelFlushBatchLocked( intelContextPtr intel,
- GLboolean ignore_cliprects,
- GLboolean refill,
- GLboolean allow_unlock);
-extern void intelRefillBatchLocked( intelContextPtr intel, GLboolean allow_unlock );
-extern void intelFinish( GLcontext *ctx );
-extern void intelFlush( GLcontext *ctx );
-extern void intelglFlush( GLcontext *ctx );
-
-extern void *intelAllocateAGP( intelContextPtr intel, GLsizei size );
-extern void intelFreeAGP( intelContextPtr intel, void *pointer );
-
-extern void *intelAllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn,
- GLsizei size, GLfloat readfreq,
- GLfloat writefreq, GLfloat priority );
-
-extern void intelFreeMemoryMESA( __DRInativeDisplay *dpy, int scrn,
- GLvoid *pointer );
-
-extern GLuint intelGetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer );
-extern GLboolean intelIsAgpMemory( intelContextPtr intel, const GLvoid *pointer,
- GLint size );
-
-extern GLuint intelAgpOffsetFromVirtual( intelContextPtr intel, const GLvoid *p );
-=======
-void intel_batch_ioctl( struct intel_context *intel,
- GLuint start_offset,
- GLuint used,
- GLboolean ignore_cliprects,
- GLboolean allow_unlock);
->>>>>>> 1.2.12.5
-
-extern void intelWaitIrq( intelContextPtr intel, int seq );
-extern u_int32_t intelGetLastFrame (intelContextPtr intel);
-extern int intelEmitIrqLocked( intelContextPtr intel );
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.c
deleted file mode 100644
index 7f4f00cf8e3..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#include "intel_context.h"
-#include "intel_mipmap_tree.h"
-#include "intel_regions.h"
-#include "intel_bufmgr.h"
-#include "enums.h"
-
-static GLenum target_to_target( GLenum target )
-{
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- return GL_TEXTURE_CUBE_MAP_ARB;
- default:
- return target;
- }
-}
-
-struct intel_mipmap_tree *intel_miptree_create( struct intel_context *intel,
- GLenum target,
- GLenum internal_format,
- GLuint first_level,
- GLuint last_level,
- GLuint width0,
- GLuint height0,
- GLuint depth0,
- GLuint cpp,
- GLboolean compressed)
-{
- GLboolean ok;
- struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
-
- DBG("%s target %s format %s level %d..%d\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(target),
- _mesa_lookup_enum_by_nr(internal_format),
- first_level,
- last_level);
-
- mt->target = target_to_target(target);
- mt->internal_format = internal_format;
- mt->first_level = first_level;
- mt->last_level = last_level;
- mt->width0 = width0;
- mt->height0 = height0;
- mt->depth0 = depth0;
- mt->cpp = cpp;
- mt->compressed = compressed;
- mt->refcount = 1;
-
- switch (intel->intelScreen->deviceID) {
- case PCI_CHIP_I945_G:
-/* case PCI_CHIP_I945_GM: */
- ok = i945_miptree_layout( mt );
- break;
- default:
- /* All the i830 chips and the i915 use this layout:
- */
- ok = i915_miptree_layout( mt );
- break;
- }
-
- if (ok)
- mt->region = intel_region_alloc( intel,
- mt->cpp,
- mt->pitch,
- mt->total_height );
-
- if (!mt->region) {
- free(mt);
- return NULL;
- }
-
- return mt;
-}
-
-
-void intel_miptree_reference( struct intel_mipmap_tree **dst,
- struct intel_mipmap_tree *src )
-{
- src->refcount++;
- *dst = src;
-}
-
-void intel_miptree_release( struct intel_context *intel,
- struct intel_mipmap_tree **mt )
-{
- if (!*mt)
- return;
-
- DBG("%s %d\n", __FUNCTION__, (*mt)->refcount-1);
- if (--(*mt)->refcount == 0) {
- intel_region_release(intel, &((*mt)->region));
- free(*mt);
- }
- *mt = NULL;
-}
-
-
-
-
-/* Can the image be pulled into a unified mipmap tree. This mirrors
- * the completeness test in a lot of ways.
- *
- * Not sure whether I want to pass gl_texture_image here.
- */
-GLboolean intel_miptree_match_image( struct intel_mipmap_tree *mt,
- struct gl_texture_image *image,
- GLuint face,
- GLuint level )
-{
- DBG("%s %d %d/%d %d/%d\n", __FUNCTION__,
- image->Border,
- image->InternalFormat, mt->internal_format,
- image->IsCompressed, mt->compressed);
-
- /* Images with borders are never pulled into mipmap trees.
- */
- if (image->Border)
- return GL_FALSE;
-
- if (image->InternalFormat != mt->internal_format ||
- image->IsCompressed != mt->compressed)
- return GL_FALSE;
-
- DBG("%s: %d/%d %d/%d %d/%d\n", __FUNCTION__,
- image->Width, mt->offset[face][level].width,
- image->Height, mt->offset[face][level].height,
- image->Depth, mt->offset[face][level].depth);
-
- /* Test image dimensions against the base level image adjusted for
- * minification. This will also catch images not present in the
- * tree, changed targets, etc.
- */
- if (image->Width != mt->offset[face][level].width ||
- image->Height != mt->offset[face][level].height ||
- image->Depth != mt->offset[face][level].depth)
- return GL_FALSE;
-
-
- DBG("%s: success\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-
-GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level)
-{
- return mt->offset[face][level].offset;
-}
-
-GLuint intel_miptree_depth_image_stride(struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level)
-{
- return mt->offset[face][level].depth_image_stride;
-}
-
-
-void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level,
- GLuint x, GLuint y,
- GLuint w, GLuint h, GLuint d)
-{
- mt->offset[face][level].offset = (x + y * mt->pitch) * mt->cpp;
- mt->offset[face][level].width = w;
- mt->offset[face][level].height = h;
- mt->offset[face][level].depth = d;
-}
-
-
-
-/**
- * Map a teximage in a mipmap tree.
- * \param row_stride returns row stride in bytes
- * \param image_stride returns image stride in bytes (for 3D textures).
- * \return address of mapping
- */
-GLubyte *intel_miptree_image_map(struct intel_context *intel,
- struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level,
- GLuint *row_stride,
- GLuint *image_stride)
-{
- DBG("%s \n", __FUNCTION__);
-
- if (row_stride)
- *row_stride = mt->pitch * mt->cpp;
-
- if (image_stride)
- *image_stride = mt->offset[face][level].depth_image_stride;
-
- return (intel_region_map(intel, mt->region) +
- intel_miptree_image_offset(mt, face, level));
-}
-
-void intel_miptree_image_unmap(struct intel_context *intel,
- struct intel_mipmap_tree *mt)
-{
- DBG("%s\n", __FUNCTION__);
- intel_region_unmap(intel, mt->region);
-}
-
-
-
-/* Upload data for a particular image.
- */
-void intel_miptree_image_data(struct intel_context *intel,
- struct intel_mipmap_tree *dst,
- GLuint face,
- GLuint level,
- void *src,
- GLuint src_row_pitch,
- GLuint src_image_pitch)
-{
- GLuint depth = dst->offset[face][level].depth;
- GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
- GLuint dst_image_stride = intel_miptree_depth_image_stride(dst, face, level);
- GLuint i;
-
- DBG("%s\n", __FUNCTION__);
- for (i = 0; i < depth; i++) {
- intel_region_data(intel,
- dst->region, dst_offset,
- 0,
- 0,
- src,
- src_row_pitch,
- 0, 0, /* source x,y */
- dst->offset[face][level].width,
- dst->offset[face][level].height);
- dst_offset += dst_image_stride;
- src += src_image_pitch;
- }
-}
-
-/* Copy mipmap image between trees
- */
-void intel_miptree_image_copy( struct intel_context *intel,
- struct intel_mipmap_tree *dst,
- GLuint face, GLuint level,
- struct intel_mipmap_tree *src )
-{
- GLuint width = src->offset[face][level].width;
- GLuint height = src->offset[face][level].height;
- GLuint depth = src->offset[face][level].depth;
- GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
- GLuint src_offset = intel_miptree_image_offset(src, face, level);
- GLuint dst_image_stride = intel_miptree_depth_image_stride(dst, face, level);
- GLuint src_image_stride = intel_miptree_depth_image_stride(src, face, level);
- GLuint i;
-
- for (i = 0; i < depth; i++) {
- intel_region_copy(intel,
- dst->region, dst_offset,
- 0,
- 0,
- src->region, src_offset,
- 0,
- 0,
- width,
- height);
-
- dst_offset += dst_image_stride;
- src_offset += src_image_stride;
- }
-
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.h b/src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.h
deleted file mode 100644
index 0d009d800c8..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_mipmap_tree.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_MIPMAP_TREE_H
-#define INTEL_MIPMAP_TREE_H
-
-#include "intel_regions.h"
-
-/* A layer on top of the intel_regions code which adds:
- *
- * - Code to size and layout a region to hold a set of mipmaps.
- * - Query to determine if a new image fits in an existing tree.
- * - More refcounting
- * - maybe able to remove refcounting from intel_region?
- * - ?
- *
- * The fixed mipmap layout of intel hardware where one offset
- * specifies the position of all images in a mipmap hierachy
- * complicates the implementation of GL texture image commands,
- * compared to hardware where each image is specified with an
- * independent offset.
- *
- * In an ideal world, each texture object would be associated with a
- * single bufmgr buffer or 2d intel_region, and all the images within
- * the texture object would slot into the tree as they arrive. The
- * reality can be a little messier, as images can arrive from the user
- * with sizes that don't fit in the existing tree, or in an order
- * where the tree layout cannot be guessed immediately.
- *
- * This structure encodes an idealized mipmap tree. The GL image
- * commands build these where possible, otherwise store the images in
- * temporary system buffers.
- */
-
-
-/**
- * Describes the location of each texture image within a texture region.
- */
-struct intel_mipmap_offset {
- GLuint offset;
- GLuint width;
- GLuint height;
- GLuint depth;
- GLuint depth_image_stride;
-};
-
-struct intel_mipmap_tree {
- /* Effectively the key:
- */
- GLenum target;
- GLenum internal_format;
-
- GLuint first_level;
- GLuint last_level;
-
- GLuint width0, height0, depth0; /**< Level zero image dimensions */
- GLuint cpp;
- GLboolean compressed;
-
- /* Derived from the above:
- */
- GLuint pitch;
- GLuint depth_pitch; /* per-image on i945? */
- GLuint total_height;
- struct intel_mipmap_offset offset[MAX_FACES][MAX_TEXTURE_LEVELS];
-
- /* The data is held here:
- */
- struct intel_region *region;
-
- /* These are also refcounted:
- */
- GLuint refcount;
-};
-
-
-
-struct intel_mipmap_tree *intel_miptree_create( struct intel_context *intel,
- GLenum target,
- GLenum internal_format,
- GLuint first_level,
- GLuint last_level,
- GLuint width0,
- GLuint height0,
- GLuint depth0,
- GLuint cpp,
- GLboolean compressed);
-
-void intel_miptree_reference( struct intel_mipmap_tree **dst,
- struct intel_mipmap_tree *src );
-
-void intel_miptree_release( struct intel_context *intel,
- struct intel_mipmap_tree **mt );
-
-/* Check if an image fits an existing mipmap tree layout
- */
-GLboolean intel_miptree_match_image( struct intel_mipmap_tree *mt,
- struct gl_texture_image *image,
- GLuint face,
- GLuint level );
-
-/* Return a pointer to an image within a tree. Return image stride as
- * well.
- */
-GLubyte *intel_miptree_image_map( struct intel_context *intel,
- struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level,
- GLuint *row_stride,
- GLuint *image_stride);
-
-void intel_miptree_image_unmap( struct intel_context *intel,
- struct intel_mipmap_tree *mt );
-
-
-/* Return the linear offset of an image relative to the start of the
- * tree:
- */
-GLuint intel_miptree_image_offset( struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level );
-
-void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level,
- GLuint x, GLuint y,
- GLuint w, GLuint h, GLuint d);
-
-GLuint intel_miptree_depth_image_stride(struct intel_mipmap_tree *mt,
- GLuint face,
- GLuint level);
-
-
-
-/* Upload an image into a tree
- */
-void intel_miptree_image_data(struct intel_context *intel,
- struct intel_mipmap_tree *dst,
- GLuint face,
- GLuint level,
- void *src,
- GLuint src_row_pitch,
- GLuint src_image_pitch);
-
-/* Copy an image between two trees
- */
-void intel_miptree_image_copy( struct intel_context *intel,
- struct intel_mipmap_tree *dst,
- GLuint face, GLuint level,
- struct intel_mipmap_tree *src );
-
-/* i915_mipmap_tree.c:
- */
-GLboolean i915_miptree_layout( struct intel_mipmap_tree *mt );
-GLboolean i945_miptree_layout( struct intel_mipmap_tree *mt );
-
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_pixel.c b/src/mesa/drivers/dri/i915-tex/intel_pixel.c
deleted file mode 100644
index 0994c031db4..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_pixel.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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 portionsalloc
- * 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.
- *
- **************************************************************************/
-
-#include "enums.h"
-#include "state.h"
-#include "swrast/swrast.h"
-
-#include "intel_context.h"
-#include "intel_pixel.h"
-#include "intel_regions.h"
-
-
-/**
- * Check if any fragment operations are in effect which might effect
- * glDraw/CopyPixels.
- */
-GLboolean intel_check_blit_fragment_ops( GLcontext *ctx )
-{
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
- /* XXX Note: Scissor could be done with the blitter:
- */
- return !(ctx->_ImageTransferState ||
- ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil.Enabled ||
- !ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled);
-}
-
-
-<<<<<<< intel_pixel.c
-/**
- * Clip the given rectangle against the buffer's bounds (including scissor).
- * \param size returns the
- * \return GL_TRUE if any pixels remain, GL_FALSE if totally clipped.
- *
- * XXX Replace this with _mesa_clip_drawpixels() and _mesa_clip_readpixels()
- * from Mesa 6.4. We shouldn't apply scissor for ReadPixels.
- */
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height)
-=======
-GLboolean intel_check_meta_tex_fragment_ops( GLcontext *ctx )
->>>>>>> 1.6.2.18
-{
-<<<<<<< intel_pixel.c
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-/**
- * Compute intersection of a clipping rectangle and pixel rectangle,
- * returning results in x/y/w/hOut vars.
- * \return GL_TRUE if there's intersection, GL_FALSE if disjoint.
- */
-static INLINE GLboolean
-intersect_region(const drm_clip_rect_t *box,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint *xOut, GLint *yOut, GLint *wOut, GLint *hOut)
-{
- GLint bx = box->x1;
- GLint by = box->y1;
- GLint bw = box->x2 - bx;
- GLint bh = box->y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) return GL_FALSE;
- if (bh <= 0) return GL_FALSE;
-
- *xOut = bx;
- *yOut = by;
- *wOut = bw;
- *hOut = bh;
- return GL_TRUE;
-=======
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
- /* Some of _ImageTransferState (scale, bias) could be done with
- * fragment programs on i915.
- */
- return !(ctx->_ImageTransferState ||
- ctx->Fog.Enabled || /* not done yet */
- ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled);
->>>>>>> 1.6.2.18
-}
-
-<<<<<<< intel_pixel.c
-
-
-static GLboolean
-intelTryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-=======
-/* The intel_region struct doesn't really do enough to capture the
- * format of the pixels in the region. For now this code assumes that
- * the region is a display surface and hence is either ARGB8888 or
- * RGB565.
- * XXX FBO: If we'd pass in the intel_renderbuffer instead of region, we'd
- * know the buffer's pixel format.
- *
- * \param format as given to glDraw/ReadPixels
- * \param type as given to glDraw/ReadPixels
- */
-GLboolean intel_check_blit_format( struct intel_region *region,
- GLenum format, GLenum type )
->>>>>>> 1.6.2.18
-{
-<<<<<<< intel_pixel.c
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- GLint size = 0; /* not really used */
- GLint pitch = pack->RowLength ? pack->RowLength : width;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Only accelerate reading to agp buffers.
- */
- if ( !intelIsAgpMemory(intel, pixels,
- pitch * height * intel->intelScreen->cpp ) ) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: dest not agp\n", __FUNCTION__);
- return GL_FALSE;
-=======
- if (region->cpp == 4 &&
- (type == GL_UNSIGNED_INT_8_8_8_8_REV ||
- type == GL_UNSIGNED_BYTE) &&
- format == GL_BGRA ) {
- return GL_TRUE;
->>>>>>> 1.6.2.18
- }
-<<<<<<< intel_pixel.c
-
- /* Need GL_PACK_INVERT_MESA to cope with upsidedown results from
- * blitter:
- */
- if (!pack->Invert) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: MESA_PACK_INVERT not set\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, pack, pixels, size, pitch))
- return GL_FALSE;
-
- switch ( intel->intelScreen->cpp ) {
- case 4:
- break;
- default:
- return GL_FALSE;
- }
-
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects and drawing offset are
- * correct.
- *
- * This is an unusual situation however, as the code which flushes
- * a full command buffer expects to be called unlocked. As a
- * workaround, immediately flush the buffer on aquiring the lock.
- */
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- int src_offset = intel->readRegion->offset;
- int src_pitch = intel->intelScreen->front.pitch;
- int dst_offset = intelAgpOffsetFromVirtual( intel, pixels);
- drm_clip_rect_t *box = dPriv->pClipRects;
- int i;
-
- assert(dst_offset != ~0); /* should have been caught above */
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height)) {
- UNLOCK_HARDWARE( intel );
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s totally clipped -- nothing to do\n",
- __FUNCTION__);
- return GL_TRUE;
- }
-
- /* convert to screen coords (y=0=top) */
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "readpixel blit src_pitch %d dst_pitch %d\n",
- src_pitch, pitch);
-
- /* We don't really have to do window clipping for readpixels.
- * The OpenGL spec says that pixels read from outside the
- * visible window region (pixel ownership) have undefined value.
- */
- for (i = 0 ; i < nbox ; i++)
- {
- GLint bx, by, bw, bh;
- if (intersect_region(box+i, x, y, width, height,
- &bx, &by, &bw, &bh)) {
- intelEmitCopyBlitLocked( intel,
- intel->intelScreen->cpp,
- src_pitch, src_offset,
- pitch, dst_offset,
- bx, by,
- bx - x, by - y,
- bw, bh );
- }
- }
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( &intel->ctx );
-
- return GL_TRUE;
-}
-
-static void
-intelReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!intelTryReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint dest )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int nbox = dPriv->numClipRects;
- int i;
- int src_offset = intelAgpOffsetFromVirtual( intel, pixels);
- int src_pitch = pitch;
-
- assert(src_offset != ~0); /* should be caught earlier */
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
- if (ctx->DrawBuffer)
- {
- y -= height; /* cope with pixel zoom */
-=======
->>>>>>> 1.6.2.18
-
-<<<<<<< intel_pixel.c
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height)) {
- UNLOCK_HARDWARE( intel );
- return;
- }
-
- y = dPriv->h - y - height; /* convert from gl to hardware coords */
- x += dPriv->x;
- y += dPriv->y;
-
- for (i = 0 ; i < nbox ; i++ )
- {
- GLint bx, by, bw, bh;
- if (intersect_region(box + i, x, y, width, height,
- &bx, &by, &bw, &bh)) {
- intelEmitCopyBlitLocked( intel,
- intel->intelScreen->cpp,
- src_pitch, src_offset,
- intel->intelScreen->front.pitch,
- intel->drawRegion->offset,
- bx - x, by - y,
- bx, by,
- bw, bh );
- }
- }
- }
- UNLOCK_HARDWARE( intel );
- intelFinish( &intel->ctx );
-}
-
-
-
-static GLboolean
-intelTryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint dest;
- GLuint cpp = intel->intelScreen->cpp;
- GLint size = width * pitch * cpp;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- switch (format) {
- case GL_RGB:
- case GL_RGBA:
- case GL_BGRA:
- dest = intel->drawRegion->offset;
-
- /* Planemask doesn't have full support in blits.
- */
- if (!ctx->Color.ColorMask[RCOMP] ||
- !ctx->Color.ColorMask[GCOMP] ||
- !ctx->Color.ColorMask[BCOMP] ||
- !ctx->Color.ColorMask[ACOMP]) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: planemask\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- /* Can't do conversions on agp reads/draws.
- */
- if ( !intelIsAgpMemory( intel, pixels, size ) ) {
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s: not agp memory\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != -1.0F)
- return GL_FALSE;
- break;
-
- default:
- return GL_FALSE;
- }
-
- if ( intelIsAgpMemory(intel, pixels, size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels, dest );
-=======
- if (region->cpp == 2 &&
- type == GL_UNSIGNED_SHORT_5_6_5_REV &&
- format == GL_BGR ) {
->>>>>>> 1.6.2.18
- return GL_TRUE;
- }
-
- fprintf(stderr, "%s: bad format for blit (cpp %d, type %s format %s)\n",
- __FUNCTION__, region->cpp,
- _mesa_lookup_enum_by_nr(type),
- _mesa_lookup_enum_by_nr(format));
-
-<<<<<<< intel_pixel.c
-static void
-intelDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!intelTryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
-
-
-
-/**
- * Implement glCopyPixels for the front color buffer (or back buffer Pixmap)
- * for the color buffer. Don't support zooming, pixel transfer, etc.
- * We do support copying from one window to another, ala glXMakeCurrentRead.
- */
-static void
-intelCopyPixels( GLcontext *ctx,
- GLint srcx, GLint srcy, GLsizei width, GLsizei height,
- GLint destx, GLint desty, GLenum type )
-{
-#if 0
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- const SWcontext *swrast = SWRAST_CONTEXT( ctx );
- XMesaDisplay *dpy = xmesa->xm_visual->display;
- const XMesaDrawable drawBuffer = xmesa->xm_draw_buffer->buffer;
- const XMesaDrawable readBuffer = xmesa->xm_read_buffer->buffer;
- const XMesaGC gc = xmesa->xm_draw_buffer->gc;
-
- ASSERT(dpy);
- ASSERT(gc);
-
- if (drawBuffer && /* buffer != 0 means it's a Window or Pixmap */
- readBuffer &&
- type == GL_COLOR &&
- (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */
- ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */
- ctx->Pixel.ZoomX == 1.0 && /* no zooming */
- ctx->Pixel.ZoomY == 1.0) {
- /* Note: we don't do any special clipping work here. We could,
- * but X will do it for us.
- */
- srcy = FLIP(xmesa->xm_read_buffer, srcy) - height + 1;
- desty = FLIP(xmesa->xm_draw_buffer, desty) - height + 1;
- XCopyArea(dpy, readBuffer, drawBuffer, gc,
- srcx, srcy, width, height, destx, desty);
- }
-#else
- _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type );
-#endif
-=======
- return GL_FALSE;
->>>>>>> 1.6.2.18
-}
-
-
-void intelInitPixelFuncs( struct dd_function_table *functions )
-{
- functions->Accum = _swrast_Accum;
- functions->Bitmap = _swrast_Bitmap;
- functions->CopyPixels = intelCopyPixels;
- functions->ReadPixels = intelReadPixels;
- functions->DrawPixels = intelDrawPixels;
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_pixel.h b/src/mesa/drivers/dri/i915-tex/intel_pixel.h
deleted file mode 100644
index 3654a91b595..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_pixel.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_PIXEL_H
-#define INTEL_PIXEL_H
-
-#include "mtypes.h"
-
-void intelInitPixelFuncs( struct dd_function_table *functions );
-
-GLboolean intel_check_blit_fragment_ops( GLcontext *ctx );
-
-GLboolean intel_check_meta_tex_fragment_ops( GLcontext *ctx );
-
-GLboolean intel_check_blit_format( struct intel_region *region,
- GLenum format, GLenum type );
-
-
-void intelReadPixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels );
-
-void intelDrawPixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format,
- GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels );
-
-void intelCopyPixels( GLcontext *ctx,
- GLint srcx, GLint srcy,
- GLsizei width, GLsizei height,
- GLint destx, GLint desty,
- GLenum type );
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_pixel_copy.c b/src/mesa/drivers/dri/i915-tex/intel_pixel_copy.c
deleted file mode 100644
index 75cf4bdfe6d..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_pixel_copy.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "enums.h"
-#include "image.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "swrast/swrast.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "intel_buffers.h"
-#include "intel_blit.h"
-#include "intel_regions.h"
-#include "intel_tris.h"
-#include "intel_pixel.h"
-#include "intel_bufmgr.h"
-
-
-static struct intel_region *copypix_src_region( struct intel_context *intel,
- GLenum type )
-{
- switch (type) {
- case GL_COLOR:
- return intel_readbuf_region( intel );
- case GL_DEPTH:
- /* Don't think this is really possible execpt at 16bpp, when we have no stencil.
- */
- if (intel->depth_region &&
- intel->depth_region->cpp == 2)
- return intel->depth_region;
- case GL_STENCIL:
- /* Don't think this is really possible.
- */
- break;
- case GL_DEPTH_STENCIL_EXT:
- /* Does it matter whether it is stencil/depth or depth/stencil?
- */
- return intel->depth_region;
- default:
- break;
- }
-
- return NULL;
-}
-
-
-/* Doesn't work for overlapping regions. Could do a double copy or
- * just fallback.
- */
-static GLboolean do_texture_copypixels( GLcontext *ctx,
- GLint srcx, GLint srcy,
- GLsizei width, GLsizei height,
- GLint dstx, GLint dsty,
- GLenum type )
-{
- struct intel_context *intel = intel_context( ctx );
- struct intel_region *dst = intel_drawbuf_region( intel );
- struct intel_region *src = copypix_src_region(intel, type);
- GLenum src_format;
- GLenum src_type;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!src || !dst || type != GL_COLOR)
- return GL_FALSE;
-
- /* Can't handle overlapping regions. Don't have sufficient control
- * over rasterization to pull it off in-place. Punt on these for
- * now.
- *
- * XXX: do a copy to a temporary.
- */
- {
- drm_clip_rect_t src;
- drm_clip_rect_t dst;
- drm_clip_rect_t tmp;
-
- src.x1 = srcx;
- src.y1 = srcy;
- src.x2 = srcx + width;
- src.y2 = srcy + height;
-
- dst.x1 = dstx;
- dst.y1 = dsty;
- dst.x1 = dstx + width * ctx->Pixel.ZoomX;
- dst.y2 = dsty + height * ctx->Pixel.ZoomY;
-
-
- if (intel_intersect_cliprects(&tmp, &src, &dst)) {
- _mesa_printf("%s: regions overlap\n", __FUNCTION__);
- return GL_FALSE;
- }
- }
-
- intelFlush( &intel->ctx );
-
- intel->vtbl.install_meta_state(intel);
-
- /* Is this true? Also will need to turn depth testing on according
- * to state:
- */
- intel->vtbl.meta_no_stencil_write(intel);
- intel->vtbl.meta_no_depth_write(intel);
-
- /* Set the 3d engine to draw into the destination region:
- */
- intel->vtbl.meta_draw_region(intel, dst, intel->depth_region);
-
- intel->vtbl.meta_import_pixel_state(intel);
-
- if (src->cpp == 2) {
- src_format = GL_RGB;
- src_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
- src_format = GL_BGRA;
- src_type = GL_UNSIGNED_BYTE;
- }
-
- /* Set the frontbuffer up as a large rectangular texture.
- */
- if (!intel->vtbl.meta_tex_rect_source( intel, src->buffer, 0,
- src->pitch,
- src->height,
- src_format,
- src_type )) {
- intel->vtbl.leave_meta_state(intel);
- return GL_FALSE;
- }
-
-
- intel->vtbl.meta_texture_blend_replace( intel );
-
-
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
-
- srcy = dPriv->h - srcy - height; /* convert from gl to hardware coords */
-
- srcx += dPriv->x;
- srcy += dPriv->y;
-
- /* Clip against the source region. This is the only source
- * clipping we do. XXX: Just set the texcord wrap mode to clamp
- * or similar.
- *
- */
- if (0) {
- GLint orig_x = srcx;
- GLint orig_y = srcy;
-
- if (!_mesa_clip_to_region(0, 0, src->pitch, src->height,
- &srcx, &srcy, &width, &height))
- goto out;
-
- dstx += srcx - orig_x;
- dsty += (srcy - orig_y) * ctx->Pixel.ZoomY;
- }
-
- /* Just use the regular cliprect mechanism... Does this need to
- * even hold the lock???
- */
- intel_meta_draw_quad(intel,
-
- dstx,
- dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (dsty + height * ctx->Pixel.ZoomY),
- dPriv->h - (dsty),
-
- 0, /* XXX: what z value? */
- 0x00ff00ff,
- srcx, srcx+width,
- srcy, srcy+height);
-
- out:
- intel->vtbl.leave_meta_state(intel);
- intel_batchbuffer_flush(intel->batch);
- }
- UNLOCK_HARDWARE( intel );
- return GL_TRUE;
-}
-
-
-
-
-
-/**
- * CopyPixels with the blitter. Don't support zooming, pixel transfer, etc.
- */
-static GLboolean do_blit_copypixels( GLcontext *ctx,
- GLint srcx, GLint srcy,
- GLsizei width, GLsizei height,
- GLint dstx, GLint dsty,
- GLenum type )
-{
- struct intel_context *intel = intel_context( ctx );
- struct intel_region *dst = intel_drawbuf_region( intel );
- struct intel_region *src = copypix_src_region( intel, type );
-
- /* Copypixels can be more than a straight copy. Ensure all the
- * extra operations are disabled:
- */
- if (!intel_check_blit_fragment_ops(ctx) ||
- ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != 1.0F)
- return GL_FALSE;
-
- if (!src || !dst)
- return GL_FALSE;
-
-
-
- intelFlush( &intel->ctx );
- intel->vtbl.render_start(intel);
- intel->vtbl.emit_state(intel);
-
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t dest_rect;
- GLint nbox = dPriv->numClipRects;
- GLint delta_x = 0;
- GLint delta_y = 0;
- GLuint i;
-
-
- dsty = dPriv->h - dsty - height; /* convert from gl to hardware coords */
- srcy = dPriv->h - srcy - height; /* convert from gl to hardware coords */
- dstx += dPriv->x;
- dsty += dPriv->y;
- srcx += dPriv->x;
- srcy += dPriv->y;
-
- /* Clip against the source region. This is the only source
- * clipping we do. Dst is clipped with cliprects below.
- *
- * TODO: Scissor?
- */
- {
- delta_x = srcx - dstx;
- delta_y = srcy - dsty;
-
- if (!_mesa_clip_to_region(0, 0, src->pitch, src->height,
- &srcx, &srcy, &width, &height))
- goto out;
-
- dstx = srcx - delta_x;
- dsty = srcy - delta_y;
- }
-
- dest_rect.x1 = dstx;
- dest_rect.y1 = dsty;
- dest_rect.x2 = dstx + width;
- dest_rect.y2 = dsty + height;
-
- /* Could do slightly more clipping: Eg, take the intersection of
- * the existing set of cliprects and those cliprects translated
- * by delta_x, delta_y:
- *
- * This code will not overwrite other windows, but will
- * introduce garbage when copying from obscured window regions.
- */
- for (i = 0 ; i < nbox ; i++ )
- {
- drm_clip_rect_t rect;
-
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
- continue;
-
-
- intelEmitCopyBlit( intel,
- dst->cpp,
- src->pitch, src->buffer, 0,
- dst->pitch, dst->buffer, 0,
- rect.x1 + delta_x,
- rect.y1 + delta_y, /* srcx, srcy */
- rect.x1,
- rect.y1, /* dstx, dsty */
- rect.x2 - rect.x1,
- rect.y2 - rect.y1 );
- }
-
- out:
- intel_batchbuffer_flush( intel->batch );
- }
- UNLOCK_HARDWARE( intel );
- return GL_TRUE;
-}
-
-
-void intelCopyPixels( GLcontext *ctx,
- GLint srcx, GLint srcy,
- GLsizei width, GLsizei height,
- GLint destx, GLint desty,
- GLenum type )
-{
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (do_blit_copypixels( ctx, srcx, srcy, width, height, destx, desty, type))
- return;
-
- if (do_texture_copypixels( ctx, srcx, srcy, width, height, destx, desty, type))
- return;
-
- _mesa_printf("fallback to _swrast_CopyPixels\n");
- _swrast_CopyPixels( ctx, srcx, srcy, width, height, destx, desty, type);
-}
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915-tex/intel_pixel_draw.c
deleted file mode 100644
index 71e251c66d9..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_pixel_draw.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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 portionsalloc
- * 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "enums.h"
-#include "image.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "bufferobj.h"
-#include "swrast/swrast.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_buffers.h"
-#include "intel_regions.h"
-#include "intel_pixel.h"
-#include "intel_buffer_objects.h"
-#include "intel_tris.h"
-#include "intel_bufmgr.h"
-
-
-
-static GLboolean do_texture_drawpixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- struct intel_context *intel = intel_context( ctx );
- struct intel_region *dst = intel_drawbuf_region( intel );
- struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
- GLuint rowLength = unpack->RowLength ? unpack->RowLength : width;
- GLuint src_offset;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intelFlush( &intel->ctx );
- intel->vtbl.render_start(intel);
- intel->vtbl.emit_state(intel);
-
- if (!dst)
- return GL_FALSE;
-
- if (src) {
- if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
- _mesa_printf("%s - _mesa_validate_pbo_access\n", __FUNCTION__);
- return GL_TRUE;
- }
- }
- else {
- /* PBO only for now:
- */
-/* _mesa_printf("%s - not PBO\n", __FUNCTION__); */
- return GL_FALSE;
- }
-
- /* There are a couple of things we can't do yet, one of which is
- * set the correct state for pixel operations when GL texturing is
- * enabled. That's a pretty rare state and probably not worth the
- * effort. A completely device-independent version of this may do
- * more.
- *
- * Similarly, we make no attempt to merge metaops processing with
- * an enabled fragment program, though it would certainly be
- * possible.
- */
- if (!intel_check_meta_tex_fragment_ops(ctx)) {
- _mesa_printf("%s - bad GL fragment state for metaops texture\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- intel->vtbl.install_meta_state(intel);
-
-
- /* Is this true? Also will need to turn depth testing on according
- * to state:
- */
- intel->vtbl.meta_no_stencil_write(intel);
- intel->vtbl.meta_no_depth_write(intel);
-
- /* Set the 3d engine to draw into the destination region:
- */
- intel->vtbl.meta_draw_region(intel, dst, intel->depth_region);
-
- intel->vtbl.meta_import_pixel_state(intel);
-
- src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height,
- format, type, 0, 0, 0);
-
-
- /* Setup the pbo up as a rectangular texture, if possible.
- *
- * TODO: This is almost always possible if the i915 fragment
- * program is adjusted to correctly swizzle the sampled colors.
- * The major exception is any 24bit texture, like RGB888, for which
- * there is no hardware support.
- */
- if (!intel->vtbl.meta_tex_rect_source( intel, src->buffer, src_offset,
- rowLength, height,
- format, type )) {
- intel->vtbl.leave_meta_state(intel);
- return GL_FALSE;
- }
-
- intel->vtbl.meta_texture_blend_replace( intel );
-
-
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- GLint srcx, srcy;
- GLint dstx, dsty;
-
- dstx = x;
- dsty = dPriv->h - (y + height);
-
- srcx = 0; /* skiprows/pixels already done */
- srcy = 0;
-
- if (0) {
- const GLint orig_x = dstx;
- const GLint orig_y = dsty;
-
- if (!_mesa_clip_to_region(0, 0, dst->pitch, dst->height,
- &dstx, &dsty, &width, &height))
- goto out;
-
- srcx += dstx - orig_x;
- srcy += dsty - orig_y;
- }
-
-
- _mesa_printf("draw %d,%d %dx%d\n", dstx,dsty,width,height);
-
- /* Must use the regular cliprect mechanism in order to get the
- * drawing origin set correctly. Otherwise scissor state is in
- * incorrect coordinate space. Does this even need to hold the
- * lock???
- */
- intel_meta_draw_quad(intel,
- dstx, dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (y + height * ctx->Pixel.ZoomY),
- dPriv->h - (y),
- - ctx->Current.RasterPos[2] * .5,
- 0x00ff00ff,
- srcx, srcx+width,
- srcy+height, srcy);
- out:
- intel->vtbl.leave_meta_state(intel);
- intel_batchbuffer_flush(intel->batch);
- }
- UNLOCK_HARDWARE( intel );
- _mesa_printf("%s - DONE\n", __FUNCTION__);
- return GL_TRUE;
-}
-
-
-
-
-
-/* Pros:
- * - no waiting for idle before updating framebuffer.
- *
- * Cons:
- * - if upload is by memcpy, this may actually be slower than fallback path.
- * - uploads the whole image even if destination is clipped
- *
- * Need to benchmark.
- *
- * Given the questions about performance, implement for pbo's only.
- * This path is definitely a win if the pbo is already in agp. If it
- * turns out otherwise, we can add the code necessary to upload client
- * data to agp space before performing the blit. (Though it may turn
- * out to be better/simpler just to use the texture engine).
- */
-static GLboolean do_blit_drawpixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_region *dest = intel_drawbuf_region(intel);
- struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
- GLuint src_offset;
- GLuint rowLength;
- GLuint fence = 0;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s\n", __FUNCTION__);
-
-
- if (!dest) {
- _mesa_printf("%s - no dest\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (src) {
- /* This validation should be done by core mesa:
- */
- if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
- _mesa_printf("%s - _mesa_validate_pbo_access\n", __FUNCTION__);
-
- return GL_TRUE;
- }
- }
- else {
- /* PBO only for now:
- */
- _mesa_printf("%s - not PBO\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!intel_check_blit_format(dest, format, type)) {
- _mesa_printf("%s - bad format for blit\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!intel_check_meta_tex_fragment_ops(ctx)) {
- _mesa_printf("%s - bad GL fragment state for meta tex\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (ctx->Pixel.ZoomX != 1.0F) {
- _mesa_printf("%s - bad PixelZoomX for blit\n", __FUNCTION__);
- return GL_FALSE;
- }
-
-
- if (unpack->RowLength > 0)
- rowLength = unpack->RowLength;
- else
- rowLength = width;
-
- if (ctx->Pixel.ZoomY == -1.0F) {
- _mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
- return GL_FALSE; /* later */
- y -= height;
- }
- else if (ctx->Pixel.ZoomY == 1.0F) {
- rowLength = -rowLength;
- }
- else {
- _mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height,
- format, type, 0, 0, 0);
-
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t rect;
- drm_clip_rect_t dest_rect;
- int i;
-
- dest_rect.x1 = dPriv->x + x;
- dest_rect.y1 = dPriv->y + dPriv->h - (y + height);
- dest_rect.x2 = dest_rect.x1 + width;
- dest_rect.y2 = dest_rect.y1 + height;
-
- for (i = 0 ; i < nbox ; i++ )
- {
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
- continue;
-
- intelEmitCopyBlit( intel,
- dest->cpp,
- rowLength,
- intel_bufferobj_buffer(src), src_offset,
- dest->pitch,
- dest->buffer, 0,
- rect.x1 - dest_rect.x1,
- rect.y2 - dest_rect.y2,
- rect.x1,
- rect.y1,
- rect.x2 - rect.x1,
- rect.y2 - rect.y1 );
- }
- fence = intel_batchbuffer_flush( intel->batch );
- }
- UNLOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- bmFinishFence(intel->bm, fence);
-
- _mesa_printf("%s - DONE\n", __FUNCTION__);
-
- return GL_TRUE;
-}
-
-
-
-void intelDrawPixels( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height,
- GLenum format,
- GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (do_blit_drawpixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- return;
-
- if (do_texture_drawpixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- return;
-
-
- _mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
-
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_pixel_read.c b/src/mesa/drivers/dri/i915-tex/intel_pixel_read.c
deleted file mode 100644
index 68dd6ea376e..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_pixel_read.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "enums.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "image.h"
-#include "bufferobj.h"
-#include "swrast/swrast.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_ioctl.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
-#include "intel_buffers.h"
-#include "intel_regions.h"
-#include "intel_pixel.h"
-#include "intel_buffer_objects.h"
-
-#include "intel_bufmgr.h"
-
-/* For many applications, the new ability to pull the source buffers
- * back out of the GTT and then do the packing/conversion operations
- * in software will be as much of an improvement as trying to get the
- * blitter and/or texture engine to do the work.
- *
- * This step is gated on private backbuffers.
- *
- * Obviously the frontbuffer can't be pulled back, so that is either
- * an argument for blit/texture readpixels, or for blitting to a
- * temporary and then pulling that back.
- *
- * When the destination is a pbo, however, it's not clear if it is
- * ever going to be pulled to main memory (though the access param
- * will be a good hint). So it sounds like we do want to be able to
- * choose between blit/texture implementation on the gpu and pullback
- * and cpu-based copying.
- *
- * Unless you can magically turn client memory into a PBO for the
- * duration of this call, there will be a cpu-based copying step in
- * any case.
- */
-
-
-static GLboolean
-do_texture_readpixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- struct intel_region *dest_region )
-{
-#if 0
- struct intel_context *intel = intel_context(ctx);
- intelScreenPrivate *screen = intel->intelScreen;
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int textureFormat;
- GLenum glTextureFormat;
- int destFormat, depthFormat, destPitch;
- drm_clip_rect_t tmp;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if ( ctx->_ImageTransferState ||
- pack->SwapBytes ||
- pack->LsbFirst ||
- !pack->Invert) {
- fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- intel->vtbl.meta_texrect_source(intel, intel_readbuf_region(intel));
-
- if (!intel->vtbl.meta_render_dest(intel,
- dest_region,
- type, format))
- {
- fprintf(stderr, "%s: couldn't set dest %s/%s\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(type),
- _mesa_lookup_enum_by_nr(format));
- return GL_FALSE;
- }
-
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects) {
- intel->vtbl.install_meta_state(intel);
- intel->vtbl.meta_no_depth_write(intel);
- intel->vtbl.meta_no_stencil_write(intel);
-
- if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
- UNLOCK_HARDWARE( intel );
- SET_STATE(i830, state);
- fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
- return GL_TRUE;
- }
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- /* Set the frontbuffer up as a large rectangular texture.
- */
- intel->vtbl.meta_tex_rect_source( intel,
- src_region,
- textureFormat );
-
-
- intel->vtbl.meta_texture_blend_replace( i830, glTextureFormat );
-
-
- /* Set the 3d engine to draw into the destination region:
- */
-
- intel->vtbl.meta_draw_region(intel, dest_region);
- intel->vtbl.meta_draw_format(intel, destFormat, depthFormat ); /* ?? */
-
-
- /* Draw a single quad, no cliprects:
- */
- intel->vtbl.meta_disable_cliprects(intel);
-
- intel->vtbl.draw_quad(intel,
- 0, width, 0, height,
- 0x00ff00ff,
- x, x+width,
- y, y+height );
-
- intel->vtbl.leave_meta_state(intel);
- }
- UNLOCK_HARDWARE( intel );
-
- intel_region_wait_fence( ctx, dest_region ); /* required by GL */
- return GL_TRUE;
-#endif
-
- return GL_FALSE;
-}
-
-
-
-
-static GLboolean do_blit_readpixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_region *src = intel_readbuf_region(intel);
- struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
- GLuint dst_offset;
- GLuint rowLength;
- GLuint fence = 0;
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s\n", __FUNCTION__);
-
- if (!src)
- return GL_FALSE;
-
- if (dst) {
- /* XXX This validation should be done by core mesa:
- */
- if (!_mesa_validate_pbo_access(2, pack, width, height, 1,
- format, type, pixels)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
- _mesa_printf("%s - _mesa_validate_pbo_access\n", __FUNCTION__);
-
- return GL_TRUE;
- }
- }
- else {
- /* PBO only for now:
- */
- _mesa_printf("%s - not PBO\n", __FUNCTION__);
- return GL_FALSE;
- }
-
-
- if (ctx->_ImageTransferState ||
- !intel_check_blit_format(src, format, type)) {
- _mesa_printf("%s - bad format for blit\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
- _mesa_printf("%s: bad packing params\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (pack->RowLength > 0)
- rowLength = pack->RowLength;
- else
- rowLength = width;
-
- if (pack->Invert) {
- _mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
- return GL_FALSE;
- }
- else {
- rowLength = -rowLength;
- }
-
- /* XXX 64-bit cast? */
- dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,
- format, type, 0, 0, 0);
-
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects are correct.
- */
- intelFlush( &intel->ctx );
- LOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t rect;
- drm_clip_rect_t src_rect;
- int i;
-
- src_rect.x1 = dPriv->x + x;
- src_rect.y1 = dPriv->y + dPriv->h - (y + height);
- src_rect.x2 = src_rect.x1 + width;
- src_rect.y2 = src_rect.y1 + height;
-
-
-
- for (i = 0 ; i < nbox ; i++)
- {
- if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
- continue;
-
- intelEmitCopyBlit( intel,
- src->cpp,
- src->pitch, src->buffer, 0,
- rowLength,
- intel_bufferobj_buffer(dst), dst_offset,
- rect.x1,
- rect.y1,
- rect.x1 - src_rect.x1,
- rect.y2 - src_rect.y2,
- rect.x2 - rect.x1,
- rect.y2 - rect.y1 );
- }
-
- fence = intel_batchbuffer_flush(intel->batch);
- }
- UNLOCK_HARDWARE( intel );
-
- if (intel->driDrawable->numClipRects)
- bmFinishFence(intel->bm, fence);
-
- if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - DONE\n", __FUNCTION__);
-
- return GL_TRUE;
-}
-
-void
-intelReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (INTEL_DEBUG & DEBUG_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- intelFlush( ctx );
-
- if (do_blit_readpixels(ctx, x, y, width, height, format, type, pack, pixels))
- return;
-
- if (do_texture_readpixels(ctx, x, y, width, height, format, type, pack, pixels))
- return;
-
- _mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
-
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack, pixels);
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_reg.h b/src/mesa/drivers/dri/i915-tex/intel_reg.h
deleted file mode 100644
index 1ec153266c7..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_reg.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#ifndef _INTEL_REG_H_
-#define _INTEL_REG_H_
-
-
-
-#define CMD_3D (0x3<<29)
-
-
-#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24))
-#define PRIM_INDIRECT (1<<23)
-#define PRIM_INLINE (0<<23)
-#define PRIM_INDIRECT_SEQUENTIAL (0<<17)
-#define PRIM_INDIRECT_ELTS (1<<17)
-
-#define PRIM3D_TRILIST (0x0<<18)
-#define PRIM3D_TRISTRIP (0x1<<18)
-#define PRIM3D_TRISTRIP_RVRSE (0x2<<18)
-#define PRIM3D_TRIFAN (0x3<<18)
-#define PRIM3D_POLY (0x4<<18)
-#define PRIM3D_LINELIST (0x5<<18)
-#define PRIM3D_LINESTRIP (0x6<<18)
-#define PRIM3D_RECTLIST (0x7<<18)
-#define PRIM3D_POINTLIST (0x8<<18)
-#define PRIM3D_DIB (0x9<<18)
-#define PRIM3D_MASK (0x1f<<18)
-
-#define I915PACKCOLOR4444(r,g,b,a) \
- ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-
-#define I915PACKCOLOR1555(r,g,b,a) \
- ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define I915PACKCOLOR565(r,g,b) \
- ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
-
-#define I915PACKCOLOR8888(r,g,b,a) \
- ((a<<24) | (r<<16) | (g<<8) | b)
-
-
-
-
-#define BR00_BITBLT_CLIENT 0x40000000
-#define BR00_OP_COLOR_BLT 0x10000000
-#define BR00_OP_SRC_COPY_BLT 0x10C00000
-#define BR13_SOLID_PATTERN 0x80000000
-
-#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4)
-#define XY_COLOR_BLT_WRITE_ALPHA (1<<21)
-#define XY_COLOR_BLT_WRITE_RGB (1<<20)
-
-#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
-#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
-#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_regions.c b/src/mesa/drivers/dri/i915-tex/intel_regions.c
deleted file mode 100644
index f2932fd0047..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_regions.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-/* Provide additional functionality on top of bufmgr buffers:
- * - 2d semantics and blit operations
- * - refcounting of buffers for multiple images in a buffer.
- * - refcounting of buffer mappings.
- * - some logic for moving the buffers to the best memory pools for
- * given operations.
- *
- * Most of this is to make it easier to implement the fixed-layout
- * mipmap tree required by intel hardware in the face of GL's
- * programming interface where each image can be specifed in random
- * order and it isn't clear what layout the tree should have until the
- * last moment.
- */
-
-#include "intel_context.h"
-#include "intel_regions.h"
-#include "intel_blit.h"
-#include "intel_bufmgr.h"
-
-/* XXX: Thread safety?
- */
-GLubyte *intel_region_map(struct intel_context *intel, struct intel_region *region)
-{
- DBG("%s\n", __FUNCTION__);
- if (!region->map_refcount++) {
- region->map = bmMapBuffer(intel->bm, region->buffer, 0);
- }
-
- return region->map;
-}
-
-void intel_region_unmap(struct intel_context *intel,
- struct intel_region *region)
-{
- DBG("%s\n", __FUNCTION__);
- if (!--region->map_refcount) {
- bmUnmapBuffer(intel->bm, region->buffer);
- region->map = NULL;
- }
-}
-
-struct intel_region *intel_region_alloc( struct intel_context *intel,
- GLuint cpp,
- GLuint pitch,
- GLuint height )
-{
- struct intel_region *region = calloc(sizeof(*region), 1);
-
- DBG("%s\n", __FUNCTION__);
-
- region->cpp = cpp;
- region->pitch = pitch;
- region->height = height; /* needed? */
- region->refcount = 1;
-
- bmGenBuffers(intel->bm, 1, &region->buffer, 0);
- bmBufferData(intel->bm, region->buffer, pitch * cpp * height, NULL, 0);
-
- return region;
-}
-
-void intel_region_reference( struct intel_region **dst,
- struct intel_region *src)
-{
- assert(*dst == NULL);
- if (src) {
- src->refcount++;
- *dst = src;
- }
-}
-
-void intel_region_release( struct intel_context *intel,
- struct intel_region **region )
-{
- if (!*region)
- return;
-
- DBG("%s %d\n", __FUNCTION__, (*region)->refcount-1);
-
- ASSERT((*region)->refcount > 0);
- (*region)->refcount--;
-
- if ((*region)->refcount == 0) {
- assert((*region)->map_refcount == 0);
- bmDeleteBuffers(intel->bm, 1, &(*region)->buffer);
- free(*region);
- }
- *region = NULL;
-}
-
-
-struct intel_region *intel_region_create_static( struct intel_context *intel,
- GLuint mem_type,
- GLuint offset,
- void *virtual,
- GLuint cpp,
- GLuint pitch,
- GLuint height )
-{
- struct intel_region *region = calloc(sizeof(*region), 1);
- DBG("%s\n", __FUNCTION__);
-
- region->cpp = cpp;
- region->pitch = pitch;
- region->height = height; /* needed? */
- region->refcount = 1;
-
- /*
- * We use a "shared" buffer type to indicate buffers created and
- * shared by others.
- */
-
- bmGenBuffers(intel->bm, 1, &region->buffer, DRM_MM_TT | DRM_MM_SHARED);
- bmSetShared(intel->bm, region->buffer, DRM_MM_TT, offset, virtual);
-
- return region;
-}
-
-
-
-/*
- * XXX Move this into core Mesa?
- */
-static void _mesa_copy_rect( GLubyte *dst,
- GLuint cpp,
- GLuint dst_pitch,
- GLuint dst_x,
- GLuint dst_y,
- GLuint width,
- GLuint height,
- GLubyte *src,
- GLuint src_pitch,
- GLuint src_x,
- GLuint src_y )
-{
- GLuint i;
-
- dst_pitch *= cpp;
- src_pitch *= cpp;
- dst += dst_x * cpp;
- src += src_x * cpp;
- dst += dst_y * dst_pitch;
- src += src_y * dst_pitch;
- width *= cpp;
-
- if (width == dst_pitch &&
- width == src_pitch)
- memcpy(dst, src, height * width);
- else {
- for (i = 0; i < height; i++) {
- memcpy(dst, src, width);
- dst += dst_pitch;
- src += src_pitch;
- }
- }
-}
-
-
-/* Upload data to a rectangular sub-region. Lots of choices how to do this:
- *
- * - memcpy by span to current destination
- * - upload data as new buffer and blit
- *
- * Currently always memcpy.
- */
-void intel_region_data(struct intel_context *intel,
- struct intel_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- void *src, GLuint src_pitch,
- GLuint srcx, GLuint srcy,
- GLuint width, GLuint height)
-{
- DBG("%s\n", __FUNCTION__);
-
- LOCK_HARDWARE(intel);
-
- _mesa_copy_rect(intel_region_map(intel, dst) + dst_offset,
- dst->cpp,
- dst->pitch,
- dstx, dsty,
- width, height,
- src,
- src_pitch,
- srcx, srcy);
-
- intel_region_unmap(intel, dst);
-
- UNLOCK_HARDWARE(intel);
-
-}
-
-/* Copy rectangular sub-regions. Need better logic about when to
- * push buffers into AGP - will currently do so whenever possible.
- */
-void intel_region_copy( struct intel_context *intel,
- struct intel_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- struct intel_region *src,
- GLuint src_offset,
- GLuint srcx, GLuint srcy,
- GLuint width, GLuint height )
-{
- DBG("%s\n", __FUNCTION__);
-
- assert(src->cpp == dst->cpp);
-
- intelEmitCopyBlit(intel,
- dst->cpp,
- src->pitch, src->buffer, src_offset,
- dst->pitch, dst->buffer, dst_offset,
- srcx, srcy,
- dstx, dsty,
- width, height);
-}
-
-/* Fill a rectangular sub-region. Need better logic about when to
- * push buffers into AGP - will currently do so whenever possible.
- */
-void intel_region_fill( struct intel_context *intel,
- struct intel_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- GLuint width, GLuint height,
- GLuint color )
-{
- DBG("%s\n", __FUNCTION__);
-
- intelEmitFillBlit(intel,
- dst->cpp,
- dst->pitch, dst->buffer, dst_offset,
- dstx, dsty,
- width, height,
- color );
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_regions.h b/src/mesa/drivers/dri/i915-tex/intel_regions.h
deleted file mode 100644
index c8173ae67fb..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_regions.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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.
- *
- **************************************************************************/
-
-#ifndef INTEL_REGIONS_H
-#define INTEL_REGIONS_H
-
-#include "mtypes.h"
-#include "intel_bufmgr.h" /* for DBG! */
-struct intel_context;
-
-/**
- * A layer on top of the bufmgr buffers that adds a few useful things:
- *
- * - Refcounting for local buffer references.
- * - Refcounting for buffer maps
- * - Buffer dimensions - pitch and height.
- * - Blitter commands for copying 2D regions between buffers. (really???)
- */
-struct intel_region {
- GLuint buffer; /**< buffer manager's buffer ID */
- GLuint refcount; /**< Reference count for region */
- GLuint cpp; /**< bytes per pixel */
- GLuint pitch; /**< in pixels */
- GLuint height; /**< in pixels */
- GLubyte *map; /**< only non-NULL when region is actually mapped */
- GLuint map_refcount; /**< Reference count for mapping */
-
- GLuint draw_offset; /**< Offset of drawing address within the region */
-};
-
-
-/* Allocate a refcounted region. Pointers to regions should only be
- * copied by calling intel_reference_region().
- */
-struct intel_region *intel_region_alloc( struct intel_context *intel,
- GLuint cpp,
- GLuint pitch,
- GLuint height );
-
-void intel_region_reference( struct intel_region **dst,
- struct intel_region *src );
-
-void intel_region_release(struct intel_context *intel,
- struct intel_region **ib );
-
-
-struct intel_region *intel_region_create_static( struct intel_context *intel,
- GLuint mem_type,
- GLuint offset,
- void *virtual,
- GLuint cpp,
- GLuint pitch,
- GLuint height );
-
-/* Map/unmap regions. This is refcounted also:
- */
-GLubyte *intel_region_map(struct intel_context *intel,
- struct intel_region *ib);
-
-void intel_region_unmap(struct intel_context *intel,
- struct intel_region *ib);
-
-
-/* Upload data to a rectangular sub-region
- */
-void intel_region_data(struct intel_context *intel,
- struct intel_region *dest,
- GLuint dest_offset,
- GLuint destx, GLuint desty,
- void *src, GLuint src_stride,
- GLuint srcx, GLuint srcy,
- GLuint width, GLuint height);
-
-/* Copy rectangular sub-regions
- */
-void intel_region_copy( struct intel_context *intel,
- struct intel_region *dest,
- GLuint dest_offset,
- GLuint destx, GLuint desty,
- struct intel_region *src,
- GLuint src_offset,
- GLuint srcx, GLuint srcy,
- GLuint width, GLuint height );
-
-/* Fill a rectangular sub-region
- */
-void intel_region_fill( struct intel_context *intel,
- struct intel_region *dest,
- GLuint dest_offset,
- GLuint destx, GLuint desty,
- GLuint width, GLuint height,
- GLuint color );
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_render.c b/src/mesa/drivers/dri/i915-tex/intel_render.c
deleted file mode 100644
index 075b453848b..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_render.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware acceleration where possible.
- *
- */
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
-#include "mtypes.h"
-#include "enums.h"
-
-#include "tnl/t_context.h"
-#include "tnl/t_vertex.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_tris.h"
-#include "intel_batchbuffer.h"
-#include "intel_reg.h"
-
-/*
- * Render unclipped vertex buffers by emitting vertices directly to
- * dma buffers. Use strip/fan hardware primitives where possible.
- * Try to simulate missing primitives with indexed vertices.
- */
-#define HAVE_POINTS 0 /* Has it, but can't use because subpixel has to
- * be adjusted for points on the INTEL/I845G
- */
-#define HAVE_LINES 1
-#define HAVE_LINE_STRIPS 1
-#define HAVE_TRIANGLES 1
-#define HAVE_TRI_STRIPS 1
-#define HAVE_TRI_STRIP_1 0 /* has it, template can't use it yet */
-#define HAVE_TRI_FANS 1
-#define HAVE_POLYGONS 1
-#define HAVE_QUADS 0
-#define HAVE_QUAD_STRIPS 0
-
-#define HAVE_ELTS 0
-
-static GLuint hw_prim[GL_POLYGON+1] = {
- 0,
- PRIM3D_LINELIST,
- PRIM3D_LINESTRIP,
- PRIM3D_LINESTRIP,
- PRIM3D_TRILIST,
- PRIM3D_TRISTRIP,
- PRIM3D_TRIFAN,
- 0,
- 0,
- PRIM3D_POLY
-};
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-static const int scale_prim[GL_POLYGON+1] = {
- 0, /* fallback case */
- 1,
- 2,
- 2,
- 1,
- 3,
- 3,
- 0, /* fallback case */
- 0, /* fallback case */
- 3
-};
-
-
-static void intelDmaPrimitive( struct intel_context *intel, GLenum prim )
-{
- if (0) fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(prim));
- INTEL_FIREVERTICES(intel);
- intel->vtbl.reduced_primitive_state( intel, reduced_prim[prim] );
- intelStartInlinePrimitive( intel, hw_prim[prim], INTEL_BATCH_CLIPRECTS );
-}
-
-
-#define LOCAL_VARS struct intel_context *intel = intel_context(ctx)
-#define INIT( prim ) \
-do { \
- intelDmaPrimitive( intel, prim ); \
-} while (0)
-
-#define FLUSH() \
-do { \
- if (intel->prim.flush) \
- intel->prim.flush(intel); \
-} while (0)
-
-#define GET_SUBSEQUENT_VB_MAX_VERTS() \
- ((BATCH_SZ - 1500) / (intel->vertex_size*4))
-#define GET_CURRENT_VB_MAX_VERTS() GET_SUBSEQUENT_VB_MAX_VERTS()
-
-#define ALLOC_VERTS( nr ) \
- intelExtendInlinePrimitive( intel, (nr) * intel->vertex_size )
-
-#define EMIT_VERTS( ctx, j, nr, buf ) \
- _tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf )
-
-#define TAG(x) intel_##x
-#include "tnl_dd/t_dd_dmatmp.h"
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-/* Heuristic to choose between the two render paths:
- */
-static GLboolean choose_render( struct intel_context *intel,
- struct vertex_buffer *VB )
-{
- int vertsz = intel->vertex_size;
- int cost_render = 0;
- int cost_fallback = 0;
- int nr_prims = 0;
- int nr_rprims = 0;
- int nr_rverts = 0;
- int rprim = intel->reduced_primitive;
- int i = 0;
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++) {
- GLuint prim = VB->Primitive[i].mode;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- nr_prims++;
- nr_rverts += length * scale_prim[prim & PRIM_MODE_MASK];
-
- if (reduced_prim[prim & PRIM_MODE_MASK] != rprim) {
- nr_rprims++;
- rprim = reduced_prim[prim & PRIM_MODE_MASK];
- }
- }
-
- /* One point for each generated primitive:
- */
- cost_render = nr_prims;
- cost_fallback = nr_rprims;
-
- /* One point for every 1024 dwords (4k) of dma:
- */
- cost_render += (vertsz * i) / 1024;
- cost_fallback += (vertsz * nr_rverts) / 1024;
-
- if (0)
- fprintf(stderr, "cost render: %d fallback: %d\n",
- cost_render, cost_fallback);
-
- if (cost_render > cost_fallback)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-static GLboolean intel_run_render( GLcontext *ctx,
- struct tnl_pipeline_stage *stage )
-{
- struct intel_context *intel = intel_context(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint i;
-
- /* Don't handle clipping or indexed vertices.
- */
- if (intel->RenderIndex != 0 ||
- !intel_validate_render( ctx, VB ) ||
- !choose_render( intel, VB )) {
- return GL_TRUE;
- }
-
- tnl->clipspace.new_inputs |= VERT_BIT_POS;
-
- tnl->Driver.Render.Start( ctx );
-
- for (i = 0 ; i < VB->PrimitiveCount ; i++)
- {
- GLuint prim = VB->Primitive[i].mode;
- GLuint start = VB->Primitive[i].start;
- GLuint length = VB->Primitive[i].count;
-
- if (!length)
- continue;
-
- intel_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
- prim );
- }
-
- tnl->Driver.Render.Finish( ctx );
-
- if (intel->prim.flush)
- intel->prim.flush(intel);
-
- return GL_FALSE; /* finished the pipe */
-}
-
-const struct tnl_pipeline_stage _intel_render_stage =
-{
- "intel render",
- NULL,
- NULL,
- NULL,
- NULL,
- intel_run_render /* run */
-};
diff --git a/src/mesa/drivers/dri/i915-tex/intel_rotate.c b/src/mesa/drivers/dri/i915-tex/intel_rotate.c
deleted file mode 100644
index a77640ee54d..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_rotate.c
+++ /dev/null
@@ -1,221 +0,0 @@
-
-/**
- * Routines for simple 2D->2D transformations for rotated, flipped screens.
- *
- * XXX This code is not intel-specific. Move it into a common/utility
- * someday.
- */
-
-#include "intel_rotate.h"
-
-#define MIN2(A, B) ( ((A) < (B)) ? (A) : (B) )
-
-#define ABS(A) ( ((A) < 0) ? -(A) : (A) )
-
-
-void
-matrix23Set(struct matrix23 *m,
- int m00, int m01, int m02,
- int m10, int m11, int m12)
-{
- m->m00 = m00; m->m01 = m01; m->m02 = m02;
- m->m10 = m10; m->m11 = m11; m->m12 = m12;
-}
-
-
-/*
- * Transform (x,y) coordinate by the given matrix.
- */
-void
-matrix23TransformCoordf(const struct matrix23 *m, float *x, float *y)
-{
- const float x0 = *x;
- const float y0 = *y;
-
- *x = m->m00 * x0 + m->m01 * y0 + m->m02;
- *y = m->m10 * x0 + m->m11 * y0 + m->m12;
-}
-
-
-void
-matrix23TransformCoordi(const struct matrix23 *m, int *x, int *y)
-{
- const int x0 = *x;
- const int y0 = *y;
-
- *x = m->m00 * x0 + m->m01 * y0 + m->m02;
- *y = m->m10 * x0 + m->m11 * y0 + m->m12;
-}
-
-
-/*
- * Transform a width and height by the given matrix.
- * XXX this could be optimized quite a bit.
- */
-void
-matrix23TransformDistance(const struct matrix23 *m, int *xDist, int *yDist)
-{
- int x0 = 0, y0 = 0;
- int x1 = *xDist, y1 = 0;
- int x2 = 0, y2 = *yDist;
- matrix23TransformCoordi(m, &x0, &y0);
- matrix23TransformCoordi(m, &x1, &y1);
- matrix23TransformCoordi(m, &x2, &y2);
-
- *xDist = (x1 - x0) + (x2 - x0);
- *yDist = (y1 - y0) + (y2 - y0);
-
- if (*xDist < 0)
- *xDist = -*xDist;
- if (*yDist < 0)
- *yDist = -*yDist;
-}
-
-
-/**
- * Transform the rect defined by (x, y, w, h) by m.
- */
-void
-matrix23TransformRect(const struct matrix23 *m, int *x, int *y, int *w, int *h)
-{
- int x0 = *x, y0 = *y;
- int x1 = *x + *w, y1 = *y;
- int x2 = *x + *w, y2 = *y + *h;
- int x3 = *x, y3 = *y + *h;
- matrix23TransformCoordi(m, &x0, &y0);
- matrix23TransformCoordi(m, &x1, &y1);
- matrix23TransformCoordi(m, &x2, &y2);
- matrix23TransformCoordi(m, &x3, &y3);
- *w = ABS(x1 - x0) + ABS(x2 - x1);
- /**w = ABS(*w);*/
- *h = ABS(y1 - y0) + ABS(y2 - y1);
- /**h = ABS(*h);*/
- *x = MIN2(x0, x1);
- *x = MIN2(*x, x2);
- *y = MIN2(y0, y1);
- *y = MIN2(*y, y2);
-}
-
-
-/*
- * Make rotation matrix for width X height screen.
- */
-void
-matrix23Rotate(struct matrix23 *m, int width, int height, int angle)
-{
- switch (angle) {
- case 0:
- matrix23Set(m, 1, 0, 0, 0, 1, 0);
- break;
- case 90:
- matrix23Set(m, 0, 1, 0, -1, 0, width);
- break;
- case 180:
- matrix23Set(m, -1, 0, width, 0, -1, height);
- break;
- case 270:
- matrix23Set(m, 0, -1, height, 1, 0, 0);
- break;
- default:
- /*abort()*/;
- }
-}
-
-
-/*
- * Make flip/reflection matrix for width X height screen.
- */
-void
-matrix23Flip(struct matrix23 *m, int width, int height, int xflip, int yflip)
-{
- if (xflip) {
- m->m00 = -1; m->m01 = 0; m->m02 = width - 1;
- }
- else {
- m->m00 = 1; m->m01 = 0; m->m02 = 0;
- }
- if (yflip) {
- m->m10 = 0; m->m11 = -1; m->m12 = height - 1;
- }
- else {
- m->m10 = 0; m->m11 = 1; m->m12 = 0;
- }
-}
-
-
-/*
- * result = a * b
- */
-void
-matrix23Multiply(struct matrix23 *result,
- const struct matrix23 *a, const struct matrix23 *b)
-{
- result->m00 = a->m00 * b->m00 + a->m01 * b->m10;
- result->m01 = a->m00 * b->m01 + a->m01 * b->m11;
- result->m02 = a->m00 * b->m02 + a->m01 * b->m12 + a->m02;
-
- result->m10 = a->m10 * b->m00 + a->m11 * b->m10;
- result->m11 = a->m10 * b->m01 + a->m11 * b->m11;
- result->m12 = a->m10 * b->m02 + a->m11 * b->m12 + a->m12;
-}
-
-
-#if 000
-
-#include <stdio.h>
-
-int
-main(int argc, char *argv[])
-{
- int width = 500, height = 400;
- int rot;
- int fx = 0, fy = 0; /* flip x and/or y ? */
- int coords[4][2];
-
- /* four corner coords to test with */
- coords[0][0] = 0; coords[0][1] = 0;
- coords[1][0] = width-1; coords[1][1] = 0;
- coords[2][0] = width-1; coords[2][1] = height-1;
- coords[3][0] = 0; coords[3][1] = height-1;
-
-
- for (rot = 0; rot < 360; rot += 90) {
- struct matrix23 rotate, flip, m;
- int i;
-
- printf("Rot %d, xFlip %d, yFlip %d:\n", rot, fx, fy);
-
- /* make transformation matrix 'm' */
- matrix23Rotate(&rotate, width, height, rot);
- matrix23Flip(&flip, width, height, fx, fy);
- matrix23Multiply(&m, &rotate, &flip);
-
- /* xform four coords */
- for (i = 0; i < 4; i++) {
- int x = coords[i][0];
- int y = coords[i][1];
- matrix23TransformCoordi(&m, &x, &y);
- printf(" %d, %d -> %d %d\n", coords[i][0], coords[i][1], x, y);
- }
-
- /* xform width, height */
- {
- int x = width;
- int y = height;
- matrix23TransformDistance(&m, &x, &y);
- printf(" %d x %d -> %d x %d\n", width, height, x, y);
- }
-
- /* xform rect */
- {
- int x = 50, y = 10, w = 200, h = 100;
- matrix23TransformRect(&m, &x, &y, &w, &h);
- printf(" %d,%d %d x %d -> %d, %d %d x %d\n", 50, 10, 200, 100,
- x, y, w, h);
- }
-
- }
-
- return 0;
-}
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_rotate.h b/src/mesa/drivers/dri/i915-tex/intel_rotate.h
deleted file mode 100644
index 0da45d20ce5..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_rotate.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef INTEL_ROTATE_H
-#define INTEL_ROTATE_H 1
-
-struct matrix23
-{
- int m00, m01, m02;
- int m10, m11, m12;
-};
-
-
-
-extern void
-matrix23Set(struct matrix23 *m,
- int m00, int m01, int m02,
- int m10, int m11, int m12);
-
-extern void
-matrix23TransformCoordi(const struct matrix23 *m, int *x, int *y);
-
-extern void
-matrix23TransformCoordf(const struct matrix23 *m, float *x, float *y);
-
-extern void
-matrix23TransformDistance(const struct matrix23 *m, int *xDist, int *yDist);
-
-extern void
-matrix23TransformRect(const struct matrix23 *m,
- int *x, int *y, int *w, int *h);
-
-extern void
-matrix23Rotate(struct matrix23 *m, int width, int height, int angle);
-
-extern void
-matrix23Flip(struct matrix23 *m, int width, int height, int xflip, int yflip);
-
-extern void
-matrix23Multiply(struct matrix23 *result,
- const struct matrix23 *a, const struct matrix23 *b);
-
-
-#endif /* INTEL_ROTATE_H */
diff --git a/src/mesa/drivers/dri/i915-tex/intel_screen.c b/src/mesa/drivers/dri/i915-tex/intel_screen.c
deleted file mode 100644
index 1401e7ada6b..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_screen.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "context.h"
-#include "framebuffer.h"
-#include "matrix.h"
-#include "renderbuffer.h"
-#include "simple_list.h"
-#include "utils.h"
-#include "vblank.h"
-#include "xmlpool.h"
-
-
-#include "intel_screen.h"
-
-#include "intel_buffers.h"
-#include "intel_tex.h"
-#include "intel_span.h"
-#include "intel_tris.h"
-#include "intel_ioctl.h"
-#include "intel_fbo.h"
-
-<<<<<<< intel_screen.c
-#include "i830_dri.h"
-
-=======
-#include "i830_dri.h"
-
-
->>>>>>> 1.29.2.13
-PUBLIC const char __driConfigOptions[] =
-DRI_CONF_BEGIN
- DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
- DRI_CONF_SECTION_END
- DRI_CONF_SECTION_QUALITY
- DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
- DRI_CONF_SECTION_END
-DRI_CONF_END;
-const GLuint __driNConfigOptions = 4;
-
-#ifdef USE_NEW_INTERFACE
-static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
-#endif /*USE_NEW_INTERFACE*/
-
-extern const struct dri_extension card_extensions[];
-
-/**
- * Map all the memory regions described by the screen.
- * \return GL_TRUE if success, GL_FALSE if error.
- */
-GLboolean
-intelMapScreenRegions(__DRIscreenPrivate *sPriv)
-{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
-
- if (intelScreen->front.handle) {
- if (drmMap(sPriv->fd,
- intelScreen->front.handle,
- intelScreen->front.size,
- (drmAddress *)&intelScreen->front.map) != 0) {
- _mesa_problem(NULL, "drmMap(frontbuffer) failed!");
- return GL_FALSE;
- }
- }
- else {
- _mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!");
- }
-
- if (drmMap(sPriv->fd,
- intelScreen->back.handle,
- intelScreen->back.size,
- (drmAddress *)&intelScreen->back.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
-
- if (drmMap(sPriv->fd,
- intelScreen->depth.handle,
- intelScreen->depth.size,
- (drmAddress *)&intelScreen->depth.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
-
- if (drmMap(sPriv->fd,
- intelScreen->tex.handle,
- intelScreen->tex.size,
- (drmAddress *)&intelScreen->tex.map) != 0) {
- intelUnmapScreenRegions(intelScreen);
- return GL_FALSE;
- }
-
- if (0)
- printf("Mappings: front: %p back: %p depth: %p tex: %p\n",
- intelScreen->front.map,
- intelScreen->back.map,
- intelScreen->depth.map,
- intelScreen->tex.map);
- return GL_TRUE;
-}
-
-
-void
-intelUnmapScreenRegions(intelScreenPrivate *intelScreen)
-{
-#define REALLY_UNMAP 1
- if (intelScreen->front.map) {
-#if REALLY_UNMAP
- if (drmUnmap(intelScreen->front.map, intelScreen->front.size) != 0)
- printf("drmUnmap front failed!\n");
-#endif
- intelScreen->front.map = NULL;
- }
- if (intelScreen->back.map) {
-#if REALLY_UNMAP
- if (drmUnmap(intelScreen->back.map, intelScreen->back.size) != 0)
- printf("drmUnmap back failed!\n");
-#endif
- intelScreen->back.map = NULL;
- }
- if (intelScreen->depth.map) {
-#if REALLY_UNMAP
- drmUnmap(intelScreen->depth.map, intelScreen->depth.size);
- intelScreen->depth.map = NULL;
-#endif
- }
- if (intelScreen->tex.map) {
-#if REALLY_UNMAP
- drmUnmap(intelScreen->tex.map, intelScreen->tex.size);
- intelScreen->tex.map = NULL;
-#endif
- }
-}
-
-
-static void
-intelPrintDRIInfo(intelScreenPrivate *intelScreen,
- __DRIscreenPrivate *sPriv,
- I830DRIPtr gDRIPriv)
-{
- fprintf(stderr, "*** Front size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->front.size, intelScreen->front.offset,
- intelScreen->front.pitch);
- fprintf(stderr, "*** Back size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->back.size, intelScreen->back.offset,
- intelScreen->back.pitch);
- fprintf(stderr, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->depth.size, intelScreen->depth.offset,
- intelScreen->depth.pitch);
- fprintf(stderr, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n",
- intelScreen->rotated.size, intelScreen->rotated.offset,
- intelScreen->rotated.pitch);
- fprintf(stderr, "*** Texture size: 0x%x offset: 0x%x\n",
- intelScreen->tex.size, intelScreen->tex.offset);
- fprintf(stderr, "*** Memory : 0x%x\n", gDRIPriv->mem);
-}
-
-
-static void
-intelPrintSAREA(const drmI830Sarea *sarea)
-{
- fprintf(stderr, "SAREA: sarea width %d height %d\n", sarea->width, sarea->height);
- fprintf(stderr, "SAREA: pitch: %d\n", sarea->pitch);
- fprintf(stderr,
- "SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x\n",
- sarea->front_offset, sarea->front_size,
- (unsigned) sarea->front_handle);
- fprintf(stderr,
- "SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x\n",
- sarea->back_offset, sarea->back_size,
- (unsigned) sarea->back_handle);
- fprintf(stderr, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x\n",
- sarea->depth_offset, sarea->depth_size,
- (unsigned) sarea->depth_handle);
- fprintf(stderr, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n",
- sarea->tex_offset, sarea->tex_size,
- (unsigned) sarea->tex_handle);
- fprintf(stderr, "SAREA: rotation: %d\n", sarea->rotation);
- fprintf(stderr,
- "SAREA: rotated offset: 0x%08x size: 0x%x\n",
- sarea->rotated_offset, sarea->rotated_size);
- fprintf(stderr, "SAREA: rotated pitch: %d\n", sarea->rotated_pitch);
-}
-
-
-/**
- * A number of the screen parameters are obtained/computed from
- * information in the SAREA. This function updates those parameters.
- */
-void
-intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen,
- drmI830Sarea *sarea)
-{
- intelScreen->width = sarea->width;
- intelScreen->height = sarea->height;
-
- intelScreen->front.offset = sarea->front_offset;
- intelScreen->front.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->front.handle = sarea->front_handle;
- intelScreen->front.size = sarea->front_size;
-
- intelScreen->back.offset = sarea->back_offset;
- intelScreen->back.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->back.handle = sarea->back_handle;
- intelScreen->back.size = sarea->back_size;
-
- intelScreen->depth.offset = sarea->depth_offset;
- intelScreen->depth.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->depth.handle = sarea->depth_handle;
- intelScreen->depth.size = sarea->depth_size;
-
- intelScreen->tex.offset = sarea->tex_offset;
- intelScreen->logTextureGranularity = sarea->log_tex_granularity;
- intelScreen->tex.handle = sarea->tex_handle;
- intelScreen->tex.size = sarea->tex_size;
-
- intelScreen->rotated.offset = sarea->rotated_offset;
- intelScreen->rotated.pitch = sarea->rotated_pitch * intelScreen->cpp;
- intelScreen->rotated.size = sarea->rotated_size;
- intelScreen->current_rotation = sarea->rotation;
- matrix23Rotate(&intelScreen->rotMatrix,
- sarea->width, sarea->height, sarea->rotation);
- intelScreen->rotatedWidth = sarea->virtualX;
- intelScreen->rotatedHeight = sarea->virtualY;
-
- if (0)
- intelPrintSAREA(sarea);
-}
-
-
-static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
-{
- intelScreenPrivate *intelScreen;
- I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
- drmI830Sarea *sarea;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
-
- if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
- fprintf(stderr,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
- return GL_FALSE;
- }
-
- /* Allocate the private area */
- intelScreen = (intelScreenPrivate *)CALLOC(sizeof(intelScreenPrivate));
- if (!intelScreen) {
- fprintf(stderr,"\nERROR! Allocating private area failed\n");
- return GL_FALSE;
- }
- /* parse information in __driConfigOptions */
- driParseOptionInfo (&intelScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- intelScreen->driScrnPriv = sPriv;
- sPriv->private = (void *)intelScreen;
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
- sarea = (drmI830Sarea *)
- (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset);
-
- intelScreen->deviceID = gDRIPriv->deviceID;
- intelScreen->mem = gDRIPriv->mem;
- intelScreen->cpp = gDRIPriv->cpp;
-
- switch (gDRIPriv->bitsPerPixel) {
- case 16: intelScreen->fbFormat = DV_PF_565; break;
- case 32: intelScreen->fbFormat = DV_PF_8888; break;
- default: exit(1); break;
- }
-<<<<<<< intel_screen.c
-=======
-
- intelScreen->front.pitch = gDRIPriv->fbStride;
- intelScreen->front.offset = gDRIPriv->fbOffset;
- intelScreen->front.map = (char *)sPriv->pFB;
-
- intelScreen->back.offset = gDRIPriv->backOffset;
- intelScreen->back.pitch = gDRIPriv->backPitch;
- intelScreen->back.handle = gDRIPriv->backbuffer;
- intelScreen->back.size = gDRIPriv->backbufferSize;
->>>>>>> 1.29.2.13
-
- intelUpdateScreenFromSAREA(intelScreen, sarea);
-
-<<<<<<< intel_screen.c
- if (0)
- intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
-=======
- intelScreen->depth.offset = gDRIPriv->depthOffset;
- intelScreen->depth.pitch = gDRIPriv->depthPitch;
- intelScreen->depth.handle = gDRIPriv->depthbuffer;
- intelScreen->depth.size = gDRIPriv->depthbufferSize;
-
- if (drmMap(sPriv->fd,
- intelScreen->depth.handle,
- intelScreen->depth.size,
- (drmAddress *)&intelScreen->depth.map) != 0) {
- fprintf(stderr, "\nERROR: line %d, Function %s, File %s\n",
- __LINE__, __FUNCTION__, __FILE__);
- FREE(intelScreen);
- drmUnmap(intelScreen->back.map, intelScreen->back.size);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-
-#if 0
-
- /*
- * FIXME: Remove this code and its references.
- */
-
- intelScreen->tex.offset = gDRIPriv->textureOffset;
- intelScreen->logTextureGranularity = gDRIPriv->logTextureGranularity;
- intelScreen->tex.handle = gDRIPriv->textures;
- intelScreen->tex.size = gDRIPriv->textureSize;
->>>>>>> 1.29.2.13
-
- if (!intelMapScreenRegions(sPriv)) {
- fprintf(stderr,"\nERROR! mapping regions\n");
- _mesa_free(intelScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
-<<<<<<< intel_screen.c
-=======
-
-#else
- intelScreen->tex.offset = 0;
- intelScreen->logTextureGranularity = 0;
- intelScreen->tex.handle = 0;
- intelScreen->tex.size = 0;
-#endif
-
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
-
- if (1) intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
->>>>>>> 1.29.2.13
-
- intelScreen->drmMinor = sPriv->drmMinor;
-
- /* Determine if IRQs are active? */
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_IRQ_ACTIVE;
- gp.value = &intelScreen->irq_active;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
- return GL_FALSE;
- }
- }
-
- /* Determine if batchbuffers are allowed */
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_ALLOW_BATCHBUFFER;
- gp.value = &intelScreen->allow_batchbuffer;
-
- ret = drmCommandWriteRead( sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: (%d) %d\n", gp.param, ret);
- return GL_FALSE;
- }
- }
-
- if (glx_enable_extension != NULL) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- }
-
- return GL_TRUE;
-}
-
-
-static void intelDestroyScreen(__DRIscreenPrivate *sPriv)
-{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
-
- intelUnmapScreenRegions(intelScreen);
- FREE(intelScreen);
- sPriv->private = NULL;
-}
-
-
-/**
- * This is called when we need to set up GL rendering to a new X window.
- */
-static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
- __DRIdrawablePrivate *driDrawPriv,
- const __GLcontextModes *mesaVis,
- GLboolean isPixmap )
-{
- intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private;
-
- if (isPixmap) {
- return GL_FALSE; /* not implemented */
- } else {
- GLboolean swStencil = (mesaVis->stencilBits > 0 &&
- mesaVis->depthBits != 24);
- GLenum rgbFormat = (mesaVis->redBits == 5 ? GL_RGB5 : GL_RGBA8);
-
- struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
-
- /* setup the hardware-based renderbuffers */
- {
-<<<<<<< intel_screen.c
- driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
- screen->front.map,
- screen->cpp,
- screen->front.offset, screen->front.pitch,
- driDrawPriv);
- intelSetSpanFunctions(frontRb, mesaVis);
-=======
- struct intel_renderbuffer *frontRb
- = intel_create_renderbuffer(rgbFormat,
- screen->width, screen->height,
- screen->front.offset,
- screen->front.pitch,
- screen->cpp,
- driScrnPriv->pFB);
- intel_set_span_functions(&frontRb->Base);
->>>>>>> 1.29.2.13
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
- }
-
- if (mesaVis->doubleBufferMode) {
- struct intel_renderbuffer *backRb
- = intel_create_renderbuffer(rgbFormat,
- screen->width, screen->height,
- screen->back.offset,
- screen->back.pitch,
- screen->cpp,
- screen->back.map);
- intel_set_span_functions(&backRb->Base);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
- }
-
- if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
- /* combined depth/stencil buffer */
- struct intel_renderbuffer *depthStencilRb
- = intel_create_renderbuffer(
- GL_DEPTH24_STENCIL8_EXT,
- screen->width, screen->height,
- screen->depth.offset,
- screen->depth.pitch,
- screen->cpp, /* 4! */
- screen->depth.map);
- intel_set_span_functions(&depthStencilRb->Base);
- /* note: bind RB to two attachment points */
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthStencilRb->Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base);
- }
- else if (mesaVis->depthBits == 16) {
- /* just 16-bit depth buffer, no hw stencil */
- struct intel_renderbuffer *depthRb
- = intel_create_renderbuffer(GL_DEPTH_COMPONENT16,
- screen->width, screen->height,
- screen->depth.offset,
- screen->depth.pitch,
- screen->cpp, /* 2! */
- screen->depth.map);
- intel_set_span_functions(&depthRb->Base);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
-
- /* now add any/all software-based renderbuffers we may need */
- _mesa_add_soft_renderbuffers(fb,
- GL_FALSE, /* never sw color */
- GL_FALSE, /* never sw depth */
- swStencil,
- mesaVis->accumRedBits > 0,
- GL_FALSE, /* never sw alpha */
- GL_FALSE /* never sw aux */);
- driDrawPriv->driverPrivate = (void *) fb;
-
- return (driDrawPriv->driverPrivate != NULL);
- }
-}
-
-static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
-{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
-}
-
-
-/**
- * Get information about previous buffer swaps.
- */
-static int
-intelGetSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
-{
- intelContextPtr intel;
-
- if ( (dPriv == NULL) || (dPriv->driContextPriv == NULL)
- || (dPriv->driContextPriv->driverPrivate == NULL)
- || (sInfo == NULL) ) {
- return -1;
- }
-
- intel = dPriv->driContextPriv->driverPrivate;
- sInfo->swap_count = intel->swap_count;
- sInfo->swap_ust = intel->swap_ust;
- sInfo->swap_missed_count = intel->swap_missed_count;
-
- sInfo->swap_missed_usage = (sInfo->swap_missed_count != 0)
- ? driCalculateSwapUsage( dPriv, 0, intel->swap_missed_ust )
- : 0.0;
-
- return 0;
-}
-
-
-/* There are probably better ways to do this, such as an
- * init-designated function to register chipids and createcontext
- * functions.
- */
-extern GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-extern GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate);
-
-
-
-
-static GLboolean intelCreateContext( const __GLcontextModes *mesaVis,
- __DRIcontextPrivate *driContextPriv,
- void *sharedContextPrivate)
-{
- __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
- intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
-
- switch (intelScreen->deviceID) {
- /* Don't deal with i830 until texture work complete:
- */
- case PCI_CHIP_845_G:
- case PCI_CHIP_I830_M:
- case PCI_CHIP_I855_GM:
- case PCI_CHIP_I865_G:
- return i830CreateContext( mesaVis, driContextPriv,
- sharedContextPrivate );
-
- case PCI_CHIP_I915_G:
- case PCI_CHIP_I915_GM:
- case PCI_CHIP_I945_G:
- case PCI_CHIP_I945_GM:
- return i915CreateContext( mesaVis, driContextPriv,
- sharedContextPrivate );
-
- default:
- fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID);
- return GL_FALSE;
- }
-}
-
-
-static const struct __DriverAPIRec intelAPI = {
- .InitDriver = intelInitDriver,
- .DestroyScreen = intelDestroyScreen,
- .CreateContext = intelCreateContext,
- .DestroyContext = intelDestroyContext,
- .CreateBuffer = intelCreateBuffer,
- .DestroyBuffer = intelDestroyBuffer,
- .SwapBuffers = intelSwapBuffers,
- .MakeCurrent = intelMakeCurrent,
- .UnbindContext = intelUnbindContext,
- .GetSwapInfo = intelGetSwapInfo,
- .GetMSC = driGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *
-intelFillInModes( unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer )
-{
- __GLcontextModes * modes;
- __GLcontextModes * m;
- unsigned num_modes;
- unsigned depth_buffer_factor;
- unsigned back_buffer_factor;
- GLenum fb_format;
- GLenum fb_type;
-
- /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
- * support pageflipping at all.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
- };
-
- u_int8_t depth_bits_array[3];
- u_int8_t stencil_bits_array[3];
-
-
- depth_bits_array[0] = 0;
- depth_bits_array[1] = depth_bits;
- depth_bits_array[2] = depth_bits;
-
- /* Just like with the accumulation buffer, always provide some modes
- * with a stencil buffer. It will be a sw fallback, but some apps won't
- * care about that.
- */
- stencil_bits_array[0] = 0;
- stencil_bits_array[1] = 0;
- stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
- back_buffer_factor = (have_back_buffer) ? 3 : 1;
-
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
- if ( pixel_bits == 16 ) {
- fb_format = GL_RGB;
- fb_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
- fb_format = GL_BGRA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for ( m = modes ; m != NULL ; m = m->next ) {
- if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) {
- m->visualRating = GLX_SLOW_CONFIG;
- }
- }
-
- return modes;
-}
-
-
-/**
- * This is the bootstrap function for the driver. libGL supplies all of the
- * requisite information about the system, and the driver initializes itself.
- * This routine also fills in the linked list pointed to by \c driver_modes
- * with the \c __GLcontextModes that the driver can support for windows or
- * pbuffers.
- *
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 5, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 4, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "i915",
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
- return NULL;
- }
-
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- ddx_version, dri_version, drm_version,
- frame_buffer, pSAREA, fd,
- internal_api_version, &intelAPI);
- if ( psp != NULL ) {
- I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
- *driver_modes = intelFillInModes( dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_screen.h b/src/mesa/drivers/dri/i915-tex/intel_screen.h
deleted file mode 100644
index 9a7a4d0d6d2..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_screen.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef _INTEL_INIT_H_
-#define _INTEL_INIT_H_
-
-#include <sys/time.h>
-#include "xmlconfig.h"
-#include "dri_util.h"
-#include "intel_rotate.h"
-#include "i830_common.h"
-
-
-<<<<<<< intel_screen.h
-/* This roughly corresponds to a gl_renderbuffer (Mesa 6.4) */
-=======
-/* XXX: change name or eliminate to avoid conflict with "struct
- * intel_region"!!!
- */
->>>>>>> 1.5.2.3
-typedef struct {
- drm_handle_t handle;
- drmSize size; /* region size in bytes */
- char *map; /* memory map */
- int offset; /* from start of video mem, in bytes */
- int pitch; /* row stride, in bytes */
-} intelRegion;
-
-typedef struct
-{
- intelRegion front;
- intelRegion back;
- intelRegion rotated;
- intelRegion depth;
- intelRegion tex;
-
- int deviceID;
- int width;
- int height;
- int mem; /* unused */
-
- int cpp; /* for front and back buffers */
-<<<<<<< intel_screen.h
- int fbFormat;
-=======
- int bitsPerPixel; /* unused */
- int fbFormat; /* XXX FBO: this is obsolete - remove after i830 updates */
->>>>>>> 1.5.2.3
-
- int logTextureGranularity;
-
- __DRIscreenPrivate *driScrnPriv;
- unsigned int sarea_priv_offset;
-
- int drmMinor;
-
- int irq_active;
- int allow_batchbuffer;
-
- struct matrix23 rotMatrix;
-
- int current_rotation; /* 0, 90, 180 or 270 */
- int rotatedWidth, rotatedHeight;
-
- /**
- * Configuration cache with default values for all contexts
- */
- driOptionCache optionCache;
-} intelScreenPrivate;
-
-
-extern GLboolean
-intelMapScreenRegions(__DRIscreenPrivate *sPriv);
-
-extern void
-intelUnmapScreenRegions(intelScreenPrivate *intelScreen);
-
-extern void
-intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen,
- drmI830Sarea *sarea);
-
-extern void
-intelDestroyContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-intelUnbindContext(__DRIcontextPrivate *driContextPriv);
-
-extern GLboolean
-intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv);
-
-<<<<<<< intel_screen.h
-extern void
-intelSwapBuffers(__DRIdrawablePrivate *dPriv);
-
-=======
->>>>>>> 1.5.2.3
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_span.c b/src/mesa/drivers/dri/i915-tex/intel_span.c
deleted file mode 100644
index 24eac0dce21..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_span.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
-
-#include "intel_fbo.h"
-#include "intel_screen.h"
-#include "intel_span.h"
-#include "intel_regions.h"
-#include "intel_ioctl.h"
-#include "intel_tex.h"
-
-#include "swrast/swrast.h"
-
-/*
- break intelWriteRGBASpan_ARGB8888
-*/
-
-#undef DBG
-#define DBG 0
-
-#define LOCAL_VARS \
- struct intel_context *intel = intel_context(ctx); \
- struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
- const GLint yScale = irb->RenderToTexture ? 1 : -1; \
- const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
- GLubyte *buf = (GLubyte *) irb->pfMap \
- + (intel->drawY * irb->pfPitch + intel->drawX) * irb->region->cpp;\
- GLuint p; \
- assert(irb->pfMap);\
- (void) p;
-
-/* XXX FBO: this is identical to the macro in spantmp2.h except we get
- * the cliprect info from the context, not the driDrawable.
- * Move this into spantmp2.h someday.
- */
-#define HW_CLIPLOOP() \
- do { \
- int _nc = intel->numClipRects; \
- while ( _nc-- ) { \
- int minx = intel->pClipRects[_nc].x1 - intel->drawX; \
- int miny = intel->pClipRects[_nc].y1 - intel->drawY; \
- int maxx = intel->pClipRects[_nc].x2 - intel->drawX; \
- int maxy = intel->pClipRects[_nc].y2 - intel->drawY;
-
-
-
-
-#define Y_FLIP(_y) ((_y) * yScale + yBias)
-
-#define HW_LOCK()
-
-#define HW_UNLOCK()
-
-/* 16 bit, RGB565 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_RGB
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
-
-#define TAG(x) intel##x##_RGB565
-#define TAG2(x,y) intel##x##_RGB565##y
-#define GET_PTR(X,Y) (buf + ((Y) * irb->pfPitch + (X)) * 2)
-#include "spantmp2.h"
-
-/* 32 bit, ARGB8888 color spanline and pixel functions
- */
-#define SPANTMP_PIXEL_FMT GL_BGRA
-#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
-
-#define TAG(x) intel##x##_ARGB8888
-#define TAG2(x,y) intel##x##_ARGB8888##y
-#define GET_PTR(X,Y) (buf + ((Y) * irb->pfPitch + (X)) * 4)
-#include "spantmp2.h"
-
-
-#define LOCAL_DEPTH_VARS \
- struct intel_context *intel = intel_context(ctx); \
- struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
- const GLuint pitch = irb->pfPitch/***XXX region->pitch*/; /* in pixels */ \
- const GLint yScale = irb->RenderToTexture ? 1 : -1; \
- const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
- char *buf = (char *) irb->pfMap/*XXX use region->map*/ + \
- (intel->drawY * pitch + intel->drawX) * irb->region->cpp;
-
-
-#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
-
-/**
- ** 16-bit depthbuffer functions.
- **/
-#define WRITE_DEPTH( _x, _y, d ) \
- ((GLushort *)buf)[(_x) + (_y) * pitch] = d;
-
-#define READ_DEPTH( d, _x, _y ) \
- d = ((GLushort *)buf)[(_x) + (_y) * pitch];
-
-
-#define TAG(x) intel##x##_z16
-#include "depthtmp.h"
-
-
-/**
- ** 24/8-bit interleaved depth/stencil functions
- ** Note: we're actually reading back combined depth+stencil values.
- ** The wrappers in main/depthstencil.c are used to extract the depth
- ** and stencil values.
- **/
-/* Change ZZZS -> SZZZ */
-#define WRITE_DEPTH( _x, _y, d ) { \
- GLuint tmp = ((d) >> 8) | ((d) << 24); \
- ((GLuint *)buf)[(_x) + (_y) * pitch] = tmp; \
-}
-
-/* Change SZZZ -> ZZZS */
-#define READ_DEPTH( d, _x, _y ) { \
- GLuint tmp = ((GLuint *)buf)[(_x) + (_y) * pitch]; \
- d = (tmp << 8) | (tmp >> 24); \
-}
-
-#define TAG(x) intel##x##_z24_s8
-#include "depthtmp.h"
-
-
-/**
- ** 8-bit stencil function (XXX FBO: This is obsolete)
- **/
-#define WRITE_STENCIL( _x, _y, d ) { \
- GLuint tmp = ((GLuint *)buf)[(_x) + (_y) * pitch]; \
- tmp &= 0xffffff; \
- tmp |= ((d) << 24); \
- ((GLuint *) buf)[(_x) + (_y) * pitch] = tmp; \
-}
-
-#define READ_STENCIL( d, _x, _y ) \
- d = ((GLuint *)buf)[(_x) + (_y) * pitch] >> 24;
-
-#define TAG(x) intel##x##_z24_s8
-#include "stenciltmp.h"
-
-
-
-/**
- * Map or unmap all the renderbuffers which we may need during
- * software rendering.
- * XXX in the future, we could probably convey extra information to
- * reduce the number of mappings needed. I.e. if doing a glReadPixels
- * from the depth buffer, we really only need one mapping.
- *
- * XXX Rewrite this function someday.
- * We can probably just loop over all the renderbuffer attachments,
- * map/unmap all of them, and not worry about the _ColorDrawBuffers
- * _ColorReadBuffer, _DepthBuffer or _StencilBuffer fields.
- */
-static void
-intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
-{
- GLcontext *ctx = &intel->ctx;
- GLuint i, j;
- struct intel_renderbuffer *irb;
-
- /* color draw buffers */
- for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
- for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers[i]; j++) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i][j];
- irb = intel_renderbuffer(rb);
- if (irb && irb->Base.Name != 0) { /* XXX FBO temporary test */
- /* this is a user-created intel_renderbuffer */
- if (irb->region) {
- if (map)
- intel_region_map(intel, irb->region);
- else
- intel_region_unmap(intel, irb->region);
- }
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- }
- }
-
- /* check for render to textures */
- for (i = 0; i < BUFFER_COUNT; i++) {
- struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment + i;
- struct gl_texture_object *tex = att->Texture;
- if (tex) {
- /* render to texture */
- ASSERT(att->Renderbuffer);
- if (map) {
- struct gl_texture_image *texImg;
- texImg = tex->Image[att->CubeMapFace][att->TextureLevel];
- intel_tex_map_images(intel, intel_texture_object(tex));
- }
- else {
- intel_tex_unmap_images(intel, intel_texture_object(tex));
- }
- }
- }
-
- /* color read buffers */
- irb = intel_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
- if (irb && irb->region && irb->Base.Name != 0) {
- if (map)
- intel_region_map(intel, irb->region);
- else
- intel_region_unmap(intel, irb->region);
- }
-
- /* Account for front/back color page flipping.
- * The span routines use the pfMap and pfPitch fields which will
- * swap the front/back region map/pitch if we're page flipped.
- * Do this after mapping, above, so the map field is valid.
- */
-#if 0
- if (map && ctx->DrawBuffer->Name == 0) {
- struct intel_renderbuffer *irbFront
- = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_FRONT_LEFT);
- struct intel_renderbuffer *irbBack
- = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_BACK_LEFT);
- if (irbBack) {
- /* double buffered */
- if (intel->sarea->pf_current_page == 0) {
- irbFront->pfMap = irbFront->region->map;
- irbFront->pfPitch = irbFront->region->pitch;
- irbBack->pfMap = irbBack->region->map;
- irbBack->pfPitch = irbBack->region->pitch;
- }
- else {
- irbFront->pfMap = irbBack->region->map;
- irbFront->pfPitch = irbBack->region->pitch;
- irbBack->pfMap = irbFront->region->map;
- irbBack->pfPitch = irbFront->region->pitch;
- }
- }
- }
-#endif
-
- /* depth buffer (Note wrapper!) */
- if (ctx->DrawBuffer->_DepthBuffer) {
- irb = intel_renderbuffer(ctx->DrawBuffer->_DepthBuffer->Wrapped);
- if (irb && irb->region && irb->Base.Name != 0) {
- if (map) {
- intel_region_map(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- else {
- intel_region_unmap(intel, irb->region);
- irb->pfMap = NULL;
- irb->pfPitch = 0;
- }
- }
- }
-
- /* stencil buffer (Note wrapper!) */
- if (ctx->DrawBuffer->_StencilBuffer) {
- irb = intel_renderbuffer(ctx->DrawBuffer->_StencilBuffer->Wrapped);
- if (irb && irb->region && irb->Base.Name != 0) {
- if (map) {
- intel_region_map(intel, irb->region);
- irb->pfMap = irb->region->map;
- irb->pfPitch = irb->region->pitch;
- }
- else {
- intel_region_unmap(intel, irb->region);
- irb->pfMap = NULL;
- irb->pfPitch = 0;
- }
- }
- }
-}
-
-
-
-/**
- * Prepare for softare rendering. Map current read/draw framebuffers'
- * renderbuffes and all currently bound texture objects.
- *
- * Old note: Moved locking out to get reasonable span performance.
- */
-void intelSpanRenderStart( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context(ctx);
- GLuint i;
-
- intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
-
-#if 0
- /* Just map the framebuffer and all textures. Bufmgr code will
- * take care of waiting on the necessary fences:
- */
- intel_region_map(intel, intel->front_region);
- intel_region_map(intel, intel->back_region);
- intel_region_map(intel, intel->depth_region);
-#endif
-
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
- intel_tex_map_images(intel, intel_texture_object(texObj));
- }
- }
-
- intel_map_unmap_buffers(intel, GL_TRUE);
-}
-
-/**
- * Called when done softare rendering. Unmap the buffers we mapped in
- * the above function.
- */
-void intelSpanRenderFinish( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context( ctx );
- GLuint i;
-
- _swrast_flush( ctx );
-
- /* Now unmap the framebuffer:
- */
-#if 0
- intel_region_unmap(intel, intel->front_region);
- intel_region_unmap(intel, intel->back_region);
- intel_region_unmap(intel, intel->depth_region);
-#endif
-
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
- intel_tex_unmap_images(intel, intel_texture_object(texObj));
- }
- }
-
- intel_map_unmap_buffers(intel, GL_FALSE);
-
- UNLOCK_HARDWARE( intel );
-}
-
-
-void intelInitSpanFuncs( GLcontext *ctx )
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
- swdd->SpanRenderStart = intelSpanRenderStart;
- swdd->SpanRenderFinish = intelSpanRenderFinish;
-}
-
-
-/**
- * Plug in appropriate span read/write functions for the given renderbuffer.
- * These are used for the software fallbacks.
- */
-void
-intel_set_span_functions(struct gl_renderbuffer *rb)
-{
- if (rb->_ActualFormat == GL_RGB5) {
- /* 565 RGB */
- intelInitPointers_RGB565(rb);
- }
- else if (rb->_ActualFormat == GL_RGBA8) {
- /* 8888 RGBA */
- intelInitPointers_ARGB8888(rb);
- }
- else if (rb->_ActualFormat == GL_DEPTH_COMPONENT16) {
- intelInitDepthPointers_z16(rb);
- }
- else if (rb->_ActualFormat == GL_DEPTH_COMPONENT24 || /* XXX FBO remove */
- rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) {
- intelInitDepthPointers_z24_s8(rb);
- }
- else if (rb->_ActualFormat == GL_STENCIL_INDEX8_EXT) { /* XXX FBO remove */
- intelInitStencilPointers_z24_s8(rb);
- }
- else {
- _mesa_problem(NULL, "Unexpected _ActualFormat in intelSetSpanFunctions");
- }
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_span.h b/src/mesa/drivers/dri/i915-tex/intel_span.h
deleted file mode 100644
index 98dd57b06a8..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_span.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef _INTEL_SPAN_H
-#define _INTEL_SPAN_H
-
-extern void intelInitSpanFuncs( GLcontext *ctx );
-
-extern void intelSpanRenderFinish( GLcontext *ctx );
-extern void intelSpanRenderStart( GLcontext *ctx );
-
-extern void
-intel_set_span_functions(struct gl_renderbuffer *rb);
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_state.c b/src/mesa/drivers/dri/i915-tex/intel_state.c
deleted file mode 100644
index c97bffffb17..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_state.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "colormac.h"
-#include "dd.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_fbo.h"
-#include "intel_regions.h"
-#include "swrast/swrast.h"
-
-int intel_translate_compare_func( GLenum func )
-{
- switch(func) {
- case GL_NEVER:
- return COMPAREFUNC_NEVER;
- case GL_LESS:
- return COMPAREFUNC_LESS;
- case GL_LEQUAL:
- return COMPAREFUNC_LEQUAL;
- case GL_GREATER:
- return COMPAREFUNC_GREATER;
- case GL_GEQUAL:
- return COMPAREFUNC_GEQUAL;
- case GL_NOTEQUAL:
- return COMPAREFUNC_NOTEQUAL;
- case GL_EQUAL:
- return COMPAREFUNC_EQUAL;
- case GL_ALWAYS:
- return COMPAREFUNC_ALWAYS;
- }
-
- fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
- return COMPAREFUNC_ALWAYS;
-}
-
-int intel_translate_stencil_op( GLenum op )
-{
- switch(op) {
- case GL_KEEP:
- return STENCILOP_KEEP;
- case GL_ZERO:
- return STENCILOP_ZERO;
- case GL_REPLACE:
- return STENCILOP_REPLACE;
- case GL_INCR:
- return STENCILOP_INCRSAT;
- case GL_DECR:
- return STENCILOP_DECRSAT;
- case GL_INCR_WRAP:
- return STENCILOP_INCR;
- case GL_DECR_WRAP:
- return STENCILOP_DECR;
- case GL_INVERT:
- return STENCILOP_INVERT;
- default:
- return STENCILOP_ZERO;
- }
-}
-
-int intel_translate_blend_factor( GLenum factor )
-{
- switch(factor) {
- case GL_ZERO:
- return BLENDFACT_ZERO;
- case GL_SRC_ALPHA:
- return BLENDFACT_SRC_ALPHA;
- case GL_ONE:
- return BLENDFACT_ONE;
- case GL_SRC_COLOR:
- return BLENDFACT_SRC_COLR;
- case GL_ONE_MINUS_SRC_COLOR:
- return BLENDFACT_INV_SRC_COLR;
- case GL_DST_COLOR:
- return BLENDFACT_DST_COLR;
- case GL_ONE_MINUS_DST_COLOR:
- return BLENDFACT_INV_DST_COLR;
- case GL_ONE_MINUS_SRC_ALPHA:
- return BLENDFACT_INV_SRC_ALPHA;
- case GL_DST_ALPHA:
- return BLENDFACT_DST_ALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return BLENDFACT_INV_DST_ALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return BLENDFACT_SRC_ALPHA_SATURATE;
- case GL_CONSTANT_COLOR:
- return BLENDFACT_CONST_COLOR;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- return BLENDFACT_INV_CONST_COLOR;
- case GL_CONSTANT_ALPHA:
- return BLENDFACT_CONST_ALPHA;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- return BLENDFACT_INV_CONST_ALPHA;
- }
-
- fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, factor);
- return BLENDFACT_ZERO;
-}
-
-int intel_translate_logic_op( GLenum opcode )
-{
- switch(opcode) {
- case GL_CLEAR:
- return LOGICOP_CLEAR;
- case GL_AND:
- return LOGICOP_AND;
- case GL_AND_REVERSE:
- return LOGICOP_AND_RVRSE;
- case GL_COPY:
- return LOGICOP_COPY;
- case GL_COPY_INVERTED:
- return LOGICOP_COPY_INV;
- case GL_AND_INVERTED:
- return LOGICOP_AND_INV;
- case GL_NOOP:
- return LOGICOP_NOOP;
- case GL_XOR:
- return LOGICOP_XOR;
- case GL_OR:
- return LOGICOP_OR;
- case GL_OR_INVERTED:
- return LOGICOP_OR_INV;
- case GL_NOR:
- return LOGICOP_NOR;
- case GL_EQUIV:
- return LOGICOP_EQUIV;
- case GL_INVERT:
- return LOGICOP_INV;
- case GL_OR_REVERSE:
- return LOGICOP_OR_RVRSE;
- case GL_NAND:
- return LOGICOP_NAND;
- case GL_SET:
- return LOGICOP_SET;
- default:
- return LOGICOP_SET;
- }
-}
-
-<<<<<<< intel_state.c
-static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
-{
- intelContextPtr intel = INTEL_CONTEXT(ctx);
- int front = 0;
-
- if (!ctx->DrawBuffer)
- return;
-
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
- front = 1;
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- case BUFFER_BIT_BACK_LEFT:
- front = 0;
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
- break;
- default:
- FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
- return;
- }
-
- if ( intel->sarea->pf_current_page == 1 )
- front ^= 1;
-
- intelSetFrontClipRects( intel );
-
- if (front) {
- intel->drawRegion = &intel->intelScreen->front;
- intel->readRegion = &intel->intelScreen->front;
- } else {
- intel->drawRegion = &intel->intelScreen->back;
- intel->readRegion = &intel->intelScreen->back;
- }
-
- intel->vtbl.set_color_region( intel, intel->drawRegion );
-}
-
-static void intelReadBuffer( GLcontext *ctx, GLenum mode )
-{
- /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
-}
-
-=======
->>>>>>> 1.9.2.6
-
-static void intelClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- struct intel_context *intel = intel_context(ctx);
- GLubyte clear[4];
-
- CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
-
- /* compute both 32 and 16-bit clear values */
- intel->ClearColor8888 = INTEL_PACKCOLOR8888(clear[0], clear[1],
- clear[2], clear[3]);
- intel->ClearColor565 = INTEL_PACKCOLOR565(clear[0], clear[1], clear[2]);
-}
-
-
-/**
- * Update the viewport transformation matrix. Depends on:
- * - viewport pos/size
- * - depthrange
- * - window pos/size or FBO size
- */
-static void intelCalcViewport( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context(ctx);
- const GLfloat *v = ctx->Viewport._WindowMap.m;
- const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
- GLfloat *m = intel->ViewportMatrix.m;
- GLfloat yScale, yBias;
-
- if (ctx->DrawBuffer->Name) {
- /* User created FBO */
- struct intel_renderbuffer *irb
- = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]);
- if (irb && !irb->RenderToTexture) {
- /* y=0=top */
- yScale = -1.0;
- yBias = irb->Base.Height;
- }
- else {
- /* y=0=bottom */
- yScale = 1.0;
- yBias = 0.0;
- }
- }
- else {
- /* window buffer, y=0=top */
- yScale = -1.0;
- yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F;
- }
-
- m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
-
- m[MAT_SY] = v[MAT_SY] * yScale;
- m[MAT_TY] = v[MAT_TY] * yScale + yBias + SUBPIXEL_Y;
-
- m[MAT_SZ] = v[MAT_SZ] * depthScale;
- m[MAT_TZ] = v[MAT_TZ] * depthScale;
-}
-
-static void intelViewport( GLcontext *ctx,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- intelCalcViewport( ctx );
-}
-
-static void intelDepthRange( GLcontext *ctx,
- GLclampd nearval, GLclampd farval )
-{
- intelCalcViewport( ctx );
-}
-
-/* Fallback to swrast for select and feedback.
- */
-static void intelRenderMode( GLcontext *ctx, GLenum mode )
-{
- struct intel_context *intel = intel_context(ctx);
- FALLBACK( intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
-}
-
-
-void intelInitStateFuncs( struct dd_function_table *functions )
-{
- functions->RenderMode = intelRenderMode;
- functions->Viewport = intelViewport;
- functions->DepthRange = intelDepthRange;
- functions->ClearColor = intelClearColor;
-}
-
-
-
-
-void intelInitState( GLcontext *ctx )
-{
- /* Mesa should do this for us:
- */
- ctx->Driver.AlphaFunc( ctx,
- ctx->Color.AlphaFunc,
- ctx->Color.AlphaRef);
-
- ctx->Driver.BlendColor( ctx,
- ctx->Color.BlendColor );
-
- ctx->Driver.BlendEquationSeparate( ctx,
- ctx->Color.BlendEquationRGB,
- ctx->Color.BlendEquationA);
-
- ctx->Driver.BlendFuncSeparate( ctx,
- ctx->Color.BlendSrcRGB,
- ctx->Color.BlendDstRGB,
- ctx->Color.BlendSrcA,
- ctx->Color.BlendDstA);
-
- ctx->Driver.ColorMask( ctx,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
-
- ctx->Driver.CullFace( ctx, ctx->Polygon.CullFaceMode );
- ctx->Driver.DepthFunc( ctx, ctx->Depth.Func );
- ctx->Driver.DepthMask( ctx, ctx->Depth.Mask );
-
- ctx->Driver.Enable( ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled );
- ctx->Driver.Enable( ctx, GL_BLEND, ctx->Color.BlendEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled );
- ctx->Driver.Enable( ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled );
- ctx->Driver.Enable( ctx, GL_CULL_FACE, ctx->Polygon.CullFlag );
- ctx->Driver.Enable( ctx, GL_DEPTH_TEST, ctx->Depth.Test );
- ctx->Driver.Enable( ctx, GL_DITHER, ctx->Color.DitherFlag );
- ctx->Driver.Enable( ctx, GL_FOG, ctx->Fog.Enabled );
- ctx->Driver.Enable( ctx, GL_LIGHTING, ctx->Light.Enabled );
- ctx->Driver.Enable( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag );
- ctx->Driver.Enable( ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag );
- ctx->Driver.Enable( ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled );
- ctx->Driver.Enable( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
- ctx->Driver.Enable( ctx, GL_TEXTURE_1D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_2D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_3D, GL_FALSE );
- ctx->Driver.Enable( ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE );
-
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
-
- ctx->Driver.FrontFace( ctx, ctx->Polygon.FrontFace );
-
- {
- GLfloat f = (GLfloat)ctx->Light.Model.ColorControl;
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f );
- }
-
- ctx->Driver.LineWidth( ctx, ctx->Line.Width );
- ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp );
- ctx->Driver.PointSize( ctx, ctx->Point.Size );
- ctx->Driver.PolygonStipple( ctx, (const GLubyte *)ctx->PolygonStipple );
- ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y,
- ctx->Scissor.Width, ctx->Scissor.Height );
- ctx->Driver.ShadeModel( ctx, ctx->Light.ShadeModel );
- ctx->Driver.StencilFuncSeparate( ctx, GL_FRONT,
- ctx->Stencil.Function[0],
- ctx->Stencil.Ref[0],
- ctx->Stencil.ValueMask[0] );
- ctx->Driver.StencilFuncSeparate( ctx, GL_BACK,
- ctx->Stencil.Function[1],
- ctx->Stencil.Ref[1],
- ctx->Stencil.ValueMask[1] );
- ctx->Driver.StencilMaskSeparate( ctx, GL_FRONT, ctx->Stencil.WriteMask[0] );
- ctx->Driver.StencilMaskSeparate( ctx, GL_BACK, ctx->Stencil.WriteMask[1] );
- ctx->Driver.StencilOpSeparate( ctx, GL_FRONT,
- ctx->Stencil.FailFunc[0],
- ctx->Stencil.ZFailFunc[0],
- ctx->Stencil.ZPassFunc[0]);
- ctx->Driver.StencilOpSeparate( ctx, GL_BACK,
- ctx->Stencil.FailFunc[1],
- ctx->Stencil.ZFailFunc[1],
- ctx->Stencil.ZPassFunc[1]);
-
-
- /* XXX this isn't really needed */
- ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex.c b/src/mesa/drivers/dri/i915-tex/intel_tex.c
deleted file mode 100644
index 8d957635763..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex.c
+++ /dev/null
@@ -1,298 +0,0 @@
-#include "texobj.h"
-#include "intel_context.h"
-#include "intel_mipmap_tree.h"
-#include "intel_tex.h"
-
-
-static GLboolean intelIsTextureResident(GLcontext *ctx,
- struct gl_texture_object *texObj)
-{
-#if 0
- struct intel_context *intel = intel_context(ctx);
- struct intel_texture_object *intelObj = intel_texture_object(texObj);
-
- return
- intelObj->mt &&
- intelObj->mt->region &&
- intel_is_region_resident(intel, intelObj->mt->region);
-#endif
- return 1;
-}
-
-
-
-static struct gl_texture_image *intelNewTextureImage( GLcontext *ctx )
-{
- (void) ctx;
- return (struct gl_texture_image *)CALLOC_STRUCT(intel_texture_image);
-}
-
-
-static struct gl_texture_object *intelNewTextureObject( GLcontext *ctx,
- GLuint name,
- GLenum target )
-{
- struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object);
-
- _mesa_initialize_texture_object(&obj->base, name, target);
-
- return &obj->base;
-}
-
-
-static void intelFreeTextureImageData( GLcontext *ctx,
- struct gl_texture_image *texImage )
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_texture_image *intelImage = intel_texture_image(texImage);
-
- if (intelImage->mt) {
- intel_miptree_release(intel, &intelImage->mt);
- }
-
- if (texImage->Data) {
- free(texImage->Data);
- texImage->Data = NULL;
- }
-}
-
-
-#ifndef __x86_64__
-static unsigned
-fastrdtsc(void)
-{
- unsigned eax;
- __asm__ volatile ("\t"
- "pushl %%ebx\n\t"
- "cpuid\n\t" ".byte 0x0f, 0x31\n\t" "popl %%ebx\n":"=a" (eax)
- :"0"(0)
- :"ecx", "edx", "cc");
-
- return eax;
-}
-#else
-static unsigned
-fastrdtsc(void)
-{
- unsigned eax;
- __asm__ volatile ("\t"
- "cpuid\n\t" ".byte 0x0f, 0x31\n\t" :"=a" (eax)
- :"0"(0)
- :"ecx", "edx", "ebx", "cc");
-
- return eax;
-}
-#endif
-
-static unsigned
-time_diff(unsigned t, unsigned t2)
-{
- return ((t < t2) ? t2 - t : 0xFFFFFFFFU - (t - t2 - 1));
-}
-
-
-/* The system memcpy (at least on ubuntu 5.10) has problems copying
- * to agp (writecombined) memory from a source which isn't 64-byte
- * aligned - there is a 4x performance falloff.
- *
- * The x86 __memcpy is immune to this but is slightly slower
- * (10%-ish) than the system memcpy.
- *
- * The sse_memcpy seems to have a slight cliff at 64/32 bytes, but
- * isn't much faster than x86_memcpy for agp copies.
- *
- * TODO: switch dynamically.
- */
-static void *do_memcpy( void *dest, const void *src, size_t n )
-{
-<<<<<<< intel_tex.c
-
- if (!image || !image->Data)
- return;
-
- if (image->Depth == 1 && image->IsClientData) {
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr, "Blit uploading\n");
-
- /* Do it with a blit.
- */
- intelEmitCopyBlitLocked( intel,
- image->TexFormat->TexelBytes,
- image->RowStride, /* ? */
- intelGetMemoryOffsetMESA( NULL, 0, image->Data ),
- t->Pitch / image->TexFormat->TexelBytes,
- intelGetMemoryOffsetMESA( NULL, 0, t->BufAddr + offset ),
- 0, 0,
- 0, 0,
- image->Width,
- image->Height);
- }
- else if (image->IsCompressed) {
- GLuint row_len = image->Width * 2;
- GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
- GLubyte *src = (GLubyte *)image->Data;
- GLuint j;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Upload image %dx%dx%d offset %xm row_len %x "
- "pitch %x depth_pitch %x\n",
- image->Width, image->Height, image->Depth, offset,
- row_len, t->Pitch, t->depth_pitch);
-
- switch (image->InternalFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, row_len );
- src += row_len;
- }
- break;
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) {
- __memcpy(dst, src, (image->Width*4) );
- src += image->Width*4;
- }
- break;
- default:
- fprintf(stderr,"Internal Compressed format not supported %d\n", image->InternalFormat);
- break;
- }
- }
- /* Time for another vtbl entry:
- */
- else if (intel->intelScreen->deviceID == PCI_CHIP_I945_G ||
- intel->intelScreen->deviceID == PCI_CHIP_I945_GM) {
- GLuint row_len = image->Width * image->TexFormat->TexelBytes;
- GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
- GLubyte *src = (GLubyte *)image->Data;
- GLuint d, j;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Upload image %dx%dx%d offset %xm row_len %x "
- "pitch %x depth_pitch %x\n",
- image->Width, image->Height, image->Depth, offset,
- row_len, t->Pitch, t->depth_pitch);
-
- if (row_len == t->Pitch) {
- memcpy( dst, src, row_len * image->Height * image->Depth );
- }
- else {
- GLuint x = 0, y = 0;
-
- for (d = 0 ; d < image->Depth ; d++) {
- GLubyte *dst0 = dst + x + y * t->Pitch;
-
- for (j = 0 ; j < image->Height ; j++) {
- __memcpy(dst0, src, row_len );
- src += row_len;
- dst0 += t->Pitch;
- }
-
- x += MIN2(4, row_len); /* Guess: 4 byte minimum alignment */
- if (x > t->Pitch) {
- x = 0;
- y += image->Height;
- }
- }
- }
-
- }
- else {
- GLuint row_len = image->Width * image->TexFormat->TexelBytes;
- GLubyte *dst = (GLubyte *)(t->BufAddr + offset);
- GLubyte *src = (GLubyte *)image->Data;
- GLuint d, j;
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- fprintf(stderr,
- "Upload image %dx%dx%d offset %xm row_len %x "
- "pitch %x depth_pitch %x\n",
- image->Width, image->Height, image->Depth, offset,
- row_len, t->Pitch, t->depth_pitch);
-
- if (row_len == t->Pitch) {
- for (d = 0; d < image->Depth; d++) {
- memcpy( dst, src, t->Pitch * image->Height );
- dst += t->depth_pitch;
- src += row_len * image->Height;
- }
- }
- else {
- for (d = 0 ; d < image->Depth ; d++) {
- for (j = 0 ; j < image->Height ; j++) {
- __memcpy(dst, src, row_len );
- src += row_len;
- dst += t->Pitch;
- }
-
- dst += t->depth_pitch - (t->Pitch * image->Height);
- }
- }
- }
-=======
- if ( (((unsigned)src) & 63) ||
- (((unsigned)dest) & 63)) {
- return __memcpy(dest, src, n);
- }
- else
- return memcpy(dest, src, n);
->>>>>>> 1.10.2.8
-}
-
-
-static void *timed_memcpy( void *dest, const void *src, size_t n )
-{
- void *ret;
- unsigned t1, t2;
- double rate;
-
- if ( (((unsigned)src) & 63) ||
- (((unsigned)dest) & 63))
- _mesa_printf("Warning - non-aligned texture copy!\n");
-
- t1 = fastrdtsc();
- ret = do_memcpy(dest, src, n);
- t2 = fastrdtsc();
-
- rate = time_diff(t1, t2);
- rate /= (double) n;
- _mesa_printf("timed_memcpy: %u %u --> %f clocks/byte\n", t1, t2, rate);
- return ret;
-}
-
-
-void intelInitTextureFuncs(struct dd_function_table * functions)
-{
- functions->ChooseTextureFormat = intelChooseTextureFormat;
- functions->TexImage1D = intelTexImage1D;
- functions->TexImage2D = intelTexImage2D;
- functions->TexImage3D = intelTexImage3D;
- functions->TexSubImage1D = intelTexSubImage1D;
- functions->TexSubImage2D = intelTexSubImage2D;
- functions->TexSubImage3D = intelTexSubImage3D;
- functions->CopyTexImage1D = intelCopyTexImage1D;
- functions->CopyTexImage2D = intelCopyTexImage2D;
- functions->CopyTexSubImage1D = intelCopyTexSubImage1D;
- functions->CopyTexSubImage2D = intelCopyTexSubImage2D;
- functions->GetTexImage = intelGetTexImage;
- functions->NewTextureObject = intelNewTextureObject;
- functions->NewTextureImage = intelNewTextureImage;
- functions->DeleteTexture = _mesa_delete_texture_object;
- functions->FreeTexImageData = intelFreeTextureImageData;
- functions->UpdateTexturePalette = 0;
- functions->IsTextureResident = intelIsTextureResident;
-
- if (INTEL_DEBUG & DEBUG_BUFMGR)
- functions->TextureMemCpy = timed_memcpy;
- else
- functions->TextureMemCpy = do_memcpy;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex.h b/src/mesa/drivers/dri/i915-tex/intel_tex.h
deleted file mode 100644
index ddc8c7aab3e..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef INTELTEX_INC
-#define INTELTEX_INC
-
-#include "mtypes.h"
-#include "intel_context.h"
-#include "texmem.h"
-
-
-void intelInitTextureFuncs( struct dd_function_table *functions );
-
-const struct gl_texture_format *
-intelChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type );
-
-
-void intelTexImage3D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-void intelTexSubImage3D(GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-void intelTexImage2D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-void intelTexSubImage2D(GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-void intelTexImage1D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-void intelTexSubImage1D(GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage);
-
-void intelCopyTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width,
- GLint border );
-
-void intelCopyTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border );
-
-void intelCopyTexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset,
- GLint x, GLint y, GLsizei width );
-
-void intelCopyTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height );
-
-void intelGetTexImage( GLcontext *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage );
-
-GLuint intel_finalize_mipmap_tree( struct intel_context *intel, GLuint unit );
-
-void intel_tex_map_images( struct intel_context *intel,
- struct intel_texture_object *intelObj );
-
-void intel_tex_unmap_images( struct intel_context *intel,
- struct intel_texture_object *intelObj );
-
-
-GLboolean
-intel_driReinitTextureHeap( driTexHeap *heap,
- unsigned size );
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex_copy.c b/src/mesa/drivers/dri/i915-tex/intel_tex_copy.c
deleted file mode 100644
index aa3dd198e29..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex_copy.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "mtypes.h"
-#include "enums.h"
-#include "image.h"
-#include "teximage.h"
-#include "swrast/swrast.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_batchbuffer.h"
-#include "intel_buffers.h"
-#include "intel_mipmap_tree.h"
-#include "intel_regions.h"
-#include "intel_fbo.h"
-#include "intel_tex.h"
-#include "intel_blit.h"
-#include "intel_pixel.h"
-#include "intel_bufmgr.h"
-
-
-/**
- * Get the intel_region which is the source for any glCopyTex[Sub]Image call.
- *
- * Do the best we can using the blitter. A future project is to use
- * the texture engine and fragment programs for these copies.
- */
-static const struct intel_region *
-get_teximage_source(struct intel_context *intel, GLenum internalFormat)
-{
- struct intel_renderbuffer *irb;
-
- if (0)
- _mesa_printf("%s %s\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(internalFormat));
-
- switch (internalFormat) {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16_ARB:
- irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH);
- if (irb && irb->region && irb->region->cpp == 2)
- return irb->region;
- return NULL;
- case GL_DEPTH24_STENCIL8_EXT:
- case GL_DEPTH_STENCIL_EXT:
- irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH);
- if (irb && irb->region && irb->region->cpp == 4)
- return irb->region;
- return NULL;
- case GL_RGBA:
- return intel_readbuf_region( intel );
- case GL_RGB:
- if (intel->intelScreen->cpp == 2)
- return intel_readbuf_region( intel );
- return NULL;
- default:
- return NULL;
- }
-}
-
-
-static GLboolean do_copy_texsubimage( struct intel_context *intel,
- struct intel_texture_image *intelImage,
- GLenum internalFormat,
- GLint dstx, GLint dsty,
- GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- GLcontext *ctx = &intel->ctx;
- const struct intel_region *src = get_teximage_source(intel, internalFormat);
-
- if (!intelImage->mt || !src)
- return GL_FALSE;
-
- intelFlush(ctx);
- LOCK_HARDWARE(intel);
- {
- GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
- intelImage->face,
- intelImage->level);
- const GLint orig_x = x;
- const GLint orig_y = y;
- const struct gl_framebuffer *fb = ctx->DrawBuffer;
-
- if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax,
- &x, &y, &width, &height)) {
- /* Update dst for clipped src. Need to also clip the source rect.
- */
- dstx += x - orig_x;
- dsty += y - orig_y;
-
- if (ctx->ReadBuffer->Name == 0) {
- /* reading from a window, adjust x, y */
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- GLuint window_y;
- /* window_y = position of window on screen if y=0=bottom */
- window_y = intel->intelScreen->height - (dPriv->y + dPriv->h);
- y = window_y + y;
- x += dPriv->x;
- }
- else {
- /* reading from a FBO */
- /* invert Y */
- y = ctx->ReadBuffer->Height - y - 1;
- }
-
-
- /* A bit of fiddling to get the blitter to work with -ve
- * pitches. But we get a nice inverted blit this way, so it's
- * worth it:
- */
- intelEmitCopyBlit( intel,
- intelImage->mt->cpp,
-
- -src->pitch,
- src->buffer,
- src->height * src->pitch * src->cpp,
-
- intelImage->mt->pitch,
- intelImage->mt->region->buffer,
- image_offset,
-
- x, y + height,
- dstx, dsty,
- width, height );
-
- intel_batchbuffer_flush( intel->batch );
- }
- }
-
-
- UNLOCK_HARDWARE(intel);
-
-#if 0
- /* GL_SGIS_generate_mipmap -- this can be accelerated now.
- * XXX Add a ctx->Driver.GenerateMipmaps() function?
- */
- if (level == texObj->BaseLevel &&
- texObj->GenerateMipmap) {
- intel_generate_mipmap(ctx, target,
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
- texObj);
- }
-#endif
-
- return GL_TRUE;
-}
-
-
-
-
-
-void intelCopyTexImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width,
- GLint border )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target);
- struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
-
- if (border)
- goto fail;
-
- /* Setup or redefine the texture object, mipmap tree and texture
- * image. Don't populate yet.
- */
- ctx->Driver.TexImage1D(ctx, target, level, internalFormat,
- width, border,
- GL_RGBA, CHAN_TYPE, NULL,
- &ctx->DefaultPacking, texObj, texImage);
-
- if (!do_copy_texsubimage(intel_context(ctx),
- intel_texture_image(texImage),
- internalFormat,
- 0, 0,
- x, y,
- width, 1))
- goto fail;
-
- return;
-
- fail:
- _swrast_copy_teximage1d( ctx, target, level, internalFormat, x, y,
- width, border );
-}
-
-void intelCopyTexImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target);
- struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
-
- if (border)
- goto fail;
-
- /* Setup or redefine the texture object, mipmap tree and texture
- * image. Don't populate yet.
- */
- ctx->Driver.TexImage2D(ctx, target, level, internalFormat,
- width, height, border,
- GL_RGBA, CHAN_TYPE, NULL,
- &ctx->DefaultPacking, texObj, texImage);
-
-
- if (!do_copy_texsubimage(intel_context(ctx),
- intel_texture_image(texImage),
- internalFormat,
- 0, 0,
- x, y,
- width, height))
- goto fail;
-
- return;
-
- fail:
- _swrast_copy_teximage2d( ctx, target, level, internalFormat, x, y,
- width, height, border );
-}
-
-
-void intelCopyTexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset,
- GLint x, GLint y, GLsizei width )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- GLenum internalFormat = texImage->InternalFormat;
-
- /* XXX need to check <border> as in above function? */
-
- /* Need to check texture is compatible with source format.
- */
-
- if (!do_copy_texsubimage(intel_context(ctx),
- intel_texture_image(texImage),
- internalFormat,
- xoffset, 0,
- x, y, width, 1)) {
- _swrast_copy_texsubimage1d( ctx, target, level,
- xoffset, x, y, width );
- }
-}
-
-
-
-void intelCopyTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- GLenum internalFormat = texImage->InternalFormat;
-
-
- /* Need to check texture is compatible with source format.
- */
-
- if (!do_copy_texsubimage(intel_context(ctx),
- intel_texture_image(texImage),
- internalFormat,
- xoffset, yoffset,
- x, y, width, height)) {
- _swrast_copy_texsubimage2d( ctx, target, level,
- xoffset, yoffset,
- x, y, width, height );
- }
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex_format.c b/src/mesa/drivers/dri/i915-tex/intel_tex_format.c
deleted file mode 100644
index ff02239e588..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex_format.c
+++ /dev/null
@@ -1,148 +0,0 @@
-#include "intel_context.h"
-#include "intel_tex.h"
-#include "texformat.h"
-#include "enums.h"
-
-/* It works out that this function is fine for all the supported
- * hardware. However, there is still a need to map the formats onto
- * hardware descriptors.
- */
-/* Note that the i915 can actually support many more formats than
- * these if we take the step of simply swizzling the colors
- * immediately after sampling...
- */
-const struct gl_texture_format *
-intelChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- struct intel_context *intel = intel_context( ctx );
- const GLboolean do32bpt = (intel->intelScreen->cpp == 4);
-
- switch ( internalFormat ) {
- case 4:
- case GL_RGBA:
- case GL_COMPRESSED_RGBA:
- if ( format == GL_BGRA ) {
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV ) {
- return &_mesa_texformat_argb8888;
- }
- else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
- return &_mesa_texformat_argb4444;
- }
- else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
- return &_mesa_texformat_argb1555;
- }
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case 3:
- case GL_RGB:
- case GL_COMPRESSED_RGB:
- if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) {
- return &_mesa_texformat_rgb565;
- }
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
-
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
-
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444;
-
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
-
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_argb8888;
-
- case GL_RGB5:
- case GL_RGB4:
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
-
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- case GL_COMPRESSED_ALPHA:
- return &_mesa_texformat_a8;
-
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- case GL_COMPRESSED_LUMINANCE:
- return &_mesa_texformat_l8;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- return &_mesa_texformat_al88;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- case GL_COMPRESSED_INTENSITY:
- return &_mesa_texformat_i8;
-
- case GL_YCBCR_MESA:
- if (type == GL_UNSIGNED_SHORT_8_8_MESA ||
- type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
- else
- return &_mesa_texformat_ycbcr_rev;
-
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgba_fxt1;
-
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgba_dxt1;
-
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return &_mesa_texformat_rgba_dxt3;
-
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return &_mesa_texformat_rgba_dxt5;
-
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- return &_mesa_texformat_depth_component16;
-
- default:
- fprintf(stderr, "unexpected texture format %s in %s\n",
- _mesa_lookup_enum_by_nr(internalFormat),
- __FUNCTION__);
- return NULL;
- }
-
- return NULL; /* never get here */
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex_image.c b/src/mesa/drivers/dri/i915-tex/intel_tex_image.c
deleted file mode 100644
index 3a437adbf00..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex_image.c
+++ /dev/null
@@ -1,440 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "enums.h"
-#include "colortab.h"
-#include "convolve.h"
-#include "context.h"
-#include "simple_list.h"
-#include "texcompress.h"
-#include "texformat.h"
-#include "texobj.h"
-#include "texstore.h"
-
-#include "intel_context.h"
-#include "intel_mipmap_tree.h"
-#include "intel_tex.h"
-#include "intel_ioctl.h"
-
-
-/* Functions to store texture images. Where possible, mipmap_tree's
- * will be created or further instantiated with image data, otherwise
- * images will be stored in malloc'd memory. A validation step is
- * required to pull those images into a mipmap tree, or otherwise
- * decide a fallback is required.
- */
-
-
-static int logbase2(int n)
-{
- GLint i = 1;
- GLint log2 = 0;
-
- while (n > i) {
- i *= 2;
- log2++;
- }
-
- return log2;
-}
-
-
-/* Otherwise, store it in memory if (Border != 0) or (any dimension ==
- * 1).
- *
- * Otherwise, if max_level >= level >= min_level, create tree with
- * space for textures from min_level down to max_level.
- *
- * Otherwise, create tree with space for textures from (level
- * 0)..(1x1). Consider pruning this tree at a validation if the
- * saving is worth it.
- */
-static void guess_and_alloc_mipmap_tree( struct intel_context *intel,
- struct intel_texture_object *intelObj,
- struct intel_texture_image *intelImage )
-{
- GLuint firstLevel;
- GLuint lastLevel;
- GLuint width = intelImage->base.Width;
- GLuint height = intelImage->base.Height;
- GLuint depth = intelImage->base.Depth;
- GLuint l2width, l2height, l2depth;
- GLuint i;
-
- DBG("%s\n", __FUNCTION__);
-
- if (intelImage->base.Border)
- return;
-
- if (intelImage->level > intelObj->base.BaseLevel &&
- (intelImage->base.Width == 1 ||
- (intelObj->base.Target != GL_TEXTURE_1D &&
- intelImage->base.Height == 1) ||
- (intelObj->base.Target == GL_TEXTURE_3D &&
- intelImage->base.Depth == 1)))
- return;
-
- /* If this image disrespects BaseLevel, allocate from level zero.
- * Usually BaseLevel == 0, so it's unlikely to happen.
- */
- if (intelImage->level < intelObj->base.BaseLevel)
- firstLevel = 0;
- else
- firstLevel = intelObj->base.BaseLevel;
-
-
- /* Figure out image dimensions at start level.
- */
- for (i = intelImage->level; i > firstLevel; i--) {
- width <<= 1;
- if (height != 1) height <<= 1;
- if (depth != 1) depth <<= 1;
- }
-
- /* Guess a reasonable value for lastLevel. This is probably going
- * to be wrong fairly often and might mean that we have to look at
- * resizable buffers, or require that buffers implement lazy
- * pagetable arrangements.
- */
- if ((intelObj->base.MinFilter == GL_NEAREST ||
- intelObj->base.MinFilter == GL_LINEAR) &&
- intelImage->level == firstLevel) {
- lastLevel = firstLevel;
- }
- else {
- l2width = logbase2(width);
- l2height = logbase2(height);
- l2depth = logbase2(depth);
- lastLevel = firstLevel + MAX2(MAX2(l2width,l2height),l2depth);
- }
-
- assert(!intelObj->mt);
- intelObj->mt = intel_miptree_create( intel,
- intelObj->base.Target,
- intelImage->base.InternalFormat,
- firstLevel,
- lastLevel,
- width,
- height,
- depth,
- intelImage->base.TexFormat->TexelBytes,
- intelImage->base.IsCompressed );
-
- DBG("%s - success\n", __FUNCTION__);
-}
-
-
-
-
-static GLuint target_to_face( GLenum target )
-{
- switch (target) {
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
- return ((GLuint) target -
- (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X);
- default:
- return 0;
- }
-}
-
-
-static void intelTexImage(GLcontext *ctx,
- GLint dims,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_texture_object *intelObj = intel_texture_object(texObj);
- struct intel_texture_image *intelImage = intel_texture_image(texImage);
- GLint postConvWidth = width;
- GLint postConvHeight = height;
- GLint texelBytes, sizeInBytes;
- GLuint dstRowStride;
- GLuint dstImageStride;
-
-
- DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(target),
- level,
- width, height, depth, border);
-
- intelFlush(ctx);
-
- intelImage->face = target_to_face( target );
- intelImage->level = level;
-
- if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) {
- _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth,
- &postConvHeight);
- }
-
- /* choose the texture format */
- texImage->TexFormat = intelChooseTextureFormat(ctx, internalFormat,
- format, type);
-
- assert(texImage->TexFormat);
-
- switch (dims) {
- case 1:
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df;
- break;
- case 2:
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df;
- break;
- case 3:
- texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D;
- texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df;
- break;
- default:
- assert(0);
- break;
- }
-
- texelBytes = texImage->TexFormat->TexelBytes;
-
-
- /* Minimum pitch of 32 bytes */
- if (postConvWidth * texelBytes < 32) {
- postConvWidth = 32 / texelBytes;
- texImage->RowStride = postConvWidth;
- }
-
- assert(texImage->RowStride == postConvWidth);
-
- /* Release the reference to a potentially orphaned buffer.
- * Release any old malloced memory.
- */
- if (intelImage->mt) {
- intel_miptree_release(intel, &intelImage->mt);
- assert(!texImage->Data);
- }
- else if (texImage->Data) {
- free(texImage->Data);
- }
-
- /* If this is the only texture image in the tree, could call
- * bmBufferData with NULL data to free the old block and avoid
- * waiting on any outstanding fences.
- */
- if (intelObj->mt &&
- intelObj->mt->first_level == level &&
- intelObj->mt->last_level == level &&
- intelObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB &&
- !intel_miptree_match_image(intelObj->mt, &intelImage->base,
- intelImage->face, intelImage->level)) {
-
- DBG("release it\n");
- intel_miptree_release(intel, &intelObj->mt);
- assert(!intelObj->mt);
- }
-
- if (!intelObj->mt) {
- guess_and_alloc_mipmap_tree(intel, intelObj, intelImage);
- if (!intelObj->mt)
- _mesa_printf("guess_and_alloc_mipmap_tree: failed\n");
- }
-
-
- if (intelObj->mt &&
- intelObj->mt != intelImage->mt &&
- intel_miptree_match_image(intelObj->mt, &intelImage->base,
- intelImage->face, intelImage->level)) {
-
- if (intelImage->mt) {
- intel_miptree_release(intel, &intelImage->mt);
- }
-
- intel_miptree_reference(&intelImage->mt, intelObj->mt);
- assert(intelImage->mt);
- }
-
- if (!intelImage->mt)
- _mesa_printf("XXX: Image did not fit into tree - storing in local memory!\n");
-
- /* intelCopyTexImage calls this function with pixels == NULL, with
- * the expectation that the mipmap tree will be set up but nothing
- * more will be done. This is where those calls return:
- */
- pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, 1,
- format, type,
- pixels, unpack, "glTexImage");
- if (!pixels)
- return;
-
-
- LOCK_HARDWARE(intel);
-
- if (intelImage->mt) {
- texImage->Data = intel_miptree_image_map(intel,
- intelImage->mt,
- intelImage->face,
- intelImage->level,
- &dstRowStride,
- &dstImageStride);
- }
- else {
- /* Allocate regular memory and store the image there temporarily. */
- if (texImage->IsCompressed) {
- sizeInBytes = texImage->CompressedSize;
- dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat,width);
- dstImageStride = 0; /* ? */
- assert(dims != 3);
- }
- else {
- dstRowStride = postConvWidth * texelBytes;
- dstImageStride = dstRowStride * postConvHeight;
- sizeInBytes = depth * dstImageStride;
- }
- texImage->Data = malloc(sizeInBytes);
- }
-
- if (INTEL_DEBUG & DEBUG_TEXTURE)
- _mesa_printf("Upload image %dx%dx%d row_len %x "
- "pitch %x depth_pitch %x\n",
- width, height, depth,
- width * texelBytes, dstRowStride, dstImageStride);
-
- /* Copy data. Would like to know when it's ok for us to eg. use
- * the blitter to copy. Or, use the hardware to do the format
- * conversion and copy:
- */
- if (!texImage->TexFormat->StoreImage(ctx, dims,
- texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- 0, 0, 0, /* dstX/Y/Zoffset */
- dstRowStride, dstImageStride,
- width, height, depth,
- format, type, pixels, unpack)) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
- }
-
- _mesa_unmap_teximage_pbo(ctx, unpack);
-
- if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
- texImage->Data = NULL;
- }
-
- UNLOCK_HARDWARE(intel);
-
-#if 0
- /* GL_SGIS_generate_mipmap -- this can be accelerated now.
- */
- if (level == texObj->BaseLevel &&
- texObj->GenerateMipmap) {
- intel_generate_mipmap(ctx, target,
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
- texObj);
- }
-#endif
-}
-
-void intelTexImage3D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- intelTexImage( ctx, 3, target, level,
- internalFormat, width, height, depth, border,
- format, type, pixels,
- unpack, texObj, texImage );
-}
-
-
-void intelTexImage2D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint height, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- intelTexImage( ctx, 2, target, level,
- internalFormat, width, height, 1, border,
- format, type, pixels,
- unpack, texObj, texImage );
-}
-
-void intelTexImage1D(GLcontext *ctx,
- GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *unpack,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- intelTexImage( ctx, 1, target, level,
- internalFormat, width, 1, 1, border,
- format, type, pixels,
- unpack, texObj, texImage );
-}
-
-
-
-/**
- * Need to map texture image into memory before copying image data,
- * then unmap it.
- */
-void intelGetTexImage( GLcontext *ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- struct intel_context *intel = intel_context( ctx );
- struct intel_texture_image *intelImage = intel_texture_image(texImage);
-
- /* Map */
-#ifdef ALL_IMAGES /* XXX Remove this, just for debug/test */
- intel_tex_map_images(intel, intel_texture_object(texObj));
-#else
- /* XXX what if intelImage->mt is NULL? */
- if (intelImage->mt) {
- intelImage->base.Data =
- intel_miptree_image_map(intel,
- intelImage->mt,
- intelImage->face,
- intelImage->level,
- &intelImage->base.RowStride,
- &intelImage->base.ImageStride);
- }
-#endif
-
- _mesa_get_teximage(ctx, target, level, format, type, pixels,
- texObj, texImage);
-
- /* Unmap */
-#ifdef ALL_IMAGES
- intel_tex_unmap_images(intel, intel_texture_object(texObj));
-#else
- if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
- intelImage->base.Data = NULL;
- }
-#endif
-}
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex_subimage.c b/src/mesa/drivers/dri/i915-tex/intel_tex_subimage.c
deleted file mode 100644
index 5adf8599a45..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex_subimage.c
+++ /dev/null
@@ -1,178 +0,0 @@
-
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "mtypes.h"
-#include "texobj.h"
-#include "texstore.h"
-#include "enums.h"
-
-#include "intel_context.h"
-#include "intel_tex.h"
-#include "intel_mipmap_tree.h"
-
-
-static void intelTexSubimage (GLcontext *ctx,
- GLint dims,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint width, GLint height, GLint depth,
- GLenum format, GLenum type, const void *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- struct intel_context *intel = intel_context(ctx);
- struct intel_texture_image *intelImage = intel_texture_image(texImage);
- GLuint dstImageStride;
- GLuint dstRowStride;
-
- DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(target),
- level,
- xoffset, yoffset,
- width, height);
-
- intelFlush(ctx);
-
- pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth, format, type,
- pixels, packing, "glTexSubImage2D");
- if (!pixels)
- return;
-
- LOCK_HARDWARE(intel);
-
- /* Map buffer if necessary. Need to lock to prevent other contexts
- * from uploading the buffer under us.
- */
- if (intelImage->mt)
- texImage->Data = intel_miptree_image_map(intel,
- intelImage->mt,
- intelImage->face,
- intelImage->level,
- &dstRowStride,
- &dstImageStride );
-
- assert(dstRowStride);
-
- if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat,
- texImage->TexFormat,
- texImage->Data,
- xoffset, yoffset, zoffset,
- dstRowStride, dstImageStride,
- width, height, depth,
- format, type, pixels, packing)) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage");
- }
-
-#if 0
- /* GL_SGIS_generate_mipmap */
- if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
- _mesa_generate_mipmap(ctx, target,
- &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
- texObj);
- }
-#endif
-
- _mesa_unmap_teximage_pbo(ctx, packing);
-
- if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
- texImage->Data = NULL;
- }
-
- UNLOCK_HARDWARE(intel);
-}
-
-
-
-
-
-void intelTexSubImage3D(GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
-
- intelTexSubimage(ctx, 3,
- target, level,
- xoffset, yoffset, zoffset,
- width, height, depth,
- format, type, pixels, packing, texObj,
- texImage);
-
-}
-
-
-
-void intelTexSubImage2D(GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
-
- intelTexSubimage(ctx, 2,
- target, level,
- xoffset, yoffset, 0,
- width, height, 1,
- format, type, pixels, packing, texObj,
- texImage);
-
-}
-
-
-void intelTexSubImage1D(GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- intelTexSubimage(ctx, 1,
- target, level,
- xoffset, 0, 0,
- width, 1, 1,
- format, type, pixels, packing, texObj,
- texImage);
-
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tex_validate.c b/src/mesa/drivers/dri/i915-tex/intel_tex_validate.c
deleted file mode 100644
index 72f5afb13e5..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tex_validate.c
+++ /dev/null
@@ -1,247 +0,0 @@
-#include "mtypes.h"
-#include "macros.h"
-
-#include "intel_context.h"
-#include "intel_mipmap_tree.h"
-#include "intel_tex.h"
-#include "intel_bufmgr.h"
-
-/**
- * Compute which mipmap levels that really need to be sent to the hardware.
- * This depends on the base image size, GL_TEXTURE_MIN_LOD,
- * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL.
- */
-static void intel_calculate_first_last_level( struct intel_texture_object *intelObj )
-{
- struct gl_texture_object *tObj = &intelObj->base;
- const struct gl_texture_image * const baseImage =
- tObj->Image[0][tObj->BaseLevel];
-
- /* These must be signed values. MinLod and MaxLod can be negative numbers,
- * and having firstLevel and lastLevel as signed prevents the need for
- * extra sign checks.
- */
- int firstLevel;
- int lastLevel;
-
- /* Yes, this looks overly complicated, but it's all needed.
- */
- switch (tObj->Target) {
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_3D:
- case GL_TEXTURE_CUBE_MAP:
- if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
- /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL.
- */
- firstLevel = lastLevel = tObj->BaseLevel;
- }
- else {
- firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
- firstLevel = MAX2(firstLevel, tObj->BaseLevel);
- lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
- lastLevel = MAX2(lastLevel, tObj->BaseLevel);
- lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2);
- lastLevel = MIN2(lastLevel, tObj->MaxLevel);
- lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */
- }
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- case GL_TEXTURE_4D_SGIS:
- firstLevel = lastLevel = 0;
- break;
- default:
- return;
- }
-
- /* save these values */
- intelObj->firstLevel = firstLevel;
- intelObj->lastLevel = lastLevel;
-}
-
-static void copy_image_data_to_tree( struct intel_context *intel,
- struct intel_texture_object *intelObj,
- struct intel_texture_image *intelImage )
-{
- if (intelImage->mt) {
- /* Copy potentially with the blitter:
- */
- intel_miptree_image_copy(intel,
- intelObj->mt,
- intelImage->face,
- intelImage->level,
- intelImage->mt);
-
- intel_miptree_release(intel, &intelImage->mt);
- }
- else {
- assert(intelImage->base.Data != NULL);
-
- /* More straightforward upload.
- */
- intel_miptree_image_data(intel,
- intelObj->mt,
- intelImage->face,
- intelImage->level,
- intelImage->base.Data,
- intelImage->base.RowStride,
- intelImage->base.RowStride * intelImage->base.Height);
-
- free(intelImage->base.Data);
- intelImage->base.Data = NULL;
- }
-
- intel_miptree_reference(&intelImage->mt, intelObj->mt);
-}
-
-
-/*
- */
-GLuint intel_finalize_mipmap_tree( struct intel_context *intel, GLuint unit )
-{
- struct gl_texture_object *tObj = intel->ctx.Texture.Unit[unit]._Current;
- struct intel_texture_object *intelObj = intel_texture_object(tObj);
-
- GLuint face, i;
- GLuint nr_faces = 0;
- struct intel_texture_image *firstImage;
-
- /* We know/require this is true by now:
- */
- assert(intelObj->base.Complete);
-
- /* What levels must the tree include at a minimum?
- */
- intel_calculate_first_last_level( intelObj );
- firstImage = intel_texture_image(intelObj->base.Image[0][intelObj->firstLevel]);
-
- /* Fallback case:
- */
- if (firstImage->base.Border) {
- if (intelObj->mt) {
- intel_miptree_release(intel, &intelObj->mt);
- }
- return GL_FALSE;
- }
-
-
- /* If both firstImage and intelObj have a tree which can contain
- * all active images, favour firstImage. Note that because of the
- * completeness requirement, we know that the image dimensions
- * will match.
- */
- if (firstImage->mt &&
- firstImage->mt != intelObj->mt &&
- firstImage->mt->first_level <= intelObj->firstLevel &&
- firstImage->mt->last_level >= intelObj->lastLevel) {
-
- if (intelObj->mt)
- intel_miptree_release(intel, &intelObj->mt);
-
- intel_miptree_reference(&intelObj->mt, firstImage->mt);
- }
-
- /* Check tree can hold all active levels. Check tree matches
- * target, imageFormat, etc.
- *
- * XXX: For some layouts (eg i945?), the test might have to be
- * first_level == firstLevel, as the tree isn't valid except at the
- * original start level. Hope to get around this by
- * programming minLod, maxLod, baseLevel into the hardware and
- * leaving the tree alone.
- */
- if (intelObj->mt &&
- ((intelObj->mt->first_level > intelObj->firstLevel) ||
- (intelObj->mt->last_level < intelObj->lastLevel) ||
- (intelObj->mt->internal_format != firstImage->base.InternalFormat))) {
- intel_miptree_release(intel, &intelObj->mt);
- }
-
-
- /* May need to create a new tree:
- */
- if (!intelObj->mt) {
- intelObj->mt = intel_miptree_create(intel,
- intelObj->base.Target,
- firstImage->base.InternalFormat,
- intelObj->firstLevel,
- intelObj->lastLevel,
- firstImage->base.Width,
- firstImage->base.Height,
- firstImage->base.Depth,
- firstImage->base.TexFormat->TexelBytes,
- firstImage->base.IsCompressed);
- }
-
- /* Pull in any images not in the object's tree:
- */
- nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- for (face = 0; face < nr_faces; face++) {
- for (i = intelObj->firstLevel; i <= intelObj->lastLevel; i++) {
- struct intel_texture_image *intelImage =
- intel_texture_image(intelObj->base.Image[face][i]);
-
- /* Need to import images in main memory or held in other trees.
- */
- if (intelObj->mt != intelImage->mt) {
- copy_image_data_to_tree(intel,
- intelObj,
- intelImage);
- }
- }
- }
-
- return GL_TRUE;
-}
-
-
-
-void intel_tex_map_images( struct intel_context *intel,
- struct intel_texture_object *intelObj )
-{
- GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- GLuint face, i;
-
- DBG("%s\n", __FUNCTION__);
-
- for (face = 0; face < nr_faces; face++) {
- for (i = intelObj->firstLevel; i <= intelObj->lastLevel; i++) {
- struct intel_texture_image *intelImage =
- intel_texture_image(intelObj->base.Image[face][i]);
-
- if (intelImage->mt) {
- intelImage->base.Data =
- intel_miptree_image_map(intel,
- intelImage->mt,
- intelImage->face,
- intelImage->level,
- &intelImage->base.RowStride,
- &intelImage->base.ImageStride);
- /* convert stride to texels, not bytes */
- intelImage->base.RowStride /= intelImage->mt->cpp;
- intelImage->base.ImageStride /= intelImage->mt->cpp;
- }
- }
- }
-}
-
-
-
-void intel_tex_unmap_images( struct intel_context *intel,
- struct intel_texture_object *intelObj )
-{
- GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- GLuint face, i;
-
- for (face = 0; face < nr_faces; face++) {
- for (i = intelObj->firstLevel; i <= intelObj->lastLevel; i++) {
- struct intel_texture_image *intelImage =
- intel_texture_image(intelObj->base.Image[face][i]);
-
- if (intelImage->mt) {
- intel_miptree_image_unmap(intel, intelImage->mt);
- intelImage->base.Data = NULL;
- }
- }
- }
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_texmem.c b/src/mesa/drivers/dri/i915-tex/intel_texmem.c
deleted file mode 100644
index 09beec95b8c..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_texmem.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "texmem.h"
-#include "simple_list.h"
-#include "imports.h"
-#include "macros.h"
-
-#include "intel_tex.h"
-
-static GLuint
-driLog2( GLuint n )
-{
- GLuint log2;
-
- for ( log2 = 1 ; n > 1 ; log2++ ) {
- n >>= 1;
- }
-
- return log2;
-}
-
-static void calculate_heap_size( driTexHeap * heap, unsigned size,
- unsigned nr_regions, unsigned alignmentShift )
-{
- unsigned l;
-
- l = driLog2( (size - 1) / nr_regions );
- if ( l < alignmentShift )
- {
- l = alignmentShift;
- }
-
- heap->logGranularity = l;
- heap->size = size & ~((1L << l) - 1);
-}
-
-
-GLboolean
-intel_driReinitTextureHeap( driTexHeap *heap,
- unsigned size )
-{
- driTextureObject *t, *tmp;
-
- /* Kick out everything:
- */
- foreach_s ( t, tmp, & heap->texture_objects ) {
- if ( t->tObj != NULL ) {
- driSwapOutTextureObject( t );
- }
- else {
- driDestroyTextureObject( t );
- }
- }
-
- /* Destroy the memory manager:
- */
- mmDestroy( heap->memory_heap );
-
- /* Recreate the memory manager:
- */
- calculate_heap_size(heap, size, heap->nrRegions, heap->alignmentShift);
- heap->memory_heap = mmInit( 0, heap->size );
- if ( heap->memory_heap == NULL ) {
- fprintf(stderr, "driReinitTextureHeap: couldn't recreate memory heap\n");
- FREE( heap );
- return GL_FALSE;
- }
-
- make_empty_list( & heap->texture_objects );
-
- return GL_TRUE;
-}
-
-
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tris.c b/src/mesa/drivers/dri/i915-tex/intel_tris.c
deleted file mode 100644
index 18bb72f3678..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tris.c
+++ /dev/null
@@ -1,1057 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "enums.h"
-#include "dd.h"
-
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
-#include "intel_screen.h"
-#include "intel_context.h"
-#include "intel_tris.h"
-#include "intel_batchbuffer.h"
-#include "intel_reg.h"
-#include "intel_span.h"
-#include "intel_tex.h"
-
-static void intelRenderPrimitive( GLcontext *ctx, GLenum prim );
-static void intelRasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
-
-/*
- */
-static void intel_flush_inline_primitive( struct intel_context *intel )
-{
- GLuint used = intel->batch->ptr - intel->prim.start_ptr;
-
- assert(intel->prim.primitive != ~0);
-
- if (used < 8)
- goto do_discard;
-
- *(int *)intel->prim.start_ptr = (_3DPRIMITIVE |
- intel->prim.primitive |
- (used/4-2));
-
- goto finished;
-
- do_discard:
- intel->batch->ptr -= used;
-
- finished:
- intel->prim.primitive = ~0;
- intel->prim.start_ptr = 0;
- intel->prim.flush = 0;
-}
-
-
-/* Emit a primitive referencing vertices in a vertex buffer.
- */
-void intelStartInlinePrimitive( struct intel_context *intel,
- GLuint prim,
- GLuint batch_flags )
-{
- BATCH_LOCALS;
-
- /* Emit a slot which will be filled with the inline primitive
- * command later.
- */
- BEGIN_BATCH(2, batch_flags);
- OUT_BATCH( 0 );
-
- intel->prim.start_ptr = intel->batch->ptr;
- intel->prim.primitive = prim;
- intel->prim.flush = intel_flush_inline_primitive;
-
- OUT_BATCH( 0 );
- ADVANCE_BATCH();
-}
-
-
-void intelWrapInlinePrimitive( struct intel_context *intel )
-{
- GLuint prim = intel->prim.primitive;
- GLuint batchflags = intel->batch->flags;
-
- intel_flush_inline_primitive(intel);
- intel_batchbuffer_flush(intel->batch);
-
- intel->vtbl.emit_state( intel );
- intelStartInlinePrimitive( intel, prim, batchflags ); /* ??? */
-}
-
-GLuint *intelExtendInlinePrimitive( struct intel_context *intel,
- GLuint dwords )
-{
- GLuint sz = dwords * sizeof(GLuint);
- GLuint *ptr;
-
- if (intel_batchbuffer_space(intel->batch) < sz)
- intelWrapInlinePrimitive( intel );
-
- ptr = (GLuint *)intel->batch->ptr;
- intel->batch->ptr += sz;
-
- return ptr;
-}
-
-
-
-/***********************************************************************
- * Emit primitives as inline vertices *
- ***********************************************************************/
-
-#ifdef __i386__
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- int __tmp; \
- __asm__ __volatile__( "rep ; movsl" \
- : "=%c" (j), "=D" (vb), "=S" (__tmp) \
- : "0" (vertsize), \
- "D" ((long)vb), \
- "S" ((long)v) ); \
-} while (0)
-#else
-#define COPY_DWORDS( j, vb, vertsize, v ) \
-do { \
- for ( j = 0 ; j < vertsize ; j++ ) { \
- vb[j] = ((GLuint *)v)[j]; \
- } \
- vb += vertsize; \
-} while (0)
-#endif
-
-static void intel_draw_quad( struct intel_context *intel,
- intelVertexPtr v0,
- intelVertexPtr v1,
- intelVertexPtr v2,
- intelVertexPtr v3 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, 6 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v3 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
- COPY_DWORDS( j, vb, vertsize, v3 );
-}
-
-static void intel_draw_triangle( struct intel_context *intel,
- intelVertexPtr v0,
- intelVertexPtr v1,
- intelVertexPtr v2 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, 3 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
- COPY_DWORDS( j, vb, vertsize, v2 );
-}
-
-
-static void intel_draw_line( struct intel_context *intel,
- intelVertexPtr v0,
- intelVertexPtr v1 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, 2 * vertsize );
- int j;
-
- COPY_DWORDS( j, vb, vertsize, v0 );
- COPY_DWORDS( j, vb, vertsize, v1 );
-}
-
-
-static void intel_draw_point( struct intel_context *intel,
- intelVertexPtr v0 )
-{
- GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, vertsize );
- int j;
-
- /* Adjust for sub pixel position -- still required for conform. */
- *(float *)&vb[0] = v0->v.x - 0.125;
- *(float *)&vb[1] = v0->v.y - 0.125;
- for (j = 2 ; j < vertsize ; j++)
- vb[j] = v0->ui[j];
-}
-
-
-
-/***********************************************************************
- * Fixup for ARB_point_parameters *
- ***********************************************************************/
-
-static void intel_atten_point( struct intel_context *intel, intelVertexPtr v0 )
-{
- GLcontext *ctx = &intel->ctx;
- GLfloat psz[4], col[4], restore_psz, restore_alpha;
-
- _tnl_get_attr( ctx, v0, _TNL_ATTRIB_POINTSIZE, psz );
- _tnl_get_attr( ctx, v0, _TNL_ATTRIB_COLOR0, col );
-
- restore_psz = psz[0];
- restore_alpha = col[3];
-
- if (psz[0] >= ctx->Point.Threshold) {
- psz[0] = MIN2(psz[0], ctx->Point.MaxSize);
- }
- else {
- GLfloat dsize = psz[0] / ctx->Point.Threshold;
- psz[0] = MAX2(ctx->Point.Threshold, ctx->Point.MinSize);
- col[3] *= dsize * dsize;
- }
-
- if (psz[0] < 1.0)
- psz[0] = 1.0;
-
- if (restore_psz != psz[0] || restore_alpha != col[3]) {
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_COLOR0, col);
-
- intel_draw_point( intel, v0 );
-
- psz[0] = restore_psz;
- col[3] = restore_alpha;
-
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
- _tnl_set_attr( ctx, v0, _TNL_ATTRIB_COLOR0, col);
- }
- else
- intel_draw_point( intel, v0 );
-}
-
-
-
-
-
-/***********************************************************************
- * Fixup for I915 WPOS texture coordinate *
- ***********************************************************************/
-
-
-
-static void intel_wpos_triangle( struct intel_context *intel,
- intelVertexPtr v0,
- intelVertexPtr v1,
- intelVertexPtr v2 )
-{
- GLuint offset = intel->wpos_offset;
- GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
- __memcpy( ((char *)v1) + offset, v1, size );
- __memcpy( ((char *)v2) + offset, v2, size );
-
- intel_draw_triangle( intel, v0, v1, v2 );
-}
-
-
-static void intel_wpos_line( struct intel_context *intel,
- intelVertexPtr v0,
- intelVertexPtr v1 )
-{
- GLuint offset = intel->wpos_offset;
- GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
- __memcpy( ((char *)v1) + offset, v1, size );
-
- intel_draw_line( intel, v0, v1 );
-}
-
-
-static void intel_wpos_point( struct intel_context *intel,
- intelVertexPtr v0 )
-{
- GLuint offset = intel->wpos_offset;
- GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
-
- intel_draw_point( intel, v0 );
-}
-
-
-
-
-
-
-/***********************************************************************
- * Macros for t_dd_tritmp.h to draw basic primitives *
- ***********************************************************************/
-
-#define TRI( a, b, c ) \
-do { \
- if (DO_FALLBACK) \
- intel->draw_tri( intel, a, b, c ); \
- else \
- intel_draw_triangle( intel, a, b, c ); \
-} while (0)
-
-#define QUAD( a, b, c, d ) \
-do { \
- if (DO_FALLBACK) { \
- intel->draw_tri( intel, a, b, d ); \
- intel->draw_tri( intel, b, c, d ); \
- } else \
- intel_draw_quad( intel, a, b, c, d ); \
-} while (0)
-
-#define LINE( v0, v1 ) \
-do { \
- if (DO_FALLBACK) \
- intel->draw_line( intel, v0, v1 ); \
- else \
- intel_draw_line( intel, v0, v1 ); \
-} while (0)
-
-#define POINT( v0 ) \
-do { \
- if (DO_FALLBACK) \
- intel->draw_point( intel, v0 ); \
- else \
- intel_draw_point( intel, v0 ); \
-} while (0)
-
-
-/***********************************************************************
- * Build render functions from dd templates *
- ***********************************************************************/
-
-#define INTEL_OFFSET_BIT 0x01
-#define INTEL_TWOSIDE_BIT 0x02
-#define INTEL_UNFILLED_BIT 0x04
-#define INTEL_FALLBACK_BIT 0x08
-#define INTEL_MAX_TRIFUNC 0x10
-
-
-static struct {
- tnl_points_func points;
- tnl_line_func line;
- tnl_triangle_func triangle;
- tnl_quad_func quad;
-} rast_tab[INTEL_MAX_TRIFUNC];
-
-
-#define DO_FALLBACK (IND & INTEL_FALLBACK_BIT)
-#define DO_OFFSET (IND & INTEL_OFFSET_BIT)
-#define DO_UNFILLED (IND & INTEL_UNFILLED_BIT)
-#define DO_TWOSIDE (IND & INTEL_TWOSIDE_BIT)
-#define DO_FLAT 0
-#define DO_TRI 1
-#define DO_QUAD 1
-#define DO_LINE 1
-#define DO_POINTS 1
-#define DO_FULL_QUAD 1
-
-#define HAVE_RGBA 1
-#define HAVE_SPEC 1
-#define HAVE_BACK_COLORS 0
-#define HAVE_HW_FLATSHADE 1
-#define VERTEX intelVertex
-#define TAB rast_tab
-
-/* Only used to pull back colors into vertices (ie, we know color is
- * floating point).
- */
-#define INTEL_COLOR( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[0], (src)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[1], (src)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[2], (src)[0]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[3], (src)[3]); \
-} while (0)
-
-#define INTEL_SPEC( dst, src ) \
-do { \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[0], (src)[2]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[1], (src)[1]); \
- UNCLAMPED_FLOAT_TO_UBYTE((dst)[2], (src)[0]); \
-} while (0)
-
-
-#define DEPTH_SCALE intel->polygon_offset_scale
-#define UNFILLED_TRI unfilled_tri
-#define UNFILLED_QUAD unfilled_quad
-#define VERT_X(_v) _v->v.x
-#define VERT_Y(_v) _v->v.y
-#define VERT_Z(_v) _v->v.z
-#define AREA_IS_CCW( a ) (a > 0)
-#define GET_VERTEX(e) (intel->verts + (e * intel->vertex_size * sizeof(GLuint)))
-
-#define VERT_SET_RGBA( v, c ) if (coloroffset) INTEL_COLOR( v->ub4[coloroffset], c )
-#define VERT_COPY_RGBA( v0, v1 ) if (coloroffset) v0->ui[coloroffset] = v1->ui[coloroffset]
-#define VERT_SAVE_RGBA( idx ) if (coloroffset) color[idx] = v[idx]->ui[coloroffset]
-#define VERT_RESTORE_RGBA( idx ) if (coloroffset) v[idx]->ui[coloroffset] = color[idx]
-
-#define VERT_SET_SPEC( v, c ) if (specoffset) INTEL_SPEC( v->ub4[specoffset], c )
-#define VERT_COPY_SPEC( v0, v1 ) if (specoffset) COPY_3V(v0->ub4[specoffset], v1->ub4[specoffset])
-#define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
-#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
-
-#define LOCAL_VARS(n) \
- struct intel_context *intel = intel_context(ctx); \
- GLuint color[n], spec[n]; \
- GLuint coloroffset = intel->coloroffset; \
- GLboolean specoffset = intel->specoffset; \
- (void) color; (void) spec; (void) coloroffset; (void) specoffset;
-
-
-/***********************************************************************
- * Helpers for rendering unfilled primitives *
- ***********************************************************************/
-
-static const GLuint hw_prim[GL_POLYGON+1] = {
- PRIM3D_POINTLIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST
-};
-
-#define RASTERIZE(x) intelRasterPrimitive( ctx, x, hw_prim[x] )
-#define RENDER_PRIMITIVE intel->render_primitive
-#define TAG(x) x
-#define IND INTEL_FALLBACK_BIT
-#include "tnl_dd/t_dd_unfilled.h"
-#undef IND
-
-/***********************************************************************
- * Generate GL render functions *
- ***********************************************************************/
-
-#define IND (0)
-#define TAG(x) x
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT)
-#define TAG(x) x##_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT)
-#define TAG(x) x##_twoside
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT)
-#define TAG(x) x##_twoside_offset
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_UNFILLED_BIT)
-#define TAG(x) x##_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT)
-#define TAG(x) x##_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_UNFILLED_BIT)
-#define TAG(x) x##_twoside_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT)
-#define TAG(x) x##_twoside_offset_unfilled
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_FALLBACK_BIT)
-#define TAG(x) x##_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_UNFILLED_BIT|INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-#define IND (INTEL_TWOSIDE_BIT|INTEL_OFFSET_BIT|INTEL_UNFILLED_BIT| \
- INTEL_FALLBACK_BIT)
-#define TAG(x) x##_twoside_offset_unfilled_fallback
-#include "tnl_dd/t_dd_tritmp.h"
-
-
-static void init_rast_tab( void )
-{
- init();
- init_offset();
- init_twoside();
- init_twoside_offset();
- init_unfilled();
- init_offset_unfilled();
- init_twoside_unfilled();
- init_twoside_offset_unfilled();
- init_fallback();
- init_offset_fallback();
- init_twoside_fallback();
- init_twoside_offset_fallback();
- init_unfilled_fallback();
- init_offset_unfilled_fallback();
- init_twoside_unfilled_fallback();
- init_twoside_offset_unfilled_fallback();
-}
-
-
-/***********************************************************************
- * Rasterization fallback helpers *
- ***********************************************************************/
-
-
-/* This code is hit only when a mix of accelerated and unaccelerated
- * primitives are being drawn, and only for the unaccelerated
- * primitives.
- */
-static void
-intel_fallback_tri( struct intel_context *intel,
- intelVertex *v0,
- intelVertex *v1,
- intelVertex *v2 )
-{
- GLcontext *ctx = &intel->ctx;
- SWvertex v[3];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- if (intel->prim.flush)
- intel->prim.flush(intel);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- _swsetup_Translate( ctx, v2, &v[2] );
- intelSpanRenderStart( ctx );
- _swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
- intelSpanRenderFinish( ctx );
-}
-
-
-static void
-intel_fallback_line( struct intel_context *intel,
- intelVertex *v0,
- intelVertex *v1 )
-{
- GLcontext *ctx = &intel->ctx;
- SWvertex v[2];
-
- if (0)
- fprintf(stderr, "\n%s\n", __FUNCTION__);
-
- if (intel->prim.flush)
- intel->prim.flush(intel);
-
- _swsetup_Translate( ctx, v0, &v[0] );
- _swsetup_Translate( ctx, v1, &v[1] );
- intelSpanRenderStart( ctx );
- _swrast_Line( ctx, &v[0], &v[1] );
- intelSpanRenderFinish( ctx );
-}
-
-
-/**********************************************************************/
-/* Render unclipped begin/end objects */
-/**********************************************************************/
-
-#define IND 0
-#define V(x) (intelVertex *)(vertptr + ((x)*vertsize*sizeof(GLuint)))
-#define RENDER_POINTS( start, count ) \
- for ( ; start < count ; start++) POINT( V(ELT(start)) );
-#define RENDER_LINE( v0, v1 ) LINE( V(v0), V(v1) )
-#define RENDER_TRI( v0, v1, v2 ) TRI( V(v0), V(v1), V(v2) )
-#define RENDER_QUAD( v0, v1, v2, v3 ) QUAD( V(v0), V(v1), V(v2), V(v3) )
-#define INIT(x) intelRenderPrimitive( ctx, x )
-#undef LOCAL_VARS
-#define LOCAL_VARS \
- struct intel_context *intel = intel_context(ctx); \
- GLubyte *vertptr = (GLubyte *)intel->verts; \
- const GLuint vertsize = intel->vertex_size; \
- const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \
- (void) elt;
-#define RESET_STIPPLE
-#define RESET_OCCLUSION
-#define PRESERVE_VB_DEFS
-#define ELT(x) x
-#define TAG(x) intel_##x##_verts
-#include "tnl/t_vb_rendertmp.h"
-#undef ELT
-#undef TAG
-#define TAG(x) intel_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-/**********************************************************************/
-/* Render clipped primitives */
-/**********************************************************************/
-
-
-
-static void intelRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- struct intel_context *intel = intel_context(ctx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint prim = intel->render_primitive;
-
- /* Render the new vertices as an unclipped polygon.
- */
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n,
- PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
- }
-
- /* Restore the render primitive
- */
- if (prim != GL_POLYGON)
- tnl->Driver.Render.PrimitiveNotify( ctx, prim );
-}
-
-static void intelRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-
-static void intelFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
- GLuint n )
-{
- struct intel_context *intel = intel_context( ctx );
- const GLuint vertsize = intel->vertex_size;
- GLuint *vb = intelExtendInlinePrimitive( intel, (n-2) * 3 * vertsize );
- GLubyte *vertptr = (GLubyte *)intel->verts;
- const GLuint *start = (const GLuint *)V(elts[0]);
- int i,j;
-
- for (i = 2 ; i < n ; i++) {
- COPY_DWORDS( j, vb, vertsize, V(elts[i-1]) );
- COPY_DWORDS( j, vb, vertsize, V(elts[i]) );
- COPY_DWORDS( j, vb, vertsize, start );
- }
-}
-
-/**********************************************************************/
-/* Choose render functions */
-/**********************************************************************/
-
-
-
-
-#define ANY_FALLBACK_FLAGS (DD_LINE_STIPPLE | DD_TRI_STIPPLE | DD_POINT_ATTEN)
-#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED)
-
-void intelChooseRenderState(GLcontext *ctx)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct intel_context *intel = intel_context(ctx);
- GLuint flags = ctx->_TriangleCaps;
- struct fragment_program *fprog = ctx->FragmentProgram._Current;
- GLboolean have_wpos = (fprog && (fprog->Base.InputsRead & FRAG_BIT_WPOS));
- GLuint index = 0;
-
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr,"\n%s\n",__FUNCTION__);
-
- if ((flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) || have_wpos) {
-
- if (flags & ANY_RASTER_FLAGS) {
- if (flags & DD_TRI_LIGHT_TWOSIDE) index |= INTEL_TWOSIDE_BIT;
- if (flags & DD_TRI_OFFSET) index |= INTEL_OFFSET_BIT;
- if (flags & DD_TRI_UNFILLED) index |= INTEL_UNFILLED_BIT;
- }
-
- if (have_wpos) {
- intel->draw_point = intel_wpos_point;
- intel->draw_line = intel_wpos_line;
- intel->draw_tri = intel_wpos_triangle;
-
- /* Make sure these get called:
- */
- index |= INTEL_FALLBACK_BIT;
- }
- else {
- intel->draw_point = intel_draw_point;
- intel->draw_line = intel_draw_line;
- intel->draw_tri = intel_draw_triangle;
- }
-
- /* Hook in fallbacks for specific primitives.
- */
- if (flags & ANY_FALLBACK_FLAGS)
- {
- if (flags & DD_LINE_STIPPLE)
- intel->draw_line = intel_fallback_line;
-
- if ((flags & DD_TRI_STIPPLE) && !intel->hw_stipple)
- intel->draw_tri = intel_fallback_tri;
-
- if (flags & DD_POINT_ATTEN)
- intel->draw_point = intel_atten_point;
-
- index |= INTEL_FALLBACK_BIT;
- }
- }
-
- if (intel->RenderIndex != index) {
- intel->RenderIndex = index;
-
- tnl->Driver.Render.Points = rast_tab[index].points;
- tnl->Driver.Render.Line = rast_tab[index].line;
- tnl->Driver.Render.Triangle = rast_tab[index].triangle;
- tnl->Driver.Render.Quad = rast_tab[index].quad;
-
- if (index == 0) {
- tnl->Driver.Render.PrimTabVerts = intel_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = intel_render_tab_elts;
- tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
- tnl->Driver.Render.ClippedPolygon = intelFastRenderClippedPoly;
- } else {
- tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
- tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = intelRenderClippedLine;
- tnl->Driver.Render.ClippedPolygon = intelRenderClippedPoly;
- }
- }
-}
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
-};
-
-
-/**********************************************************************/
-/* High level hooks for t_vb_render.c */
-/**********************************************************************/
-
-
-
-
-static void intelRunPipeline( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context(ctx);
-
- if (intel->NewGLState) {
- if (intel->NewGLState & _NEW_TEXTURE) {
- intel->vtbl.update_texture_state( intel );
- }
-
- if (!intel->Fallback) {
- if (intel->NewGLState & _INTEL_NEW_RENDERSTATE)
- intelChooseRenderState( ctx );
- }
-
- intel->NewGLState = 0;
- }
-
- _tnl_run_pipeline( ctx );
-}
-
-static void intelRenderStart( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context(ctx);
-
- intel->vtbl.render_start( intel_context(ctx) );
- intel->vtbl.emit_state( intel );
-}
-
-static void intelRenderFinish( GLcontext *ctx )
-{
- struct intel_context *intel = intel_context(ctx);
-
- if (intel->RenderIndex & INTEL_FALLBACK_BIT)
- _swrast_flush( ctx );
-
- if (intel->prim.flush)
- intel->prim.flush(intel);
-}
-
-
-
-
- /* System to flush dma and emit state changes based on the rasterized
- * primitive.
- */
-static void intelRasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim )
-{
- struct intel_context *intel = intel_context(ctx);
-
- if (0)
- fprintf(stderr, "%s %s %x\n", __FUNCTION__,
- _mesa_lookup_enum_by_nr(rprim), hwprim);
-
- intel->vtbl.reduced_primitive_state( intel, rprim );
-
- /* Start a new primitive. Arrange to have it flushed later on.
- */
- if (hwprim != intel->prim.primitive) {
- if (intel->prim.flush)
- intel->prim.flush(intel);
-
- intelStartInlinePrimitive( intel, hwprim, INTEL_BATCH_CLIPRECTS );
- }
-}
-
-
- /*
- */
-static void intelRenderPrimitive( GLcontext *ctx, GLenum prim )
-{
- struct intel_context *intel = intel_context(ctx);
-
- if (0)
- fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(prim));
-
- /* Let some clipping routines know which primitive they're dealing
- * with.
- */
- intel->render_primitive = prim;
-
- /* Shortcircuit this when called from t_dd_rendertmp.h for unfilled
- * triangles. The rasterized primitive will always be reset by
- * lower level functions in that case, potentially pingponging the
- * state:
- */
- if (reduced_prim[prim] == GL_TRIANGLES &&
- (ctx->_TriangleCaps & DD_TRI_UNFILLED))
- return;
-
- /* Set some primitive-dependent state and Start? a new primitive.
- */
- intelRasterPrimitive( ctx, reduced_prim[prim], hw_prim[prim] );
-}
-
-
- /**********************************************************************/
- /* Transition to/from hardware rasterization. */
- /**********************************************************************/
-
-static char *fallbackStrings[] = {
- "Texture",
- "Draw buffer",
- "Read buffer",
- "Color mask",
- "Render mode",
- "Stencil",
- "Stipple",
- "User disable"
-};
-
-
-static char *getFallbackString(GLuint bit)
-{
- int i = 0;
- while (bit > 1) {
- i++;
- bit >>= 1;
- }
- return fallbackStrings[i];
-}
-
-
-
-void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode )
-{
- GLcontext *ctx = &intel->ctx;
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = intel->Fallback;
-
- if (mode) {
- intel->Fallback |= bit;
- if (oldfallback == 0) {
- intelFlush(ctx);
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "ENTER FALLBACK %x: %s\n",
- bit, getFallbackString( bit ));
- _swsetup_Wakeup( ctx );
- intel->RenderIndex = ~0;
- }
- }
- else {
- intel->Fallback &= ~bit;
- if (oldfallback == bit) {
- _swrast_flush( ctx );
- if (INTEL_DEBUG & DEBUG_FALLBACKS)
- fprintf(stderr, "LEAVE FALLBACK %s\n", getFallbackString( bit ));
- tnl->Driver.Render.Start = intelRenderStart;
- tnl->Driver.Render.PrimitiveNotify = intelRenderPrimitive;
- tnl->Driver.Render.Finish = intelRenderFinish;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-
- _tnl_invalidate_vertex_state( ctx, ~0 );
- _tnl_invalidate_vertices( ctx, ~0 );
- _tnl_install_attrs( ctx,
- intel->vertex_attrs,
- intel->vertex_attr_count,
- intel->ViewportMatrix.m, 0 );
-
- intel->NewGLState |= _INTEL_NEW_RENDERSTATE;
- }
- }
-}
-
-union fi {
- GLfloat f;
- GLint i;
-};
-
-
-/**********************************************************************/
-/* Used only with the metaops callbacks. */
-/**********************************************************************/
-void intel_meta_draw_quad(struct intel_context *intel,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLfloat z,
- GLuint color,
- GLfloat s0, GLfloat s1,
- GLfloat t0, GLfloat t1)
-{
- union fi *vb;
-
- if (INTEL_DEBUG & DEBUG_DRI)
- fprintf(stderr, "%s: %f,%f-%f,%f 0x%x %f,%f-%f,%f depth: %f\n",
- __FUNCTION__,
- x0,y0,x1,y1,color,s0,t0,s1,t1, z);
-
- intel->vtbl.emit_state( intel );
-
- /* All 3d primitives should be emitted with INTEL_BATCH_CLIPRECTS,
- * otherwise the drawing origin (DR4) might not be set correctly.
- */
- intelStartInlinePrimitive( intel, PRIM3D_TRIFAN, INTEL_BATCH_CLIPRECTS );
- vb = (union fi *)intelExtendInlinePrimitive( intel, 4 * 6 );
-
-
- /* initial vertex, left bottom */
- vb[0].f = x0;
- vb[1].f = y0;
- vb[2].f = z;
- vb[3].i = color;
- vb[4].f = s0;
- vb[5].f = t0;
- vb += 6;
-
- /* right bottom */
- vb[0].f = x1;
- vb[1].f = y0;
- vb[2].f = z;
- vb[3].i = color;
- vb[4].f = s1;
- vb[5].f = t0;
- vb += 6;
-
- /* right top */
- vb[0].f = x1;
- vb[1].f = y1;
- vb[2].f = z;
- vb[3].i = color;
- vb[4].f = s1;
- vb[5].f = t1;
- vb += 6;
-
- /* left top */
- vb[0].f = x0;
- vb[1].f = y1;
- vb[2].f = z;
- vb[3].i = color;
- vb[4].f = s0;
- vb[5].f = t1;
-
- if (intel->prim.flush)
- intel->prim.flush(intel);
-}
-
-
-/**********************************************************************/
-/* Initialization. */
-/**********************************************************************/
-
-
-void intelInitTriFuncs( GLcontext *ctx )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- static int firsttime = 1;
-
- if (firsttime) {
- init_rast_tab();
- firsttime = 0;
- }
-
- tnl->Driver.RunPipeline = intelRunPipeline;
- tnl->Driver.Render.Start = intelRenderStart;
- tnl->Driver.Render.Finish = intelRenderFinish;
- tnl->Driver.Render.PrimitiveNotify = intelRenderPrimitive;
- tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
- tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
- tnl->Driver.Render.CopyPV = _tnl_copy_pv;
- tnl->Driver.Render.Interp = _tnl_interp;
-}
diff --git a/src/mesa/drivers/dri/i915-tex/intel_tris.h b/src/mesa/drivers/dri/i915-tex/intel_tris.h
deleted file mode 100644
index 1b2c474262d..00000000000
--- a/src/mesa/drivers/dri/i915-tex/intel_tris.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 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.
- *
- **************************************************************************/
-
-#ifndef INTELTRIS_INC
-#define INTELTRIS_INC
-
-#include "mtypes.h"
-
-
-
-#define _INTEL_NEW_RENDERSTATE (_DD_NEW_LINE_STIPPLE | \
- _DD_NEW_TRI_UNFILLED | \
- _DD_NEW_TRI_LIGHT_TWOSIDE | \
- _DD_NEW_TRI_OFFSET | \
- _DD_NEW_TRI_STIPPLE | \
- _NEW_PROGRAM | \
- _NEW_POLYGONSTIPPLE)
-
-extern void intelInitTriFuncs( GLcontext *ctx );
-
-extern void intelChooseRenderState( GLcontext *ctx );
-
-extern void intelStartInlinePrimitive( struct intel_context *intel, GLuint prim, GLuint flags );
-extern void intelWrapInlinePrimitive( struct intel_context *intel );
-
-GLuint *intelExtendInlinePrimitive( struct intel_context *intel,
- GLuint dwords );
-
-
-void intel_meta_draw_quad(struct intel_context *intel,
- GLfloat x0, GLfloat x1,
- GLfloat y0, GLfloat y1,
- GLfloat z,
- GLuint color,
- GLfloat s0, GLfloat s1,
- GLfloat t0, GLfloat t1);
-
-
-#endif
diff --git a/src/mesa/drivers/dri/i915-tex/server/i830_common.h b/src/mesa/drivers/dri/i915-tex/server/i830_common.h
deleted file mode 100644
index 41b5cc3c01b..00000000000
--- a/src/mesa/drivers/dri/i915-tex/server/i830_common.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/**************************************************************************
-
-Copyright 2001 VA Linux Systems Inc., Fremont, California.
-Copyright 2002 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
-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
-ATI, VA LINUX SYSTEMS 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.
-
-**************************************************************************/
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */
-
-#ifndef _I830_COMMON_H_
-#define _I830_COMMON_H_
-
-
-#define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */
-#define I830_LOG_MIN_TEX_REGION_SIZE 14
-
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_I830_INIT 0x00
-#define DRM_I830_FLUSH 0x01
-#define DRM_I830_FLIP 0x02
-#define DRM_I830_BATCHBUFFER 0x03
-#define DRM_I830_IRQ_EMIT 0x04
-#define DRM_I830_IRQ_WAIT 0x05
-#define DRM_I830_GETPARAM 0x06
-#define DRM_I830_SETPARAM 0x07
-#define DRM_I830_ALLOC 0x08
-#define DRM_I830_FREE 0x09
-#define DRM_I830_INIT_HEAP 0x0a
-#define DRM_I830_CMDBUFFER 0x0b
-#define DRM_I830_DESTROY_HEAP 0x0c
-
-typedef struct {
- enum {
- I830_INIT_DMA = 0x01,
- I830_CLEANUP_DMA = 0x02,
- I830_RESUME_DMA = 0x03
- } func;
- unsigned int mmio_offset;
- int sarea_priv_offset;
- unsigned int ring_start;
- unsigned int ring_end;
- unsigned int ring_size;
- unsigned int front_offset;
- unsigned int back_offset;
- unsigned int depth_offset;
- unsigned int w;
- unsigned int h;
- unsigned int pitch;
- unsigned int pitch_bits;
- unsigned int back_pitch;
- unsigned int depth_pitch;
- unsigned int cpp;
- unsigned int chipset;
-} drmI830Init;
-
-typedef struct {
- drmTextureRegion texList[I830_NR_TEX_REGIONS+1];
- int last_upload; /* last time texture was uploaded */
- int last_enqueue; /* last time a buffer was enqueued */
- int last_dispatch; /* age of the most recently dispatched buffer */
- int ctxOwner; /* last context to upload state */
- int texAge;
- int pf_enabled; /* is pageflipping allowed? */
- int pf_active;
- int pf_current_page; /* which buffer is being displayed? */
- int perf_boxes; /* performance boxes to be displayed */
- int width, height; /* screen size in pixels */
-
- drm_handle_t front_handle;
- int front_offset;
- int front_size;
-
- drm_handle_t back_handle;
- int back_offset;
- int back_size;
-
- drm_handle_t depth_handle;
- int depth_offset;
- int depth_size;
-
- drm_handle_t tex_handle;
- int tex_offset;
- int tex_size;
- int log_tex_granularity;
- int pitch;
- int rotation; /* 0, 90, 180 or 270 */
- int rotated_offset;
- int rotated_size;
- int rotated_pitch;
- int virtualX, virtualY;
-} drmI830Sarea;
-
-/* Flags for perf_boxes
- */
-#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
-#define I830_BOX_FLIP 0x2 /* populated by kernel */
-#define I830_BOX_WAIT 0x4 /* populated by kernel & client */
-#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
-#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
-
-
-typedef struct {
- int start; /* agp offset */
- int used; /* nr bytes in use */
- int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
- int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
- int num_cliprects; /* mulitpass with multiple cliprects? */
- drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
-} drmI830BatchBuffer;
-
-typedef struct {
- char *buf; /* agp offset */
- int sz; /* nr bytes in use */
- int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
- int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/
- int num_cliprects; /* mulitpass with multiple cliprects? */
- drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */
-} drmI830CmdBuffer;
-
-typedef struct {
- int *irq_seq;
-} drmI830IrqEmit;
-
-typedef struct {
- int irq_seq;
-} drmI830IrqWait;
-
-typedef struct {
- int param;
- int *value;
-} drmI830GetParam;
-
-#define I830_PARAM_IRQ_ACTIVE 1
-#define I830_PARAM_ALLOW_BATCHBUFFER 2
-
-typedef struct {
- int param;
- int value;
-} drmI830SetParam;
-
-#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
-#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
-#define I830_SETPARAM_ALLOW_BATCHBUFFER 3
-
-
-/* A memory manager for regions of shared memory:
- */
-#define I830_MEM_REGION_AGP 1
-
-typedef struct {
- int region;
- int alignment;
- int size;
- int *region_offset; /* offset from start of fb or agp */
-} drmI830MemAlloc;
-
-typedef struct {
- int region;
- int region_offset;
-} drmI830MemFree;
-
-typedef struct {
- int region;
- int size;
- int start;
-} drmI830MemInitHeap;
-
-typedef struct {
- int region;
-} drmI830MemDestroyHeap;
-
-
-#endif /* _I830_DRM_H_ */
diff --git a/src/mesa/drivers/dri/i915-tex/server/i830_dri.h b/src/mesa/drivers/dri/i915-tex/server/i830_dri.h
deleted file mode 100644
index 6c9a7090215..00000000000
--- a/src/mesa/drivers/dri/i915-tex/server/i830_dri.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.4 2002/10/30 12:52:18 alanh Exp $ */
-
-#ifndef _I830_DRI_H
-#define _I830_DRI_H
-
-#include "xf86drm.h"
-#include "i830_common.h"
-
-#define I830_MAX_DRAWABLES 256
-
-#define I830_MAJOR_VERSION 1
-#define I830_MINOR_VERSION 3
-#define I830_PATCHLEVEL 0
-
-#define I830_REG_SIZE 0x80000
-
-typedef struct _I830DRIRec {
- drm_handle_t regs;
- drmSize regsSize;
-
- drmSize backbufferSize;
- drm_handle_t backbuffer;
-
- drmSize depthbufferSize;
- drm_handle_t depthbuffer;
-
- drmSize rotatedSize;
- drm_handle_t rotatedbuffer;
-
- drm_handle_t textures;
- int textureSize;
-
- drm_handle_t agp_buffers;
- drmSize agp_buf_size;
-
- int deviceID;
- int width;
- int height;
- int mem;
- int cpp;
- int bitsPerPixel;
-
- int fbOffset;
- int fbStride;
-
- int backOffset;
- int backPitch;
-
- int depthOffset;
- int depthPitch;
-
- int rotatedOffset;
- int rotatedPitch;
-
- int logTextureGranularity;
- int textureOffset;
-
- int irq;
- int sarea_priv_offset;
-} I830DRIRec, *I830DRIPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I830ConfigPrivRec, *I830ConfigPrivPtr;
-
-typedef struct {
- /* Nothing here yet */
- int dummy;
-} I830DRIContextRec, *I830DRIContextPtr;
-
-
-#endif
diff --git a/src/mesa/drivers/dri/mga/README b/src/mesa/drivers/dri/mga/README
deleted file mode 100644
index a7133fa66f4..00000000000
--- a/src/mesa/drivers/dri/mga/README
+++ /dev/null
@@ -1,26 +0,0 @@
-MGA DRI driver ported from XF86DRI to FBDRI
-by Denis Oliver Kropp <dok@directfb.org>
-
-
-INFO
-
-This driver has been ported from the head branch of XFree86 to
-the embedded-1-branch of Mesa.
-
-
-STATUS
-
-Already working very well as far as I've tested it (16/32 bit).
-glxgears runs at 935 fps (G550 32MB AGP 4x, Athlon 1.33) vs 744 fps with XFree.
-Other demos (terrain, fire, etc.) have been successfully tested as well.
-
-
-TODO
-
-- mgaEngineShutdown
-- mgaEngineRestore
-- SGRAM detection
-- remove some unused bits from server/*
-- subset driver support
-- mgaWaitForVBlank
-- deinitialization (from MGADRICloseScreen) a la radeonDestroyScreen
diff --git a/src/mesa/drivers/dri/r300/pixel_shader.h b/src/mesa/drivers/dri/r300/pixel_shader.h
deleted file mode 100644
index 0d04859f9b8..00000000000
--- a/src/mesa/drivers/dri/r300/pixel_shader.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef __PIXEL_SHADER_H__
-#define __PIXEL_SHADER_H__
-
-#include "r300_reg.h"
-
-
-/* INSTR 0 */
-
-#define PFS_OP_MAD 0
-#define PFS_OP_DP3 1
-#define PFS_OP_DP4 2
-#define PFS_OP_MIN 4
-#define PFS_OP_MAX 5
-#define PFS_OP_CMP 8
-#define PFS_OP_FRC 9
-#define PFS_OP_OUTC_REPL_ALPHA 10
-
-/* "or" these with arg0 value to negate or take absolute value of an argument */
-#define PFS_ARG_NEG (1<<5)
-#define PFS_ARG_ABS (1<<6)
-
-#define MAKE_PFS_INSTR0(op, arg0, arg1, arg2, flags) \
- ( ((op)<<23) \
- | ((arg0)<<R300_FPI0_ARG0C_SHIFT) \
- | ((arg1)<<R300_FPI0_ARG1C_SHIFT) \
- | ((arg2)<<R300_FPI0_ARG2C_SHIFT) \
- | (flags) \
- )
-
-#define PFS_FLAG_X 1
-#define PFS_FLAG_Y 2
-#define PFS_FLAG_XY 3
-#define PFS_FLAG_Z 4
-#define PFS_FLAG_XZ 5
-#define PFS_FLAG_YZ 6
-#define PFS_FLAG_ALL 7
-#define PFS_FLAG_NONE 0
-
-#define EASY_PFS_INSTR0(op, arg0, arg1, arg2) \
- MAKE_PFS_INSTR0(PFS_OP_##op, \
- R300_FPI0_ARGC_##arg0, \
- R300_FPI0_ARGC_##arg1, \
- R300_FPI0_ARGC_##arg2, \
- 0)
-
-/* INSTR 1 */
-
-#define PFS_FLAG_CONST (1<<5)
-
-#define MAKE_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
- ((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
- | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
- | ((dstc) << R300_FPI1_DSTC_SHIFT) \
- | ((reg) << 23) | ((output)<<26))
-
-#define EASY_PFS_INSTR1(dstc, src0, src1, src2, reg, output) \
- MAKE_PFS_INSTR1(dstc, src0, src1, src2, PFS_FLAG_##reg, PFS_FLAG_##output)
-
-/* INSTR 2 */
-
-/* you can "or" PFS_ARG_NEG with these values to negate them */
-
-#define MAKE_PFS_INSTR2(op, arg0, arg1, arg2, flags) \
- (((op) << 23) | \
- ((arg0)<<R300_FPI2_ARG0A_SHIFT) | \
- ((arg1)<<R300_FPI2_ARG1A_SHIFT) | \
- ((arg2)<<R300_FPI2_ARG2A_SHIFT) | \
- (flags))
-
-#define EASY_PFS_INSTR2(op, arg0, arg1, arg2) \
- MAKE_PFS_INSTR2(R300_FPI2_OUTA_##op, \
- R300_FPI2_ARGA_##arg0, \
- R300_FPI2_ARGA_##arg1, \
- R300_FPI2_ARGA_##arg2, \
- 0)
-
-
-/* INSTR 3 */
-
-#define PFS_FLAG_NONE 0
-#define PFS_FLAG_REG 1
-#define PFS_FLAG_OUTPUT 2
-#define PFS_FLAG_BOTH 3
-
-#define MAKE_PFS_INSTR3(dstc, src0, src1, src2, flags) \
- ((src0) | ((src1) << R300_FPI1_SRC1C_SHIFT) \
- | ((src2)<<R300_FPI1_SRC2C_SHIFT) \
- | ((dstc) << R300_FPI1_DSTC_SHIFT) \
- | ((flags) << 23))
-
-#define EASY_PFS_INSTR3(dstc, src0, src1, src2, flag) \
- MAKE_PFS_INSTR3(dstc, src0, src1, src2, PFS_FLAG_##flag)
-
- /* What are 0's ORed with flags ? They are register numbers that
- just happen to be 0 */
-#define PFS_NOP { \
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO), \
- EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL), \
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO), \
- EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT) \
- }
-
-#endif
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_swz.c b/src/mesa/drivers/dri/r300/r300_fragprog_swz.c
deleted file mode 100644
index b29331d7bde..00000000000
--- a/src/mesa/drivers/dri/r300/r300_fragprog_swz.c
+++ /dev/null
@@ -1,1328 +0,0 @@
-/*
- * Copyright (C) 2005 Jerome Glisse. 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 (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 COPYRIGHT OWNER(S) 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.
- *
- */
-#include "r300_fragprog.h"
-#include "r300_reg.h"
-
-
-#define I0_000 ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_ZERO) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_111 ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_ZERO) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG2C_SHIFT) )
-#define I0_XXX ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_XXX) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_YYY ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_YYY) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_ZZZ ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_ZZZ) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_XYZ ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_XYZ) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_YZX ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_YZX) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_ZXY ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0C_ZXY) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_WZY ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0CA_WZY) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-#define I0_WWW ( (R300_FPI0_OUTC_MAD) | \
- (R300_FPI0_ARGC_SRC0A) | \
- (R300_FPI0_ARGC_ONE << R300_FPI0_ARG1C_SHIFT) | \
- (R300_FPI0_ARGC_ZERO << R300_FPI0_ARG2C_SHIFT) )
-
-#define IEMPTY 0
-
-#define I1_XYZ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X | \
- R300_FPI1_DSTC_REG_Y | \
- R300_FPI1_DSTC_REG_Z )
-#define I1_XY_ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X | \
- R300_FPI1_DSTC_REG_Y )
-#define I1_X_Z ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X | \
- R300_FPI1_DSTC_REG_Z )
-#define I1__YZ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_Y | \
- R300_FPI1_DSTC_REG_Z )
-#define I1_X__ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_X )
-#define I1__Y_ ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_Y )
-#define I1___Z ( R300_FPI1_SRC1C_CONST | \
- R300_FPI1_SRC2C_CONST | \
- R300_FPI1_DSTC_REG_Z )
-
-#define SEMPTY {0,{0,0,0,0},{0,0,0,0,0,0,0,0}}
-
-struct r300_fragment_program_swizzle r300_swizzle [512] = {
- /* XXX */
- {1,{0,0,0,0},{ I0_XXX, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* YXX */
- {2,{0,0,0,0},{ I0_YZX, I1_X_Z,
- I0_XXX, I1__Y_,
- 0,0,
- 0,0 } },
- /* ZXX */
- {2,{0,0,0,0},{ I0_ZZZ, I1_X__,
- I0_XXX, I1__YZ,
- 0,0,
- 0,0 } },
- /* WXX */
- {2,{0,0,0,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__YZ,
- 0,0,
- 0,0} },
- /* 0XX */
- {2,{0,2,0,0},{ I0_XXX, I1__YZ,
- I0_000, I1_X__,
- 0,0,
- 0,0 } },
- /* 1XX */
- {2,{0,2,0,0},{ I0_XXX, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XYX */
- {2,{0,0,0,0},{ I0_YYY, I1__Y_,
- I0_XXX, I1_X_Z,
- 0,0,0,0}},
- /* YYX */
- {2,{0,0,0,0},{ I0_YYY, I1_XY_,
- I0_XXX, I1___Z,
- 0,0,0,0}},
- /* ZYX */
- {3,{0,0,0,0},{ I0_ZZZ, I1_X__,
- I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- 0,0}},
- /* WYX */
- {3,{0,0,0,0},{ I0_WZY, I1_X__,
- I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- 0,0}},
- /* 0YX */
- {3,{0,0,2,0},{ I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1YX */
- {3,{0,0,2,0},{ I0_YYY, I1__Y_,
- I0_XXX, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XZX */
- {2,{0,0,0,0},{ I0_YZX, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YZX */
- {1,{0,0,0,0},{ I0_YZX, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* ZZX */
- {2,{0,0,0,0},{ I0_YZX, I1__YZ,
- I0_ZZZ, I1_X__,0,0,0,0}},
- /* WZX */
- {2,{0,0,0,0},{ I0_WZY, I1_XY_,
- I0_XXX, I1___Z,0,0,0,0}},
- /* 0ZX */
- {2,{0,2,0,0},{ I0_YZX, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1ZX */
- {2,{0,2,0,0},{ I0_YZX, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XWX */
- {2,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_XXX, I1_X_Z,
- 0,0,0,0}},
- /* YWX */
- {2,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_YZX, I1_X_Z,
- 0,0,0,0}},
- /* ZWX */
- {3,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_ZZZ, I1_X__,
- I0_XXX, I1___Z,
- 0,0}},
- /* WWX */
- {2,{0,0,0,0},{ I0_WWW, I1_XY_,
- I0_YZX, I1___Z,
- 0,0,0,0}},
- /* 0WX */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_XXX, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1WX */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_XXX, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X0X */
- {2,{0,2,0,0},{ I0_XXX, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* Y0X */
- {2,{0,2,0,0},{ I0_YZX, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* Z0X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1__Y_,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* W0X */
- {3,{0,0,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1___Z,
- I0_000, I1__Y_,
- 0,0}},
- /* 00X */
- {2,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1_XY_,
- 0,0,0,0}},
- /* 10X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_000, I1__Y_,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1X */
- {2,{0,2,0,0},{ I0_XXX, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* Y1X */
- {2,{0,2,0,0},{ I0_YZX, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* Z1X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1__Y_,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* W1X */
- {3,{0,0,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1___Z,
- I0_111, I1__Y_,
- 0,0}},
- /* 01X */
- {3,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1__Y_,
- I0_000, I1_X__,
- 0,0}},
- /* 11X */
- {2,{0,2,0,0},{ I0_XXX, I1___Z,
- I0_111, I1_XY_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XXY */
- {2,{0,0,0,0},{ I0_YYY, I1___Z,
- I0_XXX, I1_XY_,
- 0,0,0,0}},
- /* YXY */
- {2,{0,0,0,0},{ I0_YYY, I1_X_Z,
- I0_XXX, I1__Y_,
- 0,0,0,0}},
- /* ZXY */
- {1,{0,0,0,0},{ I0_ZXY, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* WXY */
- {2,{0,0,0,0},{ I0_WZY, I1_X__,
- I0_ZXY, I1__YZ,
- 0,0,0,0}},
- /* 0XY */
- {2,{0,0,0,0},{ I0_ZXY, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1XY */
- {2,{0,0,0,0},{ I0_ZXY, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XYY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YYY */
- {1,{0,0,0,0},{ I0_YYY, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* ZYY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* WYY */
- {2,{0,0,0,0},{ I0_WZY, I1_XYZ,
- I0_YYY, I1__YZ,
- 0,0,0,0}},
- /* 0YY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1YY */
- {2,{0,0,0,0},{ I0_YYY, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* ZZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* WZY */
- {1,{0,0,0,0},{ I0_WZY, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* 0ZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1ZY */
- {2,{0,0,0,0},{ I0_WZY, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XWY */
- {3,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_XXX, I1_X__,
- I0_YYY, I1___Z,
- 0,0}},
- /* YWY */
- {2,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_YYY, I1_X_Z,
- 0,0,0,0}},
- /* ZWY */
- {2,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_ZXY, I1_X_Z,
- 0,0,0,0}},
- /* WWY */
- {2,{0,0,0,0},{ I0_WWW, I1_XY_,
- I0_ZXY, I1___Z,
- 0,0,0,0}},
- /* 0WY */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_ZXY, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1WY */
- {3,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_ZXY, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X0Y */
- {3,{0,2,0,0},{ I0_XXX, I1_X__,
- I0_000, I1__Y_,
- I0_YYY, I1___Z,
- 0,0}},
- /* Y0Y */
- {2,{0,2,0,0},{ I0_YYY, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* Z0Y */
- {2,{0,2,0,0},{ I0_ZXY, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* W0Y */
- {2,{0,2,0,0},{ I0_WZY, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* 00Y */
- {2,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_000, I1_XY_,
- 0,0,0,0}},
- /* 10Y */
- {3,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_000, I1__Y_,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1Y */
- {3,{0,2,0,0},{ I0_XXX, I1_X__,
- I0_111, I1__Y_,
- I0_YYY, I1___Z,
- 0,0}},
- /* Y1Y */
- {2,{0,2,0,0},{ I0_YYY, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* Z1Y */
- {2,{0,2,0,0},{ I0_ZXY, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* W1Y */
- {3,{0,2,0,0},{ I0_WZY, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* 01Y */
- {3,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_111, I1__Y_,
- I0_000, I1_X__,
- 0,0}},
- /* 11Y */
- {2,{0,2,0,0},{ I0_YYY, I1___Z,
- I0_111, I1_XY_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XXZ */
- {2,{0,0,0,0},{ I0_XXX, I1_XY_,
- I0_ZZZ, I1___Z,
- 0,0,0,0}},
- /* YXZ */
- {3,{0,0,0,0},{ I0_XXX, I1__Y_,
- I0_YYY, I1_X__,
- I0_ZZZ, I1___Z,
- 0,0}},
- /* ZXZ */
- {2,{0,0,0,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1_X_Z,
- 0,0,0,0}},
- /* WXZ */
- {3,{0,0,0,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_ZZZ, I1___Z,
- 0,0}},
- /* 0XZ */
- {3,{0,0,2,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1XZ */
- {3,{0,0,2,0},{ I0_XXX, I1__Y_,
- I0_ZZZ, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XYZ */
- {1,{0,0,0,0},{ I0_XYZ, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* YYZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1___Z,
- I0_YYY, I1_XY_,
- 0,0,0,0}},
- /* ZYZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1_X_Z,
- I0_YYY, I1__Y_,
- 0,0,0,0}},
- /* WYZ */
- {2,{0,0,0,0},{ I0_WZY, I1_XYZ,
- I0_XYZ, I1__YZ,
- 0,0,0,0}},
- /* 0YZ */
- {2,{0,2,0,0},{ I0_XYZ, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1YZ */
- {2,{0,2,0,0},{ I0_XYZ, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XZZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1__YZ,
- I0_XXX, I1_X__,
- 0,0,0,0}},
- /* YZZ */
- {2,{0,0,0,0},{ I0_ZZZ, I1__YZ,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* ZZZ */
- {1,{0,0,0,0},{ I0_ZZZ, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* WZZ */
- {2,{0,0,0,0},{ I0_WZY, I1_XYZ,
- I0_ZZZ, I1__YZ,
- 0,0,0,0}},
- /* 0ZZ */
- {2,{0,2,0,0},{ I0_ZZZ, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1ZZ */
- {2,{0,2,0,0},{ I0_ZZZ, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XWZ */
- {2,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_XYZ, I1_X_Z,
- 0,0,0,0}},
- /* YWZ */
- {3,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_YYY, I1_X__,
- I0_XYZ, I1___Z,
- 0,0}},
- /* ZWZ */
- {2,{0,0,0,0},{ I0_WWW, I1__Y_,
- I0_ZZZ, I1_X_Z,
- 0,0,0,0}},
- /* WWZ */
- {2,{0,0,0,0},{ I0_WWW, I1_XY_,
- I0_XYZ, I1___Z,
- 0,0,0,0}},
- /* 0WZ */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_XYZ, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1WZ */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_XYZ, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X0Z */
- {2,{0,2,0,0},{ I0_XYZ, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* Y0Z */
- {3,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_000, I1__Y_,
- I0_YYY, I1_X__,
- 0,0}},
- /* Z0Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* W0Z */
- {3,{0,0,2,0},{ I0_WZY, I1_X_Z,
- I0_ZZZ, I1___Z,
- I0_000, I1__Y_,
- 0,0}},
- /* 00Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_000, I1_XY_,
- 0,0,0,0}},
- /* 10Z */
- {3,{0,2,2,0},{ I0_ZZZ, I1___Z,
- I0_000, I1__Y_,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1Z */
- {2,{0,2,0,0},{ I0_XYZ, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* Y1Z */
- {3,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_111, I1__Y_,
- I0_YYY, I1_X__,
- 0,0}},
- /* Z1Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1_X_Z,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* W1Z */
- {3,{0,0,2,0},{ I0_WZY, I1_XYZ,
- I0_ZZZ, I1___Z,
- I0_111, I1__Y_,
- 0,0}},
- /* 01Z */
- {3,{0,2,2,0},{ I0_ZZZ, I1___Z,
- I0_111, I1__Y_,
- I0_000, I1_X__,
- 0,0}},
- /* 11Z */
- {2,{0,2,0,0},{ I0_ZZZ, I1___Z,
- I0_111, I1_XY_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XXW */
- {2,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_XXX, I1_XY_,
- 0,0,0,0}},
- /* YXW */
- {3,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_XXX, I1__Y_,
- I0_YYY, I1_X__,
- 0,0}},
- /* ZXW */
- {2,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_ZXY, I1_XY_,
- 0,0,0,0}},
- /* WXW */
- {2,{0,0,0,0},{ I0_WWW, I1_X_Z,
- I0_XXX, I1__Y_,
- 0,0,0,0}},
- /* 0XW */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_XXX, I1__Y_,
- I0_000, I1_X__,
- 0,0}},
- /* 1XW */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_XXX, I1__Y_,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XYW */
- {2,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_XYZ, I1_XY_,
- 0,0,0,0}},
- /* YYW */
- {2,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_YYY, I1_XY_,
- 0,0}},
- /* ZYW */
- {3,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_XYZ, I1__Y_,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* WYW */
- {2,{0,0,0,0},{ I0_WWW, I1_X_Z,
- I0_YYY, I1__Y_,
- 0,0,0,0}},
- /* 0YW */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_YYY, I1__Y_,
- I0_000, I1_X__,
- 0,0}},
- /* 1YW */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_YYY, I1__Y_,
- I0_111, I1_X__,
- 0,0}},
-
- SEMPTY,SEMPTY,
- /* XZW */
- {3,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_XYZ, I1_X__,
- I0_ZZZ, I1__Y_,
- 0,0}},
- /* YZW */
- {2,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_YZX, I1_XY_,
- 0,0,0,0}},
- /* ZZW */
- {2,{0,0,0,0},{ I0_WWW, I1___Z,
- I0_ZZZ, I1_XY_,
- 0,0,0,0}},
- /* WZW */
- {2,{0,0,0,0},{ I0_WWW, I1_X_Z,
- I0_ZZZ, I1__Y_,
- 0,0,0,0}},
- /* 0ZW */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_ZZZ, I1__Y_,
- I0_000, I1_X__,
- 0,0}},
- /* 1ZW */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_ZZZ, I1__Y_,
- I0_111, I1_X__,
- 0,0}},
-
- SEMPTY,SEMPTY,
- /* XWW */
- {2,{0,0,0,0},{ I0_WWW, I1__YZ,
- I0_XYZ, I1_X__,
- 0,0,0,0}},
- /* YWW */
- {2,{0,0,0,0},{ I0_WWW, I1__YZ,
- I0_YYY, I1_X__,
- 0,0,0,0}},
- /* ZWW */
- {2,{0,0,0,0},{ I0_WWW, I1__YZ,
- I0_ZZZ, I1_X__,
- 0,0,0,0}},
- /* WWW */
- {1,{0,0,0,0},{ I0_WWW, I1_XYZ,
- 0,0,0,0,0,0}},
- /* 0WW */
- {2,{0,2,0,0},{ I0_WWW, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 1WW */
- {2,{0,2,0,0},{ I0_WWW, I1__YZ,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X0W */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_XYZ, I1_X__,
- I0_000, I1__Y_,
- 0,0}},
- /* Y0W */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_YYY, I1_X__,
- I0_000, I1__Y_,
- 0,0}},
- /* Z0W */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_ZZZ, I1_X__,
- I0_000, I1__Y_,
- 0,0}},
- /* W0W */
- {2,{0,2,0,0},{ I0_WWW, I1_X_Z,
- I0_000, I1__Y_,
- 0,0,0,0}},
- /* 00W */
- {2,{0,2,0,0},{ I0_WWW, I1___Z,
- I0_000, I1_XY_,
- 0,0,0,0}},
- /* 10W */
- {3,{0,2,2,0},{ I0_WWW, I1___Z,
- I0_111, I1_X__,
- I0_000, I1__Y_,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X1W */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_XYZ, I1_X__,
- I0_111, I1__Y_,
- 0,0}},
- /* Y1W */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_YYY, I1_X__,
- I0_111, I1__Y_,
- 0,0}},
- /* Z1W */
- {3,{0,0,2,0},{ I0_WWW, I1___Z,
- I0_ZZZ, I1_X__,
- I0_111, I1__Y_,
- 0,0}},
- /* W1W */
- {2,{0,2,0,0},{ I0_WWW, I1_XYZ,
- I0_111, I1__Y_,
- 0,0,0,0}},
- /* 01W */
- {3,{0,2,2,0},{ I0_WWW, I1___Z,
- I0_000, I1_X__,
- I0_111, I1__Y_,
- 0,0}},
- /* 11W */
- {2,{0,2,0,0},{ I0_WWW, I1___Z,
- I0_111, I1_XY_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- /* XX0 */
- {2,{0,2,0,0},{ I0_XXX, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* YX0 */
- {3,{0,0,2,0},{ I0_YYY, I1_X__,
- I0_XXX, I1__Y_,
- I0_000, I1___Z,
- 0,0}},
- /* ZX0 */
- {2,{0,2,0,0},{ I0_ZXY, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* WX0 */
- {3,{0,0,2,0},{ I0_WZY, I1_X__,
- I0_XXX, I1__Y_,
- I0_000, I1___Z,
- 0,0}},
- /* 0X0 */
- {2,{0,2,0,0},{ I0_XXX, I1__Y_,
- I0_000, I1_X_Z,
- 0,0,0,0}},
- /* 1X0 */
- {3,{0,2,2,0},{ I0_XXX, I1__Y_,
- I0_000, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XY0 */
- {2,{0,2,0,0},{ I0_XYZ, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* YY0 */
- {2,{0,2,0,0},{ I0_YYY, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* ZY0 */
- {3,{0,0,2,0},{ I0_YYY, I1__Y_,
- I0_ZZZ, I1_X__,
- I0_000, I1___Z,
- 0,0}},
- /* WY0 */
- {3,{0,0,2,0},{ I0_WZY, I1_X__,
- I0_XYZ, I1__Y_,
- I0_000, I1___Z,
- 0,0}},
- /* 0Y0 */
- {2,{0,2,0,0},{ I0_XYZ, I1__Y_,
- I0_000, I1_X_Z,
- 0,0,0,0}},
- /* 1Y0 */
- {3,{0,2,2,0},{ I0_XYZ, I1__Y_,
- I0_000, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XZ0 */
- {3,{0,0,2,0},{ I0_ZZZ, I1__Y_,
- I0_XYZ, I1_X__,
- I0_000, I1___Z,
- 0,0}},
- /* YZ0 */
- {2,{0,2,0,0},{ I0_YZX, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* ZZ0 */
- {2,{0,2,0,0},{ I0_ZZZ, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* WZ0 */
- {3,{0,0,2,0},{ I0_XYZ, I1_XYZ,
- I0_WZY, I1_XY_,
- I0_000, I1___Z,
- 0,0}},
- /* 0Z0 */
- {2,{0,2,0,0},{ I0_ZZZ, I1__Y_,
- I0_000, I1_X_Z,
- 0,0,0,0}},
- /* 1Z0 */
- {3,{0,2,2,0},{ I0_ZZZ, I1__Y_,
- I0_000, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* XW0 */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_XYZ, I1_X__,
- I0_000, I1___Z,
- 0,0}},
- /* YW0 */
- {3,{0,2,0,0},{ I0_WWW, I1__Y_,
- I0_000, I1___Z,
- I0_YYY, I1_X__,
- 0,0}},
- /* ZW0 */
- {3,{0,2,0,0},{ I0_WWW, I1__Y_,
- I0_000, I1___Z,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* WW0 */
- {2,{0,2,0,0},{ I0_WWW, I1_XY_,
- I0_000, I1___Z,
- 0,0,0,0}},
- /* 0W0 */
- {2,{0,2,0,0},{ I0_WWW, I1__Y_,
- I0_000, I1_X_Z,
- 0,0,0,0}},
- /* 1W0 */
- {3,{0,2,2,0},{ I0_WWW, I1__Y_,
- I0_000, I1___Z,
- I0_111, I1_X__,
- 0,0}},
- SEMPTY,SEMPTY,
- /* X00 */
- {2,{0,2,0,0},{ I0_XYZ, I1_X__,
- I0_000, I1__YZ,
- 0,0,0,0}},
- /* Y00 */
- {2,{0,2,0,0},{ I0_YYY, I1_X__,
- I0_000, I1__YZ,
- 0,0,0,0}},
- /* Z00 */
- {2,{0,2,0,0},{ I0_ZZZ, I1_X__,
- I0_000, I1__YZ,
- 0,0,0,0}},
- /* W00 */
- {2,{2,0,0,0},{ I0_WZY, I1_X__,
- I0_000, I1__YZ,
- 0,0,0,0}},
- /* 000 */
- {1,{2,0,0,0},{ I0_000, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- /* 100 */
- {2,{2,2,0,0},{ I0_000, I1__YZ,
- I0_111, I1_X__,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* X10 */
- {3,{0,2,2,0},{ I0_XYZ, I1_XYZ,
- I0_000, I1___Z,
- I0_111, I1__Y_,
- 0,0}},
- /* Y10 */
- {3,{0,2,2,0},{ I0_YYY, I1_XYZ,
- I0_000, I1___Z,
- I0_111, I1__Y_,
- 0,0}},
- /* Z10 */
- {3,{0,2,2,0},{ I0_ZZZ, I1_XYZ,
- I0_000, I1___Z,
- I0_111, I1__Y_,
- 0,0}},
- /* W10 */
- {3,{0,2,2,0},{ I0_WZY, I1_XYZ,
- I0_000, I1___Z,
- I0_111, I1__Y_,
- 0,0}},
- /* 010 */
- {2,{2,2,0,0},{ I0_000, I1_X_Z,
- I0_111, I1__Y_,
- 0, 0, 0, 0 } },
- /* 110 */
- {2,{2,2,0,0},{ I0_000, I1___Z,
- I0_111, I1_XY_,
- 0,0,0,0}},
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
-
-
-
- /* XX1 */
- {2,{0,2,0,0},{ I0_XXX, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* YX1 */
- {3,{0,0,2,0},{ I0_YYY, I1_X__,
- I0_XXX, I1__Y_,
- I0_111, I1___Z,
- 0,0}},
- /* ZX1 */
- {2,{0,2,0,0},{ I0_ZXY, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* WX1 */
- {3,{0,0,2,0},{ I0_WZY, I1_XYZ,
- I0_XXX, I1__Y_,
- I0_111, I1___Z,
- 0,0}},
- /* 0X1 */
- {3,{0,2,2,0},{ I0_XXX, I1__Y_,
- I0_111, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1X1 */
- {2,{0,2,0,0},{ I0_XXX, I1__Y_,
- I0_111, I1_X_Z,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XY1 */
- {2,{0,2,0,0},{ I0_XYZ, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* YY1 */
- {2,{0,2,0,0},{ I0_YYY, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* ZY1 */
- {3,{0,0,2,0},{ I0_YYY, I1__Y_,
- I0_ZZZ, I1_X__,
- I0_111, I1___Z,
- 0,0}},
- /* WY1 */
- {3,{0,0,2,0},{ I0_WZY, I1_XYZ,
- I0_XYZ, I1__Y_,
- I0_111, I1___Z,
- 0,0}},
- /* 0Y1 */
- {3,{0,2,2,0},{ I0_XYZ, I1__Y_,
- I0_111, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1Y1 */
- {2,{0,2,0,0},{ I0_XYZ, I1__Y_,
- I0_111, I1_X_Z,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XZ1 */
- {3,{0,0,2,0},{ I0_ZZZ, I1__Y_,
- I0_XYZ, I1_X__,
- I0_111, I1___Z,
- 0,0}},
- /* YZ1 */
- {2,{0,2,0,0},{ I0_YZX, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* ZZ1 */
- {2,{0,2,0,0},{ I0_ZZZ, I1_XYZ,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* WZ1 */
- {2,{0,2,0,0},{ I0_WZY, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* 0Z1 */
- {3,{0,2,2,0},{ I0_ZZZ, I1_XYZ,
- I0_111, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1Z1 */
- {2,{0,2,0,0},{ I0_ZZZ, I1__Y_,
- I0_111, I1_X_Z,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* XW1 */
- {3,{0,0,2,0},{ I0_WWW, I1__Y_,
- I0_XYZ, I1_X__,
- I0_111, I1___Z,
- 0,0}},
- /* YW1 */
- {3,{0,2,0,0},{ I0_WWW, I1__Y_,
- I0_111, I1___Z,
- I0_YYY, I1_X__,
- 0,0}},
- /* ZW1 */
- {3,{0,2,0,0},{ I0_WWW, I1__Y_,
- I0_111, I1___Z,
- I0_ZZZ, I1_X__,
- 0,0}},
- /* WW1 */
- {2,{0,2,0,0},{ I0_WWW, I1_XY_,
- I0_111, I1___Z,
- 0,0,0,0}},
- /* 0W1 */
- {3,{0,2,2,0},{ I0_WWW, I1__Y_,
- I0_111, I1___Z,
- I0_000, I1_X__,
- 0,0}},
- /* 1W1 */
- {2,{0,2,0,0},{ I0_WWW, I1__Y_,
- I0_111, I1_X_Z,
- 0,0,0,0}},
- SEMPTY,SEMPTY,
- /* X01 */
- {3,{0,2,2,0},{ I0_XYZ, I1_X__,
- I0_111, I1___Z,
- I0_000, I1__Y_,
- 0,0}},
- /* Y01 */
- {3,{0,2,2,0},{ I0_YYY, I1_X__,
- I0_111, I1___Z,
- I0_000, I1__Y_,
- 0,0}},
- /* Z01 */
- {3,{0,2,2,0},{ I0_ZZZ, I1_X__,
- I0_111, I1___Z,
- I0_000, I1__Y_,
- 0,0}},
- /* W01 */
- {3,{0,2,2,0},{ I0_WZY, I1_XYZ,
- I0_111, I1___Z,
- I0_000, I1__Y_,
- 0,0}},
- /* 001 */
- {2,{2,2,0,0},{ I0_111, I1___Z,
- I0_000, I1_XY_,
- 0,0,0,0}},
- /* 101 */
- {2,{2,2,0,0},{ I0_111, I1_X_Z,
- I0_000, I1__Y_,
- 0, 0, 0, 0 } },
- SEMPTY,SEMPTY,
- /* X11 */
- {2,{0,2,0,0},{ I0_XYZ, I1_X__,
- I0_111, I1__YZ,
- 0,0,0,0}},
- /* Y11 */
- {2,{0,2,0,0},{ I0_YYY, I1_X__,
- I0_111, I1__YZ,
- 0,0,0,0}},
- /* Z11 */
- {2,{0,2,0,0},{ I0_ZZZ, I1_X__,
- I0_111, I1__YZ,
- 0,0,0,0}},
- /* W11 */
- {2,{0,2,0,0},{ I0_WZY, I1_XYZ,
- I0_111, I1__YZ,
- 0,0,0,0}},
- /* 011 */
- {2,{2,2,0,0},{ I0_111, I1__YZ,
- I0_000, I1_X__,
- 0,0,0,0}},
- /* 111 */
- {1,{2,0,0,0},{ I0_111, I1_XYZ,
- 0, 0, 0, 0, 0, 0 } },
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,
- SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY,SEMPTY
-};
-
-/******************************************************************************
-* Color source mask table
-******************************************************************************/
-
-#define S_111 R300_FPI0_ARGC_ONE
-#define S_000 R300_FPI0_ARGC_ZERO
-
-#define S0XXX R300_FPI0_ARGC_SRC0C_XXX
-#define S0YYY R300_FPI0_ARGC_SRC0C_YYY
-#define S0ZZZ R300_FPI0_ARGC_SRC0C_ZZZ
-#define S0WWW R300_FPI0_ARGC_SRC0A
-#define S0XYZ R300_FPI0_ARGC_SRC0C_XYZ
-#define S0ZXY R300_FPI0_ARGC_SRC0C_ZXY
-#define S0YZX R300_FPI0_ARGC_SRC0C_YZX
-#define S0WZY R300_FPI0_ARGC_SRC0CA_WZY
-#define S0WZY R300_FPI0_ARGC_SRC0CA_WZY
-
-#define S1XXX R300_FPI0_ARGC_SRC1C_XXX
-#define S1YYY R300_FPI0_ARGC_SRC1C_YYY
-#define S1ZZZ R300_FPI0_ARGC_SRC1C_ZZZ
-#define S1WWW R300_FPI0_ARGC_SRC1A
-#define S1XYZ R300_FPI0_ARGC_SRC1C_XYZ
-#define S1ZXY R300_FPI0_ARGC_SRC1C_ZXY
-#define S1YZX R300_FPI0_ARGC_SRC1C_YZX
-#define S1WZY R300_FPI0_ARGC_SRC1CA_WZY
-
-#define S2XXX R300_FPI0_ARGC_SRC2C_XXX
-#define S2YYY R300_FPI0_ARGC_SRC2C_YYY
-#define S2ZZZ R300_FPI0_ARGC_SRC2C_ZZZ
-#define S2WWW R300_FPI0_ARGC_SRC2A
-#define S2XYZ R300_FPI0_ARGC_SRC2C_XYZ
-#define S2ZXY R300_FPI0_ARGC_SRC2C_ZXY
-#define S2YZX R300_FPI0_ARGC_SRC2C_YZX
-#define S2WZY R300_FPI0_ARGC_SRC2CA_WZY
-
-#define ntnat 32
-
-const GLuint r300_swz_srcc_mask[3][512] = {
- {
- S0XXX,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0YZX,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0ZXY,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S0YYY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S0WZY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0XYZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0ZZZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S0WWW,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,S_000,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,S_111,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat
- },
- {
- S1XXX,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1YZX,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1ZXY,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S1YYY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S1WZY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1XYZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1ZZZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S1WWW,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,S_000,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,S_111,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat
- },
- {
- S2XXX,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2YZX,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2ZXY,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S2YYY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,S2WZY,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2XYZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2ZZZ,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,S2WWW,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,S_000,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,S_111,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,ntnat,
- ntnat,ntnat
- }
-};
-
-/******************************************************************************
-* Alpha source mask table
-******************************************************************************/
-
-GLuint r300_swz_srca_mask[3][6] = {
- { R300_FPI2_ARGA_SRC0C_X,
- R300_FPI2_ARGA_SRC0C_Y,
- R300_FPI2_ARGA_SRC0C_Z,
- R300_FPI2_ARGA_SRC0A,
- R300_FPI2_ARGA_ZERO,
- R300_FPI2_ARGA_ONE },
- { R300_FPI2_ARGA_SRC1C_X,
- R300_FPI2_ARGA_SRC1C_Y,
- R300_FPI2_ARGA_SRC1C_Z,
- R300_FPI2_ARGA_SRC1A,
- R300_FPI2_ARGA_ZERO,
- R300_FPI2_ARGA_ONE },
- { R300_FPI2_ARGA_SRC2C_X,
- R300_FPI2_ARGA_SRC2C_Y,
- R300_FPI2_ARGA_SRC2C_Z,
- R300_FPI2_ARGA_SRC2A,
- R300_FPI2_ARGA_ZERO,
- R300_FPI2_ARGA_ONE },
-};
diff --git a/src/mesa/drivers/dri/tdfx/BUGS b/src/mesa/drivers/dri/tdfx/BUGS
deleted file mode 100644
index b15f6a91ed8..00000000000
--- a/src/mesa/drivers/dri/tdfx/BUGS
+++ /dev/null
@@ -1,64 +0,0 @@
-REMOVE THIS FILE BEFORE MERGING WITH TRUNK
-------------------------------------------
-
-OUTSTANDING BUGS
-
-demos/reflect - reading back Z on Voodoo3, image offset to right
- Fixed in latest Glide.
-
-Q3 - some polygons drawn as vertical strips, similar to bug that was
- seen in demos/fire. Voodoo3 only. May be related to glDepthMask
- or glColorMask.
-
-book/fog - not fogging
- Fog in orthograph mode still not implemented. Checking with
- 3dfx engineers for ideas.
-
-Q3 demo crashes after changing display settings
- but the full Q3 game version seems OK.
-
-
-
-MORE OUTSTANDING BUGS
-
-private context was NULL! causing immediate failure of any glx prog. cant
-reproduce after restarting the X server. putting it down as halluc.
-
-texture object image was NULL, causing segmentation failure. happens with
-prboom. ive put a check in tdfx_texstate.c but this isn't a fix.
-
-prboom, wall textures near first chainsaw aren't bound properly. sideways
-movements causes the wall textures to move with you. prboom busted?
-
-16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it
-looks like multitexturing gone wrong. i'll disable a tmu and test.
-
-sof, polygons appear at wrong x,y,z positions, intermittent, have not yet
-found reliable way of reproducing. culling? sometimes polys disappear.
-
-descent3 is all black in 16bpp mode - FIXED (palette problems)
-
-smeared pixels in quake3 - FIXED (texture memory overlapped FB)
-
-
-
-PERFORMANCE COMPARISON (Brian / Alan)
-
- V3/16 is Voodoo3 in 16bpp on a P3/500
- V5/16 is Voodoo5 in 16bpp on a P3/600
- V5/32 is Voodoo5 in 32bpp on a P3/600
- V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600
- V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600
-
- tdfx-2-1-branch tdfx-3-0-0-branch
-demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32
-------------------------------------------------------------------------
-gloss 257 183 174 320 308 177 313 167
-fire 42 39 52 41
-fire (no help) 98 80 50 106 113 73 124 80
-tunnel 61 50 70 58
-tunnel (no help) 167 142 57 138 152 113 171 122
-gears 663 554 540 881 1232 776 1484 830
-teapot 20 21 37 36
-teapot (no help) 22 14 14 24 30 30 43 42
-
diff --git a/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S b/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S
deleted file mode 100644
index 0f4cc45089b..00000000000
--- a/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fastpath.S,v 1.2 2000/09/26 15:56:51 tsi Exp $ */
-
-#include "../../X86/assyntax.h"
-
-#define SETUP_RGBA 0x1
-#define SETUP_TMU0 0x2
-#define SETUP_TMU1 0x4
-
-
-/* Pack either rgba or texture into the remaining half of a 32 byte vertex.
- */
-#define CLIP_R 24
-#define CLIP_G 16
-#define CLIP_B 20
-#define CLIP_A 28 /* defined inf fxdrv.h */
-
-#define CLIP_S0 16
-#define CLIP_T0 20
-#define CLIP_S1 24
-#define CLIP_T1 28
-
-#define SIZE 4
-#define TYPE (0)
-#define TAG(x) x
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 8
-#define TYPE (SETUP_RGBA)
-#define TAG(x) x##_RGBA
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 6
-#define TYPE (SETUP_TMU0)
-#define TAG(x) x##_TMU0
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 8
-#define TYPE (SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_TMU0_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-#undef CLIP_S1
-#undef CLIP_T1
-#define CLIP_S1 16
-#define CLIP_T1 20
-
-#define SIZE 6
-#define TYPE (SETUP_TMU1)
-#define TAG(x) x##_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-/* These three need to use a full 64 byte clip-space vertex.
- */
-#undef CLIP_S0
-#undef CLIP_T0
-#undef CLIP_S1
-#undef CLIP_T1
-
-#define CLIP_S0 32
-#define CLIP_T0 36
-#define CLIP_S1 40
-#define CLIP_T1 44
-
-#define SIZE 10
-#define TYPE (SETUP_RGBA|SETUP_TMU0)
-#define TAG(x) x##_RGBA_TMU0
-#include "fx_3dnow_fasttmp.h"
-
-#define SIZE 12
-#define TYPE (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)
-#define TAG(x) x##_RGBA_TMU0_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-#undef CLIP_S1
-#undef CLIP_T1
-#define CLIP_S1 32
-#define CLIP_T1 36
-
-#define SIZE 10
-#define TYPE (SETUP_RGBA|SETUP_TMU1)
-#define TAG(x) x##_RGBA_TMU1
-#include "fx_3dnow_fasttmp.h"
-
-
diff --git a/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h b/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h
deleted file mode 100644
index 9ec4935d781..00000000000
--- a/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/X86/fx_3dnow_fasttmp.h,v 1.2 2000/09/26 15:56:51 tsi Exp $ */
-
-#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER)
-#define TAGLLBL(a) TAG(.L##a)
-#else
-#define TAGLLBL(a) TAG(a)
-#endif
-
-#if !GLIDE3
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 4
-#define GR_VERTEX_Z_OFFSET 8
-#define GR_VERTEX_R_OFFSET 12
-#define GR_VERTEX_G_OFFSET 16
-#define GR_VERTEX_B_OFFSET 20
-#define GR_VERTEX_OOZ_OFFSET 24
-#define GR_VERTEX_A_OFFSET 28
-#define GR_VERTEX_OOW_OFFSET 32
-
-#else /* GLIDE3 */
-
-#define GR_VERTEX_X_OFFSET 0
-#define GR_VERTEX_Y_OFFSET 4
-#define GR_VERTEX_OOZ_OFFSET 8
-#define GR_VERTEX_OOW_OFFSET 12
-#define GR_VERTEX_R_OFFSET 16
-#define GR_VERTEX_G_OFFSET 20
-#define GR_VERTEX_B_OFFSET 24
-#define GR_VERTEX_A_OFFSET 28
-#define GR_VERTEX_Z_OFFSET 32
-
-#endif /* GLIDE3 */
-
-#define GR_VERTEX_SOW_TMU0_OFFSET 36
-#define GR_VERTEX_TOW_TMU0_OFFSET 40
-#define GR_VERTEX_OOW_TMU0_OFFSET 44
-#define GR_VERTEX_SOW_TMU1_OFFSET 48
-#define GR_VERTEX_TOW_TMU1_OFFSET 52
-#define GR_VERTEX_OOW_TMU1_OFFSET 56
-
-
-
-
-/*#define MAT_SX 0 /* accessed by REGIND !! */
-#define MAT_SY 20
-#define MAT_SZ 40
-#define MAT_TX 48
-#define MAT_TY 52
-#define MAT_TZ 56
-
-
-
-
-/* Do viewport map, device scale and perspective projection.
- *
- * void project_verts( GLfloat *first,
- * GLfloat *last,
- * const GLfloat *m,
- * GLuint stride )
- *
- *
- * Rearrange fxVertices to look like grVertices.
- */
-
-GLOBL GLNAME( TAG(fx_3dnow_project_vertices) )
-GLNAME( TAG(fx_3dnow_project_vertices) ):
-
- PUSH_L ( EBP )
-
- MOV_L ( REGOFF(8, ESP), ECX ) /* first_vert */
- MOV_L ( REGOFF(12, ESP), EDX ) /* last_vert */
-
- CMP_L ( ECX, EDX )
- JE ( TAGLLBL(FXPV_end) )
-
- FEMMS
-
- PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
-
- MOV_L ( REGOFF(16, ESP), EBP ) /* matrix */
- MOV_L ( REGOFF(20, ESP), EAX ) /* stride */
-
- MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
- PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
-
-#if !defined(FX_V2)
- MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
- MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
-#endif
-
- MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
- PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
-
- MOVD ( REGIND(EBP), MM5 )
- PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
-
- MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
-
-
-ALIGNTEXT32
-TAGLLBL(FXPV_loop_start):
-
- PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
-
-
- MOVD ( REGOFF(12, ECX), MM0 ) /* | f[3] */
- PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
-
- MOVD ( REGOFF(12, ECX), MM7 ) /* | f[3] */
- PFRCPIT1 ( MM0, MM7 )
- PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
-
- PUNPCKLDQ ( MM7, MM7 )
-
-
-#if (TYPE & SETUP_RGBA)
- MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
- MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
-#endif
-
-#if (TYPE & SETUP_TMU1)
- MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
- PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
-#endif
-
-
-#if (TYPE & SETUP_TMU0)
- MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
- PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
-#endif
-
-
-
-
-
-/* DO_SETUP_XYZ */
-
- MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
- PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
-
- MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
- PFMUL ( MM7, MM3 ) /* | f[2] * oow */
-
- MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
- PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
-
- PFADD ( MM0, MM3 ) /* | f[2] += vtz */
- PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
-
- PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
-
-#if !defined(FX_V2)
- PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
-#endif
-
- MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
- MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
-
-
-/* end of DO_SETUP_XYZ */
-
- MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
- ADD_L ( EAX, ECX ) /* f += stride */
-
- CMP_L ( ECX, EDX ) /* stall??? */
- JA ( TAGLLBL(FXPV_loop_start) )
-
-TAGLLBL(FXPV_end):
- FEMMS
- POP_L ( EBP )
- RET
-
-
-
-
-
-
-
-/* void project_verts( GLfloat *first,
- * GLfloat *last,
- * const GLfloat *m,
- * GLuint stride,
- * const GLubyte *mask )
- *
- */
-
-GLOBL GLNAME( TAG(fx_3dnow_project_clipped_vertices) )
-GLNAME( TAG(fx_3dnow_project_clipped_vertices) ):
-
- PUSH_L ( EBP )
-
- MOV_L ( REGOFF(8, ESP), ECX ) /* first FXDRIVER(VB)->verts*/
- MOV_L ( REGOFF(12, ESP), EDX ) /* last FXDRIVER(VB)->last_vert */
-
- FEMMS
-
- PUSH_L ( EDI )
- PUSH_L ( ESI )
-
- PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */
-
- MOV_L ( REGOFF(24, ESP), EBP ) /* mat ctx->Viewport.WindowMap.M */
- MOV_L ( REGOFF(28, ESP), EAX ) /* stride */
- MOV_L ( REGOFF(32, ESP), ESI ) /* VB->ClipMask */
-
- MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */
- PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */
-
-#if !defined(FX_V2)
- MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */
- MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */
-#endif
-
- MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */
- PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */
-
- MOVD ( REGIND(EBP), MM5 )
- PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */
-
- MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */
-
-
-
-ALIGNTEXT32
-TAGLLBL(FXPCV_loop_start):
-
- PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */
-
- CMP_B ( CONST(0), REGIND(ESI) )
- JNE ( TAGLLBL(FXPCV_skip) )
-
- MOVD ( REGOFF(12, ECX), MM0) /* | f[3] */
- PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */
-
- MOVD ( REGOFF(12, ECX), MM7) /* | f[3] */
- PFRCPIT1 ( MM0, MM7 )
- PFRCPIT2 ( MM0, MM7 ) /* oow | oow */
-
- PUNPCKLDQ ( MM7, MM7 )
-
-
-#if (TYPE & SETUP_RGBA)
- MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */
- MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) )
-#endif
-
-#if (TYPE & SETUP_TMU1)
- MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */
- PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) )
-#endif
-
-
-#if (TYPE & SETUP_TMU0)
- MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */
- PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */
- MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) )
-#endif
-
-
-
-
-/* DO_SETUP_XYZ */
-
- MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */
- PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */
-
- MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */
- PFMUL ( MM7, MM3 ) /* | f[2] * oow */
-
- MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */
- PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */
-
- PFADD ( MM0, MM3 ) /* | f[2] += vtz */
- PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */
-
- PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */
-
-#if !defined(FX_V2)
- PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */
-#endif
-
- MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) )
- MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) )
-
-
-/* end of DO_SETUP_XYZ */
-
- MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */
-
-TAGLLBL(FXPCV_skip):
- ADD_L ( EAX, ECX ) /* f += stride */
-
- INC_L ( ESI ) /* next ClipMask */
- CMP_L ( ECX, EDX )
- JA ( TAGLLBL(FXPCV_loop_start) )
-
- POP_L ( ESI )
- POP_L ( EDI )
-
-TAGLLBL(FXPCV_end):
- FEMMS
- POP_L ( EBP )
- RET
-
-
-
-#undef TYPE
-#undef TAG
-#undef SIZE
-
diff --git a/src/mesa/drivers/ggi/default/.cvsignore b/src/mesa/drivers/ggi/default/.cvsignore
deleted file mode 100644
index c8a526b14d7..00000000000
--- a/src/mesa/drivers/ggi/default/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-genkgi.conf
diff --git a/src/mesa/drivers/ggi/default/genkgi.h b/src/mesa/drivers/ggi/default/genkgi.h
deleted file mode 100644
index 1202150060b..00000000000
--- a/src/mesa/drivers/ggi/default/genkgi.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $Id: genkgi.h,v 1.3 1999-08-22 08:56:50 jtaylor Exp $
-******************************************************************************
-
- GGIMesa - KGIcon specific overrides for fbcon-mesa
- API header
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************************
-*/
-
-#ifndef _GENKGI_MESA_H
-#define _GENKGI_MESA_H
-
-#undef KGI_USE_PPBUFS
-
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <kgi/kgi.h>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-/* FIXME: LibGGI needs to export its genkgi.h */
-struct genkgi_priv
-{
- ggi_gc *mapped_gc;
- unsigned int gc_size;
- ggifunc_drawline *drawline;
- ggifunc_drawbox *drawbox;
- ggifunc_fillscreen *fillscreen;
- int fd_gc;
- int close_gc;
- int fd_kgicommand;
- uint8 *mapped_kgicommand;
- uint8 *kgicommand_ptr;
- unsigned int kgicommand_buffersize;
-};
-
-#define GENKGI_PRIV(vis) ((struct genkgi_priv *)FBDEV_PRIV(vis)->accelpriv)
-
-extern ggifunc_getapi GGIMesa_genkgi_getapi;
-extern ggifunc_flush GGIMesa_genkgi_flush;
-
-struct genkgi_priv_mesa
-{
- char accel[100];
- int have_accel;
- void *accelpriv; /* Private data of subdrivers */
- struct genkgi_priv *oldpriv; /* LibGGI's private data */
-};
-
-#define GENKGI_PRIV_MESA(vis) ((struct genkgi_priv_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv)
-
-#endif /* _GENKHI_MESA_H */
diff --git a/src/mesa/drivers/ggi/display/.cvsignore b/src/mesa/drivers/ggi/display/.cvsignore
deleted file mode 100644
index 98858db2c0e..00000000000
--- a/src/mesa/drivers/ggi/display/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-fbdev.conf
diff --git a/src/mesa/drivers/windows/fx/fx.rc b/src/mesa/drivers/windows/fx/fx.rc
deleted file mode 100644
index f920b8768dd..00000000000
--- a/src/mesa/drivers/windows/fx/fx.rc
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <windows.h>
-
-#define PRODNAME "Mesa 6.x"
-#define CONTACTSTR "http://www.mesa3d.org"
-#define HWSTR "3dfx Voodoo Graphics, Voodoo Rush, Voodoo^2, Voodoo Banshee, Velocity 100/200, Voodoo3, Voodoo4, Voodoo5"
-#define COPYRIGHTSTR "Copyright \251 Brian E. Paul"
-
-#define VERSIONSTR "6.3.0.1"
-#define MANVERSION 6
-#define MANREVISION 3
-#define BUILD_NUMBER 1
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
- PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
- FILEFLAGSMASK 0x0030003FL
-
- FILEOS VOS_DOS_WINDOWS32
- FILETYPE VFT_DRV
- FILESUBTYPE VFT2_DRV_INSTALLABLE
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904E4"
- BEGIN
- VALUE "FileDescription", PRODNAME
- VALUE "FileVersion", VERSIONSTR
- VALUE "LegalCopyright", COPYRIGHTSTR
- VALUE "ProductName", PRODNAME
- VALUE "Graphics Subsystem", HWSTR
- VALUE "Contact", CONTACTSTR
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- /* the following line should be extended for localized versions */
- VALUE "Translation", 0x409, 1252
- END
-END
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c
deleted file mode 100644
index cad299540d7..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c
+++ /dev/null
@@ -1,1196 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Driver interface code to Mesa
-*
-****************************************************************************/
-
-//#include <windows.h>
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-extern BOOL dglSwapBuffers(HDC hDC);
-
-// HACK: Hack the _33 member of the OpenGL perspective projection matrix
-const float _fPersp_33 = 1.6f;
-
-//---------------------------------------------------------------------------
-// Internal functions
-//---------------------------------------------------------------------------
-
-void _gld_mesa_warning(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal warning mechanism
- gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str);
-}
-
-//---------------------------------------------------------------------------
-
-void _gld_mesa_fatal(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal fatal-message mechanism
- gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str);
-
- // Mesa calls abort(0) here.
- ddlogClose();
- exit(0);
-}
-
-//---------------------------------------------------------------------------
-
-D3DSTENCILOP _gldConvertStencilOp(
- GLenum StencilOp)
-{
- // Used by Stencil: pass, fail and zfail
-
- switch (StencilOp) {
- case GL_KEEP:
- return D3DSTENCILOP_KEEP;
- case GL_ZERO:
- return D3DSTENCILOP_ZERO;
- case GL_REPLACE:
- return D3DSTENCILOP_REPLACE;
- case GL_INCR:
- return D3DSTENCILOP_INCRSAT;
- case GL_DECR:
- return D3DSTENCILOP_DECRSAT;
- case GL_INVERT:
- return D3DSTENCILOP_INVERT;
- case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_INCR;
- case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_DECR;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n");
-#endif
-
- return D3DSTENCILOP_KEEP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DCMPFUNC _gldConvertCompareFunc(
- GLenum CmpFunc)
-{
- // Used for Alpha func, depth func and stencil func.
-
- switch (CmpFunc) {
- case GL_NEVER:
- return D3DCMP_NEVER;
- case GL_LESS:
- return D3DCMP_LESS;
- case GL_EQUAL:
- return D3DCMP_EQUAL;
- case GL_LEQUAL:
- return D3DCMP_LESSEQUAL;
- case GL_GREATER:
- return D3DCMP_GREATER;
- case GL_NOTEQUAL:
- return D3DCMP_NOTEQUAL;
- case GL_GEQUAL:
- return D3DCMP_GREATEREQUAL;
- case GL_ALWAYS:
- return D3DCMP_ALWAYS;
- };
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n");
-#endif
-
- return D3DCMP_ALWAYS;
-}
-
-//---------------------------------------------------------------------------
-
-D3DBLEND _gldConvertBlendFunc(
- GLenum blend,
- GLenum DefaultBlend)
-{
- switch (blend) {
- case GL_ZERO:
- return D3DBLEND_ZERO;
- case GL_ONE:
- return D3DBLEND_ONE;
- case GL_DST_COLOR:
- return D3DBLEND_DESTCOLOR;
- case GL_SRC_COLOR:
- return D3DBLEND_SRCCOLOR;
- case GL_ONE_MINUS_DST_COLOR:
- return D3DBLEND_INVDESTCOLOR;
- case GL_ONE_MINUS_SRC_COLOR:
- return D3DBLEND_INVSRCCOLOR;
- case GL_SRC_ALPHA:
- return D3DBLEND_SRCALPHA;
- case GL_ONE_MINUS_SRC_ALPHA:
- return D3DBLEND_INVSRCALPHA;
- case GL_DST_ALPHA:
- return D3DBLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return D3DBLEND_INVDESTALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return D3DBLEND_SRCALPHASAT;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n");
-#endif
-
- return DefaultBlend;
-}
-
-//---------------------------------------------------------------------------
-// Misc. functions
-//---------------------------------------------------------------------------
-
-void gld_Noop_DX7(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Error_DX7(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- // Quite useless.
-// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Required Mesa functions
-//---------------------------------------------------------------------------
-
-static GLboolean gld_set_draw_buffer_DX7(
- GLcontext *ctx,
- GLenum mode)
-{
- (void) ctx;
- if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_set_read_buffer_DX7(
- GLcontext *ctx,
- GLframebuffer *buffer,
- GLenum mode)
-{
- /* separate read buffer not supported */
-/*
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(mode == GL_FRONT_LEFT);
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Clear_DX7(
- GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint x,
- GLint y,
- GLint width,
- GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DCOLOR Color = 0;
- float Z = 0.0f;
- DWORD Stencil = 0;
- D3DRECT d3dClearRect;
-
- // TODO: Colourmask
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (!gld->pDev)
- return;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]);
- dwFlags |= D3DCLEAR_TARGET;
- Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]);
-// ctx->Color.ClearColor[1],
-// ctx->Color.ClearColor[2],
-// ctx->Color.ClearColor[3]);
- }
-
- if (mask & DD_DEPTH_BIT) {
- // D3D7 will fail the Clear call if we try and clear a
- // depth buffer and we haven't created one.
- // Also, some apps try and clear a depth buffer,
- // when a depth buffer hasn't been requested by the app.
- if (ctx->Visual.depthBits == 0) {
- mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask
- } else {
- dwFlags |= D3DCLEAR_ZBUFFER;
- Z = ctx->Depth.Clear;
- }
- }
-
- if (mask & DD_STENCIL_BIT) {
- if (ctx->Visual.stencilBits == 0) {
- // No stencil bits in depth buffer
- mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask
- } else {
- dwFlags |= D3DCLEAR_STENCIL;
- Stencil = ctx->Stencil.Clear;
- }
- }
-
- // Some apps do really weird things with the rect, such as Quake3.
- if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) {
- all = GL_TRUE;
- }
-
- if (!all) {
- // Calculate clear subrect
- d3dClearRect.x1 = x;
- d3dClearRect.y1 = gldCtx->dwHeight - (y + height);
- d3dClearRect.x2 = x + width;
- d3dClearRect.y2 = d3dClearRect.y1 + height;
- }
-
- // dwFlags will be zero if there's nothing to clear
- if (dwFlags) {
- _GLD_DX7_DEV(Clear(
- gld->pDev,
- all ? 0 : 1,
- all ? NULL : &d3dClearRect,
- dwFlags,
- Color, Z, Stencil));
- }
-
- if (mask & DD_ACCUM_BIT) {
- // Clear accumulation buffer
- }
-}
-
-//---------------------------------------------------------------------------
-
-// Mesa 5: Parameter change
-static void gld_buffer_size_DX7(
-// GLcontext *ctx,
- GLframebuffer *fb,
- GLuint *width,
- GLuint *height)
-{
-// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
-
- *width = fb->Width; // gldCtx->dwWidth;
- *height = fb->Height; // gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Finish_DX7(
- GLcontext *ctx)
-{
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Flush_DX7(
- GLcontext *ctx)
-{
- GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- // TODO: Detect apps that glFlush() then SwapBuffers() ?
-
- if (gld->EmulateSingle) {
- // Emulating a single-buffered context.
- // [Direct3D doesn't allow rendering to front buffer]
- dglSwapBuffers(gld->hDC);
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_STENCIL(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Two-sided stencil. New for Mesa 5
- const GLuint uiFace = 0UL;
-
- struct gl_stencil_attrib *pStencil = &ctx->Stencil;
-
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE));
- if (pStencil->Enabled) {
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace])));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILREF, pStencil->Ref[uiFace]));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILMASK, pStencil->ValueMask[uiFace]));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILWRITEMASK, pStencil->WriteMask[uiFace]));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace])));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace])));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace])));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_COLOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DBLEND src;
- D3DBLEND dest;
-
- // Alpha func
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc)));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAREF, (DWORD)ctx->Color.AlphaRef));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHATESTENABLE, ctx->Color.AlphaEnabled));
-
- // Blend func
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHABLENDENABLE, ctx->Color.BlendEnabled));
- src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE);
- dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO);
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SRCBLEND, src));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_DESTBLEND, dest));
-
-/*
- // Color mask - unsupported by DX7
- if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED;
- if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN;
- if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE;
- if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA;
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_COLORWRITEENABLE, dwFlags));
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_DEPTH(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func)));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_POLYGON(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DFILLMODE d3dFillMode = D3DFILL_SOLID;
- D3DCULL d3dCullMode = D3DCULL_NONE;
- int iOffset = 0;
-
- // Fillmode
- switch (ctx->Polygon.FrontMode) {
- case GL_POINT:
- d3dFillMode = D3DFILL_POINT;
- break;
- case GL_LINE:
- d3dFillMode = D3DFILL_WIREFRAME;
- break;
- case GL_FILL:
- d3dFillMode = D3DFILL_SOLID;
- break;
- }
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FILLMODE, d3dFillMode));
-
- if (ctx->Polygon.CullFlag) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CW;
- else
- d3dCullMode = D3DCULL_CCW;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CCW;
- else
- d3dCullMode = D3DCULL_CW;
- break;
- case GL_FRONT_AND_BACK:
- d3dCullMode = D3DCULL_NONE;
- break;
- default:
- break;
- }
- } else {
- d3dCullMode = D3DCULL_NONE;
- }
-// d3dCullMode = D3DCULL_NONE; // TODO: DEBUGGING
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, d3dCullMode));
-
- // Polygon offset
- // ZBIAS ranges from 0 to 16 and can only move towards the viewer
- // Mesa5: ctx->Polygon._OffsetAny removed
- if (ctx->Polygon.OffsetFill) {
- iOffset = (int)ctx->Polygon.OffsetUnits;
- if (iOffset < 0)
- iOffset = -iOffset;
- else
- iOffset = 0; // D3D can't push away
- }
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_ZBIAS, iOffset));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_FOG(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DCOLOR d3dFogColour;
- D3DFOGMODE d3dFogMode = D3DFOG_LINEAR;
-
- // TODO: Fog is calculated seperately in the Mesa pipeline
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGENABLE, FALSE));
- return;
-
- // Fog enable
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGENABLE, ctx->Fog.Enabled));
- if (!ctx->Fog.Enabled) {
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGTABLEMODE, D3DFOG_NONE));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE));
- return; // If disabled, don't bother setting any fog state
- }
-
- // Fog colour
- d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0],
- ctx->Fog.Color[1],
- ctx->Fog.Color[2],
- ctx->Fog.Color[3]);
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGCOLOR, d3dFogColour));
-
- // Fog density
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density))));
-
- // Fog start
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGSTART, *((DWORD*) (&ctx->Fog.Start))));
-
- // Fog end
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGEND, *((DWORD*) (&ctx->Fog.End))));
-
- // Fog mode
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- d3dFogMode = D3DFOG_LINEAR;
- break;
- case GL_EXP:
- d3dFogMode = D3DFOG_EXP;
- break;
- case GL_EXP2:
- d3dFogMode = D3DFOG_EXP2;
- break;
- }
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGTABLEMODE, d3dFogMode));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_NONE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_LIGHT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
- DWORD dwSpecularEnable;
-
- // Shademode
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT));
-
- // Separate specular colour
- if (ctx->Light.Enabled)
- dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE;
- else
- dwSpecularEnable = FALSE;
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SPECULARENABLE, dwSpecularEnable));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_MODELVIEW(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ModelView.m;
- // Mesa5: Model-view is now a stack
- GLfloat *pM = ctx->ModelviewMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10];
- m._34 = pM[11];
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14];
- m._44 = pM[15];
-/* m[0][0] = pM[0];
- m[0][1] = pM[1];
- m[0][2] = pM[2];
- m[0][3] = pM[3];
- m[1][0] = pM[4];
- m[1][1] = pM[5];
- m[1][2] = pM[6];
- m[1][3] = pM[7];
- m[2][0] = pM[8];
- m[2][1] = pM[9];
- m[2][2] = pM[10];
- m[2][3] = pM[11];
- m[3][0] = pM[12];
- m[3][1] = pM[13];
- m[3][2] = pM[14];
- m[3][3] = pM[15];*/
-
- gld->matModelView = m;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_PROJECTION(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ProjectionMatrix.m;
- // Mesa 5: Now a stack
- GLfloat *pM = ctx->ProjectionMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
-
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
-
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10] / _fPersp_33; // / 1.6f;
- m._34 = pM[11];
-
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14] / 2.0f;
- m._44 = pM[15];
-
- gld->matProjection = m;
-}
-
-//---------------------------------------------------------------------------
-/*
-void gldFrustumHook_DX7(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Frustum(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = farval / (nearval - farval);
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval);
-}
-
-//---------------------------------------------------------------------------
-
-void gldOrthoHook_DX7(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Ortho(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = 1.6f;
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval);
-}
-*/
-//---------------------------------------------------------------------------
-
-void gld_NEW_VIEWPORT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DVIEWPORT7 d3dvp;
-// GLint x, y;
-// GLsizei w, h;
-
- // Set depth range
- _GLD_DX7_DEV(GetViewport(gld->pDev, &d3dvp));
- // D3D can't do Quake1/Quake2 z-trick
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.dvMinZ = ctx->Viewport.Near;
- d3dvp.dvMaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.dvMinZ = ctx->Viewport.Far;
- d3dvp.dvMaxZ = ctx->Viewport.Near;
- }
-/* x = ctx->Viewport.X;
- y = ctx->Viewport.Y;
- w = ctx->Viewport.Width;
- h = ctx->Viewport.Height;
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;*/
- _GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp));
-
-// gld->fFlipWindowY = (float)gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
-{
- struct gl_eval_attrib *eval = &ctx->Eval;
-
- if ((eval->AutoNormal) ||
- (eval->Map1Color4) ||
- (eval->Map1Index) ||
- (eval->Map1Normal) ||
- (eval->Map1TextureCoord1) ||
- (eval->Map1TextureCoord2) ||
- (eval->Map1TextureCoord3) ||
- (eval->Map1TextureCoord4) ||
- (eval->Map1Vertex3) ||
- (eval->Map1Vertex4) ||
- (eval->Map2Color4) ||
- (eval->Map2Index) ||
- (eval->Map2Normal) ||
- (eval->Map2TextureCoord1) ||
- (eval->Map2TextureCoord2) ||
- (eval->Map2TextureCoord3) ||
- (eval->Map2TextureCoord4) ||
- (eval->Map2Vertex3) ||
- (eval->Map2Vertex4)
- )
- return TRUE;
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
- GLD_driver_dx7 *gld)
-{
-// return TRUE; // DEBUGGING: ALWAYS USE MESA
-// return FALSE; // DEBUGGING: ALWAYS USE D3D
-
- if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE))
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE; // Force Mesa TnL
- }
-
- if ((ctx->Light.Enabled) ||
- (1) ||
- (ctx->Texture._TexGenEnabled) ||
- (ctx->Texture._TexMatEnabled) ||
-// (ctx->Transform._AnyClip) ||
- (ctx->Scissor.Enabled) ||
- _gldAnyEvalEnabled(ctx) // Put this last so we can early-out
- )
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE;
- }
-
- gld->PipelineUsage.qwD3DFVF.QuadPart++;
- return FALSE;
-
-/* // Force Mesa pipeline?
- if (glb.dwTnL == GLDS_TNL_MESA) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Test for functionality not exposed in the D3D pathways
- if ((ctx->Texture._GenFlags)) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Now decide if vertex shader can be used.
- // If two sided lighting is enabled then we must either
- // use Mesa TnL or the vertex shader
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) {
- // Use Vertex Shader
- gld->PipelineUsage.dwD3D2SVS.QuadPart++;
- return GLD_PIPELINE_D3D_VS_TWOSIDE;
- } else {
- // Use Mesa TnL
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
- }
-
- // Must be D3D fixed-function pipeline
- gld->PipelineUsage.dwD3DFVF.QuadPart++;
- return GLD_PIPELINE_D3D_FVF;
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_update_state_DX7(
- GLcontext *ctx,
- GLuint new_state)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLD_pb_dx7 *gldPB;
-
- if (!gld || !gld->pDev)
- return;
-
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-
- // SetupIndex will be used in the pipelines for choosing setup function
- if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) ||
- (ctx->Fog.Enabled))
- {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT_EXTRAS;
- else
- gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS;
- } else {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture
- else
- gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture
- }
-
- gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld);
- if (gld->bUseMesaTnL) {
- gldPB = &gld->PB2d;
- // DX7 Does not implement D3DRS_SOFTWAREVERTEXPROCESSING
-// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, TRUE));
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, FALSE));
-// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
- } else {
- gldPB = &gld->PB3d;
- _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, TRUE));
-// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) {
-// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware));
-// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
-// } else {
- // DX7 Does not implement D3DRS_SOFTWAREVERTEXPROCESSING
-// _GLD_DX7_DEV(SetRenderState(gld->pDev, D3DRENDERSTATE_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL));
-// _GLD_DX7_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
-// }
- }
-
-#define _GLD_TEST_STATE(a) \
- if (new_state & (a)) { \
- gld##a(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_TEST_STATE_DX7(a) \
- if (new_state & (a)) { \
- gld##a##_DX7(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_IGNORE_STATE(a) new_state &= ~(a);
-
-// if (!gld->bUseMesaTnL) {
- // Not required if Mesa is doing the TnL.
- // Problem: If gld->bUseMesaTnL is TRUE when these are signaled,
- // then we'll miss updating the D3D TnL pipeline.
- // Therefore, don't test for gld->bUseMesaTnL
- _GLD_TEST_STATE(_NEW_MODELVIEW);
- _GLD_TEST_STATE(_NEW_PROJECTION);
-// }
-
- _GLD_TEST_STATE_DX7(_NEW_TEXTURE); // extern, so guard with _DX7
- _GLD_TEST_STATE(_NEW_COLOR);
- _GLD_TEST_STATE(_NEW_DEPTH);
- _GLD_TEST_STATE(_NEW_POLYGON);
- _GLD_TEST_STATE(_NEW_STENCIL);
- _GLD_TEST_STATE(_NEW_FOG);
- _GLD_TEST_STATE(_NEW_LIGHT);
- _GLD_TEST_STATE(_NEW_VIEWPORT);
-
- _GLD_IGNORE_STATE(_NEW_TRANSFORM);
-
-
-// Stubs for future use.
-/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_STATE(_NEW_ACCUM);
- _GLD_TEST_STATE(_NEW_EVAL);
- _GLD_TEST_STATE(_NEW_HINT);
- _GLD_TEST_STATE(_NEW_LINE);
- _GLD_TEST_STATE(_NEW_PIXEL);
- _GLD_TEST_STATE(_NEW_POINT);
- _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_STATE(_NEW_SCISSOR);
- _GLD_TEST_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_STATE(_NEW_ARRAY);
- _GLD_TEST_STATE(_NEW_RENDERMODE);
- _GLD_TEST_STATE(_NEW_BUFFERS);
- _GLD_TEST_STATE(_NEW_MULTISAMPLE);
-*/
-
-// For debugging.
-#if 0
-#define _GLD_TEST_UNHANDLED_STATE(a) \
- if (new_state & (a)) { \
- gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \
- }
- _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM);
- _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_HINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_LINE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY);
- _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS);
- _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE);
-#undef _GLD_UNHANDLED_STATE
-#endif
-
-#undef _GLD_TEST_STATE
-}
-
-//---------------------------------------------------------------------------
-// Viewport
-//---------------------------------------------------------------------------
-
-void gld_Viewport_DX7(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DVIEWPORT7 d3dvp;
-
- if (!gld || !gld->pDev)
- return;
-
- // This is a hack. When the app is minimized, Mesa passes
- // w=1 and h=1 for viewport dimensions. Without this test
- // we get a GPF in gld_wgl_resize_buffers().
- if ((w==1) && (h==1))
- return;
-
- // Call ResizeBuffersMESA. This function will early-out
- // if no resize is needed.
- //ctx->Driver.ResizeBuffersMESA(ctx);
- // Mesa 5: Changed parameters
- ctx->Driver.ResizeBuffers(gldCtx->glBuffer);
-
-#if 0
- ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
-#endif
-
- // ** D3D viewport must not be outside the render target surface **
- // Sanity check the GL viewport dimensions
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
-
- d3dvp.dwX = x;
- d3dvp.dwY = gldCtx->dwHeight - (y + h);
- d3dvp.dwWidth = w;
- d3dvp.dwHeight = h;
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.dvMinZ = ctx->Viewport.Near;
- d3dvp.dvMaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.dvMinZ = ctx->Viewport.Far;
- d3dvp.dvMaxZ = ctx->Viewport.Near;
- }
-
- // TODO: DEBUGGING
-// d3dvp.MinZ = 0.0f;
-// d3dvp.MaxZ = 1.0f;
-
- _GLD_DX7_DEV(SetViewport(gld->pDev, &d3dvp));
-
-}
-
-//---------------------------------------------------------------------------
-
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
-
-// Mesa 5: Parameter change
-void gldResizeBuffers_DX7(
-// GLcontext *ctx)
- GLframebuffer *fb)
-{
- GET_CURRENT_CONTEXT(ctx);
- dglWglResizeBuffers(ctx, TRUE);
-}
-
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-// This is only for debugging.
-// To use, plug into ctx->Driver.Enable pointer below.
-void gld_Enable(
- GLcontext *ctx,
- GLenum e,
- GLboolean b)
-{
- char buf[1024];
- sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE");
- ddlogMessage(DDLOG_SYSTEM, buf);
-}
-#endif
-//---------------------------------------------------------------------------
-// Driver pointer setup
-//---------------------------------------------------------------------------
-
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
-
-void gldSetupDriverPointers_DX7(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- // Mandatory functions
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = gld_update_state_DX7;
- ctx->Driver.Clear = gld_Clear_DX7;
- ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX7;
- ctx->Driver.GetBufferSize = gld_buffer_size_DX7;
- ctx->Driver.Finish = gld_Finish_DX7;
- ctx->Driver.Flush = gld_Flush_DX7;
- ctx->Driver.Error = gld_Error_DX7;
-
- // Hardware accumulation buffer
- ctx->Driver.Accum = NULL; // TODO: gld_Accum;
-
- // Bitmap functions
- ctx->Driver.CopyPixels = gld_CopyPixels_DX7;
- ctx->Driver.DrawPixels = gld_DrawPixels_DX7;
- ctx->Driver.ReadPixels = gld_ReadPixels_DX7;
- ctx->Driver.Bitmap = gld_Bitmap_DX7;
-
- // Buffer resize
- ctx->Driver.ResizeBuffers = gldResizeBuffers_DX7;
-
- // Texture image functions
- ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX7;
- ctx->Driver.TexImage1D = gld_TexImage1D_DX7;
- ctx->Driver.TexImage2D = gld_TexImage2D_DX7;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX7;
- ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX7;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX7; //NULL;
- ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX7; //NULL;
- ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX7; //NULL;
- ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX7; //NULL;
- ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX7;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- // Texture object functions
- ctx->Driver.BindTexture = NULL;
- ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!;
- ctx->Driver.DeleteTexture = gld_DeleteTexture_DX7;
- ctx->Driver.PrioritizeTexture = NULL;
-
- // Imaging functionality
- ctx->Driver.CopyColorTable = NULL;
- ctx->Driver.CopyColorSubTable = NULL;
- ctx->Driver.CopyConvolutionFilter1D = NULL;
- ctx->Driver.CopyConvolutionFilter2D = NULL;
-
- // State changing functions
- ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc;
- ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc;
- ctx->Driver.ClearColor = NULL; //gld_ClearColor;
- ctx->Driver.ClearDepth = NULL; //gld_ClearDepth;
- ctx->Driver.ClearStencil = NULL; //gld_ClearStencil;
- ctx->Driver.ColorMask = NULL; //gld_ColorMask;
- ctx->Driver.CullFace = NULL; //gld_CullFace;
- ctx->Driver.ClipPlane = NULL; //gld_ClipPlane;
- ctx->Driver.FrontFace = NULL; //gld_FrontFace;
- ctx->Driver.DepthFunc = NULL; //gld_DepthFunc;
- ctx->Driver.DepthMask = NULL; //gld_DepthMask;
- ctx->Driver.DepthRange = NULL;
- ctx->Driver.Enable = NULL; //gld_Enable;
- ctx->Driver.Fogfv = NULL; //gld_Fogfv;
- ctx->Driver.Hint = NULL; //gld_Hint;
- ctx->Driver.Lightfv = NULL; //gld_Lightfv;
- ctx->Driver.LightModelfv = NULL; //gld_LightModelfv;
- ctx->Driver.LineStipple = NULL; //gld_LineStipple;
- ctx->Driver.LineWidth = NULL; //gld_LineWidth;
- ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode;
- ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv;
- ctx->Driver.PointSize = NULL; //gld_PointSize;
- ctx->Driver.PolygonMode = NULL; //gld_PolygonMode;
- ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset;
- ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple;
- ctx->Driver.RenderMode = NULL; //gld_RenderMode;
- ctx->Driver.Scissor = NULL; //gld_Scissor;
- ctx->Driver.ShadeModel = NULL; //gld_ShadeModel;
- ctx->Driver.StencilFunc = NULL; //gld_StencilFunc;
- ctx->Driver.StencilMask = NULL; //gld_StencilMask;
- ctx->Driver.StencilOp = NULL; //gld_StencilOp;
- ctx->Driver.TexGen = NULL; //gld_TexGen;
- ctx->Driver.TexEnv = NULL;
- ctx->Driver.TexParameter = NULL;
- ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix;
- ctx->Driver.Viewport = gld_Viewport_DX7;
-
- _swsetup_Wakeup(ctx);
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX7;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
-
- // Hook into glFrustum() and glOrtho()
-// ctx->Exec->Frustum = gldFrustumHook_DX7;
-// ctx->Exec->Ortho = gldOrthoHook_DX7;
-
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h
deleted file mode 100644
index b5a491e41b1..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_dx7.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 7.0a header file
-*
-****************************************************************************/
-
-#ifndef _GLD_DX7_H
-#define _GLD_DX7_H
-
-//---------------------------------------------------------------------------
-// Windows includes
-//---------------------------------------------------------------------------
-
-#define DIRECTDRAW_VERSION 0x0700
-#define DIRECT3D_VERSION 0x0700
-#include <d3d.h>
-#include <d3dx.h>
-
-// Typedef for obtaining function from d3d7.dll
-//typedef IDirect3D7* (WINAPI *FNDIRECT3DCREATE7) (UINT);
-
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-
-#ifdef _DEBUG
-// Debug build tests the return value of D3D calls
-#define _GLD_TEST_HRESULT(h) \
-{ \
- HRESULT _hr = (h); \
- if (FAILED(_hr)) { \
- gldLogError(GLDLOG_ERROR, #h, _hr); \
- } \
-}
-#define _GLD_DX7(func) _GLD_TEST_HRESULT(IDirect3D7_##func##)
-#define _GLD_DX7_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice7_##func##)
-#define _GLD_DX7_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer7_##func##)
-#define _GLD_DX7_TEX(func) _GLD_TEST_HRESULT(IDirectDrawSurface7_##func##)
-#else
-#define _GLD_DX7(func) IDirect3D7_##func
-#define _GLD_DX7_DEV(func) IDirect3DDevice7_##func
-#define _GLD_DX7_VB(func) IDirect3DVertexBuffer7_##func
-#define _GLD_DX7_TEX(func) IDirectDrawSurface7_##func
-#endif
-
-#define SAFE_RELEASE(p) \
-{ \
- if (p) { \
- (p)->lpVtbl->Release(p); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_VB7(p) \
-{ \
- if (p) { \
- IDirect3DVertexBuffer7_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_SURFACE7(p) \
-{ \
- if (p) { \
- IDirectDrawSurface7_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-// Emulate some DX8 defines
-#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
-#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
-#define D3DCOLOR_COLORVALUE(r,g,b,a) D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
-
-
-// Setup index.
-enum {
- GLD_SI_FLAT = 0,
- GLD_SI_SMOOTH = 1,
- GLD_SI_FLAT_EXTRAS = 2,
- GLD_SI_SMOOTH_EXTRAS = 3,
-};
-
-//---------------------------------------------------------------------------
-// Vertex definitions for Fixed-Function pipeline
-//---------------------------------------------------------------------------
-
-//
-// NOTE: If the number of texture units is altered then most of
-// the texture code will need to be revised.
-//
-
-#define GLD_MAX_TEXTURE_UNITS_DX7 2
-
-//
-// 2D vertex transformed by Mesa
-//
-#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \
- D3DFVF_DIFFUSE | \
- D3DFVF_SPECULAR | \
- D3DFVF_TEX2)
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT sz; // Screen Z (depth)
- FLOAT rhw; // Reciprocal homogenous W
- DWORD diffuse; // Diffuse colour
- DWORD specular; // For separate-specular support
- FLOAT t0_u, t0_v; // 1st set of texture coords
- FLOAT t1_u, t1_v; // 2nd set of texture coords
-} GLD_2D_VERTEX;
-
-
-//
-// 3D vertex transformed by Direct3D
-//
-#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \
- D3DFVF_DIFFUSE | \
- D3DFVF_TEX2)
-
-typedef struct {
- D3DXVECTOR3 Position; // XYZ Vector in object space
- D3DCOLOR Diffuse; // Diffuse colour
- D3DXVECTOR2 TexUnit0; // Texture unit 0
- D3DXVECTOR2 TexUnit1; // Texture unit 1
-} GLD_3D_VERTEX;
-
-//---------------------------------------------------------------------------
-// Structs
-//---------------------------------------------------------------------------
-
-// This keeps a count of how many times we choose each individual internal
-// pathway. Useful for seeing if a certain pathway was ever used by an app, and
-// how much each pathway is biased.
-// Zero the members at context creation and dump stats at context deletion.
-typedef struct {
- // Note: DWORD is probably too small
- ULARGE_INTEGER qwMesa; // Mesa TnL pipeline
- ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline
-} GLD_pipeline_usage;
-
-// GLDirect Primitive Buffer (points, lines, triangles and quads)
-typedef struct {
- // Data for IDirect3D7::CreateVertexBuffer()
- DWORD dwStride; // Stride of vertex
- DWORD dwCreateFlags; // Create flags
- DWORD dwFVF; // Direct3D Flexible Vertex Format
-
- IDirect3DVertexBuffer7 *pVB; // Holds points, lines, tris and quads.
-
- // Point list is assumed to be at start of buffer
- DWORD iFirstLine; // Index of start of line list
- DWORD iFirstTriangle; // Index of start of triangle list
-
- BYTE *pPoints; // Pointer to next free point
- BYTE *pLines; // Pointer to next free line
- BYTE *pTriangles; // Pointer to next free triangle
-
- DWORD nPoints; // Number of points ready to render
- DWORD nLines; // Number of lines ready to render
- DWORD nTriangles; // Number of triangles ready to render
-} GLD_pb_dx7;
-
-// GLDirect DX7 driver data
-typedef struct {
- // GLDirect vars
- BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered)
- BOOL bDepthStencil; // Depth buffer needed (stencil optional)
- D3DX_SURFACEFORMAT RenderFormat; // Format of back/front buffer
- D3DX_SURFACEFORMAT DepthFormat; // Format of depth/stencil
-
- // Direct3D vars
- DDCAPS ddCaps;
- D3DDEVICEDESC7 d3dCaps;
- BOOL bHasHWTnL; // Device has Hardware Transform/Light?
- ID3DXContext *pD3DXContext; // Base D3DX context
- IDirectDraw7 *pDD; // DirectDraw7 interface
- IDirect3D7 *pD3D; // Base Direct3D7 interface
- IDirect3DDevice7 *pDev; // Direct3D7 Device interface
- GLD_pb_dx7 PB2d; // Vertices transformed by Mesa
- GLD_pb_dx7 PB3d; // Vertices transformed by Direct3D
- D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type
- D3DMATRIX matProjection; // Projection matrix for D3D TnL
- D3DMATRIX matModelView; // Model/View matrix for D3D TnL
- int iSetupFunc; // Which setup functions to use
- BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL
-
- GLD_pipeline_usage PipelineUsage;
-} GLD_driver_dx7;
-
-#define GLD_GET_DX7_DRIVER(c) (GLD_driver_dx7*)(c)->glPriv
-
-//---------------------------------------------------------------------------
-// Function prototypes
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX7(LPCSTR a);
-void gldEnableExtensions_DX7(GLcontext *ctx);
-void gldInstallPipeline_DX7(GLcontext *ctx);
-void gldSetupDriverPointers_DX7(GLcontext *ctx);
-void gldResizeBuffers_DX7(GLframebuffer *fb);
-
-
-// Texture functions
-
-void gldCopyTexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX7(GLcontext *ctx);
-void gld_DrawPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX7(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX7(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX7(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX7(GLcontext *ctx);
-
-// 2D primitive functions
-
-void gld_Points2D_DX7(GLcontext *ctx, GLuint first, GLuint last);
-
-void gld_Line2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-
-void gld_Triangle2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-
-void gld_Quad2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// 3D primitive functions
-
-void gld_Points3D_DX7(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// Primitive functions for Two-sided-lighting Vertex Shader
-
-void gld_Points2DTwoside_DX7(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-#endif
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h b/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h
deleted file mode 100644
index df6fceb43e6..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_dxerr7.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*==========================================================================;
- *
- *
- * File: dxerr8.h
- * Content: DirectX Error Library Include File
- *
- ****************************************************************************/
-
-#ifndef _GLD_DXERR7_H_
-#define _GLD_DXERR7_H_
-
-
-#include <d3d.h>
-
-//
-// DXGetErrorString8
-//
-// Desc: Converts an DirectX HRESULT to a string
-//
-// Args: HRESULT hr Can be any error code from
-// DPLAY D3D8 D3DX8 DMUSIC DSOUND
-//
-// Return: Converted string
-//
-const char* __stdcall DXGetErrorString8A(HRESULT hr);
-const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr);
-
-#ifdef UNICODE
- #define DXGetErrorString8 DXGetErrorString8W
-#else
- #define DXGetErrorString8 DXGetErrorString8A
-#endif
-
-
-//
-// DXTrace
-//
-// Desc: Outputs a formatted error message to the debug stream
-//
-// Args: CHAR* strFile The current file, typically passed in using the
-// __FILE__ macro.
-// DWORD dwLine The current line number, typically passed in using the
-// __LINE__ macro.
-// HRESULT hr An HRESULT that will be traced to the debug stream.
-// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
-// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
-//
-// Return: The hr that was passed in.
-//
-//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
-//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
-HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox);
-HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox);
-
-#ifdef UNICODE
- #define DXTrace DXTraceW
-#else
- #define DXTrace DXTraceA
-#endif
-
-
-//
-// Helper macros
-//
-#if defined(DEBUG) | defined(_DEBUG)
- #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
- #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
- #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
-#else
- #define DXTRACE_MSG(str) (0L)
- #define DXTRACE_ERR(str,hr) (hr)
- #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
-#endif
-
-
-#endif
-
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c
deleted file mode 100644
index 6be41a80dd3..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GL extensions
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "../gld_settings.h"
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-//#include "ddlog.h"
-//#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "extensions.h"
-
-// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
-
-//---------------------------------------------------------------------------
-// Hack for the SGIS_multitexture extension that was removed from Mesa
-// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel
-
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // To enable, uncomment:
- // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
-//---------------------------------------------------------------------------
-
-enum {
- /* Quake2 GL_SGIS_multitexture */
- GL_SELECTED_TEXTURE_SGIS = 0x835B,
- GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C,
- GL_MAX_TEXTURES_SGIS = 0x835D,
- GL_TEXTURE0_SGIS = 0x835E,
- GL_TEXTURE1_SGIS = 0x835F,
- GL_TEXTURE2_SGIS = 0x8360,
- GL_TEXTURE3_SGIS = 0x8361,
- GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363,
-};
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldSelectTextureSGIS(
- GLenum target)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glActiveTextureARB(ARB_target);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fSGIS(
- GLenum target,
- GLfloat s,
- GLfloat t)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fARB(ARB_target, s, t);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fvSGIS(
- GLenum target,
- const GLfloat *v)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fvARB(ARB_target, v);
-}
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
-
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-GLD_extension GLD_multitexList[] = {
-/*
- { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" },
- { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" },
- { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" },
- { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" },
- { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" },
- { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" },
- { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" },
- { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" },
- { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" },
- { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" },
- { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
- { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" },
- { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" },
- { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" },
- { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" },
- { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" },
- { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" },
- { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" },
- { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" },
- { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" },
- { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" },
- { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" },
- { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" },
- { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" },
- { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" },
- { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" },
- { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" },
- { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" },
- { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" },
- { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" },
- { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" },
- { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" },
- { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" },
-*/
- { (PROC)glActiveTextureARB, "glActiveTextureARB" },
- { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },
- { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },
- { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },
- { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },
- { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },
- { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },
- { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },
- { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },
- { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },
- { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },
- { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },
- { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },
- { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },
- { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },
- { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },
- { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },
- { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },
- { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },
- { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },
- { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },
- { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },
- { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },
- { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },
- { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },
- { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },
- { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },
- { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },
- { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },
- { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },
- { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },
- { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },
- { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },
-
- // Descent3 doesn't use correct string, hence this hack
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" },
-
- // Quake2 SGIS multitexture
- { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
-
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- if (glb.bMultitexture) {
- for (i=0; GLD_multitexList[i].proc; i++) {
- if (!strcmp(a, GLD_multitexList[i].name)) {
- proc = GLD_multitexList[i].proc;
- break;
- }
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-void gldEnableExtensions_DX7(
- GLcontext *ctx)
-{
- GLuint i;
-
- // Mesa enables some extensions by default.
- // This table decides which ones we want to switch off again.
-
- // NOTE: GL_EXT_compiled_vertex_array appears broken.
-
- const char *gld_disable_extensions[] = {
-// "GL_ARB_transpose_matrix",
-// "GL_EXT_compiled_vertex_array",
-// "GL_EXT_polygon_offset",
-// "GL_EXT_rescale_normal",
- "GL_EXT_texture3D",
-// "GL_NV_texgen_reflection",
- "GL_EXT_abgr",
- "GL_EXT_bgra",
- NULL
- };
-
- const char *gld_multitex_extensions[] = {
- "GL_ARB_multitexture", // Quake 3
- NULL
- };
-
- // Quake 2 engines
- const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture";
-
- const char *gld_enable_extensions[] = {
- "GL_EXT_texture_env_add", // Quake 3
- "GL_ARB_texture_env_add", // Quake 3
- NULL
- };
-
- for (i=0; gld_disable_extensions[i]; i++) {
- _mesa_disable_extension(ctx, gld_disable_extensions[i]);
- }
-
- for (i=0; gld_enable_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_enable_extensions[i]);
- }
-
- if (glb.bMultitexture) {
- for (i=0; gld_multitex_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_multitex_extensions[i]);
- }
-
- // GL_SGIS_multitexture
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // Fair bit slower on GeForce256,
- // Much slower on 3dfx Voodoo5 5500.
-// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
- }
-
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
- _mesa_enable_1_4_extensions(ctx);
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c
deleted file mode 100644
index 9ccec69b98a..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_pipeline_dx7.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa transformation pipeline with GLDirect fastpath
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-extern struct tnl_pipeline_stage _gld_d3d_render_stage;
-extern struct tnl_pipeline_stage _gld_mesa_render_stage;
-
-static const struct tnl_pipeline_stage *gld_pipeline[] = {
- &_gld_d3d_render_stage, // Direct3D TnL
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_gld_mesa_render_stage, // Mesa TnL, D3D rendering
- 0,
-};
-
-//---------------------------------------------------------------------------
-
-void gldInstallPipeline_DX7(
- GLcontext *ctx)
-{
- // Remove any existing pipeline stages,
- // then install GLDirect pipeline stages.
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, gld_pipeline);
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
deleted file mode 100644
index 5da25003c08..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
+++ /dev/null
@@ -1,1448 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Primitive (points/lines/tris/quads) rendering
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-// Disable compiler complaints about unreferenced local variables
-#pragma warning (disable:4101)
-
-//---------------------------------------------------------------------------
-// Helper defines for primitives
-//---------------------------------------------------------------------------
-
-//static const float ooZ = 1.0f / 65536.0f; // One over Z
-
-#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3]))
-#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3]))
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-//---------------------------------------------------------------------------
-// 2D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_2D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_TRIANGLES \
- BOOL bFog = ctx->Fog.Enabled; \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour; \
- GLuint facing = 0; \
- struct vertex_buffer *VB; \
- GLchan (*vbcolor)[4]; \
- GLchan (*vbspec)[4]
-
-#define GLD_SETUP_GET_SWVERT(s) \
- swv = &ss->verts[##s]
-
-#define GLD_SETUP_2D_VERTEX \
- pV->x = swv->win[0]; \
- pV->y = GLD_FLIP_Y(swv->win[1]); \
- pV->rhw = swv->win[3]
-
-#define GLD_SETUP_SMOOTH_COLOUR \
- pV->diffuse = GLD_COLOUR
-
-#define GLD_SETUP_GET_FLAT_COLOUR \
- dwFlatColour = GLD_COLOUR
-#define GLD_SETUP_GET_FLAT_FOG_COLOUR \
- dwFlatColour = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_USE_FLAT_COLOUR \
- pV->diffuse = dwFlatColour
-
-#define GLD_SETUP_GET_FLAT_SPECULAR \
- dwSpecularColour= GLD_SPECULAR
-
-#define GLD_SETUP_USE_FLAT_SPECULAR \
- pV->specular = dwSpecularColour
-
-#define GLD_SETUP_DEPTH \
- pV->sz = swv->win[2] / ctx->DepthMaxF
-// pV->z = swv->win[2] * ooZ;
-
-#define GLD_SETUP_SPECULAR \
- pV->specular = GLD_SPECULAR
-
-#define GLD_SETUP_FOG \
- pV->diffuse = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_TEX0 \
- pV->t0_u = swv->texcoord[0][0]; \
- pV->t0_v = swv->texcoord[0][1]
-
-#define GLD_SETUP_TEX1 \
- pV->t1_u = swv->texcoord[1][0]; \
- pV->t1_v = swv->texcoord[1][1]
-
-#define GLD_SETUP_LIGHTING(v) \
- if (facing == 1) { \
- pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- } else { \
- if (bFog) \
- GLD_SETUP_FOG; \
- else \
- GLD_SETUP_SMOOTH_COLOUR; \
- GLD_SETUP_SPECULAR; \
- }
-
-#define GLD_SETUP_GET_FLAT_LIGHTING(v) \
- if (facing == 1) { \
- dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- }
-
-#define GLD_SETUP_TWOSIDED_LIGHTING \
- /* Two-sided lighting */ \
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \
- SWvertex *v[3]; \
- GLfloat ex,ey,fx,fy,cc; \
- /* Get vars for later */ \
- VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
- } else { \
- vbspec = NULL; \
- } \
- v[0] = &verts[v0]; \
- v[1] = &verts[v1]; \
- v[2] = &verts[v2]; \
- ex = v[0]->win[0] - v[2]->win[0]; \
- ey = v[0]->win[1] - v[2]->win[1]; \
- fx = v[1]->win[0] - v[2]->win[0]; \
- fy = v[1]->win[1] - v[2]->win[1]; \
- cc = ex*fy - ey*fx; \
- facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \
- }
-
-//---------------------------------------------------------------------------
-// 3D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_3D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_TRIANGLES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
- pV->Position.x = p4f[##v][0]; \
- pV->Position.y = p4f[##v][1]; \
- pV->Position.z = p4f[##v][2];
-
-#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-
-#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-#define GLD_SETUP_USE_FLAT_COLOUR_3D \
- pV->Diffuse = dwColor;
-
-#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
- pV->TexUnit0.x = tc[##v][0]; \
- pV->TexUnit0.y = tc[##v][1]; \
- }
-
-#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
- pV->TexUnit1.x = tc[##v][0]; \
- pV->TexUnit1.y = tc[##v][1]; \
- }
-
-//---------------------------------------------------------------------------
-// Helper functions
-//---------------------------------------------------------------------------
-
-__inline DWORD _gldComputeFog(
- GLcontext *ctx,
- SWvertex *swv)
-{
- // Full fog calculation.
- // Based on Mesa code.
-
- GLchan rFog, gFog, bFog;
- GLchan fR, fG, fB;
- const GLfloat f = swv->fog;
- const GLfloat g = 1.0 - f;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
- fR = f * swv->color[0] + g * rFog;
- fG = f * swv->color[1] + g * gFog;
- fB = f * swv->color[2] + g * bFog;
- return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ResetLineStipple_DX7(
- GLcontext *ctx)
-{
- // TODO: Fake stipple with a 32x32 texture.
-}
-
-//---------------------------------------------------------------------------
-// 2D (post-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points2D_DX7(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_2D_VARS_POINTS;
-
- unsigned i;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- // Not supported by DX7
-// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
- GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- } else {
- GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, swv++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- }
-
- gld->PB2d.pPoints = (BYTE*)pV;
- gld->PB2d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
-
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v2);
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v2);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v3);
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v3);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothExtras_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v3);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// 3D (pre-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points3D_DX7(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_3D_VARS_POINTS
-
- unsigned i;
-// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- // Not supported by DX7
-// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
-// GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_3D_VERTEX(VB->Elts[i])
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- } else {
-// GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- }
-/*
- for (i=first; i<last; i++, pV++) {
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
-*/
- gld->PB3d.pPoints = (BYTE*)pV;
- gld->PB3d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-// Line functions
-//---------------------------------------------------------------------------
-
-void gld_Line3DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line3DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-// Triangle functions
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-// Quad functions
-//---------------------------------------------------------------------------
-
-void gld_Quad3DFlat_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad3DSmooth_DX7(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_SMOOTH_COLOUR_3D(v3)
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// Vertex setup for two-sided-lighting vertex shader
-//---------------------------------------------------------------------------
-
-/*
-
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last)
-{
- // NOTE: Two-sided lighting does not apply to Points
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-*/
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c
deleted file mode 100644
index bbe673516d6..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_texture_dx7.c
+++ /dev/null
@@ -1,2196 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Texture / Bitmap functions
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-//#include <d3dx8tex.h>
-
-#include "texformat.h"
-#include "colormac.h"
-#include "texstore.h"
-#include "image.h"
-// #include "mem.h"
-
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h))
-
-D3DX_SURFACEFORMAT _gldD3DXFormatFromSurface(IDirectDrawSurface7 *pSurface);
-
-//---------------------------------------------------------------------------
-// 1D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + (i) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (i) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (i))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (i))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 2D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 3D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// Direct3D texture formats that have no Mesa equivalent
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _mesa_texstore_argb8888, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
- gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
- gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
- MESA_FORMAT_ARGB1555, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 5, /* RedBits */
- 5, /* GreenBits */
- 5, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb1555, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
- gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
- gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb4444, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
- gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
- gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
-};
-
-//---------------------------------------------------------------------------
-// Texture unit constants
-//---------------------------------------------------------------------------
-
-// List of possible combinations of texture environments.
-// Example: GLD_TEXENV_MODULATE_RGBA means
-// GL_MODULATE, GL_RGBA base internal format.
-#define GLD_TEXENV_DECAL_RGB 0
-#define GLD_TEXENV_DECAL_RGBA 1
-#define GLD_TEXENV_DECAL_ALPHA 2
-#define GLD_TEXENV_REPLACE_RGB 3
-#define GLD_TEXENV_REPLACE_RGBA 4
-#define GLD_TEXENV_REPLACE_ALPHA 5
-#define GLD_TEXENV_MODULATE_RGB 6
-#define GLD_TEXENV_MODULATE_RGBA 7
-#define GLD_TEXENV_MODULATE_ALPHA 8
-#define GLD_TEXENV_BLEND_RGB 9
-#define GLD_TEXENV_BLEND_RGBA 10
-#define GLD_TEXENV_BLEND_ALPHA 11
-#define GLD_TEXENV_ADD_RGB 12
-#define GLD_TEXENV_ADD_RGBA 13
-#define GLD_TEXENV_ADD_ALPHA 14
-
-// Per-stage (i.e. per-unit) texture environment
-typedef struct {
- DWORD ColorArg1; // Colour argument 1
- D3DTEXTUREOP ColorOp; // Colour operation
- DWORD ColorArg2; // Colour argument 2
- DWORD AlphaArg1; // Alpha argument 1
- D3DTEXTUREOP AlphaOp; // Alpha operation
- DWORD AlphaArg2; // Alpha argument 2
-} GLD_texenv;
-
-// TODO: Do we really need to set ARG1 and ARG2 every time?
-// They seem to always be TEXTURE and CURRENT respectively.
-
-// C = Colour out
-// A = Alpha out
-// Ct = Colour from Texture
-// Cf = Colour from fragment (diffuse)
-// At = Alpha from Texture
-// Af = Alpha from fragment (diffuse)
-// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND)
-const GLD_texenv gldTexEnv[] = {
- // DECAL_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af
- {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_ALPHA: <undefined> use DECAL_RGB
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
-
- // REPLACE_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // REPLACE_RGBA: C=Ct, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
- // REPLACE_ALPHA: C=Cf, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
-
- // MODULATE_RGB: C=CfCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // MODULATE_RGBA: C=CfCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // MODULATE_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- //
- // DX7 Does not support D3DTOP_LERP
- // Emulate(?) via D3DTOP_ADDSMOOTH
- //
-#if 0
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-#else
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADDSMOOTH, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADDSMOOTH, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-#endif
- // BLEND_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // ADD_RGB: C=Cf+Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // ADD_RGBA: C=Cf+Ct, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // ADD_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-};
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREADDRESS _gldConvertWrap(
- GLenum wrap)
-{
-// ASSERT(wrap==GL_CLAMP || wrap==GL_REPEAT);
- return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREMAGFILTER _gldConvertMagFilter(
- GLenum magfilter)
-{
- ASSERT(magfilter==GL_LINEAR || magfilter==GL_NEAREST);
- return (magfilter == GL_LINEAR) ? D3DTFG_LINEAR : D3DTFG_POINT;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldConvertMinFilter(
- GLenum minfilter,
- D3DTEXTUREMINFILTER *min_filter,
- D3DTEXTUREMIPFILTER *mip_filter)
-{
- switch (minfilter) {
- case GL_NEAREST:
- *min_filter = D3DTFN_POINT;
- *mip_filter = D3DTFP_NONE;
- break;
- case GL_LINEAR:
- *min_filter = D3DTFN_LINEAR;
- *mip_filter = D3DTFP_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- *min_filter = D3DTFN_POINT;
- *mip_filter = D3DTFP_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- *min_filter = D3DTFN_LINEAR;
- *mip_filter = D3DTFP_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- *min_filter = D3DTFN_POINT;
- *mip_filter = D3DTFP_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- *min_filter = D3DTFN_LINEAR;
- *mip_filter = D3DTFP_LINEAR;
- break;
- default:
- ASSERT(0);
- }
-}
-
-//---------------------------------------------------------------------------
-
-D3DX_SURFACEFORMAT _gldGLFormatToD3DFormat(
- GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures
- return D3DX_SF_L8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return D3DX_SF_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return D3DX_SF_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return D3DX_SF_X8R8G8B8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return D3DX_SF_A8L8;
- case GL_R3_G3_B2:
- // TODO: Mesa does not support RGB332 internally
- return D3DX_SF_X4R4G4B4; //D3DFMT_R3G3B2;
- case GL_RGB4:
- return D3DX_SF_X4R4G4B4;
- case GL_RGB5:
- return D3DX_SF_R5G5B5;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return D3DX_SF_R8G8B8;
- case GL_RGBA4:
- return D3DX_SF_A4R4G4B4;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return D3DX_SF_A8R8G8B8;
- case GL_RGB5_A1:
- return D3DX_SF_A1R5G5B5;
- }
-
- ASSERT(0);
-
- // Return an acceptable default
- return D3DX_SF_A8R8G8B8;
-}
-
-//---------------------------------------------------------------------------
-
-GLenum _gldDecodeBaseFormat(
- IDirectDrawSurface7 *pTex)
-{
- // Examine Direct3D texture and return base OpenGL internal texture format
- // NOTE: We can't use any base format info from Mesa because D3D might have
- // used a different texture format when we used D3DXCreateTexture().
-
- // Base internal format is one of (Red Book p355):
- // GL_ALPHA,
- // GL_LUMINANCE,
- // GL_LUMINANCE_ALPHA,
- // GL_INTENSITY,
- // GL_RGB,
- // GL_RGBA
-
- // NOTE: INTENSITY not used (not supported by Direct3D)
- // LUMINANCE has same texture functions as RGB
- // LUMINANCE_ALPHA has same texture functions as RGBA
-
- // TODO: cache format instead of using GetLevelDesc()
-// D3DSURFACE_DESC desc;
-// _GLD_DX7_TEX(GetLevelDesc(pTex, 0, &desc));
-
- D3DX_SURFACEFORMAT sf;
-
- sf = _gldD3DXFormatFromSurface(pTex);
-
- switch (sf) {
- case D3DX_SF_R8G8B8:
- case D3DX_SF_X8R8G8B8:
- case D3DX_SF_R5G6B5:
- case D3DX_SF_R5G5B5:
- case D3DX_SF_R3G3B2:
- case D3DX_SF_X4R4G4B4:
- case D3DX_SF_PALETTE8:
- case D3DX_SF_L8:
- return GL_RGB;
- case D3DX_SF_A8R8G8B8:
- case D3DX_SF_A1R5G5B5:
- case D3DX_SF_A4R4G4B4:
-// case D3DX_SF_A8R3G3B2: // Unsupported by DX7
-// case D3DX_SF_A8P8: // Unsupported by DX7
- case D3DX_SF_A8L8:
-// case D3DX_SF_A4L4: // Unsupported by DX7
- return GL_RGBA;
- case D3DX_SF_A8:
- return GL_ALPHA;
- // Compressed texture formats. Need to check these...
- case D3DX_SF_DXT1:
- return GL_RGBA;
-// case D3DX_SF_DXT2: // Unsupported by DX7
- return GL_RGB;
- case D3DX_SF_DXT3:
- return GL_RGBA;
-// case D3DX_SF_DXT4: // Unsupported by DX7
- return GL_RGB;
- case D3DX_SF_DXT5:
- return GL_RGBA;
- }
-
- // Fell through. Return arbitary default.
- ASSERT(0); // BANG!
- return GL_RGBA;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* _gldMesaFormatForD3DFormat(
- D3DX_SURFACEFORMAT d3dfmt)
-{
- switch (d3dfmt) {
- case D3DX_SF_A8R8G8B8:
- return &_mesa_texformat_argb8888;
- case D3DX_SF_R8G8B8:
- return &_mesa_texformat_rgb888;
- case D3DX_SF_R5G6B5:
- return &_mesa_texformat_rgb565;
- case D3DX_SF_A4R4G4B4:
- return &_mesa_texformat_argb4444;
- case D3DX_SF_A1R5G5B5:
- return &_mesa_texformat_argb1555;
- case D3DX_SF_A8L8:
- return &_mesa_texformat_al88;
- case D3DX_SF_R3G3B2:
- return &_mesa_texformat_rgb332;
- case D3DX_SF_A8:
- return &_mesa_texformat_a8;
- case D3DX_SF_L8:
- return &_mesa_texformat_l8;
- case D3DX_SF_X8R8G8B8:
- return &_gld_texformat_X8R8G8B8;
- case D3DX_SF_R5G5B5:
- return &_gld_texformat_X1R5G5B5;
- case D3DX_SF_X4R4G4B4:
- return &_gld_texformat_X4R4G4B4;
- }
-
- // If we reach here then we've made an error somewhere else
- // by allowing a format that is not supported.
- ASSERT(0);
-
- return NULL; // Shut up compiler warning
-}
-
-//---------------------------------------------------------------------------
-
-D3DX_SURFACEFORMAT _gldD3DXFormatFromSurface(
- IDirectDrawSurface7 *pSurface)
-{
- DDPIXELFORMAT ddpf;
-
- ddpf.dwSize = sizeof(ddpf);
-
- // Obtain pixel format of surface
- _GLD_DX7_TEX(GetPixelFormat(pSurface, &ddpf));
- // Decode to D3DX surface format
- return D3DXMakeSurfaceFormat(&ddpf);
-}
-
-//---------------------------------------------------------------------------
-
-void _gldClearSurface(
- IDirectDrawSurface *pSurface,
- D3DCOLOR dwColour)
-{
- DDBLTFX bltFX; // Used for colour fill
-
- // Initialise struct
- bltFX.dwSize = sizeof(bltFX);
- // Set clear colour
- bltFX.dwFillColor = dwColour;
- // Clear surface. HW accelerated if available.
- IDirectDrawSurface7_Blt(pSurface, NULL, NULL, NULL, DDBLT_COLORFILL, &bltFX);
-}
-
-//---------------------------------------------------------------------------
-// Copy* functions
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage1D_DX7(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage1D_DX7(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage3D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height )
-{
- // TODO ?
-}
-
-//---------------------------------------------------------------------------
-// Bitmap/Pixel functions
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1)
-
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT z; // depth value
- FLOAT rhw; // reciprocal homogenous W (always 1.0f)
- FLOAT tu, tv; // texture coords
-} _GLD_IMAGE_VERTEX;
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldDrawPixels(
- GLcontext *ctx,
- BOOL bChromakey, // Alpha test for glBitmap() images
- GLint x, // GL x position
- GLint y, // GL y position (needs flipping)
- GLsizei width, // Width of input image
- GLsizei height, // Height of input image
- IDirectDrawSurface7 *pImage)
-{
- //
- // Draw input image as texture implementing PixelZoom and clipping.
- // Any fragment operations currently enabled will be used.
- //
-
- // NOTE: This DX7 version does not create a new texture in which
- // to copy the input image, as the image is already a texture.
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DDSURFACEDESC2 ddsd;
- _GLD_IMAGE_VERTEX v[4];
-
- float ZoomWidth, ZoomHeight;
- float ScaleWidth, ScaleHeight;
-
- // Fixup for rasterisation rules
- const float cfEpsilon = 1.0f / (float)height;
-
- //
- // Set up the quad like this (ascii-art ahead!)
- //
- // 3--2
- // | |
- // 0--1
- //
- //
-
- // Set depth
- v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2];
- // Set Reciprocal Homogenous W
- v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f;
-
- // Set texcoords
- // Examine texture size - if different to input width and height
- // then we'll need to munge the texcoords to fit.
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- IDirectDrawSurface7_GetSurfaceDesc(pImage, &ddsd);
- ScaleWidth = (float)width / (float)ddsd.dwWidth;
- ScaleHeight = (float)height / (float)ddsd.dwHeight;
- v[0].tu = 0.0f; v[0].tv = 0.0f;
- v[1].tu = ScaleWidth; v[1].tv = 0.0f;
- v[2].tu = ScaleWidth; v[2].tv = ScaleHeight;
- v[3].tu = 0.0f; v[3].tv = ScaleHeight;
-
- // Set raster positions
- ZoomWidth = (float)width * ctx->Pixel.ZoomX;
- ZoomHeight = (float)height * ctx->Pixel.ZoomY;
-
- v[0].x = x; v[0].y = GLD_FLIP_Y(y+cfEpsilon);
- v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y+cfEpsilon);
- v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight+cfEpsilon);
- v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight+cfEpsilon);
-
- // Draw image with full HW acceleration
- // NOTE: Be nice to use a State Block for all this state...
- IDirect3DDevice7_SetTexture(gld->pDev, 0, pImage);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CLIPPING, TRUE);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTFN_POINT);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTFP_POINT);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTFG_POINT);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- // Ensure texture unit 1 is disabled
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
-
- //
- // Emulate Chromakey with an Alpha Test.
- // [Alpha Test is more widely supported anyway]
- //
- if (bChromakey) {
- // Switch on alpha testing
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHATESTENABLE, TRUE);
- // Fragment passes is alpha is greater than reference value
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAFUNC, D3DCMP_GREATER);
- // Set alpha reference value between Bitmap alpha values of
- // zero (transparent) and one (opaque).
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ALPHAREF, 0x7f);
- }
-
- IDirect3DDevice7_DrawPrimitive(gld->pDev, D3DPT_TRIANGLEFAN, _GLD_FVF_IMAGE, &v, 4, 0);
-
- // Reset state to before we messed it up
- FLUSH_VERTICES(ctx, _NEW_ALL);
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DrawPixels_DX7(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirectDrawSurface7 *pImage;
- HRESULT hr;
- DDSURFACEDESC2 ddsd;
- DWORD dwFlags;
- D3DX_SURFACEFORMAT sf;
- DWORD dwMipmaps;
-
- const struct gl_texture_format *MesaFormat;
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- dwFlags = D3DX_TEXTURE_NOMIPMAP;
- sf = D3DX_SF_A8R8G8B8;
- dwMipmaps = 1;
-
- hr = D3DXCreateTexture(
- gld->pDev,
- &dwFlags,
- &width, &height,
- &sf, // format
- NULL, // palette
- &pImage, // Output texture
- &dwMipmaps);
- if (FAILED(hr)) {
- return;
- }
-
- // D3DXCreateTexture() may not clear the texture is creates.
- _gldClearSurface(pImage, 0);
-
- //
- // Use Mesa to fill in image
- //
-
- // Lock all of surface
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- dwFlags = DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT;
- hr = IDirectDrawSurface7_Lock(pImage, NULL, &ddsd, dwFlags, NULL);
- if (FAILED(hr)) {
- SAFE_RELEASE_SURFACE7(pImage);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA,
- &_mesa_texformat_argb8888,
- ddsd.lpSurface,
- width, height, 1, 0, 0, 0,
- ddsd.lPitch,
- 0, /* dstImageStride */
- format, type, pixels, unpack);
-
- IDirectDrawSurface7_Unlock(pImage, NULL);
-
- _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage);
-
- SAFE_RELEASE_SURFACE7(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ReadPixels_DX7(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *dest)
-{
-// TODO
-#if 0
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirect3DSurface8 *pBackbuffer = NULL;
- IDirect3DSurface8 *pNativeImage = NULL;
- IDirect3DSurface8 *pCanonicalImage = NULL;
-
- D3DSURFACE_DESC d3dsd;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- struct gl_pixelstore_attrib srcPacking;
- int i;
- GLint DstRowStride;
- const struct gl_texture_format *MesaFormat;
-
- switch (format) {
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
- DstRowStride = _mesa_image_row_stride(pack, width, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pNativeImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels.
- //
- // This intermediate surface ensure that we can use CopyRects()
- // instead of relying on D3DXLoadSurfaceFromSurface(), which may
- // try and lock the backbuffer. This way seems safer.
- //
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pNativeImage,
- &ptDst);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Create an RGBA8888 surface
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pCanonicalImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // Convert to RGBA8888
- hr = D3DXLoadSurfaceFromSurface(
- pCanonicalImage, // Dest surface
- NULL, NULL, // Dest palette, RECT
- pNativeImage, // Src surface
- NULL, NULL, // Src palette, RECT
- D3DX_FILTER_NONE, // Filter
- 0); // Colourkey
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- srcPacking.Alignment = 1;
- srcPacking.ImageHeight = height;
- srcPacking.LsbFirst = GL_FALSE;
- srcPacking.RowLength = 0;
- srcPacking.SkipImages = 0;
- srcPacking.SkipPixels = 0;
- srcPacking.SkipRows = 0;
- srcPacking.SwapBytes = GL_FALSE;
-
- // Lock all of image
- hr = IDirect3DSurface8_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX7_return;
- }
-
- // We need to flip the data. Yuck.
- // Perhaps Mesa has a span packer we can use in future...
- for (i=0; i<height; i++) {
- BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
- BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA, // base format
- MesaFormat, // dst format
- pDestRow, // dest addr
- width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z
- DstRowStride, // dst row stride
- 0, // dstImageStride
- GL_BGRA, // src format
- GL_UNSIGNED_BYTE, // src type
- pSrcRow, // src addr
- &srcPacking); // packing params of source image
- }
-
- IDirect3DSurface8_UnlockRect(pCanonicalImage);
-
-gld_ReadPixels_DX7_return:
- SAFE_RELEASE_SURFACE8(pCanonicalImage);
- SAFE_RELEASE_SURFACE8(pNativeImage);
- SAFE_RELEASE_SURFACE8(pBackbuffer);
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_CopyPixels_DX7(
- GLcontext *ctx,
- GLint srcx,
- GLint srcy,
- GLsizei width,
- GLsizei height,
- GLint dstx,
- GLint dsty,
- GLenum type)
-{
-// TODO
-#if 0
- //
- // NOTE: Not allowed to copy vidmem to vidmem!
- // Therefore we use an intermediate image surface.
- //
-
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirect3DSurface8 *pBackbuffer;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface8 *pImage;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
-
- // Only backbuffer
- if (type != GL_COLOR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pImage);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pImage,
- &ptDst);
- IDirect3DSurface8_Release(pBackbuffer);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Bitmap_DX7(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- GLD_context *gldCtx;
- GLD_driver_dx7 *gld;
-
- IDirectDrawSurface7 *pImage; // Bitmap texture
- HRESULT hr;
- BYTE *pTempBitmap; // Pointer to unpacked bitmap
- D3DCOLOR clBitmapOne; // Opaque bitmap colour
- D3DCOLOR clBitmapZero; // Transparent bitmap colour
- D3DCOLOR *pBits; // Pointer to texture surface
- const GLubyte *src;
- int i, j, k;
-
- DDSURFACEDESC2 ddsd; // Surface desc returned by lock call
- DWORD dwFlags;
- D3DX_SURFACEFORMAT sf;
- DWORD dwMipmaps;
-
- // Keep a copy of width/height as D3DXCreateTexture() call may alter input dimensions
- GLsizei dwWidth = width;
- GLsizei dwHeight = height;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- // Bail if no bitmap (only raster pos is updated)
- if ((bitmap == NULL) && (width==0) && (height==0))
- return;
-
- //
- // TODO: Detect conditions when created texture (pImage) is non-pow2.
- // Texture coords may need to be adjusted to compensate.
- //
-
- clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero
- clBitmapOne = D3DCOLOR_COLORVALUE(
- ctx->Current.RasterColor[0],
- ctx->Current.RasterColor[1],
- ctx->Current.RasterColor[2],
- 1.0f); // NOTE: Alpha is One
-
- // Use Mesa to unpack bitmap into a canonical format
- pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack);
- if (pTempBitmap == NULL)
- return;
-
- // Flags for texture creation
- dwFlags = D3DX_TEXTURE_NOMIPMAP;
- sf = D3DX_SF_A8R8G8B8;
- dwMipmaps = 1;
-
- // Create a D3D texture to hold the bitmap
- hr = D3DXCreateTexture(
- gld->pDev,
- &dwFlags,
- &dwWidth, &dwHeight,
- &sf, // format
- NULL, // palette
- &pImage, // Output texture
- &dwMipmaps);
- if (FAILED(hr)) {
- FREE(pTempBitmap);
- return;
- }
-
- // D3DXCreateTexture may return a texture bigger than we asked for
- // (i.e. padded to POW2) so let's clear the entire image bitmap.
- // Additional: Looks like this is not strictly necessary.
-// _gldClearSurface(pImage, clBitmapZero);
-
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- dwFlags = DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT;
- hr = IDirectDrawSurface7_Lock(pImage, NULL, &ddsd, dwFlags, NULL);
- if (FAILED(hr)) {
- FREE(pTempBitmap);
- SAFE_RELEASE_SURFACE7(pImage);
- return;
- }
-
-#if 0
- // DEBUG CODE
- if (!(width==ddsd.dwWidth && height==ddsd.dwHeight))
- ddlogPrintf(GLDLOG_WARN, "gld_Bitmap: In=%d,%d / Tex=%d,%d", width,height,ddsd.dwWidth,ddsd.dwHeight);
-#endif
-
-#if 0
- // DEBUG CODE
- ddlogPrintf(GLDLOG_SYSTEM, "gld_Bitmap: In=%d,%d / Tex=%d,%d", width,height,ddsd.dwWidth,ddsd.dwHeight);
- ddlogPrintf(GLDLOG_SYSTEM, "gld_Bitmap: bpp=%d", ddsd.ddpfPixelFormat.dwRGBBitCount);
-#endif
-
- // Cast texel pointer to texture surface.
- // We can do this because we used D3DX_SF_A8R8G8B8 as the format
- pBits = (D3DCOLOR*)ddsd.lpSurface;
-
-
- // Copy from the input bitmap into the texture
- for (i=0; i<height; i++) {
- GLubyte byte;
- pBits = (D3DCOLOR*)((BYTE*)ddsd.lpSurface + (i*ddsd.lPitch));
- src = (const GLubyte *) _mesa_image_address(2,
- &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
- 0, i, 0);
- for (j=0; j<(width>>3); j++) {
- byte = *src++;
- for (k=0; k<8; k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- // Fill remaining bits from bitmap
- if (width & 7) {
- byte = *src;
- for (k=0; k<(width & 7); k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- }
-
- // We're done with the unpacked bitmap
- FREE(pTempBitmap);
-
- // Finished with texture surface - unlock it
- IDirectDrawSurface7_Unlock(pImage, NULL);
-
- // Use internal function to draw bitmap onto rendertarget
- _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage);
-
- // We're done with the bitmap texure - release it
- IDirectDrawSurface7_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-// Texture functions
-//---------------------------------------------------------------------------
-
-void _gldAllocateTexture(
- GLcontext *ctx,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- HRESULT hr;
- IDirectDrawSurface7 *pTex;
- D3DX_SURFACEFORMAT d3dFormat;
- DWORD dwFlags;
- DWORD dwMipmaps;
- DWORD dwWidth, dwHeight;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (pTex) {
- // Decide whether we can keep existing D3D texture
- // by examining top-level surface.
- DDSURFACEDESC2 ddsd;
- ddsd.dwSize = sizeof(DDSURFACEDESC2);
- _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd));
- // Release existing texture if not compatible
- if ((ddsd.dwWidth == texImage->Width) ||
- (ddsd.dwHeight == texImage->Height))
- {
- return; // Keep the existing texture
- }
- tObj->DriverData = NULL;
- _GLD_DX7_TEX(Release(pTex));
- }
-
- dwFlags = (glb.bUseMipmaps) ? 0 : D3DX_TEXTURE_NOMIPMAP;
- dwMipmaps = (glb.bUseMipmaps) ? D3DX_DEFAULT : 1;
- dwWidth = texImage->Width;
- dwHeight = texImage->Height;
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat);
- hr = D3DXCreateTexture(
- gld->pDev,
- &dwFlags,
- &dwWidth,
- &dwHeight,
- &d3dFormat,
- NULL,
- &pTex,
- &dwMipmaps);
- if (FAILED(hr)) {
- gldLogError(GLDLOG_ERROR, "AllocateTexture failed", hr);
- }
- tObj->DriverData = pTex;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* gld_ChooseTextureFormat_DX7(
- GLcontext *ctx,
- GLint internalFormat,
- GLenum srcFormat,
- GLenum srcType)
-{
- // [Based on mesa_choose_tex_format()]
- //
- // We will choose only texture formats that are supported
- // by Direct3D. If the hardware doesn't support a particular
- // texture format, then the D3DX texture calls that we use
- // will automatically use a HW supported format.
- //
- // The most critical aim is to reduce copying; if we can use
- // texture-image data directly then it will be a big performance assist.
- //
-
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8; // D3DFMT_A8
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5
- // Mesa will convert this for us later...
- // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88; // D3DFMT_A8L8
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2
- case GL_RGB4:
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4
- case 3:
- case GL_RGB:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
-// Safer(?), slower version.
-void gld_TexImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- RECT rcSrcRect;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
-
- if (!tObj || !texImage)
- return;
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- SetRect(&rcSrcRect, 0, 0, width, height);
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- NULL,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexImage2D_DX7(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- IDirectDrawSurface7 *pTex = NULL;
- IDirectDrawSurface7 *pSurface = NULL;
- HRESULT hr;
- DDSURFACEDESC2 ddsd;
- int i;
- DDSCAPS2 ddsCaps;
-
- if (!tObj || !texImage)
- return;
-
- // GLQUAKE FIX
- // Test for input alpha data with non-alpha internalformat
- if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) {
- // Input format has alpha, but a non-alpha format has been requested.
- texImage->IntFormat = GL_RGBA;
- internalFormat = GL_RGBA;
- }
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (!pTex) {
- ASSERT(0);
- return; // Texture has not been created
- }
-
- pSurface = pTex;
- if (level != 0) {
- ddsd.dwSize = sizeof(ddsd);
- _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd));
- if ((level > 0) && (level >= ddsd.dwMipMapCount))
- return; // Level does not exist
- ZeroMemory(&ddsCaps, sizeof(ddsCaps));
- for (i=0; i<level; i++) {
- ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
- hr = IDirectDrawSurface7_GetAttachedSurface(
- pSurface,
- &ddsCaps,
- &pSurface);
- if (SUCCEEDED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- } else {
- ;
- }
- }
- }
-
- // Lock all of surface
- ddsd.dwSize = sizeof(ddsd);
- hr = IDirectDrawSurface7_Lock(pSurface, NULL, &ddsd, 0, 0);
- if (FAILED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- texImage->Format,
- //_gldMesaFormatForD3DFormat(d3dsd.Format),
- _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)),
- ddsd.lpSurface,
- width, height, 1, 0, 0, 0,
- ddsd.lPitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- IDirectDrawSurface7_Unlock(pSurface, NULL);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- // A 1D texture is a 2D texture with a height of zero
- gld_TexImage2D_DX7(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_GET_CONTEXT
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- D3DFORMAT d3dFormat;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
- RECT rcSrcRect;
- RECT rcDstRect;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= _GLD_DX8_TEX(GetLevelCount(pTex))
- return; // Level does not exist
- hr = _GLD_DX8_TEX(GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->Format);
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- // Source rectangle is whole of input image
- SetRect(&rcSrcRect, 0, 0, width, height);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- &rcDstRect,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- IDirectDrawSurface7 *pTex;
- IDirectDrawSurface7 *pSurface;
- HRESULT hr;
- RECT rcDstRect;
- DDSURFACEDESC2 ddsd;
- int i;
- DDSCAPS2 ddsCaps;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
-
- __try {
-
- ddsd.dwSize = sizeof(ddsd);
- _GLD_DX7_TEX(GetSurfaceDesc(pTex, &ddsd));
- if ((level > 0) && (level >= ddsd.dwMipMapCount))
- return; // Level does not exist
-
- ZeroMemory(&ddsCaps, sizeof(ddsCaps));
- pSurface = pTex;
- for (i=0; i<level; i++) {
- ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
- hr = IDirectDrawSurface7_GetAttachedSurface(
- pSurface,
- &ddsCaps,
- &pSurface);
- if(SUCCEEDED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- } else {
- return;
- }
- }
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- // Lock sub-rect of surface
- hr = IDirectDrawSurface7_Lock(pSurface, &rcDstRect, &ddsd, 0, 0);
- if (FAILED(hr)) {
- IDirectDrawSurface7_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- _gldMesaFormatForD3DFormat(_gldD3DXFormatFromSurface(pSurface)),
- ddsd.lpSurface,
- width, height, 1,
- 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!!
- ddsd.lPitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
-
- IDirectDrawSurface7_Unlock(pSurface, &rcDstRect);
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- ;
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gld_TexSubImage2D_DX7(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DeleteTexture_DX7(
- GLcontext *ctx,
- struct gl_texture_object *tObj)
-{
- GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
-
- __try {
-
- if (tObj) {
- IDirectDrawSurface7 *pTex = (IDirectDrawSurface7*)tObj->DriverData;
- if (pTex) {
-/* // Make sure texture is not bound to a stage before releasing it
- for (int i=0; i<MAX_TEXTURE_UNITS; i++) {
- if (gld->CurrentTexture[i] == pTex) {
- gld->pDev->SetTexture(i, NULL);
- gld->CurrentTexture[i] = NULL;
- }
- }*/
- _GLD_DX7_TEX(Release(pTex));
- tObj->DriverData = NULL;
- }
- }
-
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- ;
- }
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetColorOps(
- const GLD_driver_dx7 *gld,
- GLuint unit,
- DWORD ColorArg1,
- D3DTEXTUREOP ColorOp,
- DWORD ColorArg2)
-{
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2));
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetAlphaOps(
- const GLD_driver_dx7 *gld,
- GLuint unit,
- DWORD AlphaArg1,
- D3DTEXTUREOP AlphaOp,
- DWORD AlphaArg2)
-{
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2));
-}
-
-//---------------------------------------------------------------------------
-
-void gldUpdateTextureUnit(
- GLcontext *ctx,
- GLuint unit,
- BOOL bPassThrough)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- D3DTEXTUREMINFILTER minfilter;
- D3DTEXTUREMIPFILTER mipfilter;
- GLenum BaseFormat;
- DWORD dwColorArg0;
- int iTexEnv = 0;
- GLD_texenv *pTexenv;
-
- // NOTE: If bPassThrough is FALSE then texture stage can be
- // disabled otherwise it must pass-through it's current fragment.
-
- const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = pUnit->_Current;
-
- IDirectDrawSurface7 *pTex = NULL;
- if (tObj) {
- pTex = (IDirectDrawSurface7*)tObj->DriverData;
- }
-
- __try {
-
- // Enable texturing if unit is enabled and a valid D3D texture exists
- // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT
- //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) {
- if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) {
- // Enable texturing
- _GLD_DX7_DEV(SetTexture(gld->pDev, unit, pTex));
- } else {
- // Disable texturing, then return
- _GLD_DX7_DEV(SetTexture(gld->pDev, unit, NULL));
- if (bPassThrough) {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- } else {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- }
- return;
- }
-
- // Texture parameters
- _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter);
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
- _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
-
- // Texture priority
- _GLD_DX7_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f)));
-
- // Texture environment
- // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops.
- // See Page 355 of the Red Book.
- BaseFormat = _gldDecodeBaseFormat(pTex);
-
- switch (BaseFormat) {
- case GL_RGB:
- iTexEnv = 0;
- break;
- case GL_RGBA:
- iTexEnv = 1;
- break;
- case GL_ALPHA:
- iTexEnv = 2;
- break;
- }
-
- switch (pUnit->EnvMode) {
- case GL_DECAL:
- iTexEnv += 0;
- break;
- case GL_REPLACE:
- iTexEnv += 3;
- break;
- case GL_MODULATE:
- iTexEnv += 6;
- break;
- case GL_BLEND:
- // Set blend colour
- // Unsupported by DX7
-// dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]);
-// _GLD_DX7_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0));
-// gldLogMessage(GLDLOG_WARN, "GL_BLEND\n");
- iTexEnv += 9;
- break;
- case GL_ADD:
- iTexEnv += 12;
- break;
- }
- pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv];
- _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2);
- _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2);
-
- }
- __except(EXCEPTION_EXECUTE_HANDLER) {
- ;
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_TEXTURE_DX7(
- GLcontext *ctx)
-{
- // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
-
- BOOL bUnit0Enabled;
- BOOL bUnit1Enabled;
-
- if (!ctx)
- return; // Sanity check
-
- if (ctx->Const.MaxTextureUnits == 1) {
- gldUpdateTextureUnit(ctx, 0, TRUE);
- return;
- }
-
- //
- // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!!
- //
-
- // Mesa 5: Texture Units altered
- bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
- bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
-
- // If Unit0 is disabled and Unit1 is enabled then we must pass-though
- gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE);
- // We can always disable the last texture unit
- gldUpdateTextureUnit(ctx, 1, FALSE);
-
-#ifdef _DEBUG
- {
- // Find out whether device supports current renderstates
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- DWORD dwPasses;
- _GLD_DX7_DEV(ValidateDevice(gld->pDev, &dwPasses));
-#if 0
- if (FAILED(hr)) {
- gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr);
- }
-#endif
- if (dwPasses != 1) {
- gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n");
- }
- }
-#endif
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
deleted file mode 100644
index a85620dde8d..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect fastpath pipeline stage
-*
-****************************************************************************/
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-/*
-__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
- GLD_driver_dx8 *gld)
-{
- D3DXMATRIX mat, matView, matProj;
- GLfloat *pM;
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ModelView.m;
- pM = ctx->ModelviewMatrixStack.Top->m;
- matView._11 = pM[0];
- matView._12 = pM[1];
- matView._13 = pM[2];
- matView._14 = pM[3];
- matView._21 = pM[4];
- matView._22 = pM[5];
- matView._23 = pM[6];
- matView._24 = pM[7];
- matView._31 = pM[8];
- matView._32 = pM[9];
- matView._33 = pM[10];
- matView._34 = pM[11];
- matView._41 = pM[12];
- matView._42 = pM[13];
- matView._43 = pM[14];
- matView._44 = pM[15];
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ProjectionMatrix.m;
- pM = ctx->ProjectionMatrixStack.Top->m;
- matProj._11 = pM[0];
- matProj._12 = pM[1];
- matProj._13 = pM[2];
- matProj._14 = pM[3];
- matProj._21 = pM[4];
- matProj._22 = pM[5];
- matProj._23 = pM[6];
- matProj._24 = pM[7];
- matProj._31 = pM[8];
- matProj._32 = pM[9];
- matProj._33 = pM[10];
- matProj._34 = pM[11];
- matProj._41 = pM[12];
- matProj._42 = pM[13];
- matProj._43 = pM[14];
- matProj._44 = pM[15];
-
- D3DXMatrixMultiply( &mat, &matView, &matProj );
- D3DXMatrixTranspose( &mat, &mat );
-
- _GLD_DX8_DEV(SetVertexShaderConstant(gld->pDev, 0, &mat, 4));
-}
-*/
-//---------------------------------------------------------------------------
-
-static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- TNLcontext *tnl;
- struct vertex_buffer *VB;
- tnl_render_func *tab;
- GLint pass;
- GLD_pb_dx7 *gldPB = &gld->PB3d;
- DWORD dwFlags;
-
-/*
- static int count = 0;
- count++;
- if (count != 2)
- return GL_FALSE;
-*/
- // The "check" function should disable this stage,
- // but we'll test gld->bUseMesaTnL anyway.
- if (gld->bUseMesaTnL) {
- // Do nothing in this stage, but continue pipeline
- return GL_TRUE;
- }
-
- tnl = TNL_CONTEXT(ctx);
- VB = &tnl->vb;
- pass = 0;
-
- tnl->Driver.Render.Start( ctx );
-
-#if 0
- // For debugging: Useful to see if an app passes colour data in
- // an unusual format.
- switch (VB->ColorPtr[0]->Type) {
- case GL_FLOAT:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
- break;
- case GL_UNSIGNED_BYTE:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n");
- break;
- default:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n");
- break;
- }
-#endif
-
- tnl->Driver.Render.Points = gld_Points3D_DX7;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line3DFlat_DX7;
- tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX7;
- tnl->Driver.Render.Quad = gld_Quad3DFlat_DX7;
- } else {
- tnl->Driver.Render.Line = gld_Line3DSmooth_DX7;
- tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX7;
- tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX7;
- }
-
-// _GLD_DX7_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- dwFlags = DDLOCK_DISCARDCONTENTS | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY;
- _GLD_DX7_VB(Lock(gldPB->pVB, dwFlags, &gldPB->pPoints, NULL));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts);
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length)
- {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
- _GLD_DX7_VB(Unlock(gldPB->pVB));
-
-// _GLD_DX7_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride));
-
- _GLD_DX7_DEV(SetTransform(gld->pDev, D3DTRANSFORMSTATE_PROJECTION, &gld->matProjection));
- _GLD_DX7_DEV(SetTransform(gld->pDev, D3DTRANSFORMSTATE_WORLD, &gld->matModelView));
-
- if (gldPB->nPoints) {
-// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_POINTLIST, gldPB->pVB, 0, gldPB->nPoints, 0));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
-// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_LINELIST, gldPB->pVB, gldPB->iFirstLine, gldPB->nLines, 0));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
-// _GLD_DX7_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_TRIANGLELIST, gldPB->pVB, gldPB->iFirstTriangle, gldPB->nTriangles, 0));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_d3d_render_stage =
-{
- "gld_d3d_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- gld_d3d_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c
deleted file mode 100644
index 0a57bde2588..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_mesa_render_dx7.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/* $Id: gld_vb_mesa_render_dx7.c,v 1.6 2005-08-27 13:56:08 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
- */
-
-
-/*
- * Render whole vertex buffers, including projection of vertices from
- * clip space and clipping of primitives.
- *
- * This file makes calls to project vertices and to the point, line
- * and triangle rasterizers via the function pointers:
- *
- * context->Driver.Render.*
- *
- */
-
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx7.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-/**********************************************************************/
-/* Clip single primitives */
-/**********************************************************************/
-
-
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
-#define W(i) coord[i][3]
-#define Z(i) coord[i][2]
-#define Y(i) coord[i][1]
-#define X(i) coord[i][0]
-#define SIZE 4
-#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h"
-
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, with the possibility of clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte ormask = c1|c2; \
- if (!ormask) \
- LineFunc( ctx, v1, v2 ); \
- else if (!(c1 & c2 & 0x3f)) \
- clip_line_4( ctx, v1, v2, ormask ); \
-} while (0)
-
-#define RENDER_TRI( v1, v2, v3 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
- GLubyte ormask = c1|c2|c3; \
- if (!ormask) \
- TriangleFunc( ctx, v1, v2, v3 ); \
- else if (!(c1 & c2 & c3 & 0x3f)) \
- clip_tri_4( ctx, v1, v2, v3, ormask ); \
-} while (0)
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte c3 = mask[v3], c4 = mask[v4]; \
- GLubyte ormask = c1|c2|c3|c4; \
- if (!ormask) \
- QuadFunc( ctx, v1, v2, v3, v4 ); \
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) \
- clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \
-} while (0)
-
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
-
-#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/* Elts, with the possibility of clipping.
- */
-#undef ELT
-#undef TAG
-#define ELT(x) elt[x]
-#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
-
-/* TODO: do this for all primitives, verts and elts:
- */
-static void clip_elt_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &tnl->vb;
- const GLuint * const elt = VB->Elts;
- GLubyte *mask = VB->ClipMask;
- GLuint last = count-2;
- GLuint j;
- (void) flags;
-
- tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
-
- for (j=start; j < last; j+=3 ) {
- GLubyte c1 = mask[elt[j]];
- GLubyte c2 = mask[elt[j+1]];
- GLubyte c3 = mask[elt[j+2]];
- GLubyte ormask = c1|c2|c3;
- if (ormask) {
- if (start < j)
- render_tris( ctx, start, j, 0 );
- if (!(c1&c2&c3&0x3f))
- clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask );
- start = j+3;
- }
- }
-
- if (start < j)
- render_tris( ctx, start, j, 0 );
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, no clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
- LineFunc( ctx, v1, v2 )
-
-#define RENDER_TRI( v1, v2, v3 ) \
- TriangleFunc( ctx, v1, v2, v3 )
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
- QuadFunc( ctx, v1, v2, v3, v4 )
-
-#define TAG(x) _gld_tnl_##x##_verts
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-/* Elts, no clipping.
- */
-#undef ELT
-#define TAG(x) _gld_tnl_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Helper functions for drivers */
-/**********************************************************************/
-/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint *tmp = VB->Elts;
-
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
-}
-
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-*/
-
-
-/**********************************************************************/
-/* Clip and render whole vertex buffers */
-/**********************************************************************/
-
-tnl_points_func _gldSetupPoints[4] = {
- gld_Points2D_DX7,
- gld_Points2D_DX7,
- gld_Points2D_DX7,
- gld_Points2D_DX7
-};
-tnl_line_func _gldSetupLine[4] = {
- gld_Line2DFlat_DX7,
- gld_Line2DSmooth_DX7,
- gld_Line2DFlat_DX7,
- gld_Line2DSmooth_DX7,
-};
-tnl_triangle_func _gldSetupTriangle[4] = {
- gld_Triangle2DFlat_DX7,
- gld_Triangle2DSmooth_DX7,
- gld_Triangle2DFlatExtras_DX7,
- gld_Triangle2DSmoothExtras_DX7
-};
-tnl_quad_func _gldSetupQuad[4] = {
- gld_Quad2DFlat_DX7,
- gld_Quad2DSmooth_DX7,
- gld_Quad2DFlatExtras_DX7,
- gld_Quad2DSmoothExtras_DX7
-};
-
-//---------------------------------------------------------------------------
-
-static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab;
- GLint pass = 0;
- GLD_pb_dx7 *gldPB;
- DWORD dwFlags;
-
- /* Allow the drivers to lock before projected verts are built so
- * that window coordinates are guarenteed not to change before
- * rendering.
- */
- ASSERT(tnl->Driver.Render.Start);
-
- tnl->Driver.Render.Start( ctx );
-
- gldPB = &gld->PB2d;
- tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc];
- tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc];
- tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc];
- tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc];
-
- dwFlags = DDLOCK_DISCARDCONTENTS | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY;
- _GLD_DX7_VB(Lock(gldPB->pVB, dwFlags, &gldPB->pPoints, NULL));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
-
- // Allocate primitive pointers - gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 );
-
- if (VB->ClipOrMask) {
- tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
- }
- else {
- tab = (VB->Elts ?
- tnl->Driver.Render.PrimTabElts :
- tnl->Driver.Render.PrimTabVerts);
- }
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length) {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
-
-// tnl->Driver.Render.Finish( ctx );
-
- _GLD_DX7_VB(Unlock(gldPB->pVB));
-
- if (gldPB->nPoints) {
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_POINTLIST, gldPB->pVB, 0, gldPB->nPoints, 0));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_LINELIST, gldPB->pVB, gldPB->iFirstLine, gldPB->nLines*2, 0));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX7_DEV(DrawPrimitiveVB(gld->pDev, D3DPT_TRIANGLELIST, gldPB->pVB, gldPB->iFirstTriangle, gldPB->nTriangles*3, 0));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-const struct tnl_pipeline_stage _gld_mesa_render_stage =
-{
- "gld_mesa_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- _gld_mesa_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c
deleted file mode 100644
index 0f8fe33eb15..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx7/gld_wgl_dx7.c
+++ /dev/null
@@ -1,1611 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.x WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-//#include "gld_dxerr8.h"
-#include "gld_dx7.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-// Copied from dglcontect.c
-#define GLDERR_NONE 0
-#define GLDERR_MEM 1
-#define GLDERR_DDRAW 2
-#define GLDERR_D3D 3
-#define GLDERR_BPP 4
-#define GLDERR_DDS 5
-// This external var keeps track of any error
-extern int nContextError;
-
-// Uncomment this for persistant resources
-//#define _GLD_PERSISTANT
-
-#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
-
-//---------------------------------------------------------------------------
-
-static char szColorDepthWarning[] =
-"GLDirect does not support the current desktop\n\
-color depth.\n\n\
-You may need to change the display resolution to\n\
-16 bits per pixel or higher color depth using\n\
-the Windows Display Settings control panel\n\
-before running this OpenGL application.\n";
-
-// The only depth-stencil formats currently supported by Direct3D
-// Surface Format Depth Stencil Total Bits
-// D3DFMT_D32 32 - 32
-// D3DFMT_D15S1 15 1 16
-// D3DFMT_D24S8 24 8 32
-// D3DFMT_D16 16 - 16
-// D3DFMT_D24X8 24 - 32
-// D3DFMT_D24X4S4 24 4 32
-
-// This pixel format will be used as a template when compiling the list
-// of pixel formats supported by the hardware. Many fields will be
-// filled in at runtime.
-// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
-static DGL_pixelFormat pfTemplateHW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 16, // Total colour bitplanes (excluding alpha bitplanes)
- 5, 0, // Red bits, shift
- 5, 0, // Green bits, shift
- 5, 0, // Blue bits, shift
- 0, 0, // Alpha bits, shift (destination alpha)
- 0, // Accumulator bits (total)
- 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha
- 0, // Depth bits
- 0, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- D3DX_SF_UNKNOWN, // No depth/stencil buffer
-};
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// Vertex Shader Declaration
-static DWORD dwTwoSidedLightingDecl[] =
-{
- D3DVSD_STREAM(0),
- D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position
- D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal
- D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color
- D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color
- D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0
- D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1
- D3DVSD_END()
-};
-
-// Vertex Shader for two-sided lighting
-static char *szTwoSidedLightingVS =
-// This is a test shader!
-"vs.1.0\n"
-"m4x4 oPos,v0,c0\n"
-"mov oD0,v2\n"
-"mov oD1,v3\n"
-"mov oT0,v4\n"
-"mov oT1,v5\n"
-;
-*/
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-typedef struct {
-// HINSTANCE hD3D8DLL; // Handle to d3d8.dll
-// FNDIRECT3DCREATE7 fnDirect3DCreate7; // Direct3DCreate8 function prototype
-// BOOL bDirect3D; // Persistant Direct3D7 exists
-// BOOL bDirect3DDevice; // Persistant Direct3DDevice7 exists
-// IDirect3D7 *pD3D; // Persistant Direct3D7
-// IDirect3DDevice7 *pDev; // Persistant Direct3DDevice7
- BOOL bD3DXStarted;
-} GLD_dx7_globals;
-
-// These are "global" to all DX7 contexts. KeithH
-static GLD_dx7_globals dx7Globals;
-
-// Added for correct clipping of multiple open windows. (DaveM)
-LPDIRECTDRAWSURFACE7 lpDDSPrimary = NULL;
-LPDIRECTDRAWCLIPPER lpDDClipper = NULL;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-BOOL gldGetDXErrorString_DX(
- HRESULT hr,
- char *buf,
- int nBufSize)
-{
- //
- // Return a string describing the input HRESULT error code
- //
-
- D3DXGetErrorString(hr, nBufSize, buf);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-//
-// DX7 does not support multisample
-/*
-static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType(
- IDirect3D8 *pD3D8,
- D3DFORMAT SurfaceFormat,
- D3DDEVTYPE d3dDevType,
- BOOL Windowed)
-{
- int i;
- HRESULT hr;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE)
- return D3DMULTISAMPLE_NONE;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) {
- // Find fastest multisample
- for (i=2; i<17; i++) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- } else {
- // Find nicest multisample
- for (i=16; i>1; i--) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- }
-
- // Nothing found - return default
- return D3DMULTISAMPLE_NONE;
-}
-*/
-//---------------------------------------------------------------------------
-
-void _gldDestroyPrimitiveBuffer(
- GLD_pb_dx7 *gldVB)
-{
- SAFE_RELEASE(gldVB->pVB);
-
- // Sanity check...
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
-}
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
- GLD_driver_dx7 *lpCtx,
- GLD_pb_dx7 *gldVB)
-{
- HRESULT hResult;
- char *szCreateVertexBufferFailed = "CreateVertexBuffer failed";
- DWORD dwMaxVertices; // Max number of vertices in vertex buffer
- DWORD dwVBSize; // Total size of vertex buffer
- D3DVERTEXBUFFERDESC vbdesc;
-
- // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
- // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
- // We'll use IMM_SIZE if it's larger (which it should not be).
- dwMaxVertices = MAX_ARRAY_LOCK_SIZE;
-
- // Max vertex buffer size limited in DX7. (DaveM)
- if (dwMaxVertices*9 > D3DMAXNUMVERTICES)
- dwMaxVertices = D3DMAXNUMVERTICES/9;
-
- // Now calculate how many vertices to allow for in total
- // 1 per point, 2 per line, 6 per quad = 9
- dwVBSize = dwMaxVertices * 9 * gldVB->dwStride;
-
- vbdesc.dwSize = sizeof(vbdesc);
- vbdesc.dwCaps = gldVB->dwCreateFlags;
- vbdesc.dwFVF = gldVB->dwFVF;
- vbdesc.dwNumVertices = dwMaxVertices * 9;
-
-/* hResult = IDirect3DDevice8_CreateVertexBuffer(
- lpCtx->pDev,
- dwVBSize,
-RAgldVB->dwUsage,
- gldVB->dwFVF,
- gldVB->dwPool,
- &gldVB->pVB);*/
- hResult = IDirect3D7_CreateVertexBuffer(
- lpCtx->pD3D,
- &vbdesc,
- &gldVB->pVB,
- 0);
- if (FAILED(hResult)) {
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed);
- return hResult;
- }
-
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
- gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL;
- gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB
- gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-// Function: _gldCreateVertexShaders
-// Create DX8 Vertex Shaders.
-//---------------------------------------------------------------------------
-/*
-void _gldCreateVertexShaders(
- GLD_driver_dx8 *gld)
-{
- DWORD dwFlags;
- LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer
- HRESULT hr;
-
-#ifdef _DEBUG
- dwFlags = D3DXASM_DEBUG;
-#else
- dwFlags = 0; // D3DXASM_SKIPVALIDATION;
-#endif
-
- ddlogMessage(DDLOG_INFO, "Creating shaders...\n");
-
- // Init the shader handle
- gld->VStwosidelight.hShader = 0;
-
- if (gld->d3dCaps8.MaxStreams == 0) {
- // Lame DX8 driver doesn't support streams
- // Not fatal, as defaults will be used
- ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n");
- return;
- }
-
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-// return;
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-
- //
- // Two-sided lighting
- //
-
-#if 0
- //
- // DEBUGGING: Load shader from a text file
- //
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- hr = D3DXAssembleShaderFromFile(
- "twoside.vsh",
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#else
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- // Assemble ascii shader text into shader opcodes
- hr = D3DXAssembleShader(
- szTwoSidedLightingVS,
- strlen(szTwoSidedLightingVS),
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#endif
- if (FAILED(hr)) {
- ddlogError(DDLOG_WARN, "AssembleShader failed", hr);
- SAFE_RELEASE(pVSOpcodeBuffer);
- return;
- }
-
-// This is for debugging. Remove to enable vertex shaders in HW
-#define _GLD_FORCE_SW_VS 0
-
- if (_GLD_FORCE_SW_VS) {
- // _GLD_FORCE_SW_VS should be disabled for Final Release
- ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n");
- }
-
- // Try and create shader in hardware.
- // NOTE: The D3D Ref device appears to succeed when trying to
- // create the device in hardware, but later complains
- // when trying to set it with SetVertexShader(). Go figure.
- if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) {
- // Don't try and create a hardware shader with the Ref device
- hr = E_FAIL; // COM error/fail result
- } else {
- gld->VStwosidelight.bHardware = TRUE;
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- 0);
- }
- if (FAILED(hr)) {
- ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n");
- // Failed. Try and create shader for software processing
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- D3DUSAGE_SOFTWAREPROCESSING);
- if (FAILED(hr)) {
- gld->VStwosidelight.hShader = 0; // Sanity check
- ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr);
- return;
- }
- // Succeeded, but for software processing
- gld->VStwosidelight.bHardware = FALSE;
- }
-
- SAFE_RELEASE(pVSOpcodeBuffer);
-
- ddlogMessage(DDLOG_INFO, "... OK\n");
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyVertexShaders(
- GLD_driver_dx8 *gld)
-{
- if (gld->VStwosidelight.hShader) {
- IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader);
- gld->VStwosidelight.hShader = 0;
- }
-}
-*/
-//---------------------------------------------------------------------------
-
-BOOL gldCreateDrawable_DX(
- DGL_ctx *ctx,
-// BOOL bDefaultDriver,
- BOOL bDirectDrawPersistant,
- BOOL bPersistantBuffers)
-{
- //
- // bDirectDrawPersistant: applies to IDirect3D8
- // bPersistantBuffers: applies to IDirect3DDevice8
- //
-
-// D3DDEVTYPE d3dDevType;
-// D3DPRESENT_PARAMETERS d3dpp;
-// D3DDISPLAYMODE d3ddm;
-// DWORD dwBehaviourFlags;
-// D3DADAPTER_IDENTIFIER8 d3dIdent;
-
- HRESULT hr;
- GLD_driver_dx7 *lpCtx = NULL;
- D3DX_VIDMODEDESC d3ddm;
-
- // Parameters for D3DXCreateContextEx
- // These will be different for fullscreen and windowed
- DWORD dwDeviceIndex;
- DWORD dwFlags;
- HWND hwnd;
- HWND hwndFocus;
- DWORD numColorBits;
- DWORD numAlphaBits;
- DWORD numDepthBits;
- DWORD numStencilBits;
- DWORD numBackBuffers;
- DWORD dwWidth;
- DWORD dwHeight;
- DWORD refreshRate;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- if (ctx->glPriv) {
- lpCtx = ctx->glPriv;
- // Release any existing interfaces (in reverse order)
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext);
- lpCtx->pD3DXContext = NULL;
- } else {
- lpCtx = (GLD_driver_dx7*)malloc(sizeof(GLD_driver_dx7));
- ZeroMemory(lpCtx, sizeof(lpCtx));
- }
-
-// d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- // Use REF device if requested. Otherwise D3DX_DEFAULT will choose highest level
- // of HW acceleration.
- dwDeviceIndex = (glb.dwDriver == GLDS_DRIVER_REF) ? D3DX_HWLEVEL_REFERENCE : D3DX_DEFAULT;
-
- // TODO: Check this
-// if (bDefaultDriver)
-// d3dDevType = D3DDEVTYPE_REF;
-
-#ifdef _GLD_PERSISTANT
- // Use persistant interface if needed
- if (bDirectDrawPersistant && dx7Globals.bDirect3D) {
- lpCtx->pD3D = dx7Globals.pD3D;
- IDirect3D7_AddRef(lpCtx->pD3D);
- goto SkipDirectDrawCreate;
- }
-#endif
-/*
- // Create Direct3D7 object
- lpCtx->pD3D = dx7Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95);
- if (lpCtx->pD3D == NULL) {
- MessageBox(NULL, "Unable to initialize Direct3D8", "GLDirect", MB_OK);
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D8 interface");
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-*/
-
-#ifdef _GLD_PERSISTANT
- // Cache Direct3D interface for subsequent GLRCs
- if (bDirectDrawPersistant && !dx8Globals.bDirect3D) {
- dx7Globals.pD3D = lpCtx->pD3D;
- IDirect3D7_AddRef(dx7Globals.pD3D);
- dx7Globals.bDirect3D = TRUE;
- }
-SkipDirectDrawCreate:
-#endif
-/*
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-*/
-
-#if 0
- // Get device caps
- hResult = IDirect3D8_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps8);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_GetDeviceCaps failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Check for hardware transform & lighting
- lpCtx->bHasHWTnL = lpCtx->d3dCaps8.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
- // If this flag is present then we can't default to Mesa
- // SW rendering between BeginScene() and EndScene().
- if (lpCtx->d3dCaps8.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) {
- ddlogMessage(DDLOG_WARN,
- "Warning : No 2D allowed during 3D scene.\n");
- }
-#endif
-
- //
- // Create the Direct3D context
- //
-
-#ifdef _GLD_PERSISTANT
- // Re-use original IDirect3DDevice if persistant buffers exist.
- // Note that we test for persistant IDirect3D8 as well
- // bDirectDrawPersistant == persistant IDirect3D8 (DirectDraw8 does not exist)
- if (bDirectDrawPersistant && bPersistantBuffers && dx7Globals.pD3D && dx7Globals.pDev) {
- lpCtx->pDev = dx7Globals.pDev;
- IDirect3DDevice7_AddRef(dx7Globals.pDev);
- goto skip_direct3ddevice_create;
- }
-#endif
-/*
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
-
- // Support for vertical retrace synchronisation.
- // Set default presentation interval in case caps bits are missing
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- // FullScreen_PresentationInterval must be default for Windowed mode
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
-
- // Decide if we can use hardware TnL
- dwBehaviourFlags = (lpCtx->bHasHWTnL) ?
- D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
- // Add flag to tell D3D to be thread-safe
- if (glb.bMultiThreaded)
- dwBehaviourFlags |= D3DCREATE_MULTITHREADED;
- hResult = IDirect3D8_CreateDevice(lpCtx->pD3D,
- glb.dwAdapter,
- d3dDevType,
- ctx->hWnd,
- dwBehaviourFlags,
- &d3dpp,
- &lpCtx->pDev);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_CreateDevice failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-*/
-
- // Create D3DX context
- if (ctx->bFullscreen) {
- //
- // FULLSCREEN
- //
-
- // Get display mode
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
-
- // Fullscreen Parameters
- dwFlags = D3DX_CONTEXT_FULLSCREEN;
- hwnd = ctx->hWnd;
- hwndFocus = ctx->hWnd;
- numColorBits = ctx->lpPF->pfd.cColorBits;
- numAlphaBits = ctx->lpPF->pfd.cAlphaBits;
- numDepthBits = ctx->lpPF->pfd.cDepthBits + ctx->lpPF->pfd.cStencilBits;
- numStencilBits = ctx->lpPF->pfd.cStencilBits;
- numBackBuffers = D3DX_DEFAULT; // Default is 1 backbuffer
- dwWidth = d3ddm.width;
- dwHeight = d3ddm.height;
- refreshRate = d3ddm.refreshRate; // D3DX_DEFAULT;
- } else {
- //
- // WINDOWED
- //
-
- // Windowed Parameters
- dwFlags = 0; // No flags means "windowed"
- hwnd = ctx->hWnd;
- hwndFocus = (HWND)D3DX_DEFAULT;
- numColorBits = D3DX_DEFAULT; // Use Desktop depth
- numAlphaBits = ctx->lpPF->pfd.cAlphaBits;
- numDepthBits = ctx->lpPF->pfd.cDepthBits + ctx->lpPF->pfd.cStencilBits;
- numStencilBits = ctx->lpPF->pfd.cStencilBits;
- numBackBuffers = D3DX_DEFAULT; // Default is 1 backbuffer
- dwWidth = ctx->dwWidth;
- dwHeight = ctx->dwHeight;
- refreshRate = D3DX_DEFAULT;
- }
- hr = D3DXCreateContextEx(dwDeviceIndex, dwFlags, hwnd, hwndFocus,
- numColorBits, numAlphaBits, numDepthBits, numStencilBits,
- numBackBuffers,
- dwWidth, dwHeight, refreshRate,
- &lpCtx->pD3DXContext);
- if (FAILED(hr)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "D3DXCreateContextEx failed", hr);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Obtain D3D7 interfaces from ID3DXContext
-// lpCtx->pDD = ID3DXContext_GetDD(lpCtx->pD3DXContext);
- lpCtx->pDD = lpCtx->pD3DXContext->lpVtbl->GetDD(lpCtx->pD3DXContext);
- if (lpCtx->pDD == NULL)
- goto return_with_error;
- lpCtx->pD3D = lpCtx->pD3DXContext->lpVtbl->GetD3D(lpCtx->pD3DXContext);
- if (lpCtx->pD3D == NULL)
- goto return_with_error;
- lpCtx->pDev = lpCtx->pD3DXContext->lpVtbl->GetD3DDevice(lpCtx->pD3DXContext);
- if (lpCtx->pDev == NULL)
- goto return_with_error;
-
- // Need to manage clipper manually for multiple windows
- // since DX7 D3DX utility lib does not appear to do that. (DaveM)
- if (!ctx->bFullscreen) {
- // Get primary surface too
- lpDDSPrimary = lpCtx->pD3DXContext->lpVtbl->GetPrimary(lpCtx->pD3DXContext);
- if (lpDDSPrimary == NULL) {
- ddlogPrintf(DDLOG_WARN, "GetPrimary");
- goto return_with_error;
- }
- // Create clipper for correct window updates
- if (IDirectDraw7_CreateClipper(lpCtx->pDD, 0, &lpDDClipper, NULL) != DD_OK) {
- ddlogPrintf(DDLOG_WARN, "CreateClipper");
- goto return_with_error;
- }
- // Set the window that the clipper belongs to
- if (IDirectDrawClipper_SetHWnd(lpDDClipper, 0, hwnd) != DD_OK) {
- ddlogPrintf(DDLOG_WARN, "SetHWnd");
- goto return_with_error;
- }
- // Attach the clipper to the primary surface
- if (IDirectDrawSurface7_SetClipper(lpDDSPrimary, lpDDClipper) != DD_OK) {
- ddlogPrintf(DDLOG_WARN, "SetClipper");
- goto return_with_error;
- }
- }
-
- // Get device caps
- IDirect3DDevice7_GetCaps(lpCtx->pDev, &lpCtx->d3dCaps);
-
- // Determine HW TnL
- lpCtx->bHasHWTnL = lpCtx->d3dCaps.dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
-#ifdef _GLD_PERSISTANT
- if (bDirectDrawPersistant && bPersistantBuffers && dx7Globals.pD3D) {
- dx7Globals.pDev = lpCtx->pDev;
- dx7Globals.bDirect3DDevice = TRUE;
- }
-#endif
-
-#if 0
- // Dump some useful stats
- hResult = IDirect3D8_GetAdapterIdentifier(
- lpCtx->pD3D,
- glb.dwAdapter,
- D3DENUM_NO_WHQL_LEVEL, // Avoids 1 to 2 second delay
- &d3dIdent);
- if (SUCCEEDED(hResult)) {
- ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description);
- ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]",
- d3dIdent.Driver,
- HIWORD(d3dIdent.DriverVersion.HighPart),
- LOWORD(d3dIdent.DriverVersion.HighPart),
- HIWORD(d3dIdent.DriverVersion.LowPart),
- LOWORD(d3dIdent.DriverVersion.LowPart));
- ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]",
- d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision);
- }
-#endif
-
- // Init projection matrix for D3D TnL
- D3DXMatrixIdentity((D3DXMATRIX*)&lpCtx->matProjection);
- lpCtx->matModelView = lpCtx->matProjection;
-// gld->bUseMesaProjection = TRUE;
-
-skip_direct3ddevice_create:
-
- // Create buffers to hold primitives
- lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX;
-// lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM;
- lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX);
- lpCtx->PB2d.dwCreateFlags = D3DVBCAPS_DONOTCLIP |
- D3DVBCAPS_SYSTEMMEMORY |
- D3DVBCAPS_WRITEONLY;
- hr = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d);
- if (FAILED(hr))
- goto return_with_error;
-
- lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX;
-// lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX);
- lpCtx->PB3d.dwCreateFlags = D3DVBCAPS_WRITEONLY;
-
- hr = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d);
- if (FAILED(hr))
- goto return_with_error;
-
- // Zero the pipeline usage counters
- lpCtx->PipelineUsage.qwMesa.QuadPart =
-// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart =
- lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0;
-
- // Assign drawable to GL private
- ctx->glPriv = lpCtx;
- return TRUE;
-
-return_with_error:
- // Clean up and bail
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- //SAFE_RELEASE(lpCtx->pD3DXContext);
- lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext);
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_DX(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- GLD_driver_dx7 *gld = NULL;
-// D3DDEVTYPE d3dDevType;
-// D3DPRESENT_PARAMETERS d3dpp;
-// D3DDISPLAYMODE d3ddm;
- D3DX_VIDMODEDESC d3ddm;
- HRESULT hr;
- DWORD dwWidth, dwHeight;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice7_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-/*
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- if (!bDefaultDriver)
- d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software)
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
-// goto return_with_error;
- return FALSE;
- }
-*/
- // Release objects before Reset()
- _gldDestroyPrimitiveBuffer(&gld->PB3d);
- _gldDestroyPrimitiveBuffer(&gld->PB2d);
-
-/*
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- // TODO: Sync to refresh
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- // Get better benchmark results? KeithH
-// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED;
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
- hResult = IDirect3DDevice8_Reset(gld->pDev, &d3dpp);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult);
- return FALSE;
- //goto cleanup_and_return_with_error;
- }
-*/
- // Obtain dimensions of 'window'
- if (ctx->bFullscreen) {
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
- dwWidth = d3ddm.width;
- dwHeight = d3ddm.height;
- } else {
- dwWidth = ctx->dwWidth;
- dwHeight = ctx->dwHeight;
- }
-
- // Resize context
- hr = gld->pD3DXContext->lpVtbl->Resize(gld->pD3DXContext, dwWidth, dwHeight);
- if (FAILED(hr)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "gldResizeDrawable_DX: Resize failed", hr);
- return FALSE;
- }
-
- // Clear the resized surface (DaveM)
- {
- D3DVIEWPORT7 vp1, vp2;
- IDirect3DDevice7_GetViewport(gld->pDev, &vp1);
- IDirect3DDevice7_GetViewport(gld->pDev, &vp2);
- vp2.dwX = 0;
- vp2.dwY = 0;
- vp2.dwWidth = dwWidth;
- vp2.dwHeight = dwHeight;
- IDirect3DDevice7_SetViewport(gld->pDev, &vp2);
- hr = gld->pD3DXContext->lpVtbl->Clear(gld->pD3DXContext, D3DCLEAR_TARGET);
- if (FAILED(hr))
- ddlogError(DDLOG_WARN, "gldResizeDrawable_DX: Clear failed", hr);
- IDirect3DDevice7_SetViewport(gld->pDev, &vp1);
- }
-
- //
- // Recreate objects
- //
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d);
-
- // Signal a complete state update
- ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL);
-
- // Begin a new scene
- IDirect3DDevice7_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_DX(
- DGL_ctx *ctx)
-{
- GLD_driver_dx7 *lpCtx = NULL;
-
- // Error if context is NULL.
- if (!ctx)
- return FALSE;
-
- // Error if the drawable does not exist.
- if (!ctx->glPriv)
- return FALSE;
-
- lpCtx = ctx->glPriv;
-
-#ifdef _DEBUG
- // Dump out stats
- ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X",
- lpCtx->PipelineUsage.qwMesa.HighPart,
- lpCtx->PipelineUsage.qwMesa.LowPart,
- lpCtx->PipelineUsage.qwD3DFVF.HighPart,
- lpCtx->PipelineUsage.qwD3DFVF.LowPart);
-#endif
-
- // Destroy Primtive Buffers
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- // Release DX interfaces (in reverse order)
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- //SAFE_RELEASE(lpCtx->pD3DXContext);
- lpCtx->pD3DXContext->lpVtbl->Release(lpCtx->pD3DXContext);
-
- // Free the private drawable data
- free(ctx->glPriv);
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_DX(void)
-{
-/*
- ZeroMemory(&dx7Globals, sizeof(dx7Globals));
-
- // Load d3d8.dll
- dx8Globals.hD3D8DLL = LoadLibrary("D3D8.DLL");
- if (dx8Globals.hD3D8DLL == NULL)
- return FALSE;
-
- // Now try and obtain Direct3DCreate8
- dx8Globals.fnDirect3DCreate8 = (FNDIRECT3DCREATE8)GetProcAddress(dx8Globals.hD3D8DLL, "Direct3DCreate8");
- if (dx8Globals.fnDirect3DCreate8 == NULL) {
- FreeLibrary(dx8Globals.hD3D8DLL);
- return FALSE;
- }
-*/
-
- // Initialise D3DX
- return FAILED(D3DXInitialize()) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_DX(void)
-{
-/*
- if (dx7Globals.bDirect3DDevice) {
- SAFE_RELEASE(dx7Globals.pDev);
- dx7Globals.bDirect3DDevice = FALSE;
- }
- if (dx7Globals.bDirect3D) {
- SAFE_RELEASE(dx7Globals.pD3D);
- dx7Globals.bDirect3D = FALSE;
- }
-
- FreeLibrary(dx8Globals.hD3D8DLL);
- dx8Globals.hD3D8DLL = NULL;
- dx8Globals.fnDirect3DCreate8 = NULL;
-*/
- return FAILED(D3DXUninitialize()) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDisplayFormat(
- D3DX_SURFACEFORMAT fmt,
- BYTE *cColorBits,
- BYTE *cRedBits,
- BYTE *cGreenBits,
- BYTE *cBlueBits,
- BYTE *cAlphaBits)
-{
- switch (fmt) {
-/* case D3DX_SF_X1R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;*/
- case D3DX_SF_R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DX_SF_R5G6B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 6;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DX_SF_X8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
- return;
- case D3DX_SF_A8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 8;
- return;
- }
-
- // Should not get here!
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDepthStencilFormat(
- D3DX_SURFACEFORMAT fmt,
- BYTE *cDepthBits,
- BYTE *cStencilBits)
-{
- // NOTE: GL expects either 32 or 16 as depth bits.
- switch (fmt) {
- case D3DX_SF_Z16S0:
- *cDepthBits = 16;
- *cStencilBits = 0;
- return;
- case D3DX_SF_Z32S0:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DX_SF_Z15S1:
- *cDepthBits = 15;
- *cStencilBits = 1;
- return;
- case D3DX_SF_Z24S8:
- *cDepthBits = 24;
- *cStencilBits = 8;
- return;
- case D3DX_SF_S1Z15:
- *cDepthBits = 15;
- *cStencilBits = 1;
- return;
- case D3DX_SF_S8Z24:
- *cDepthBits = 24;
- *cStencilBits = 8;
- return;
- }
-}
-
-//---------------------------------------------------------------------------
-/*
-BOOL GLD_CheckDepthStencilMatch(
- DWORD dwDeviceIndex,
- D3DX_SURFACEFORMAT sfWant)
-{
- // Emulate function built in to DX9
- D3DX_SURFACEFORMAT sfFound;
- int i;
- int nFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, D3DX_SC_DEPTHBUFFER);
- if (nFormats) {
- for (i=0; i<nFormats; i++) {
- D3DXGetSurfaceFormat(dwDeviceIndex, NULL, D3DX_SC_DEPTHBUFFER, i, &sfFound); }
- if (sfFound == sfWant)
- return TRUE;
- }
-
- return FALSE;
-}
-*/
-//---------------------------------------------------------------------------
-
-D3DX_SURFACEFORMAT _gldFindCompatibleDepthStencilFormat(
- DWORD dwDeviceIndex)
-{
- // Jump through some hoops...
-
- ID3DXContext *pD3DXContext = NULL;
- IDirectDrawSurface7 *pZBuffer = NULL;
- DDPIXELFORMAT ddpf;
- HWND hWnd;
-
- // Get an HWND - use Desktop's
- hWnd = GetDesktopWindow();
-
- // Create a fully specified default context.
- D3DXCreateContextEx(dwDeviceIndex, 0, hWnd, (HWND)D3DX_DEFAULT,
- D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT,
- D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT,
- &pD3DXContext);
-
- // Obtain depth buffer that was created in context
- pZBuffer = pD3DXContext->lpVtbl->GetZBuffer(pD3DXContext);
-
- // Get pixel format of depth buffer
- ddpf.dwSize = sizeof(ddpf);
- pZBuffer->lpVtbl->GetPixelFormat(pZBuffer, &ddpf);
- // Done with surface - release it
- pZBuffer->lpVtbl->Release(pZBuffer);
-
- // Done with D3DX context
- pD3DXContext->lpVtbl->Release(pD3DXContext);
-
- // Convert and return
- return D3DXMakeSurfaceFormat(&ddpf);
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_DX(void)
-{
- D3DX_DEVICEDESC d3dxdd;
- D3DX_VIDMODEDESC d3ddm;
- D3DX_SURFACEFORMAT fmt[64]; // 64 should be enough...
- DWORD dwDeviceIndex;
- DWORD surfClassFlags;
-// IDirect3D7 *pD3D = NULL;
- HRESULT hr;
- int nSupportedFormats = 0; // Total formats
- int nDepthOnlyFormats = 0;
- int nDepthStencilFormats = 0;
- int i;
- DGL_pixelFormat *pPF;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-// char buf[128];
-// char cat[8];
-
- // Direct3D (SW or HW)
- // These are arranged so that 'best' pixelformat
- // is higher in the list (for ChoosePixelFormat).
-/* const D3DFORMAT DepthStencil[4] = {
- D3DX_SF_Z16S0, //D3DX_SF_D16,
- D3DX_SF_Z15S1, //D3DX_SF_D15S1,
- D3DX_SF_Z32S0, //D3DX_SF_D32,
- D3DX_SF_Z24S8, //D3DX_SF_D24S8,
- //D3DX_SF_D24X8,
- //D3DX_SF_D24X4S4,
- };*/
-
- // Dump DX version
- ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 7.0\n");
-
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- //
- // Pixelformats for Direct3D (SW or HW) rendering
- //
-
- dwDeviceIndex = (glb.dwDriver == GLDS_DRIVER_REF) ? D3DX_HWLEVEL_REFERENCE : D3DX_DEFAULT;
-
- // Dump description
- D3DXGetDeviceDescription(dwDeviceIndex, &d3dxdd);
- ddlogPrintf(GLDLOG_SYSTEM, "Device: %s", d3dxdd.driverDesc);
-
- // Get display mode
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
-
-#if 0
- // Phooey - this don't work...
-/*
- // Since D3DXGetMaxSurfaceFormats() can lie to us, we'll need a workaround.
- // Explicitly test for matching depth/stencil to display bpp.
- if (d3ddm.bpp <= 16) {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z16S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z16S0;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z15S1))
- fmt[nSupportedFormats++] = D3DX_SF_Z15S1;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_S1Z15))
- fmt[nSupportedFormats++] = D3DX_SF_S1Z15;
- // Didn't find anything? Try default
- if (nSupportedFormats == 0) {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z32S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z32S0;
- }
- } else {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z32S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z32S0;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z24S8))
- fmt[nSupportedFormats++] = D3DX_SF_Z24S8;
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_S8Z24))
- fmt[nSupportedFormats++] = D3DX_SF_S8Z24;
- // Didn't find anything? Try default
- if (nSupportedFormats == 0) {
- if (GLD_CheckDepthStencilMatch(dwDeviceIndex, D3DX_SF_Z16S0))
- fmt[nSupportedFormats++] = D3DX_SF_Z16S0;
- }
- }
-*/
- // Go the Whole Hog...
- fmt[nSupportedFormats++] = _gldFindCompatibleDepthStencilFormat(dwDeviceIndex);
-#else
- //
- // Depth buffer formats WITHOUT stencil
- //
- surfClassFlags = D3DX_SC_DEPTHBUFFER;
- nDepthOnlyFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, surfClassFlags);
- //
- // Depth buffer formats WITH stencil
- //
- surfClassFlags = D3DX_SC_DEPTHBUFFER | D3DX_SC_STENCILBUFFER;
- nDepthStencilFormats = D3DXGetMaxSurfaceFormats(dwDeviceIndex, NULL, surfClassFlags);
-
- // Work out how many formats we have in total
- if ((nDepthOnlyFormats + nDepthStencilFormats) == 0)
- return FALSE; // Bail: no compliant pixelformats
-
- // Get depth buffer formats WITHOUT stencil
- surfClassFlags = D3DX_SC_DEPTHBUFFER;
- for (i=0; i<nDepthOnlyFormats; i++) {
- D3DXGetSurfaceFormat(dwDeviceIndex, NULL, surfClassFlags, i, &fmt[nSupportedFormats++]);
- }
- // NOTE: For some reason we already get stencil formats when only specifying D3DX_SC_DEPTHBUFFER
- /*
- // Get depth buffer formats WITH stencil
- surfClassFlags = D3DX_SC_DEPTHBUFFER | D3DX_SC_STENCILBUFFER;
- for (i=0; i<nDepthStencilFormats; i++) {
- D3DXGetSurfaceFormat(dwDeviceIndex, NULL, surfClassFlags, i, &fmt[nSupportedFormats++]);
- }
- */
-#endif
-
- // Total count of pixelformats is:
- // (nSupportedFormats+1)*2
- glb.lpPF = (DGL_pixelFormat *)calloc((nSupportedFormats)*2, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = (nSupportedFormats)*2;
- if (glb.lpPF == NULL) {
- glb.nPixelFormatCount = 0;
- return FALSE;
- }
-
- // Get a copy of pointer that we can alter
- pPF = glb.lpPF;
-
- // Cache colour bits from display format
-// _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
- // Get display mode
- D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
- cColorBits = d3ddm.bpp;
- cAlphaBits = 0;
- switch (d3ddm.bpp) {
- case 15:
- cRedBits = 5; cGreenBits = 5; cBlueBits = 5;
- break;
- case 16:
- cRedBits = 5; cGreenBits = 6; cBlueBits = 5;
- break;
- case 24:
- case 32:
- cRedBits = 8; cGreenBits = 8; cBlueBits = 8;
- break;
- default:
- cRedBits = 5; cGreenBits = 5; cBlueBits = 5;
- }
-
- //
- // Add single-buffer formats
- //
-
-/* // Single-buffer, no depth-stencil buffer
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DX_SF_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- //
- // Add double-buffer formats
- //
-
-/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DX_SF_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- // Popup warning message if non RGB color mode
- {
- // This is a hack. KeithH
- HDC hdcDesktop = GetDC(NULL);
- DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- ReleaseDC(0, hdcDesktop);
- if (dwDisplayBitDepth <= 8) {
- ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
- MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
- }
- }
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_DX(
- DGL_ctx *lpCtx)
-{
- GLD_driver_dx7 *gld = NULL;
- int MaxTextureSize, TextureLevels;
- BOOL bSoftwareTnL;
-
- if (lpCtx == NULL)
- return FALSE;
-
- gld = lpCtx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (glb.bMultitexture) {
- lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps.wMaxSimultaneousTextures;
- // Only support MAX_TEXTURE_UNITS texture units.
- // ** If this is altered then the FVF formats must be reviewed **.
- if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX7)
- lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX7;
- } else {
- // Multitexture override
- lpCtx->glCtx->Const.MaxTextureUnits = 1;
- }
-
- // max texture size
-// MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth);
- MaxTextureSize = min(gld->d3dCaps.dwMaxTextureHeight, gld->d3dCaps.dwMaxTextureWidth);
- if (MaxTextureSize == 0)
- MaxTextureSize = 256; // Sanity check
-
- //
- // HACK!!
- if (MaxTextureSize > 1024)
- MaxTextureSize = 1024; // HACK - CLAMP TO 1024
- // HACK!!
- //
-
- // TODO: Check this again for Mesa 5
- // Got to set MAX_TEXTURE_SIZE as max levels.
- // Who thought this stupid idea up? ;)
- TextureLevels = 0;
- // Calculate power-of-two.
- while (MaxTextureSize) {
- TextureLevels++;
- MaxTextureSize >>= 1;
- }
- lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
-
- // Defaults
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_LIGHTING, FALSE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_DITHERENABLE, TRUE);
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD);
-
- // Set texture coord set to be used with each stage
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 0, D3DTSS_TEXCOORDINDEX, 0);
- IDirect3DDevice7_SetTextureStageState(gld->pDev, 1, D3DTSS_TEXCOORDINDEX, 1);
-
- // Set up Depth buffer
- IDirect3DDevice7_SetRenderState(gld->pDev, D3DRENDERSTATE_ZENABLE,
- (lpCtx->lpPF->dwDriverData!=D3DX_SF_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE);
-
- // Set the view matrix
- {
- D3DXMATRIX vm;
-#if 1
- D3DXMatrixIdentity(&vm);
-#else
- D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f);
- D3DXVECTOR3 At(0.0f, 0.0f, -1.0f);
- D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
- D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up);
- vm._31 = -vm._31;
- vm._32 = -vm._32;
- vm._33 = -vm._33;
- vm._34 = -vm._34;
-#endif
- IDirect3DDevice7_SetTransform(gld->pDev, D3DTRANSFORMSTATE_VIEW, &vm);
- }
-
-// DX7 does not support D3DRS_SOFTWAREVERTEXPROCESSING
-/*
- if (gld->bHasHWTnL) {
- if (glb.dwTnL == GLDS_TNL_DEFAULT)
- bSoftwareTnL = FALSE; // HW TnL
- else {
- bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE;
- }
- } else {
- // No HW TnL, so no choice possible
- bSoftwareTnL = TRUE;
- }
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL);
-*/
-
-// Dump this in a Release build as well, now.
-//#ifdef _DEBUG
- ddlogPrintf(DDLOG_INFO, "HW TnL: %s",
-// gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable");
- gld->bHasHWTnL ? "Enabled" : "Unavailable");
-//#endif
-
- // Set up interfaces to Mesa
- gldEnableExtensions_DX7(lpCtx->glCtx);
- gldInstallPipeline_DX7(lpCtx->glCtx);
- gldSetupDriverPointers_DX7(lpCtx->glCtx);
-
- // Signal a complete state update
- lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL);
-
- // Start a scene
- IDirect3DDevice7_BeginScene(gld->pDev);
- lpCtx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_DX(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- HRESULT hr;
- GLD_driver_dx7 *gld = NULL;
- DWORD dwFlags;
-
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
-
- // End the scene if one is started
- if (ctx->bSceneStarted) {
- IDirect3DDevice7_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- // Needed by D3DX for MDI multi-window apps (DaveM)
- if (lpDDClipper)
- IDirectDrawClipper_SetHWnd(lpDDClipper, 0, hWnd);
-
- // Swap the buffers. hWnd may override the hWnd used for CreateDevice()
-// hr = IDirect3DDevice8_Present(gld->pDev, NULL, NULL, hWnd, NULL);
-
- // Set refresh sync flag
- dwFlags = glb.bWaitForRetrace ? 0 : D3DX_UPDATE_NOVSYNC;
- // Render and show frame
- hr = gld->pD3DXContext->lpVtbl->UpdateFrame(gld->pD3DXContext, dwFlags);
- if (FAILED(hr))
- ddlogError(DDLOG_WARN, "gldSwapBuffers_DX: UpdateFrame", hr);
-
- if (hr == DDERR_SURFACELOST) {
- hr = gld->pD3DXContext->lpVtbl->RestoreSurfaces(gld->pD3DXContext);
- if (FAILED(hr))
- ddlogError(DDLOG_WARN, "gldSwapBuffers_DX: RestoreSurfaces", hr);
- }
-
-exit_swap:
- // Begin a new scene
- IDirect3DDevice7_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return (FAILED(hr)) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_DX(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
-// D3DDISPLAYMODE d3ddm;
- D3DX_VIDMODEDESC d3ddm;
- HRESULT hr;
- GLD_driver_dx7 *lpCtx = NULL;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-
- if ((glddm == NULL) || (ctx == NULL))
- return FALSE;
-
- lpCtx = ctx->glPriv;
- if (lpCtx == NULL)
- return FALSE;
-
- if (lpCtx->pD3D == NULL)
- return FALSE;
-
-// hr = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- hr = D3DXGetCurrentVideoMode(D3DX_DEFAULT, &d3ddm);
- if (FAILED(hr))
- return FALSE;
-
- // Get info from the display format
-// _BitsFromDisplayFormat(d3ddm.Format,
-// &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- glddm->Width = d3ddm.width;
- glddm->Height = d3ddm.height;
- glddm->BPP = d3ddm.bpp;
- glddm->Refresh = d3ddm.refreshRate;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c
deleted file mode 100644
index 0a6d9f8555c..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c
+++ /dev/null
@@ -1,1176 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Driver interface code to Mesa
-*
-****************************************************************************/
-
-//#include <windows.h>
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-extern BOOL dglSwapBuffers(HDC hDC);
-
-// HACK: Hack the _33 member of the OpenGL perspective projection matrix
-const float _fPersp_33 = 1.6f;
-
-//---------------------------------------------------------------------------
-// Internal functions
-//---------------------------------------------------------------------------
-
-void _gld_mesa_warning(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal warning mechanism
- gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str);
-}
-
-//---------------------------------------------------------------------------
-
-void _gld_mesa_fatal(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal fatal-message mechanism
- gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str);
-
- // Mesa calls abort(0) here.
- ddlogClose();
- exit(0);
-}
-
-//---------------------------------------------------------------------------
-
-D3DSTENCILOP _gldConvertStencilOp(
- GLenum StencilOp)
-{
- // Used by Stencil: pass, fail and zfail
-
- switch (StencilOp) {
- case GL_KEEP:
- return D3DSTENCILOP_KEEP;
- case GL_ZERO:
- return D3DSTENCILOP_ZERO;
- case GL_REPLACE:
- return D3DSTENCILOP_REPLACE;
- case GL_INCR:
- return D3DSTENCILOP_INCRSAT;
- case GL_DECR:
- return D3DSTENCILOP_DECRSAT;
- case GL_INVERT:
- return D3DSTENCILOP_INVERT;
- case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_INCR;
- case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_DECR;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n");
-#endif
-
- return D3DSTENCILOP_KEEP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DCMPFUNC _gldConvertCompareFunc(
- GLenum CmpFunc)
-{
- // Used for Alpha func, depth func and stencil func.
-
- switch (CmpFunc) {
- case GL_NEVER:
- return D3DCMP_NEVER;
- case GL_LESS:
- return D3DCMP_LESS;
- case GL_EQUAL:
- return D3DCMP_EQUAL;
- case GL_LEQUAL:
- return D3DCMP_LESSEQUAL;
- case GL_GREATER:
- return D3DCMP_GREATER;
- case GL_NOTEQUAL:
- return D3DCMP_NOTEQUAL;
- case GL_GEQUAL:
- return D3DCMP_GREATEREQUAL;
- case GL_ALWAYS:
- return D3DCMP_ALWAYS;
- };
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n");
-#endif
-
- return D3DCMP_ALWAYS;
-}
-
-//---------------------------------------------------------------------------
-
-D3DBLEND _gldConvertBlendFunc(
- GLenum blend,
- GLenum DefaultBlend)
-{
- switch (blend) {
- case GL_ZERO:
- return D3DBLEND_ZERO;
- case GL_ONE:
- return D3DBLEND_ONE;
- case GL_DST_COLOR:
- return D3DBLEND_DESTCOLOR;
- case GL_SRC_COLOR:
- return D3DBLEND_SRCCOLOR;
- case GL_ONE_MINUS_DST_COLOR:
- return D3DBLEND_INVDESTCOLOR;
- case GL_ONE_MINUS_SRC_COLOR:
- return D3DBLEND_INVSRCCOLOR;
- case GL_SRC_ALPHA:
- return D3DBLEND_SRCALPHA;
- case GL_ONE_MINUS_SRC_ALPHA:
- return D3DBLEND_INVSRCALPHA;
- case GL_DST_ALPHA:
- return D3DBLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return D3DBLEND_INVDESTALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return D3DBLEND_SRCALPHASAT;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n");
-#endif
-
- return DefaultBlend;
-}
-
-//---------------------------------------------------------------------------
-// Misc. functions
-//---------------------------------------------------------------------------
-
-void gld_Noop_DX8(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Error_DX8(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- // Quite useless.
-// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Required Mesa functions
-//---------------------------------------------------------------------------
-
-static GLboolean gld_set_draw_buffer_DX8(
- GLcontext *ctx,
- GLenum mode)
-{
- (void) ctx;
- if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_set_read_buffer_DX8(
- GLcontext *ctx,
- GLframebuffer *buffer,
- GLenum mode)
-{
- /* separate read buffer not supported */
-/*
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(mode == GL_FRONT_LEFT);
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Clear_DX8(
- GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint x,
- GLint y,
- GLint width,
- GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DCOLOR Color = 0;
- float Z = 0.0f;
- DWORD Stencil = 0;
- D3DRECT d3dClearRect;
-
- // TODO: Colourmask
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (!gld->pDev)
- return;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]);
- dwFlags |= D3DCLEAR_TARGET;
- Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]);
-// ctx->Color.ClearColor[1],
-// ctx->Color.ClearColor[2],
-// ctx->Color.ClearColor[3]);
- }
-
- if (mask & DD_DEPTH_BIT) {
- // D3D8 will fail the Clear call if we try and clear a
- // depth buffer and we haven't created one.
- // Also, some apps try and clear a depth buffer,
- // when a depth buffer hasn't been requested by the app.
- if (ctx->Visual.depthBits == 0) {
- mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask
- } else {
- dwFlags |= D3DCLEAR_ZBUFFER;
- Z = ctx->Depth.Clear;
- }
- }
-
- if (mask & DD_STENCIL_BIT) {
- if (ctx->Visual.stencilBits == 0) {
- // No stencil bits in depth buffer
- mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask
- } else {
- dwFlags |= D3DCLEAR_STENCIL;
- Stencil = ctx->Stencil.Clear;
- }
- }
-
- // Some apps do really weird things with the rect, such as Quake3.
- if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) {
- all = GL_TRUE;
- }
-
- if (!all) {
- // Calculate clear subrect
- d3dClearRect.x1 = x;
- d3dClearRect.y1 = gldCtx->dwHeight - (y + height);
- d3dClearRect.x2 = x + width;
- d3dClearRect.y2 = d3dClearRect.y1 + height;
- }
-
- // dwFlags will be zero if there's nothing to clear
- if (dwFlags) {
- _GLD_DX8_DEV(Clear(
- gld->pDev,
- all ? 0 : 1,
- all ? NULL : &d3dClearRect,
- dwFlags,
- Color, Z, Stencil));
- }
-
- if (mask & DD_ACCUM_BIT) {
- // Clear accumulation buffer
- }
-}
-
-//---------------------------------------------------------------------------
-
-// Mesa 5: Parameter change
-static void gld_buffer_size_DX8(
-// GLcontext *ctx,
- GLframebuffer *fb,
- GLuint *width,
- GLuint *height)
-{
-// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
-
- *width = fb->Width; // gldCtx->dwWidth;
- *height = fb->Height; // gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Finish_DX8(
- GLcontext *ctx)
-{
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Flush_DX8(
- GLcontext *ctx)
-{
- GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- // TODO: Detect apps that glFlush() then SwapBuffers() ?
-
- if (gld->EmulateSingle) {
- // Emulating a single-buffered context.
- // [Direct3D doesn't allow rendering to front buffer]
- dglSwapBuffers(gld->hDC);
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_STENCIL(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Two-sided stencil. New for Mesa 5
- const GLuint uiFace = 0UL;
-
- struct gl_stencil_attrib *pStencil = &ctx->Stencil;
-
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE));
- if (pStencil->Enabled) {
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace])));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILREF, pStencil->Ref[uiFace]));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILMASK, pStencil->ValueMask[uiFace]));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILWRITEMASK, pStencil->WriteMask[uiFace]));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace])));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace])));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace])));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_COLOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DBLEND src;
- D3DBLEND dest;
-
- // Alpha func
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc)));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAREF, (DWORD)ctx->Color.AlphaRef));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, ctx->Color.AlphaEnabled));
-
- // Blend func
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ALPHABLENDENABLE, ctx->Color.BlendEnabled));
- src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE);
- dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO);
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SRCBLEND, src));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_DESTBLEND, dest));
-
- // Color mask
- if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED;
- if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN;
- if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE;
- if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_COLORWRITEENABLE, dwFlags));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_DEPTH(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func)));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_POLYGON(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DFILLMODE d3dFillMode = D3DFILL_SOLID;
- D3DCULL d3dCullMode = D3DCULL_NONE;
- int iOffset = 0;
-
- // Fillmode
- switch (ctx->Polygon.FrontMode) {
- case GL_POINT:
- d3dFillMode = D3DFILL_POINT;
- break;
- case GL_LINE:
- d3dFillMode = D3DFILL_WIREFRAME;
- break;
- case GL_FILL:
- d3dFillMode = D3DFILL_SOLID;
- break;
- }
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FILLMODE, d3dFillMode));
-
- if (ctx->Polygon.CullFlag) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CW;
- else
- d3dCullMode = D3DCULL_CCW;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CCW;
- else
- d3dCullMode = D3DCULL_CW;
- break;
- case GL_FRONT_AND_BACK:
- d3dCullMode = D3DCULL_NONE;
- break;
- default:
- break;
- }
- } else {
- d3dCullMode = D3DCULL_NONE;
- }
-// d3dCullMode = D3DCULL_NONE; // TODO: DEBUGGING
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CULLMODE, d3dCullMode));
-
- // Polygon offset
- // ZBIAS ranges from 0 to 16 and can only move towards the viewer
- // Mesa5: ctx->Polygon._OffsetAny removed
- if (ctx->Polygon.OffsetFill) {
- iOffset = (int)ctx->Polygon.OffsetUnits;
- if (iOffset < 0)
- iOffset = -iOffset;
- else
- iOffset = 0; // D3D can't push away
- }
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_ZBIAS, iOffset));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_FOG(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DCOLOR d3dFogColour;
- D3DFOGMODE d3dFogMode = D3DFOG_LINEAR;
-
- // TODO: Fog is calculated seperately in the Mesa pipeline
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, FALSE));
- return;
-
- // Fog enable
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, ctx->Fog.Enabled));
- if (!ctx->Fog.Enabled) {
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, D3DFOG_NONE));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
- return; // If disabled, don't bother setting any fog state
- }
-
- // Fog colour
- d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0],
- ctx->Fog.Color[1],
- ctx->Fog.Color[2],
- ctx->Fog.Color[3]);
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGCOLOR, d3dFogColour));
-
- // Fog density
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density))));
-
- // Fog start
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGSTART, *((DWORD*) (&ctx->Fog.Start))));
-
- // Fog end
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGEND, *((DWORD*) (&ctx->Fog.End))));
-
- // Fog mode
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- d3dFogMode = D3DFOG_LINEAR;
- break;
- case GL_EXP:
- d3dFogMode = D3DFOG_EXP;
- break;
- case GL_EXP2:
- d3dFogMode = D3DFOG_EXP2;
- break;
- }
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, d3dFogMode));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_LIGHT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- DWORD dwSpecularEnable;
-
- // Shademode
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT));
-
- // Separate specular colour
- if (ctx->Light.Enabled)
- dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE;
- else
- dwSpecularEnable = FALSE;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SPECULARENABLE, dwSpecularEnable));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_MODELVIEW(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ModelView.m;
- // Mesa5: Model-view is now a stack
- GLfloat *pM = ctx->ModelviewMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10];
- m._34 = pM[11];
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14];
- m._44 = pM[15];
-
- gld->matModelView = m;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_PROJECTION(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ProjectionMatrix.m;
- // Mesa 5: Now a stack
- GLfloat *pM = ctx->ProjectionMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
-
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
-
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10] / _fPersp_33; // / 1.6f;
- m._34 = pM[11];
-
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14] / 2.0f;
- m._44 = pM[15];
-
- gld->matProjection = m;
-}
-
-//---------------------------------------------------------------------------
-/*
-void gldFrustumHook_DX8(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Frustum(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = farval / (nearval - farval);
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval);
-}
-
-//---------------------------------------------------------------------------
-
-void gldOrthoHook_DX8(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Ortho(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = 1.6f;
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval);
-}
-*/
-//---------------------------------------------------------------------------
-
-void gld_NEW_VIEWPORT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DVIEWPORT8 d3dvp;
-// GLint x, y;
-// GLsizei w, h;
-
- // Set depth range
- _GLD_DX8_DEV(GetViewport(gld->pDev, &d3dvp));
- // D3D can't do Quake1/Quake2 z-trick
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-/* x = ctx->Viewport.X;
- y = ctx->Viewport.Y;
- w = ctx->Viewport.Width;
- h = ctx->Viewport.Height;
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;*/
- _GLD_DX8_DEV(SetViewport(gld->pDev, &d3dvp));
-
-// gld->fFlipWindowY = (float)gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
-{
- struct gl_eval_attrib *eval = &ctx->Eval;
-
- if ((eval->AutoNormal) ||
- (eval->Map1Color4) ||
- (eval->Map1Index) ||
- (eval->Map1Normal) ||
- (eval->Map1TextureCoord1) ||
- (eval->Map1TextureCoord2) ||
- (eval->Map1TextureCoord3) ||
- (eval->Map1TextureCoord4) ||
- (eval->Map1Vertex3) ||
- (eval->Map1Vertex4) ||
- (eval->Map2Color4) ||
- (eval->Map2Index) ||
- (eval->Map2Normal) ||
- (eval->Map2TextureCoord1) ||
- (eval->Map2TextureCoord2) ||
- (eval->Map2TextureCoord3) ||
- (eval->Map2TextureCoord4) ||
- (eval->Map2Vertex3) ||
- (eval->Map2Vertex4)
- )
- return TRUE;
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
- GLD_driver_dx8 *gld)
-{
-// return TRUE; // DEBUGGING: ALWAYS USE MESA
-// return FALSE; // DEBUGGING: ALWAYS USE D3D
-
- if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE))
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE; // Force Mesa TnL
- }
-
- if ((ctx->Light.Enabled) ||
- (1) ||
- (ctx->Texture._TexGenEnabled) ||
- (ctx->Texture._TexMatEnabled) ||
-// (ctx->Transform._AnyClip) ||
- (ctx->Scissor.Enabled) ||
- _gldAnyEvalEnabled(ctx) // Put this last so we can early-out
- )
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE;
- }
-
- gld->PipelineUsage.qwD3DFVF.QuadPart++;
- return FALSE;
-
-/* // Force Mesa pipeline?
- if (glb.dwTnL == GLDS_TNL_MESA) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Test for functionality not exposed in the D3D pathways
- if ((ctx->Texture._GenFlags)) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Now decide if vertex shader can be used.
- // If two sided lighting is enabled then we must either
- // use Mesa TnL or the vertex shader
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) {
- // Use Vertex Shader
- gld->PipelineUsage.dwD3D2SVS.QuadPart++;
- return GLD_PIPELINE_D3D_VS_TWOSIDE;
- } else {
- // Use Mesa TnL
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
- }
-
- // Must be D3D fixed-function pipeline
- gld->PipelineUsage.dwD3DFVF.QuadPart++;
- return GLD_PIPELINE_D3D_FVF;
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_update_state_DX8(
- GLcontext *ctx,
- GLuint new_state)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLD_pb_dx8 *gldPB;
-
- if (!gld || !gld->pDev)
- return;
-
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-
- // SetupIndex will be used in the pipelines for choosing setup function
- if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) ||
- (ctx->Fog.Enabled))
- {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT_EXTRAS;
- else
- gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS;
- } else {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture
- else
- gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture
- }
-
- gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld);
- if (gld->bUseMesaTnL) {
- gldPB = &gld->PB2d;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE));
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, FALSE));
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
- } else {
- gldPB = &gld->PB3d;
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE));
-// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) {
-// _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware));
-// _GLD_DX8_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
-// } else {
- _GLD_DX8_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL));
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
-// }
- }
-
-#define _GLD_TEST_STATE(a) \
- if (new_state & (a)) { \
- gld##a(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_TEST_STATE_DX8(a) \
- if (new_state & (a)) { \
- gld##a##_DX8(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_IGNORE_STATE(a) new_state &= ~(a);
-
-// if (!gld->bUseMesaTnL) {
- // Not required if Mesa is doing the TnL.
- // Problem: If gld->bUseMesaTnL is TRUE when these are signaled,
- // then we'll miss updating the D3D TnL pipeline.
- // Therefore, don't test for gld->bUseMesaTnL
- _GLD_TEST_STATE(_NEW_MODELVIEW);
- _GLD_TEST_STATE(_NEW_PROJECTION);
-// }
-
- _GLD_TEST_STATE_DX8(_NEW_TEXTURE); // extern, so guard with _DX8
- _GLD_TEST_STATE(_NEW_COLOR);
- _GLD_TEST_STATE(_NEW_DEPTH);
- _GLD_TEST_STATE(_NEW_POLYGON);
- _GLD_TEST_STATE(_NEW_STENCIL);
- _GLD_TEST_STATE(_NEW_FOG);
- _GLD_TEST_STATE(_NEW_LIGHT);
- _GLD_TEST_STATE(_NEW_VIEWPORT);
-
- _GLD_IGNORE_STATE(_NEW_TRANSFORM);
-
-
-// Stubs for future use.
-/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_STATE(_NEW_ACCUM);
- _GLD_TEST_STATE(_NEW_EVAL);
- _GLD_TEST_STATE(_NEW_HINT);
- _GLD_TEST_STATE(_NEW_LINE);
- _GLD_TEST_STATE(_NEW_PIXEL);
- _GLD_TEST_STATE(_NEW_POINT);
- _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_STATE(_NEW_SCISSOR);
- _GLD_TEST_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_STATE(_NEW_ARRAY);
- _GLD_TEST_STATE(_NEW_RENDERMODE);
- _GLD_TEST_STATE(_NEW_BUFFERS);
- _GLD_TEST_STATE(_NEW_MULTISAMPLE);
-*/
-
-// For debugging.
-#if 0
-#define _GLD_TEST_UNHANDLED_STATE(a) \
- if (new_state & (a)) { \
- gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \
- }
- _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM);
- _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_HINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_LINE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY);
- _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS);
- _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE);
-#undef _GLD_UNHANDLED_STATE
-#endif
-
-#undef _GLD_TEST_STATE
-}
-
-//---------------------------------------------------------------------------
-// Viewport
-//---------------------------------------------------------------------------
-
-void gld_Viewport_DX8(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DVIEWPORT8 d3dvp;
-
- if (!gld || !gld->pDev)
- return;
-
- // This is a hack. When the app is minimized, Mesa passes
- // w=1 and h=1 for viewport dimensions. Without this test
- // we get a GPF in gld_wgl_resize_buffers().
- if ((w==1) && (h==1))
- return;
-
- // Call ResizeBuffersMESA. This function will early-out
- // if no resize is needed.
- //ctx->Driver.ResizeBuffersMESA(ctx);
- // Mesa 5: Changed parameters
- ctx->Driver.ResizeBuffers(gldCtx->glBuffer);
-
-#if 0
- ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
-#endif
-
- // ** D3D viewport must not be outside the render target surface **
- // Sanity check the GL viewport dimensions
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
-
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-
- // TODO: DEBUGGING
-// d3dvp.MinZ = 0.0f;
-// d3dvp.MaxZ = 1.0f;
-
- _GLD_DX8_DEV(SetViewport(gld->pDev, &d3dvp));
-
-}
-
-//---------------------------------------------------------------------------
-
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
-
-// Mesa 5: Parameter change
-void gldResizeBuffers_DX8(
-// GLcontext *ctx)
- GLframebuffer *fb)
-{
- GET_CURRENT_CONTEXT(ctx);
- dglWglResizeBuffers(ctx, TRUE);
-}
-
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-// This is only for debugging.
-// To use, plug into ctx->Driver.Enable pointer below.
-void gld_Enable(
- GLcontext *ctx,
- GLenum e,
- GLboolean b)
-{
- char buf[1024];
- sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE");
- ddlogMessage(DDLOG_SYSTEM, buf);
-}
-#endif
-//---------------------------------------------------------------------------
-// Driver pointer setup
-//---------------------------------------------------------------------------
-
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
-
-void gldSetupDriverPointers_DX8(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- // Mandatory functions
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = gld_update_state_DX8;
- ctx->Driver.Clear = gld_Clear_DX8;
- ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX8;
- ctx->Driver.GetBufferSize = gld_buffer_size_DX8;
- ctx->Driver.Finish = gld_Finish_DX8;
- ctx->Driver.Flush = gld_Flush_DX8;
- ctx->Driver.Error = gld_Error_DX8;
-
- // Hardware accumulation buffer
- ctx->Driver.Accum = NULL; // TODO: gld_Accum;
-
- // Bitmap functions
- ctx->Driver.CopyPixels = gld_CopyPixels_DX8;
- ctx->Driver.DrawPixels = gld_DrawPixels_DX8;
- ctx->Driver.ReadPixels = gld_ReadPixels_DX8;
- ctx->Driver.Bitmap = gld_Bitmap_DX8;
-
- // Buffer resize
- ctx->Driver.ResizeBuffers = gldResizeBuffers_DX8;
-
- // Texture image functions
- ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX8;
- ctx->Driver.TexImage1D = gld_TexImage1D_DX8;
- ctx->Driver.TexImage2D = gld_TexImage2D_DX8;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX8;
- ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX8;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX8; //NULL;
- ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX8; //NULL;
- ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX8; //NULL;
- ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX8; //NULL;
- ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX8;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- // Texture object functions
- ctx->Driver.BindTexture = NULL;
- ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!;
- ctx->Driver.DeleteTexture = gld_DeleteTexture_DX8;
- ctx->Driver.PrioritizeTexture = NULL;
-
- // Imaging functionality
- ctx->Driver.CopyColorTable = NULL;
- ctx->Driver.CopyColorSubTable = NULL;
- ctx->Driver.CopyConvolutionFilter1D = NULL;
- ctx->Driver.CopyConvolutionFilter2D = NULL;
-
- // State changing functions
- ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc;
- ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc;
- ctx->Driver.ClearColor = NULL; //gld_ClearColor;
- ctx->Driver.ClearDepth = NULL; //gld_ClearDepth;
- ctx->Driver.ClearStencil = NULL; //gld_ClearStencil;
- ctx->Driver.ColorMask = NULL; //gld_ColorMask;
- ctx->Driver.CullFace = NULL; //gld_CullFace;
- ctx->Driver.ClipPlane = NULL; //gld_ClipPlane;
- ctx->Driver.FrontFace = NULL; //gld_FrontFace;
- ctx->Driver.DepthFunc = NULL; //gld_DepthFunc;
- ctx->Driver.DepthMask = NULL; //gld_DepthMask;
- ctx->Driver.DepthRange = NULL;
- ctx->Driver.Enable = NULL; //gld_Enable;
- ctx->Driver.Fogfv = NULL; //gld_Fogfv;
- ctx->Driver.Hint = NULL; //gld_Hint;
- ctx->Driver.Lightfv = NULL; //gld_Lightfv;
- ctx->Driver.LightModelfv = NULL; //gld_LightModelfv;
- ctx->Driver.LineStipple = NULL; //gld_LineStipple;
- ctx->Driver.LineWidth = NULL; //gld_LineWidth;
- ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode;
- ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv;
- ctx->Driver.PointSize = NULL; //gld_PointSize;
- ctx->Driver.PolygonMode = NULL; //gld_PolygonMode;
- ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset;
- ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple;
- ctx->Driver.RenderMode = NULL; //gld_RenderMode;
- ctx->Driver.Scissor = NULL; //gld_Scissor;
- ctx->Driver.ShadeModel = NULL; //gld_ShadeModel;
- ctx->Driver.StencilFunc = NULL; //gld_StencilFunc;
- ctx->Driver.StencilMask = NULL; //gld_StencilMask;
- ctx->Driver.StencilOp = NULL; //gld_StencilOp;
- ctx->Driver.TexGen = NULL; //gld_TexGen;
- ctx->Driver.TexEnv = NULL;
- ctx->Driver.TexParameter = NULL;
- ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix;
- ctx->Driver.Viewport = gld_Viewport_DX8;
-
- _swsetup_Wakeup(ctx);
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX8;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
-
- // Hook into glFrustum() and glOrtho()
-// ctx->Exec->Frustum = gldFrustumHook_DX8;
-// ctx->Exec->Ortho = gldOrthoHook_DX8;
-
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h
deleted file mode 100644
index 7efec7cae80..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_dx8.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.0 header file
-*
-****************************************************************************/
-
-#ifndef _GLD_DX8_H
-#define _GLD_DX8_H
-
-//---------------------------------------------------------------------------
-// Windows includes
-//---------------------------------------------------------------------------
-
-//#ifndef STRICT
-//#define STRICT
-//#endif
-
-//#define WIN32_LEAN_AND_MEAN
-//#include <windows.h>
-#include <d3d8.h>
-#include <d3dx8.h>
-
-// MS screwed up with the DX8.1 SDK - there's no compile-time
-// method of compiling for 8.0 via the 8.1 SDK unless you
-// "make sure you don't use any 8.1 interfaces".
-// We CAN use 8.1 D3DX static functions, though - just not new 8.1 interfaces.
-//
-// D3D_SDK_VERSION is 120 for 8.0 (supported by Windows 95).
-// D3D_SDK_VERSION is 220 for 8.1 (NOT supported by Windows 95).
-//
-#define D3D_SDK_VERSION_DX8_SUPPORT_WIN95 120
-
-// Typedef for obtaining function from d3d8.dll
-typedef IDirect3D8* (WINAPI *FNDIRECT3DCREATE8) (UINT);
-
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-
-#ifdef _DEBUG
-#define _GLD_TEST_HRESULT(h) \
-{ \
- HRESULT _hr = (h); \
- if (FAILED(_hr)) { \
- gldLogError(GLDLOG_ERROR, #h, _hr); \
- } \
-}
-#define _GLD_DX8(func) _GLD_TEST_HRESULT(IDirect3D8_##func##)
-#define _GLD_DX8_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice8_##func##)
-#define _GLD_DX8_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer8_##func##)
-#define _GLD_DX8_TEX(func) _GLD_TEST_HRESULT(IDirect3DTexture8_##func##)
-#else
-#define _GLD_DX8(func) IDirect3D8_##func
-#define _GLD_DX8_DEV(func) IDirect3DDevice8_##func
-#define _GLD_DX8_VB(func) IDirect3DVertexBuffer8_##func
-#define _GLD_DX8_TEX(func) IDirect3DTexture8_##func
-#endif
-
-#define SAFE_RELEASE(p) \
-{ \
- if (p) { \
- (p)->lpVtbl->Release(p); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_VB8(p) \
-{ \
- if (p) { \
- IDirect3DVertexBuffer8_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_SURFACE8(p) \
-{ \
- if (p) { \
- IDirect3DSurface8_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-// Setup index.
-enum {
- GLD_SI_FLAT = 0,
- GLD_SI_SMOOTH = 1,
- GLD_SI_FLAT_EXTRAS = 2,
- GLD_SI_SMOOTH_EXTRAS = 3,
-};
-/*
-// Internal pipeline
-typedef enum {
- GLD_PIPELINE_MESA = 0, // Mesa pipeline
- GLD_PIPELINE_D3D_FVF = 1, // Direct3D Fixed-function pipeline
- GLD_PIPELINE_D3D_VS_TWOSIDE = 2 // Direct3D two-sided-lighting vertex shader
-} GLD_tnl_pipeline;
-*/
-//---------------------------------------------------------------------------
-// Vertex definitions for Fixed-Function pipeline
-//---------------------------------------------------------------------------
-
-//
-// NOTE: If the number of texture units is altered then most of
-// the texture code will need to be revised.
-//
-
-#define GLD_MAX_TEXTURE_UNITS_DX8 2
-
-//
-// 2D vertex transformed by Mesa
-//
-#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \
- D3DFVF_DIFFUSE | \
- D3DFVF_SPECULAR | \
- D3DFVF_TEX2)
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT sz; // Screen Z (depth)
- FLOAT rhw; // Reciprocal homogenous W
- DWORD diffuse; // Diffuse colour
- DWORD specular; // For separate-specular support
- FLOAT t0_u, t0_v; // 1st set of texture coords
- FLOAT t1_u, t1_v; // 2nd set of texture coords
-} GLD_2D_VERTEX;
-
-
-//
-// 3D vertex transformed by Direct3D
-//
-#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \
- D3DFVF_DIFFUSE | \
- D3DFVF_TEX2)
-
-typedef struct {
- D3DXVECTOR3 Position; // XYZ Vector in object space
- D3DCOLOR Diffuse; // Diffuse colour
- D3DXVECTOR2 TexUnit0; // Texture unit 0
- D3DXVECTOR2 TexUnit1; // Texture unit 1
-} GLD_3D_VERTEX;
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// DX8 Vertex Shader
-typedef struct {
- DWORD hShader; // If NULL, shader is invalid and cannot be used
- BOOL bHardware; // If TRUE then shader was created for hardware,
- // otherwise shader was created for software.
-} GLD_vertexShader;
-*/
-//---------------------------------------------------------------------------
-// Structs
-//---------------------------------------------------------------------------
-
-// This keeps a count of how many times we choose each individual internal
-// pathway. Useful for seeing if a certain pathway was ever used by an app, and
-// how much each pathway is biased.
-// Zero the members at context creation and dump stats at context deletion.
-typedef struct {
- // Note: DWORD is probably too small
- ULARGE_INTEGER qwMesa; // Mesa TnL pipeline
- ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline
-// ULARGE_INTEGER dwD3D2SVS; // Direct3D Two-Sided Vertex Shader pipeline
-} GLD_pipeline_usage;
-
-// GLDirect Primitive Buffer (points, lines, triangles and quads)
-typedef struct {
- // Data for IDirect3DDevice8::CreateVertexBuffer()
- DWORD dwStride; // Stride of vertex
- DWORD dwUsage; // Usage flags
- DWORD dwFVF; // Direct3D Flexible Vertex Format
- DWORD dwPool; // Pool flags
-
- IDirect3DVertexBuffer8 *pVB; // Holds points, lines, tris and quads.
-
- // Point list is assumed to be at start of buffer
- DWORD iFirstLine; // Index of start of line list
- DWORD iFirstTriangle; // Index of start of triangle list
-
- BYTE *pPoints; // Pointer to next free point
- BYTE *pLines; // Pointer to next free line
- BYTE *pTriangles; // Pointer to next free triangle
-
- DWORD nPoints; // Number of points ready to render
- DWORD nLines; // Number of lines ready to render
- DWORD nTriangles; // Number of triangles ready to render
-} GLD_pb_dx8;
-
-// GLDirect DX8 driver data
-typedef struct {
- // GLDirect vars
- BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered)
- BOOL bDepthStencil; // Depth buffer needed (stencil optional)
- D3DFORMAT RenderFormat; // Format of back/front buffer
- D3DFORMAT DepthFormat; // Format of depth/stencil
-// float fFlipWindowY; // Value for flipping viewport Y coord
-
- // Direct3D vars
- D3DCAPS8 d3dCaps8;
- BOOL bHasHWTnL; // Device has Hardware Transform/Light?
- IDirect3D8 *pD3D; // Base Direct3D8 interface
- IDirect3DDevice8 *pDev; // Direct3D8 Device interface
- GLD_pb_dx8 PB2d; // Vertices transformed by Mesa
- GLD_pb_dx8 PB3d; // Vertices transformed by Direct3D
- D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type
- D3DXMATRIX matProjection; // Projection matrix for D3D TnL
- D3DXMATRIX matModelView; // Model/View matrix for D3D TnL
- int iSetupFunc; // Which setup functions to use
- BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL
-
- // Direct3D vars for two-sided lighting
-// GLD_vertexShader VStwosidelight; // Vertex Shader for two-sided lighting
-// D3DXMATRIX matWorldViewProj;// World/View/Projection matrix for shaders
-
-
-// GLD_tnl_pipeline TnLPipeline; // Index of current internal pipeline
- GLD_pipeline_usage PipelineUsage;
-} GLD_driver_dx8;
-
-#define GLD_GET_DX8_DRIVER(c) (GLD_driver_dx8*)(c)->glPriv
-
-//---------------------------------------------------------------------------
-// Function prototypes
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX8(LPCSTR a);
-void gldEnableExtensions_DX8(GLcontext *ctx);
-void gldInstallPipeline_DX8(GLcontext *ctx);
-void gldSetupDriverPointers_DX8(GLcontext *ctx);
-//void gldResizeBuffers_DX8(GLcontext *ctx);
-void gldResizeBuffers_DX8(GLframebuffer *fb);
-
-
-// Texture functions
-
-void gldCopyTexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX8(GLcontext *ctx);
-void gld_DrawPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX8(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX8(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX8(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX8(GLcontext *ctx);
-
-// 2D primitive functions
-
-void gld_Points2D_DX8(GLcontext *ctx, GLuint first, GLuint last);
-
-void gld_Line2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-
-void gld_Triangle2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-
-void gld_Quad2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// 3D primitive functions
-
-void gld_Points3D_DX8(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// Primitive functions for Two-sided-lighting Vertex Shader
-
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-#endif
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h b/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h
deleted file mode 100644
index f8e92b936e8..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_dxerr8.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*==========================================================================;
- *
- *
- * File: dxerr8.h
- * Content: DirectX Error Library Include File
- *
- ****************************************************************************/
-
-#ifndef _GLD_DXERR8_H_
-#define _GLD_DXERR8_H_
-
-
-#include <d3d8.h>
-
-//
-// DXGetErrorString8
-//
-// Desc: Converts an DirectX HRESULT to a string
-//
-// Args: HRESULT hr Can be any error code from
-// DPLAY D3D8 D3DX8 DMUSIC DSOUND
-//
-// Return: Converted string
-//
-const char* __stdcall DXGetErrorString8A(HRESULT hr);
-const WCHAR* __stdcall DXGetErrorString8W(HRESULT hr);
-
-#ifdef UNICODE
- #define DXGetErrorString8 DXGetErrorString8W
-#else
- #define DXGetErrorString8 DXGetErrorString8A
-#endif
-
-
-//
-// DXTrace
-//
-// Desc: Outputs a formatted error message to the debug stream
-//
-// Args: CHAR* strFile The current file, typically passed in using the
-// __FILE__ macro.
-// DWORD dwLine The current line number, typically passed in using the
-// __LINE__ macro.
-// HRESULT hr An HRESULT that will be traced to the debug stream.
-// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
-// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
-//
-// Return: The hr that was passed in.
-//
-//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
-//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
-HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox);
-HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox);
-
-#ifdef UNICODE
- #define DXTrace DXTraceW
-#else
- #define DXTrace DXTraceA
-#endif
-
-
-//
-// Helper macros
-//
-#if defined(DEBUG) | defined(_DEBUG)
- #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
- #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
- #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
-#else
- #define DXTRACE_MSG(str) (0L)
- #define DXTRACE_ERR(str,hr) (hr)
- #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
-#endif
-
-
-#endif
-
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c
deleted file mode 100644
index 108f12a9d16..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GL extensions
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "../gld_settings.h"
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-//#include "ddlog.h"
-//#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "extensions.h"
-
-// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
-
-//---------------------------------------------------------------------------
-// Hack for the SGIS_multitexture extension that was removed from Mesa
-// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel
-
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // To enable, uncomment:
- // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
-//---------------------------------------------------------------------------
-
-enum {
- /* Quake2 GL_SGIS_multitexture */
- GL_SELECTED_TEXTURE_SGIS = 0x835B,
- GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C,
- GL_MAX_TEXTURES_SGIS = 0x835D,
- GL_TEXTURE0_SGIS = 0x835E,
- GL_TEXTURE1_SGIS = 0x835F,
- GL_TEXTURE2_SGIS = 0x8360,
- GL_TEXTURE3_SGIS = 0x8361,
- GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363,
-};
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldSelectTextureSGIS(
- GLenum target)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glActiveTextureARB(ARB_target);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fSGIS(
- GLenum target,
- GLfloat s,
- GLfloat t)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fARB(ARB_target, s, t);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fvSGIS(
- GLenum target,
- const GLfloat *v)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fvARB(ARB_target, v);
-}
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
-
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-GLD_extension GLD_multitexList[] = {
-/*
- { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" },
- { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" },
- { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" },
- { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" },
- { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" },
- { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" },
- { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" },
- { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" },
- { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" },
- { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" },
- { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
- { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" },
- { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" },
- { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" },
- { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" },
- { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" },
- { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" },
- { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" },
- { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" },
- { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" },
- { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" },
- { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" },
- { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" },
- { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" },
- { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" },
- { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" },
- { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" },
- { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" },
- { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" },
- { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" },
- { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" },
- { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" },
- { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" },
-*/
- { (PROC)glActiveTextureARB, "glActiveTextureARB" },
- { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },
- { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },
- { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },
- { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },
- { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },
- { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },
- { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },
- { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },
- { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },
- { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },
- { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },
- { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },
- { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },
- { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },
- { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },
- { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },
- { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },
- { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },
- { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },
- { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },
- { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },
- { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },
- { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },
- { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },
- { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },
- { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },
- { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },
- { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },
- { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },
- { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },
- { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },
- { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },
-
- // Descent3 doesn't use correct string, hence this hack
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" },
-
- // Quake2 SGIS multitexture
- { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
-
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- if (glb.bMultitexture) {
- for (i=0; GLD_multitexList[i].proc; i++) {
- if (!strcmp(a, GLD_multitexList[i].name)) {
- proc = GLD_multitexList[i].proc;
- break;
- }
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-void gldEnableExtensions_DX8(
- GLcontext *ctx)
-{
- GLuint i;
-
- // Mesa enables some extensions by default.
- // This table decides which ones we want to switch off again.
-
- // NOTE: GL_EXT_compiled_vertex_array appears broken.
-
- const char *gld_disable_extensions[] = {
-// "GL_ARB_transpose_matrix",
-// "GL_EXT_compiled_vertex_array",
-// "GL_EXT_polygon_offset",
-// "GL_EXT_rescale_normal",
- "GL_EXT_texture3D",
-// "GL_NV_texgen_reflection",
- NULL
- };
-
- const char *gld_multitex_extensions[] = {
- "GL_ARB_multitexture", // Quake 3
- NULL
- };
-
- // Quake 2 engines
- const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture";
-
- const char *gld_enable_extensions[] = {
- "GL_EXT_texture_env_add", // Quake 3
- "GL_ARB_texture_env_add", // Quake 3
- NULL
- };
-
- for (i=0; gld_disable_extensions[i]; i++) {
- _mesa_disable_extension(ctx, gld_disable_extensions[i]);
- }
-
- for (i=0; gld_enable_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_enable_extensions[i]);
- }
-
- if (glb.bMultitexture) {
- for (i=0; gld_multitex_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_multitex_extensions[i]);
- }
-
- // GL_SGIS_multitexture
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // Fair bit slower on GeForce256,
- // Much slower on 3dfx Voodoo5 5500.
-// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
- }
-
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
- _mesa_enable_1_4_extensions(ctx);
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c
deleted file mode 100644
index 2baea57443c..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_pipeline_dx8.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa transformation pipeline with GLDirect fastpath
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-extern struct tnl_pipeline_stage _gld_d3d_render_stage;
-extern struct tnl_pipeline_stage _gld_mesa_render_stage;
-
-static const struct tnl_pipeline_stage *gld_pipeline[] = {
- &_gld_d3d_render_stage, // Direct3D TnL
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_gld_mesa_render_stage, // Mesa TnL, D3D rendering
- 0,
-};
-
-//---------------------------------------------------------------------------
-
-void gldInstallPipeline_DX8(
- GLcontext *ctx)
-{
- // Remove any existing pipeline stages,
- // then install GLDirect pipeline stages.
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, gld_pipeline);
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
deleted file mode 100644
index 700b5200862..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
+++ /dev/null
@@ -1,1446 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Primitive (points/lines/tris/quads) rendering
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-// Disable compiler complaints about unreferenced local variables
-#pragma warning (disable:4101)
-
-//---------------------------------------------------------------------------
-// Helper defines for primitives
-//---------------------------------------------------------------------------
-
-//static const float ooZ = 1.0f / 65536.0f; // One over Z
-
-#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3]))
-#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3]))
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-//---------------------------------------------------------------------------
-// 2D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_2D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_TRIANGLES \
- BOOL bFog = ctx->Fog.Enabled; \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour; \
- GLuint facing = 0; \
- struct vertex_buffer *VB; \
- GLchan (*vbcolor)[4]; \
- GLchan (*vbspec)[4]
-
-#define GLD_SETUP_GET_SWVERT(s) \
- swv = &ss->verts[##s]
-
-#define GLD_SETUP_2D_VERTEX \
- pV->x = swv->win[0]; \
- pV->y = GLD_FLIP_Y(swv->win[1]); \
- pV->rhw = swv->win[3]
-
-#define GLD_SETUP_SMOOTH_COLOUR \
- pV->diffuse = GLD_COLOUR
-
-#define GLD_SETUP_GET_FLAT_COLOUR \
- dwFlatColour = GLD_COLOUR
-#define GLD_SETUP_GET_FLAT_FOG_COLOUR \
- dwFlatColour = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_USE_FLAT_COLOUR \
- pV->diffuse = dwFlatColour
-
-#define GLD_SETUP_GET_FLAT_SPECULAR \
- dwSpecularColour= GLD_SPECULAR
-
-#define GLD_SETUP_USE_FLAT_SPECULAR \
- pV->specular = dwSpecularColour
-
-#define GLD_SETUP_DEPTH \
- pV->sz = swv->win[2] / ctx->DepthMaxF
-// pV->z = swv->win[2] * ooZ;
-
-#define GLD_SETUP_SPECULAR \
- pV->specular = GLD_SPECULAR
-
-#define GLD_SETUP_FOG \
- pV->diffuse = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_TEX0 \
- pV->t0_u = swv->texcoord[0][0]; \
- pV->t0_v = swv->texcoord[0][1]
-
-#define GLD_SETUP_TEX1 \
- pV->t1_u = swv->texcoord[1][0]; \
- pV->t1_v = swv->texcoord[1][1]
-
-#define GLD_SETUP_LIGHTING(v) \
- if (facing == 1) { \
- pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- } else { \
- if (bFog) \
- GLD_SETUP_FOG; \
- else \
- GLD_SETUP_SMOOTH_COLOUR; \
- GLD_SETUP_SPECULAR; \
- }
-
-#define GLD_SETUP_GET_FLAT_LIGHTING(v) \
- if (facing == 1) { \
- dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- }
-
-#define GLD_SETUP_TWOSIDED_LIGHTING \
- /* Two-sided lighting */ \
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \
- SWvertex *v[3]; \
- GLfloat ex,ey,fx,fy,cc; \
- /* Get vars for later */ \
- VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
- } else { \
- vbspec = NULL; \
- } \
- v[0] = &verts[v0]; \
- v[1] = &verts[v1]; \
- v[2] = &verts[v2]; \
- ex = v[0]->win[0] - v[2]->win[0]; \
- ey = v[0]->win[1] - v[2]->win[1]; \
- fx = v[1]->win[0] - v[2]->win[0]; \
- fy = v[1]->win[1] - v[2]->win[1]; \
- cc = ex*fy - ey*fx; \
- facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \
- }
-
-//---------------------------------------------------------------------------
-// 3D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_3D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_TRIANGLES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
- pV->Position.x = p4f[##v][0]; \
- pV->Position.y = p4f[##v][1]; \
- pV->Position.z = p4f[##v][2];
-
-#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-
-#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-#define GLD_SETUP_USE_FLAT_COLOUR_3D \
- pV->Diffuse = dwColor;
-
-#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
- pV->TexUnit0.x = tc[##v][0]; \
- pV->TexUnit0.y = tc[##v][1]; \
- }
-
-#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
- pV->TexUnit1.x = tc[##v][0]; \
- pV->TexUnit1.y = tc[##v][1]; \
- }
-
-//---------------------------------------------------------------------------
-// Helper functions
-//---------------------------------------------------------------------------
-
-__inline DWORD _gldComputeFog(
- GLcontext *ctx,
- SWvertex *swv)
-{
- // Full fog calculation.
- // Based on Mesa code.
-
- GLchan rFog, gFog, bFog;
- GLchan fR, fG, fB;
- const GLfloat f = swv->fog;
- const GLfloat g = 1.0f - f;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
- fR = f * swv->color[0] + g * rFog;
- fG = f * swv->color[1] + g * gFog;
- fB = f * swv->color[2] + g * bFog;
- return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ResetLineStipple_DX8(
- GLcontext *ctx)
-{
- // TODO: Fake stipple with a 32x32 texture.
-}
-
-//---------------------------------------------------------------------------
-// 2D (post-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points2D_DX8(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_2D_VARS_POINTS;
-
- unsigned i;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
- GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- } else {
- GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, swv++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- }
-
- gld->PB2d.pPoints = (BYTE*)pV;
- gld->PB2d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
-
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v2);
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v2);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v3);
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v3);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothExtras_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v3);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// 3D (pre-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points3D_DX8(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_3D_VARS_POINTS
-
- unsigned i;
-// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
-// GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_3D_VERTEX(VB->Elts[i])
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- } else {
-// GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- }
-/*
- for (i=first; i<last; i++, pV++) {
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
-*/
- gld->PB3d.pPoints = (BYTE*)pV;
- gld->PB3d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-// Line functions
-//---------------------------------------------------------------------------
-
-void gld_Line3DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line3DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-// Triangle functions
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-// Quad functions
-//---------------------------------------------------------------------------
-
-void gld_Quad3DFlat_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad3DSmooth_DX8(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_SMOOTH_COLOUR_3D(v3)
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// Vertex setup for two-sided-lighting vertex shader
-//---------------------------------------------------------------------------
-
-/*
-
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last)
-{
- // NOTE: Two-sided lighting does not apply to Points
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-*/
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c
deleted file mode 100644
index f24b3cfb74d..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_texture_dx8.c
+++ /dev/null
@@ -1,2046 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Texture / Bitmap functions
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-#include <d3dx8tex.h>
-
-#include "texformat.h"
-#include "colormac.h"
-#include "texstore.h"
-#include "image.h"
-// #include "mem.h"
-
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h))
-
-//---------------------------------------------------------------------------
-// 1D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + (i) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (i) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (i))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (i))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 2D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 3D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// Direct3D texture formats that have no Mesa equivalent
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _mesa_texstore_argb8888, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
- gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
- gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
- MESA_FORMAT_ARGB1555, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 5, /* RedBits */
- 5, /* GreenBits */
- 5, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb1555, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
- gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
- gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb4444, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
- gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
- gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
-};
-
-//---------------------------------------------------------------------------
-// Texture unit constants
-//---------------------------------------------------------------------------
-
-// List of possible combinations of texture environments.
-// Example: GLD_TEXENV_MODULATE_RGBA means
-// GL_MODULATE, GL_RGBA base internal format.
-#define GLD_TEXENV_DECAL_RGB 0
-#define GLD_TEXENV_DECAL_RGBA 1
-#define GLD_TEXENV_DECAL_ALPHA 2
-#define GLD_TEXENV_REPLACE_RGB 3
-#define GLD_TEXENV_REPLACE_RGBA 4
-#define GLD_TEXENV_REPLACE_ALPHA 5
-#define GLD_TEXENV_MODULATE_RGB 6
-#define GLD_TEXENV_MODULATE_RGBA 7
-#define GLD_TEXENV_MODULATE_ALPHA 8
-#define GLD_TEXENV_BLEND_RGB 9
-#define GLD_TEXENV_BLEND_RGBA 10
-#define GLD_TEXENV_BLEND_ALPHA 11
-#define GLD_TEXENV_ADD_RGB 12
-#define GLD_TEXENV_ADD_RGBA 13
-#define GLD_TEXENV_ADD_ALPHA 14
-
-// Per-stage (i.e. per-unit) texture environment
-typedef struct {
- DWORD ColorArg1; // Colour argument 1
- D3DTEXTUREOP ColorOp; // Colour operation
- DWORD ColorArg2; // Colour argument 2
- DWORD AlphaArg1; // Alpha argument 1
- D3DTEXTUREOP AlphaOp; // Alpha operation
- DWORD AlphaArg2; // Alpha argument 2
-} GLD_texenv;
-
-// TODO: Do we really need to set ARG1 and ARG2 every time?
-// They seem to always be TEXTURE and CURRENT respectively.
-
-// C = Colour out
-// A = Alpha out
-// Ct = Colour from Texture
-// Cf = Colour from fragment (diffuse)
-// At = Alpha from Texture
-// Af = Alpha from fragment (diffuse)
-// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND)
-const GLD_texenv gldTexEnv[] = {
- // DECAL_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af
- {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_ALPHA: <undefined> use DECAL_RGB
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
-
- // REPLACE_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // REPLACE_RGBA: C=Ct, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
- // REPLACE_ALPHA: C=Cf, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
-
- // MODULATE_RGB: C=CfCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // MODULATE_RGBA: C=CfCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // MODULATE_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // BLEND_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // ADD_RGB: C=Cf+Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // ADD_RGBA: C=Cf+Ct, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // ADD_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-};
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREADDRESS _gldConvertWrap(
- GLenum wrap)
-{
- return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREFILTERTYPE _gldConvertMagFilter(
- GLenum magfilter)
-{
- return (magfilter == GL_LINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldConvertMinFilter(
- GLenum minfilter,
- D3DTEXTUREFILTERTYPE *min_filter,
- D3DTEXTUREFILTERTYPE *mip_filter)
-{
- switch (minfilter) {
- case GL_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- }
-}
-
-//---------------------------------------------------------------------------
-
-D3DFORMAT _gldGLFormatToD3DFormat(
- GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures
- return D3DFMT_L8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return D3DFMT_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return D3DFMT_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return D3DFMT_X8R8G8B8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return D3DFMT_A8L8;
- case GL_R3_G3_B2:
- // TODO: Mesa does not support RGB332 internally
- return D3DFMT_X4R4G4B4; //D3DFMT_R3G3B2;
- case GL_RGB4:
- return D3DFMT_X4R4G4B4;
- case GL_RGB5:
- return D3DFMT_X1R5G5B5;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return D3DFMT_R8G8B8;
- case GL_RGBA4:
- return D3DFMT_A4R4G4B4;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return D3DFMT_A8R8G8B8;
- case GL_RGB5_A1:
- return D3DFMT_A1R5G5B5;
- }
-
- // Return an acceptable default
- return D3DFMT_A8R8G8B8;
-}
-
-//---------------------------------------------------------------------------
-
-GLenum _gldDecodeBaseFormat(
- IDirect3DTexture8 *pTex)
-{
- // Examine Direct3D texture and return base OpenGL internal texture format
- // NOTE: We can't use any base format info from Mesa because D3D might have
- // used a different texture format when we used D3DXCreateTexture().
-
- // Base internal format is one of (Red Book p355):
- // GL_ALPHA,
- // GL_LUMINANCE,
- // GL_LUMINANCE_ALPHA,
- // GL_INTENSITY,
- // GL_RGB,
- // GL_RGBA
-
- // NOTE: INTENSITY not used (not supported by Direct3D)
- // LUMINANCE has same texture functions as RGB
- // LUMINANCE_ALPHA has same texture functions as RGBA
-
- // TODO: cache format instead of using GetLevelDesc()
- D3DSURFACE_DESC desc;
- _GLD_DX8_TEX(GetLevelDesc(pTex, 0, &desc));
-
- switch (desc.Format) {
- case D3DFMT_R8G8B8:
- case D3DFMT_X8R8G8B8:
- case D3DFMT_R5G6B5:
- case D3DFMT_X1R5G5B5:
- case D3DFMT_R3G3B2:
- case D3DFMT_X4R4G4B4:
- case D3DFMT_P8:
- case D3DFMT_L8:
- return GL_RGB;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A1R5G5B5:
- case D3DFMT_A4R4G4B4:
- case D3DFMT_A8R3G3B2:
- case D3DFMT_A8P8:
- case D3DFMT_A8L8:
- case D3DFMT_A4L4:
- return GL_RGBA;
- case D3DFMT_A8:
- return GL_ALPHA;
- // Compressed texture formats. Need to check these...
- case D3DFMT_DXT1:
- return GL_RGBA;
- case D3DFMT_DXT2:
- return GL_RGB;
- case D3DFMT_DXT3:
- return GL_RGBA;
- case D3DFMT_DXT4:
- return GL_RGB;
- case D3DFMT_DXT5:
- return GL_RGBA;
- }
-
- // Fell through. Return arbitary default.
- return GL_RGBA;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* _gldMesaFormatForD3DFormat(
- D3DFORMAT d3dfmt)
-{
- switch (d3dfmt) {
- case D3DFMT_A8R8G8B8:
- return &_mesa_texformat_argb8888;
- case D3DFMT_R8G8B8:
- return &_mesa_texformat_rgb888;
- case D3DFMT_R5G6B5:
- return &_mesa_texformat_rgb565;
- case D3DFMT_A4R4G4B4:
- return &_mesa_texformat_argb4444;
- case D3DFMT_A1R5G5B5:
- return &_mesa_texformat_argb1555;
- case D3DFMT_A8L8:
- return &_mesa_texformat_al88;
- case D3DFMT_R3G3B2:
- return &_mesa_texformat_rgb332;
- case D3DFMT_A8:
- return &_mesa_texformat_a8;
- case D3DFMT_L8:
- return &_mesa_texformat_l8;
- case D3DFMT_X8R8G8B8:
- return &_gld_texformat_X8R8G8B8;
- case D3DFMT_X1R5G5B5:
- return &_gld_texformat_X1R5G5B5;
- case D3DFMT_X4R4G4B4:
- return &_gld_texformat_X4R4G4B4;
- }
-
- // If we reach here then we've made an error somewhere else
- // by allowing a format that is not supported.
- assert(0);
-
- return NULL; // Shut up compiler warning
-}
-
-//---------------------------------------------------------------------------
-// Copy* functions
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage1D_DX8(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage1D_DX8(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage3D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height )
-{
- // TODO ?
-}
-
-//---------------------------------------------------------------------------
-// Bitmap/Pixel functions
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1)
-
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT z; // depth value
- FLOAT rhw; // reciprocal homogenous W (always 1.0f)
- FLOAT tu, tv; // texture coords
-} _GLD_IMAGE_VERTEX;
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldDrawPixels(
- GLcontext *ctx,
- BOOL bChromakey, // Alpha test for glBitmap() images
- GLint x, // GL x position
- GLint y, // GL y position (needs flipping)
- GLsizei width, // Width of input image
- GLsizei height, // Height of input image
- IDirect3DSurface8 *pImage)
-{
- //
- // Draw input image as texture implementing PixelZoom and clipping.
- // Any fragment operations currently enabled will be used.
- //
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTexture;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface8 *pSurface;
- _GLD_IMAGE_VERTEX v[4];
- HRESULT hr;
-
- float ZoomWidth, ZoomHeight;
- float ScaleWidth, ScaleHeight;
-
- // Create a texture to hold image
- hr = D3DXCreateTexture(
- gld->pDev,
- width, height,
- 1, // miplevels
- 0, // usage
- D3DFMT_A8R8G8B8, // format
- D3DPOOL_MANAGED, // pool
- &pTexture);
- if (FAILED(hr))
- return hr;
-
- hr = IDirect3DTexture8_GetSurfaceLevel(pTexture, 0, &pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture8_Release(pTexture);
- return hr;
- }
-
- // Copy image into texture
- hr = D3DXLoadSurfaceFromSurface(
- pSurface, NULL, NULL, // Dest surface
- pImage, NULL, NULL, // Src surface
- D3DX_FILTER_NONE,
- 0);
- IDirect3DSurface8_Release(pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture8_Release(pTexture);
- return hr;
- }
-
- //
- // Set up the quad like this (ascii-art ahead!)
- //
- // 3--2
- // | |
- // 0--1
- //
- //
-
- // Set depth
- v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2];
- // Set Reciprocal Homogenous W
- v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f;
-
- // Set texcoords
- // Examine texture size - if different to input width and height
- // then we'll need to munge the texcoords to fit.
- IDirect3DTexture8_GetLevelDesc(pTexture, 0, &d3dsd);
- ScaleWidth = (float)width / (float)d3dsd.Width;
- ScaleHeight = (float)height / (float)d3dsd.Height;
- v[0].tu = 0.0f; v[0].tv = 0.0f;
- v[1].tu = ScaleWidth; v[1].tv = 0.0f;
- v[2].tu = ScaleWidth; v[2].tv = ScaleHeight;
- v[3].tu = 0.0f; v[3].tv = ScaleHeight;
-
- // Set raster positions
- ZoomWidth = (float)width * ctx->Pixel.ZoomX;
- ZoomHeight = (float)height * ctx->Pixel.ZoomY;
-
- v[0].x = x; v[0].y = GLD_FLIP_Y(y);
- v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y);
- v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight);
- v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight);
-
- // Draw image with full HW acceleration
- // NOTE: Be nice to use a State Block for all this state...
- IDirect3DDevice8_SetTexture(gld->pDev, 0, pTexture);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTEXF_POINT);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- IDirect3DDevice8_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
- IDirect3DDevice8_SetVertexShader(gld->pDev, _GLD_FVF_IMAGE);
-
- //
- // Emulate Chromakey with an Alpha Test.
- // [Alpha Test is more widely supported anyway]
- //
- if (bChromakey) {
- // Switch on alpha testing
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, TRUE);
- // Fragment passes is alpha is greater than reference value
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, D3DCMP_GREATER);
- // Set alpha reference value between Bitmap alpha values of
- // zero (transparent) and one (opaque).
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ALPHAREF, 0x7f);
- }
-
- IDirect3DDevice8_DrawPrimitiveUP(gld->pDev, D3DPT_TRIANGLEFAN, 2, &v, sizeof(_GLD_IMAGE_VERTEX));
-
- // Release texture
- IDirect3DDevice8_SetTexture(gld->pDev, 0, NULL);
- IDirect3DTexture8_Release(pTexture);
-
- // Reset state to before we messed it up
- FLUSH_VERTICES(ctx, _NEW_ALL);
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DrawPixels_DX8(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
-
- const struct gl_texture_format *MesaFormat;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pImage);
- if (FAILED(hr)) {
- return;
- }
-
- //
- // Use Mesa to fill in image
- //
-
- // Lock all of surface
- hr = IDirect3DSurface8_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
-
- // unpack image, apply transfer ops and store directly in texture
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, /* dstImageStride */
- format, type, pixels, unpack);
-
- IDirect3DSurface8_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ReadPixels_DX8(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *dest)
-{
-
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pBackbuffer = NULL;
- IDirect3DSurface8 *pNativeImage = NULL;
- IDirect3DSurface8 *pCanonicalImage = NULL;
-
- D3DSURFACE_DESC d3dsd;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- struct gl_pixelstore_attrib srcPacking;
- int i;
- GLint DstRowStride;
- const struct gl_texture_format *MesaFormat;
-
- switch (format) {
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
- DstRowStride = _mesa_image_row_stride(pack, width, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pNativeImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels.
- //
- // This intermediate surface ensure that we can use CopyRects()
- // instead of relying on D3DXLoadSurfaceFromSurface(), which may
- // try and lock the backbuffer. This way seems safer.
- //
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pNativeImage,
- &ptDst);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Create an RGBA8888 surface
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pCanonicalImage);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // Convert to RGBA8888
- hr = D3DXLoadSurfaceFromSurface(
- pCanonicalImage, // Dest surface
- NULL, NULL, // Dest palette, RECT
- pNativeImage, // Src surface
- NULL, NULL, // Src palette, RECT
- D3DX_FILTER_NONE, // Filter
- 0); // Colourkey
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- srcPacking.Alignment = 1;
- srcPacking.ImageHeight = height;
- srcPacking.LsbFirst = GL_FALSE;
- srcPacking.RowLength = 0;
- srcPacking.SkipImages = 0;
- srcPacking.SkipPixels = 0;
- srcPacking.SkipRows = 0;
- srcPacking.SwapBytes = GL_FALSE;
-
- // Lock all of image
- hr = IDirect3DSurface8_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX8_return;
- }
-
- // We need to flip the data. Yuck.
- // Perhaps Mesa has a span packer we can use in future...
- for (i=0; i<height; i++) {
- BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
- BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA, // base format
- MesaFormat, // dst format
- pDestRow, // dest addr
- width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z
- DstRowStride, // dst row stride
- 0, // dstImageStride
- GL_BGRA, // src format
- GL_UNSIGNED_BYTE, // src type
- pSrcRow, // src addr
- &srcPacking); // packing params of source image
- }
-
- IDirect3DSurface8_UnlockRect(pCanonicalImage);
-
-gld_ReadPixels_DX8_return:
- SAFE_RELEASE_SURFACE8(pCanonicalImage);
- SAFE_RELEASE_SURFACE8(pNativeImage);
- SAFE_RELEASE_SURFACE8(pBackbuffer);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_CopyPixels_DX8(
- GLcontext *ctx,
- GLint srcx,
- GLint srcy,
- GLsizei width,
- GLsizei height,
- GLint dstx,
- GLint dsty,
- GLenum type)
-{
- //
- // NOTE: Not allowed to copy vidmem to vidmem!
- // Therefore we use an intermediate image surface.
- //
-
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pBackbuffer;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface8 *pImage;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
-
- // Only backbuffer
- if (type != GL_COLOR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice8_GetBackBuffer(
- gld->pDev,
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface8_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- &pImage);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pBackbuffer);
- return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels
- hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pImage,
- &ptDst);
- IDirect3DSurface8_Release(pBackbuffer);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Bitmap_DX8(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- GLD_context *gldCtx;
- GLD_driver_dx8 *gld;
-
- IDirect3DSurface8 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- BYTE *pTempBitmap;
- D3DCOLOR clBitmapOne, clBitmapZero;
- D3DCOLOR *pBits;
- const GLubyte *src;
- int i, j, k;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero
- clBitmapOne = D3DCOLOR_COLORVALUE(
- ctx->Current.RasterColor[0],
- ctx->Current.RasterColor[1],
- ctx->Current.RasterColor[2],
- 1.0f); // NOTE: Alpha is One
-
- hr = IDirect3DDevice8_CreateImageSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- &pImage);
- if (FAILED(hr)) {
- return;
- }
-
- // Lock all of surface
- hr = IDirect3DSurface8_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack);
- if (pTempBitmap == NULL) {
- IDirect3DSurface8_Release(pImage);
- return;
- }
-
- pBits = (D3DCOLOR*)d3dLockedRect.pBits;
-
- for (i=0; i<height; i++) {
- GLubyte byte;
- pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch));
- src = (const GLubyte *) _mesa_image_address(2,
- &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
- 0, i, 0);
- for (j=0; j<(width>>3); j++) {
- byte = *src++;
- for (k=0; k<8; k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- // Fill remaining bits from bitmap
- if (width & 7) {
- byte = *src;
- for (k=0; k<(width & 7); k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- }
-
- FREE(pTempBitmap);
-
-/*
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- GL_BITMAP,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- GL_BITMAP, GL_COLOR_INDEX, bitmap, unpack);
-*/
- IDirect3DSurface8_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage);
-
- IDirect3DSurface8_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-// Texture functions
-//---------------------------------------------------------------------------
-
-void _gldAllocateTexture(
- GLcontext *ctx,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- D3DFORMAT d3dFormat;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (pTex) {
- // Decide whether we can keep existing D3D texture
- // by examining top-level surface.
- D3DSURFACE_DESC d3dsd;
- _GLD_DX8_TEX(GetLevelDesc(pTex, 0, &d3dsd));
- // Release existing texture if not compatible
- if ((d3dsd.Width == texImage->Width) ||
- (d3dsd.Height == texImage->Height))
- {
- return; // Keep the existing texture
- }
- tObj->DriverData = NULL;
- _GLD_DX8_TEX(Release(pTex));
- }
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat);
- D3DXCreateTexture(
- gld->pDev,
- texImage->Width,
- texImage->Height,
- // TODO: Re-evaluate mipmapping
- (glb.bUseMipmaps) ? D3DX_DEFAULT : 1,
- 0, // Usage
- d3dFormat,
- D3DPOOL_MANAGED,
- &pTex);
- tObj->DriverData = pTex;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* gld_ChooseTextureFormat_DX8(
- GLcontext *ctx,
- GLint internalFormat,
- GLenum srcFormat,
- GLenum srcType)
-{
- // [Based on mesa_choose_tex_format()]
- //
- // We will choose only texture formats that are supported
- // by Direct3D. If the hardware doesn't support a particular
- // texture format, then the D3DX texture calls that we use
- // will automatically use a HW supported format.
- //
- // The most critical aim is to reduce copying; if we can use
- // texture-image data directly then it will be a big performance assist.
- //
-
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8; // D3DFMT_A8
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5
- // Mesa will convert this for us later...
- // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88; // D3DFMT_A8L8
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2
- case GL_RGB4:
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4
- case 3:
- case GL_RGB:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
-// Safer(?), slower version.
-void gld_TexImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- RECT rcSrcRect;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
-
- if (!tObj || !texImage)
- return;
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- SetRect(&rcSrcRect, 0, 0, width, height);
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- NULL,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexImage2D_DX8(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- // GLQUAKE FIX
- // Test for input alpha data with non-alpha internalformat
- if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) {
- // Input format has alpha, but a non-alpha format has been requested.
- texImage->IntFormat = GL_RGBA;
- internalFormat = GL_RGBA;
- }
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface8_GetDesc(pSurface, &d3dsd);
-
- // Lock all of surface
- hr = IDirect3DSurface8_LockRect(pSurface, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- IDirect3DSurface8_UnlockRect(pSurface);
- IDirect3DSurface8_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- // A 1D texture is a 2D texture with a height of zero
- gld_TexImage2D_DX8(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_GET_CONTEXT
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- D3DFORMAT d3dFormat;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
- RECT rcSrcRect;
- RECT rcDstRect;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= _GLD_DX8_TEX(GetLevelCount(pTex))
- return; // Level does not exist
- hr = _GLD_DX8_TEX(GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->Format);
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- // Source rectangle is whole of input image
- SetRect(&rcSrcRect, 0, 0, width, height);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- &rcDstRect,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface8_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- IDirect3DTexture8 *pTex;
- IDirect3DSurface8 *pSurface;
- HRESULT hr;
- RECT rcDstRect;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture8_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture8_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface8_GetDesc(pSurface, &d3dsd);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- // Lock sub-rect of surface
- hr = IDirect3DSurface8_LockRect(pSurface, &d3dLockedRect, &rcDstRect, 0);
- if (FAILED(hr)) {
- IDirect3DSurface8_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1,
- 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!!
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
-
- IDirect3DSurface8_UnlockRect(pSurface);
- IDirect3DSurface8_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gld_TexSubImage2D_DX8(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DeleteTexture_DX8(
- GLcontext *ctx,
- struct gl_texture_object *tObj)
-{
- GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
-
- if (tObj) {
- IDirect3DTexture8 *pTex = (IDirect3DTexture8*)tObj->DriverData;
- if (pTex) {
-/* // Make sure texture is not bound to a stage before releasing it
- for (int i=0; i<MAX_TEXTURE_UNITS; i++) {
- if (gld->CurrentTexture[i] == pTex) {
- gld->pDev->SetTexture(i, NULL);
- gld->CurrentTexture[i] = NULL;
- }
- }*/
- _GLD_DX8_TEX(Release(pTex));
- tObj->DriverData = NULL;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetColorOps(
- const GLD_driver_dx8 *gld,
- GLuint unit,
- DWORD ColorArg1,
- D3DTEXTUREOP ColorOp,
- DWORD ColorArg2)
-{
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2));
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetAlphaOps(
- const GLD_driver_dx8 *gld,
- GLuint unit,
- DWORD AlphaArg1,
- D3DTEXTUREOP AlphaOp,
- DWORD AlphaArg2)
-{
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2));
-}
-
-//---------------------------------------------------------------------------
-
-void gldUpdateTextureUnit(
- GLcontext *ctx,
- GLuint unit,
- BOOL bPassThrough)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- D3DTEXTUREFILTERTYPE minfilter;
- D3DTEXTUREFILTERTYPE mipfilter;
- GLenum BaseFormat;
- DWORD dwColorArg0;
- int iTexEnv = 0;
- GLD_texenv *pTexenv;
-
- // NOTE: If bPassThrough is FALSE then texture stage can be
- // disabled otherwise it must pass-through it's current fragment.
-
- const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = pUnit->_Current;
-
- IDirect3DTexture8 *pTex = NULL;
- if (tObj) {
- pTex = (IDirect3DTexture8*)tObj->DriverData;
- }
-
- // Enable texturing if unit is enabled and a valid D3D texture exists
- // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT
- //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) {
- if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) {
- // Enable texturing
- _GLD_DX8_DEV(SetTexture(gld->pDev, unit, pTex));
- } else {
- // Disable texturing, then return
- _GLD_DX8_DEV(SetTexture(gld->pDev, unit, NULL));
- if (bPassThrough) {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- } else {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- }
- return;
- }
-
- // Texture parameters
- _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter);
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
-
- // Texture priority
- _GLD_DX8_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f)));
-
- // Texture environment
- // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops.
- // See Page 355 of the Red Book.
- BaseFormat = _gldDecodeBaseFormat(pTex);
-
- switch (BaseFormat) {
- case GL_RGB:
- iTexEnv = 0;
- break;
- case GL_RGBA:
- iTexEnv = 1;
- break;
- case GL_ALPHA:
- iTexEnv = 2;
- break;
- }
-
- switch (pUnit->EnvMode) {
- case GL_DECAL:
- iTexEnv += 0;
- break;
- case GL_REPLACE:
- iTexEnv += 3;
- break;
- case GL_MODULATE:
- iTexEnv += 6;
- break;
- case GL_BLEND:
- // Set blend colour
- dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]);
- _GLD_DX8_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0));
- iTexEnv += 9;
- break;
- case GL_ADD:
- iTexEnv += 12;
- break;
- }
- pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv];
- _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2);
- _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_TEXTURE_DX8(
- GLcontext *ctx)
-{
- // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
-
- BOOL bUnit0Enabled;
- BOOL bUnit1Enabled;
-
- if (!ctx)
- return; // Sanity check
-
- if (ctx->Const.MaxTextureUnits == 1) {
- gldUpdateTextureUnit(ctx, 0, TRUE);
- return;
- }
-
- //
- // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!!
- //
-
- // Mesa 5: Texture Units altered
- //bUnit0Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) ? TRUE : FALSE;
- //bUnit1Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D)) ? TRUE : FALSE;
- bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
- bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
-
- // If Unit0 is disabled and Unit1 is enabled then we must pass-though
- gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE);
- // We can always disable the last texture unit
- gldUpdateTextureUnit(ctx, 1, FALSE);
-
-#ifdef _DEBUG
- {
- // Find out whether device supports current renderstates
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-// GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- DWORD dwPasses;
- _GLD_DX8_DEV(ValidateDevice(gld->pDev, &dwPasses));
-// if (FAILED(hr)) {
-// gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr);
-// }
- if (dwPasses != 1) {
- gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n");
- }
- }
-#endif
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
deleted file mode 100644
index cafbf4f5c50..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect fastpath pipeline stage
-*
-****************************************************************************/
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
- GLD_driver_dx8 *gld)
-{
- D3DXMATRIX mat, matView, matProj;
- GLfloat *pM;
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ModelView.m;
- pM = ctx->ModelviewMatrixStack.Top->m;
- matView._11 = pM[0];
- matView._12 = pM[1];
- matView._13 = pM[2];
- matView._14 = pM[3];
- matView._21 = pM[4];
- matView._22 = pM[5];
- matView._23 = pM[6];
- matView._24 = pM[7];
- matView._31 = pM[8];
- matView._32 = pM[9];
- matView._33 = pM[10];
- matView._34 = pM[11];
- matView._41 = pM[12];
- matView._42 = pM[13];
- matView._43 = pM[14];
- matView._44 = pM[15];
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ProjectionMatrix.m;
- pM = ctx->ProjectionMatrixStack.Top->m;
- matProj._11 = pM[0];
- matProj._12 = pM[1];
- matProj._13 = pM[2];
- matProj._14 = pM[3];
- matProj._21 = pM[4];
- matProj._22 = pM[5];
- matProj._23 = pM[6];
- matProj._24 = pM[7];
- matProj._31 = pM[8];
- matProj._32 = pM[9];
- matProj._33 = pM[10];
- matProj._34 = pM[11];
- matProj._41 = pM[12];
- matProj._42 = pM[13];
- matProj._43 = pM[14];
- matProj._44 = pM[15];
-
- D3DXMatrixMultiply( &mat, &matView, &matProj );
- D3DXMatrixTranspose( &mat, &mat );
-
- _GLD_DX8_DEV(SetVertexShaderConstant(gld->pDev, 0, &mat, 4));
-}
-
-//---------------------------------------------------------------------------
-
-static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- TNLcontext *tnl;
- struct vertex_buffer *VB;
- tnl_render_func *tab;
- GLint pass;
- GLD_pb_dx8 *gldPB = &gld->PB3d;
-/*
- static int count = 0;
- count++;
- if (count != 2)
- return GL_FALSE;
-*/
- // The "check" function should disable this stage,
- // but we'll test gld->bUseMesaTnL anyway.
- if (gld->bUseMesaTnL) {
- // Do nothing in this stage, but continue pipeline
- return GL_TRUE;
- }
-
- tnl = TNL_CONTEXT(ctx);
- VB = &tnl->vb;
- pass = 0;
-
- tnl->Driver.Render.Start( ctx );
-
-#if 0
- // For debugging: Useful to see if an app passes colour data in
- // an unusual format.
- switch (VB->ColorPtr[0]->Type) {
- case GL_FLOAT:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
- break;
- case GL_UNSIGNED_BYTE:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n");
- break;
- default:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n");
- break;
- }
-#endif
-
- tnl->Driver.Render.Points = gld_Points3D_DX8;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line3DFlat_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX8;
- tnl->Driver.Render.Quad = gld_Quad3DFlat_DX8;
- } else {
- tnl->Driver.Render.Line = gld_Line3DSmooth_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX8;
- tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX8;
- }
-
- _GLD_DX8_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts);
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length)
- {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
- _GLD_DX8_VB(Unlock(gldPB->pVB));
-
- _GLD_DX8_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride));
-
- _GLD_DX8_DEV(SetTransform(gld->pDev, D3DTS_PROJECTION, &gld->matProjection));
- _GLD_DX8_DEV(SetTransform(gld->pDev, D3DTS_WORLD, &gld->matModelView));
-
- if (gldPB->nPoints) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_d3d_render_stage =
-{
- "gld_d3d_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- gld_d3d_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c
deleted file mode 100644
index 81414a31dde..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_mesa_render_dx8.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/* $Id: gld_vb_mesa_render_dx8.c,v 1.6 2005-08-27 13:56:08 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
- */
-
-
-/*
- * Render whole vertex buffers, including projection of vertices from
- * clip space and clipping of primitives.
- *
- * This file makes calls to project vertices and to the point, line
- * and triangle rasterizers via the function pointers:
- *
- * context->Driver.Render.*
- *
- */
-
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx8.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-/**********************************************************************/
-/* Clip single primitives */
-/**********************************************************************/
-
-
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
-#define W(i) coord[i][3]
-#define Z(i) coord[i][2]
-#define Y(i) coord[i][1]
-#define X(i) coord[i][0]
-#define SIZE 4
-#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h"
-
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, with the possibility of clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte ormask = c1|c2; \
- if (!ormask) \
- LineFunc( ctx, v1, v2 ); \
- else if (!(c1 & c2 & 0x3f)) \
- clip_line_4( ctx, v1, v2, ormask ); \
-} while (0)
-
-#define RENDER_TRI( v1, v2, v3 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
- GLubyte ormask = c1|c2|c3; \
- if (!ormask) \
- TriangleFunc( ctx, v1, v2, v3 ); \
- else if (!(c1 & c2 & c3 & 0x3f)) \
- clip_tri_4( ctx, v1, v2, v3, ormask ); \
-} while (0)
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte c3 = mask[v3], c4 = mask[v4]; \
- GLubyte ormask = c1|c2|c3|c4; \
- if (!ormask) \
- QuadFunc( ctx, v1, v2, v3, v4 ); \
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) \
- clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \
-} while (0)
-
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
-
-#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/* Elts, with the possibility of clipping.
- */
-#undef ELT
-#undef TAG
-#define ELT(x) elt[x]
-#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
-
-/* TODO: do this for all primitives, verts and elts:
- */
-static void clip_elt_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &tnl->vb;
- const GLuint * const elt = VB->Elts;
- GLubyte *mask = VB->ClipMask;
- GLuint last = count-2;
- GLuint j;
- (void) flags;
-
- tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
-
- for (j=start; j < last; j+=3 ) {
- GLubyte c1 = mask[elt[j]];
- GLubyte c2 = mask[elt[j+1]];
- GLubyte c3 = mask[elt[j+2]];
- GLubyte ormask = c1|c2|c3;
- if (ormask) {
- if (start < j)
- render_tris( ctx, start, j, 0 );
- if (!(c1&c2&c3&0x3f))
- clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask );
- start = j+3;
- }
- }
-
- if (start < j)
- render_tris( ctx, start, j, 0 );
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, no clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
- LineFunc( ctx, v1, v2 )
-
-#define RENDER_TRI( v1, v2, v3 ) \
- TriangleFunc( ctx, v1, v2, v3 )
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
- QuadFunc( ctx, v1, v2, v3, v4 )
-
-#define TAG(x) _gld_tnl_##x##_verts
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-/* Elts, no clipping.
- */
-#undef ELT
-#define TAG(x) _gld_tnl_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Helper functions for drivers */
-/**********************************************************************/
-/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint *tmp = VB->Elts;
-
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
-}
-
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-*/
-
-
-/**********************************************************************/
-/* Clip and render whole vertex buffers */
-/**********************************************************************/
-
-tnl_points_func _gldSetupPoints[4] = {
- gld_Points2D_DX8,
- gld_Points2D_DX8,
- gld_Points2D_DX8,
- gld_Points2D_DX8
-};
-tnl_line_func _gldSetupLine[4] = {
- gld_Line2DFlat_DX8,
- gld_Line2DSmooth_DX8,
- gld_Line2DFlat_DX8,
- gld_Line2DSmooth_DX8,
-};
-tnl_triangle_func _gldSetupTriangle[4] = {
- gld_Triangle2DFlat_DX8,
- gld_Triangle2DSmooth_DX8,
- gld_Triangle2DFlatExtras_DX8,
- gld_Triangle2DSmoothExtras_DX8
-};
-tnl_quad_func _gldSetupQuad[4] = {
- gld_Quad2DFlat_DX8,
- gld_Quad2DSmooth_DX8,
- gld_Quad2DFlatExtras_DX8,
- gld_Quad2DSmoothExtras_DX8
-};
-
-//---------------------------------------------------------------------------
-
-static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab;
- GLint pass = 0;
- GLD_pb_dx8 *gldPB;
-
- /* Allow the drivers to lock before projected verts are built so
- * that window coordinates are guarenteed not to change before
- * rendering.
- */
- ASSERT(tnl->Driver.Render.Start);
-
- tnl->Driver.Render.Start( ctx );
-
- // NOTE: Setting D3DRS_SOFTWAREVERTEXPROCESSING for a mixed-mode device resets
- // stream, indices and shader to default values of NULL or 0.
-/* if ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) &&
- gld->VStwosidelight.hShader &&
- !ctx->Fog.Enabled)
- {
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware);
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
- gldPB = &gld->PBtwosidelight;
- tnl->Driver.Render.Points = gld_Points2DTwoside_DX8;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line2DFlatTwoside_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle2DFlatTwoside_DX8;
- tnl->Driver.Render.Quad = gld_Quad2DFlatTwoside_DX8;
- } else {
- tnl->Driver.Render.Line = gld_Line2DSmoothTwoside_DX8;
- tnl->Driver.Render.Triangle = gld_Triangle2DSmoothTwoside_DX8;
- tnl->Driver.Render.Quad = gld_Quad2DSmoothTwoside_DX8;
- }
- } else {*/
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE);
- gldPB = &gld->PB2d;
- _GLD_DX8_DEV(SetVertexShader(gld->pDev, gldPB->dwFVF));
- tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc];
- tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc];
- tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc];
- tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc];
-// }
-
- _GLD_DX8_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 );
-
- if (VB->ClipOrMask) {
- tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
- }
- else {
- tab = (VB->Elts ?
- tnl->Driver.Render.PrimTabElts :
- tnl->Driver.Render.PrimTabVerts);
- }
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length) {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
-
-// tnl->Driver.Render.Finish( ctx );
-
- _GLD_DX8_VB(Unlock(gldPB->pVB));
-
- _GLD_DX8_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, gldPB->dwStride));
-
- if (gldPB->nPoints) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX8_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_mesa_render_stage =
-{
- "gld_mesa_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- _gld_mesa_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c
deleted file mode 100644
index 690f68b68f1..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx8/gld_wgl_dx8.c
+++ /dev/null
@@ -1,1335 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.x WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-#include "gld_dxerr8.h"
-#include "gld_dx8.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-// Copied from dglcontect.c
-#define GLDERR_NONE 0
-#define GLDERR_MEM 1
-#define GLDERR_DDRAW 2
-#define GLDERR_D3D 3
-#define GLDERR_BPP 4
-#define GLDERR_DDS 5
-// This external var keeps track of any error
-extern int nContextError;
-
-#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
-
-//---------------------------------------------------------------------------
-
-static char szColorDepthWarning[] =
-"GLDirect does not support the current desktop\n\
-color depth.\n\n\
-You may need to change the display resolution to\n\
-16 bits per pixel or higher color depth using\n\
-the Windows Display Settings control panel\n\
-before running this OpenGL application.\n";
-
-// The only depth-stencil formats currently supported by Direct3D
-// Surface Format Depth Stencil Total Bits
-// D3DFMT_D32 32 - 32
-// D3DFMT_D15S1 15 1 16
-// D3DFMT_D24S8 24 8 32
-// D3DFMT_D16 16 - 16
-// D3DFMT_D24X8 24 - 32
-// D3DFMT_D24X4S4 24 4 32
-
-// This pixel format will be used as a template when compiling the list
-// of pixel formats supported by the hardware. Many fields will be
-// filled in at runtime.
-// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
-static DGL_pixelFormat pfTemplateHW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 16, // Total colour bitplanes (excluding alpha bitplanes)
- 5, 0, // Red bits, shift
- 5, 0, // Green bits, shift
- 5, 0, // Blue bits, shift
- 0, 0, // Alpha bits, shift (destination alpha)
- 0, // Accumulator bits (total)
- 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha
- 0, // Depth bits
- 0, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- D3DFMT_UNKNOWN, // No depth/stencil buffer
-};
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-
-// Vertex Shader Declaration
-static DWORD dwTwoSidedLightingDecl[] =
-{
- D3DVSD_STREAM(0),
- D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position
- D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal
- D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color
- D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color
- D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0
- D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1
- D3DVSD_END()
-};
-
-// Vertex Shader for two-sided lighting
-static char *szTwoSidedLightingVS =
-// This is a test shader!
-"vs.1.0\n"
-"m4x4 oPos,v0,c0\n"
-"mov oD0,v2\n"
-"mov oD1,v3\n"
-"mov oT0,v4\n"
-"mov oT1,v5\n"
-;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-typedef struct {
- HINSTANCE hD3D8DLL; // Handle to d3d8.dll
- FNDIRECT3DCREATE8 fnDirect3DCreate8; // Direct3DCreate8 function prototype
- BOOL bDirect3D; // Persistant Direct3D8 exists
- BOOL bDirect3DDevice; // Persistant Direct3DDevice8 exists
- IDirect3D8 *pD3D; // Persistant Direct3D8
- IDirect3DDevice8 *pDev; // Persistant Direct3DDevice8
-} GLD_dx8_globals;
-
-// These are "global" to all DX8 contexts. KeithH
-static GLD_dx8_globals dx8Globals;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-BOOL gldGetDXErrorString_DX(
- HRESULT hr,
- char *buf,
- int nBufSize)
-{
- //
- // Return a string describing the input HRESULT error code
- //
-
- D3DXGetErrorString(hr, buf, nBufSize);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType(
- IDirect3D8 *pD3D8,
- D3DFORMAT SurfaceFormat,
- D3DDEVTYPE d3dDevType,
- BOOL Windowed)
-{
- int i;
- HRESULT hr;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE)
- return D3DMULTISAMPLE_NONE;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) {
- // Find fastest multisample
- for (i=2; i<17; i++) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- } else {
- // Find nicest multisample
- for (i=16; i>1; i--) {
- hr = IDirect3D8_CheckDeviceMultiSampleType(
- pD3D8,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- }
-
- // Nothing found - return default
- return D3DMULTISAMPLE_NONE;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyPrimitiveBuffer(
- GLD_pb_dx8 *gldVB)
-{
- SAFE_RELEASE(gldVB->pVB);
-
- // Sanity check...
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
-}
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
- GLD_driver_dx8 *lpCtx,
- GLD_pb_dx8 *gldVB)
-{
- HRESULT hResult;
- char *szCreateVertexBufferFailed = "CreateVertexBuffer failed";
- DWORD dwMaxVertices; // Max number of vertices in vertex buffer
- DWORD dwVBSize; // Total size of vertex buffer
-
- // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
- // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
- // We'll use IMM_SIZE if it's larger (which it should not be).
- dwMaxVertices = MAX_ARRAY_LOCK_SIZE;
-
- // Now calculate how many vertices to allow for in total
- // 1 per point, 2 per line, 6 per quad = 9
- dwVBSize = dwMaxVertices * 9 * gldVB->dwStride;
-
- hResult = IDirect3DDevice8_CreateVertexBuffer(
- lpCtx->pDev,
- dwVBSize,
- gldVB->dwUsage,
- gldVB->dwFVF,
- gldVB->dwPool,
- &gldVB->pVB);
- if (FAILED(hResult)) {
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed);
- return hResult;
- }
-
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
- gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL;
- gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB
- gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-// Function: _gldCreateVertexShaders
-// Create DX8 Vertex Shaders.
-//---------------------------------------------------------------------------
-/*
-void _gldCreateVertexShaders(
- GLD_driver_dx8 *gld)
-{
- DWORD dwFlags;
- LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer
- HRESULT hr;
-
-#ifdef _DEBUG
- dwFlags = D3DXASM_DEBUG;
-#else
- dwFlags = 0; // D3DXASM_SKIPVALIDATION;
-#endif
-
- ddlogMessage(DDLOG_INFO, "Creating shaders...\n");
-
- // Init the shader handle
- gld->VStwosidelight.hShader = 0;
-
- if (gld->d3dCaps8.MaxStreams == 0) {
- // Lame DX8 driver doesn't support streams
- // Not fatal, as defaults will be used
- ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n");
- return;
- }
-
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-// return;
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-
- //
- // Two-sided lighting
- //
-
-#if 0
- //
- // DEBUGGING: Load shader from a text file
- //
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- hr = D3DXAssembleShaderFromFile(
- "twoside.vsh",
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#else
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- // Assemble ascii shader text into shader opcodes
- hr = D3DXAssembleShader(
- szTwoSidedLightingVS,
- strlen(szTwoSidedLightingVS),
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#endif
- if (FAILED(hr)) {
- ddlogError(DDLOG_WARN, "AssembleShader failed", hr);
- SAFE_RELEASE(pVSOpcodeBuffer);
- return;
- }
-
-// This is for debugging. Remove to enable vertex shaders in HW
-#define _GLD_FORCE_SW_VS 0
-
- if (_GLD_FORCE_SW_VS) {
- // _GLD_FORCE_SW_VS should be disabled for Final Release
- ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n");
- }
-
- // Try and create shader in hardware.
- // NOTE: The D3D Ref device appears to succeed when trying to
- // create the device in hardware, but later complains
- // when trying to set it with SetVertexShader(). Go figure.
- if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) {
- // Don't try and create a hardware shader with the Ref device
- hr = E_FAIL; // COM error/fail result
- } else {
- gld->VStwosidelight.bHardware = TRUE;
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- 0);
- }
- if (FAILED(hr)) {
- ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n");
- // Failed. Try and create shader for software processing
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- D3DUSAGE_SOFTWAREPROCESSING);
- if (FAILED(hr)) {
- gld->VStwosidelight.hShader = 0; // Sanity check
- ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr);
- return;
- }
- // Succeeded, but for software processing
- gld->VStwosidelight.bHardware = FALSE;
- }
-
- SAFE_RELEASE(pVSOpcodeBuffer);
-
- ddlogMessage(DDLOG_INFO, "... OK\n");
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyVertexShaders(
- GLD_driver_dx8 *gld)
-{
- if (gld->VStwosidelight.hShader) {
- IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader);
- gld->VStwosidelight.hShader = 0;
- }
-}
-*/
-//---------------------------------------------------------------------------
-
-LPVOID lpOpaque1 = NULL;
-LPVOID lpOpaque2 = NULL;
-
-BOOL gldCreateDrawable_DX(
- DGL_ctx *ctx,
-// BOOL bDefaultDriver,
- BOOL bDirectDrawPersistant,
- BOOL bPersistantBuffers)
-{
- //
- // bDirectDrawPersistant: applies to IDirect3D8
- // bPersistantBuffers: applies to IDirect3DDevice8
- //
-
- HRESULT hResult;
- GLD_driver_dx8 *lpCtx = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- DWORD dwBehaviourFlags;
- D3DADAPTER_IDENTIFIER8 d3dIdent;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- if (ctx->glPriv) {
- lpCtx = ctx->glPriv;
- // Release any existing interfaces
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- } else {
- lpCtx = (GLD_driver_dx8*)malloc(sizeof(GLD_driver_dx8));
- ZeroMemory(lpCtx, sizeof(lpCtx));
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- // TODO: Check this
-// if (bDefaultDriver)
-// d3dDevType = D3DDEVTYPE_REF;
-
- // Use persistant interface if needed
- if (bDirectDrawPersistant && dx8Globals.bDirect3D) {
- lpCtx->pD3D = dx8Globals.pD3D;
- IDirect3D8_AddRef(lpCtx->pD3D);
- goto SkipDirectDrawCreate;
- }
-
- // Create Direct3D8 object
- lpCtx->pD3D = dx8Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95);
- if (lpCtx->pD3D == NULL) {
- MessageBox(NULL, "Unable to initialize Direct3D8", "GLDirect", MB_OK);
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D8 interface");
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Cache Direct3D interface for subsequent GLRCs
- if (bDirectDrawPersistant && !dx8Globals.bDirect3D) {
- dx8Globals.pD3D = lpCtx->pD3D;
- IDirect3D8_AddRef(dx8Globals.pD3D);
- dx8Globals.bDirect3D = TRUE;
- }
-SkipDirectDrawCreate:
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Get device caps
- hResult = IDirect3D8_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps8);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_GetDeviceCaps failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Check for hardware transform & lighting
- lpCtx->bHasHWTnL = lpCtx->d3dCaps8.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
- // If this flag is present then we can't default to Mesa
- // SW rendering between BeginScene() and EndScene().
- if (lpCtx->d3dCaps8.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) {
- ddlogMessage(DDLOG_WARN,
- "Warning : No 2D allowed during 3D scene.\n");
- }
-
- //
- // Create the Direct3D context
- //
-
- // Re-use original IDirect3DDevice if persistant buffers exist.
- // Note that we test for persistant IDirect3D8 as well
- // bDirectDrawPersistant == persistant IDirect3D8 (DirectDraw8 does not exist)
- if (bDirectDrawPersistant && bPersistantBuffers && dx8Globals.pD3D && dx8Globals.pDev) {
- lpCtx->pDev = dx8Globals.pDev;
- IDirect3DDevice8_AddRef(dx8Globals.pDev);
- goto skip_direct3ddevice_create;
- }
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
-
- // Support for vertical retrace synchronisation.
- // Set default presentation interval in case caps bits are missing
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- if (lpCtx->d3dCaps8.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- // FullScreen_PresentationInterval must be default for Windowed mode
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
-
- // Decide if we can use hardware TnL
- dwBehaviourFlags = (lpCtx->bHasHWTnL) ?
- D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
- // Add flag to tell D3D to be thread-safe
- if (glb.bMultiThreaded)
- dwBehaviourFlags |= D3DCREATE_MULTITHREADED;
- // Add flag to tell D3D to be FPU-safe
- if (!glb.bFastFPU)
- dwBehaviourFlags |= D3DCREATE_FPU_PRESERVE;
- hResult = IDirect3D8_CreateDevice(lpCtx->pD3D,
- glb.dwAdapter,
- d3dDevType,
- ctx->hWnd,
- dwBehaviourFlags,
- &d3dpp,
- &lpCtx->pDev);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D8_CreateDevice failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- if (bDirectDrawPersistant && bPersistantBuffers && dx8Globals.pD3D) {
- dx8Globals.pDev = lpCtx->pDev;
- dx8Globals.bDirect3DDevice = TRUE;
- }
-
-/*
- // See if DDraw interfaces are available (DaveM)
- hResult = IDirect3D8_QueryInterface(lpCtx->pDev,
- &IID_IDirectDraw7, (LPVOID*)&lpOpaque1);
- if (FAILED(hResult) || lpOpaque1 == NULL) {
- ddlogMessage(DDLOG_INFO, "DirectDraw QueryInterface unavailable\n");
- }
-
- hResult = IDirect3DDevice8_QueryInterface(lpCtx->pDev,
- &IID_IDirectDrawSurface7, (LPVOID*)&lpOpaque2);
- if (FAILED(hResult) || lpOpaque2 == NULL) {
- ddlogMessage(DDLOG_INFO, "DirectDrawSurface QueryInterface unavialable\n");
- }
-*/
- // Dump some useful stats
- hResult = IDirect3D8_GetAdapterIdentifier(
- lpCtx->pD3D,
- glb.dwAdapter,
- D3DENUM_NO_WHQL_LEVEL, // Avoids 1 to 2 second delay
- &d3dIdent);
- if (SUCCEEDED(hResult)) {
- ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description);
- ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]",
- d3dIdent.Driver,
- HIWORD(d3dIdent.DriverVersion.HighPart),
- LOWORD(d3dIdent.DriverVersion.HighPart),
- HIWORD(d3dIdent.DriverVersion.LowPart),
- LOWORD(d3dIdent.DriverVersion.LowPart));
- ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]",
- d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision);
- }
-
- // Init projection matrix for D3D TnL
- D3DXMatrixIdentity(&lpCtx->matProjection);
- lpCtx->matModelView = lpCtx->matProjection;
-// gld->bUseMesaProjection = TRUE;
-
-skip_direct3ddevice_create:
-
- // Create buffers to hold primitives
- lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX;
- lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM;
- lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX);
- lpCtx->PB2d.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d);
- if (FAILED(hResult))
- goto return_with_error;
-
- lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX;
- lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX);
- lpCtx->PB3d.dwUsage = D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d);
- if (FAILED(hResult))
- goto return_with_error;
-
-/* // NOTE: A FVF code of zero indicates a non-FVF vertex buffer (for vertex shaders)
- lpCtx->PBtwosidelight.dwFVF = 0; //GLD_FVF_TWOSIDED_VERTEX;
- lpCtx->PBtwosidelight.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PBtwosidelight.dwStride = sizeof(GLD_TWOSIDED_VERTEX);
- lpCtx->PBtwosidelight.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PBtwosidelight);
- if (FAILED(hResult))
- goto return_with_error;*/
-
- // Now try and create the DX8 Vertex Shaders
-// _gldCreateVertexShaders(lpCtx);
-
- // Zero the pipeline usage counters
- lpCtx->PipelineUsage.qwMesa.QuadPart =
-// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart =
- lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0;
-
- // Assign drawable to GL private
- ctx->glPriv = lpCtx;
- return TRUE;
-
-return_with_error:
- // Clean up and bail
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_DX(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- GLD_driver_dx8 *gld = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- HRESULT hResult;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice8_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- if (!bDefaultDriver)
- d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software)
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D8_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
-// goto return_with_error;
- return FALSE;
- }
-
- // Destroy DX8 Vertex Shaders before Reset()
-// _gldDestroyVertexShaders(gld);
-
- // Release POOL_DEFAULT objects before Reset()
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB2d);
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB3d);
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT)
-// _gldDestroyPrimitiveBuffer(&gld->PBtwosidelight);
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- // TODO: Sync to refresh
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- // Get better benchmark results? KeithH
-// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED;
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
- hResult = IDirect3DDevice8_Reset(gld->pDev, &d3dpp);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult);
- return FALSE;
- //goto cleanup_and_return_with_error;
- }
-
- // Explicitly Clear resized surfaces (DaveM)
- {
- D3DVIEWPORT8 d3dvp1, d3dvp2;
- IDirect3DDevice8_GetViewport(gld->pDev, &d3dvp1);
- IDirect3DDevice8_GetViewport(gld->pDev, &d3dvp2);
- d3dvp1.X = 0;
- d3dvp1.Y = 0;
- d3dvp1.Width = ctx->dwWidth;
- d3dvp1.Height = ctx->dwHeight;
- IDirect3DDevice8_SetViewport(gld->pDev, &d3dvp1);
- IDirect3DDevice8_Clear(gld->pDev,0,NULL,D3DCLEAR_TARGET,0,0,0);
- IDirect3DDevice8_SetViewport(gld->pDev, &d3dvp2);
- }
-
- //
- // Recreate POOL_DEFAULT objects
- //
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
- }
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d);
- }
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) {
-// _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
-// }
-
- // Recreate DX8 Vertex Shaders
-// _gldCreateVertexShaders(gld);
-
- // Signal a complete state update
- ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL);
-
- // Begin a new scene
- IDirect3DDevice8_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_DX(
- DGL_ctx *ctx)
-{
- GLD_driver_dx8 *lpCtx = NULL;
-
- // Error if context is NULL.
- if (!ctx)
- return FALSE;
-
- // Error if the drawable does not exist.
- if (!ctx->glPriv)
- return FALSE;
-
- lpCtx = ctx->glPriv;
-
-#ifdef _DEBUG
- // Dump out stats
- ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X",
- lpCtx->PipelineUsage.qwMesa.HighPart,
- lpCtx->PipelineUsage.qwMesa.LowPart,
- lpCtx->PipelineUsage.qwD3DFVF.HighPart,
- lpCtx->PipelineUsage.qwD3DFVF.LowPart);
-#endif
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
-
- // Free the private drawable data
- free(ctx->glPriv);
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_DX(void)
-{
- ZeroMemory(&dx8Globals, sizeof(dx8Globals));
-
- // Load d3d8.dll
- dx8Globals.hD3D8DLL = LoadLibrary("D3D8.DLL");
- if (dx8Globals.hD3D8DLL == NULL)
- return FALSE;
-
- // Now try and obtain Direct3DCreate8
- dx8Globals.fnDirect3DCreate8 = (FNDIRECT3DCREATE8)GetProcAddress(dx8Globals.hD3D8DLL, "Direct3DCreate8");
- if (dx8Globals.fnDirect3DCreate8 == NULL) {
- FreeLibrary(dx8Globals.hD3D8DLL);
- return FALSE;
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_DX(void)
-{
- if (dx8Globals.bDirect3DDevice) {
- SAFE_RELEASE(dx8Globals.pDev);
- dx8Globals.bDirect3DDevice = FALSE;
- }
- if (dx8Globals.bDirect3D) {
- SAFE_RELEASE(dx8Globals.pD3D);
- dx8Globals.bDirect3D = FALSE;
- }
-
- FreeLibrary(dx8Globals.hD3D8DLL);
- dx8Globals.hD3D8DLL = NULL;
- dx8Globals.fnDirect3DCreate8 = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDisplayFormat(
- D3DFORMAT fmt,
- BYTE *cColorBits,
- BYTE *cRedBits,
- BYTE *cGreenBits,
- BYTE *cBlueBits,
- BYTE *cAlphaBits)
-{
- switch (fmt) {
- case D3DFMT_X1R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_R5G6B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 6;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_X8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
- return;
- case D3DFMT_A8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 8;
- return;
- }
-
- // Should not get here!
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDepthStencilFormat(
- D3DFORMAT fmt,
- BYTE *cDepthBits,
- BYTE *cStencilBits)
-{
- // NOTE: GL expects either 32 or 16 as depth bits.
- switch (fmt) {
- case D3DFMT_D32:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D15S1:
- *cDepthBits = 16;
- *cStencilBits = 1;
- return;
- case D3DFMT_D24S8:
- *cDepthBits = 32;
- *cStencilBits = 8;
- return;
- case D3DFMT_D16:
- *cDepthBits = 16;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X8:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X4S4:
- *cDepthBits = 32;
- *cStencilBits = 4;
- return;
- }
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_DX(void)
-{
- D3DDISPLAYMODE d3ddm;
- D3DFORMAT fmt[6];
- IDirect3D8 *pD3D = NULL;
- HRESULT hr;
- int nSupportedFormats = 0;
- int i;
- DGL_pixelFormat *pPF;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-// char buf[128];
-// char cat[8];
-
- // Direct3D (SW or HW)
- // These are arranged so that 'best' pixelformat
- // is higher in the list (for ChoosePixelFormat).
- const D3DFORMAT DepthStencil[6] = {
- D3DFMT_D15S1,
- D3DFMT_D16,
- D3DFMT_D24X8,
- D3DFMT_D24X4S4,
- D3DFMT_D24S8,
- D3DFMT_D32,
- };
-
- // Dump DX version
- ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 8.0\n");
-
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- //
- // Pixelformats for Direct3D (SW or HW) rendering
- //
-
- // Get a Direct3D 8.0 interface
- pD3D = dx8Globals.fnDirect3DCreate8(D3D_SDK_VERSION_DX8_SUPPORT_WIN95);
- if (!pD3D) {
- return FALSE;
- }
-
- // We will use the display mode format when finding compliant
- // rendertarget/depth-stencil surfaces.
- hr = IDirect3D8_GetAdapterDisplayMode(pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr)) {
- IDirect3D8_Release(pD3D);
- return FALSE;
- }
-
- // Run through the possible formats and detect supported formats
- for (i=0; i<6; i++) {
- hr = IDirect3D8_CheckDeviceFormat(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- D3DUSAGE_DEPTHSTENCIL,
- D3DRTYPE_SURFACE,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal.
- continue;
-
- // Verify that the depth format is compatible.
- hr = IDirect3D8_CheckDepthStencilMatch(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- d3ddm.Format,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal, just means depth-stencil
- // format is not compatible with this display mode.
- continue;
-
- fmt[nSupportedFormats++] = DepthStencil[i];
- }
-
- IDirect3D8_Release(pD3D);
-
- if (nSupportedFormats == 0)
- return FALSE; // Bail: no compliant pixelformats
-
- // Total count of pixelformats is:
- // (nSupportedFormats+1)*2
- glb.lpPF = (DGL_pixelFormat *)calloc((nSupportedFormats)*2, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = (nSupportedFormats)*2;
- if (glb.lpPF == NULL) {
- glb.nPixelFormatCount = 0;
- return FALSE;
- }
-
- // Get a copy of pointer that we can alter
- pPF = glb.lpPF;
-
- // Cache colour bits from display format
- _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- //
- // Add single-buffer formats
- //
-
- // Single-buffer, no depth-stencil buffer
-/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- //
- // Add double-buffer formats
- //
-
-/* memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;*/
-
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- // Popup warning message if non RGB color mode
- {
- // This is a hack. KeithH
- HDC hdcDesktop = GetDC(NULL);
- DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- ReleaseDC(0, hdcDesktop);
- if (dwDisplayBitDepth <= 8) {
- ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
- MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
- }
- }
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_DX(
- DGL_ctx *lpCtx)
-{
- GLD_driver_dx8 *gld = NULL;
- int MaxTextureSize, TextureLevels;
- BOOL bSoftwareTnL;
-
- if (lpCtx == NULL)
- return FALSE;
-
- gld = lpCtx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (glb.bMultitexture) {
- lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps8.MaxSimultaneousTextures;
- // Only support MAX_TEXTURE_UNITS texture units.
- // ** If this is altered then the FVF formats must be reviewed **.
- if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX8)
- lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX8;
- } else {
- // Multitexture override
- lpCtx->glCtx->Const.MaxTextureUnits = 1;
- }
-
- // max texture size
- MaxTextureSize = min(gld->d3dCaps8.MaxTextureHeight, gld->d3dCaps8.MaxTextureWidth);
- if (MaxTextureSize == 0)
- MaxTextureSize = 256; // Sanity check
-
- //
- // HACK!!
- if (MaxTextureSize > 1024)
- MaxTextureSize = 1024; // HACK - CLAMP TO 1024
- // HACK!!
- //
-
- // Got to set MAX_TEXTURE_SIZE as max levels.
- // Who thought this stupid idea up? ;)
- TextureLevels = 0;
- // Calculate power-of-two.
- while (MaxTextureSize) {
- TextureLevels++;
- MaxTextureSize >>= 1;
- }
- lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
-
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE);
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
-
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_ZENABLE,
- (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE);
-
- // Set the view matrix
- {
- D3DXMATRIX vm;
-#if 1
- D3DXMatrixIdentity(&vm);
-#else
- D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f);
- D3DXVECTOR3 At(0.0f, 0.0f, -1.0f);
- D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
- D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up);
- vm._31 = -vm._31;
- vm._32 = -vm._32;
- vm._33 = -vm._33;
- vm._34 = -vm._34;
-#endif
- IDirect3DDevice8_SetTransform(gld->pDev, D3DTS_VIEW, &vm);
- }
-
- if (gld->bHasHWTnL) {
- if (glb.dwTnL == GLDS_TNL_DEFAULT)
- bSoftwareTnL = FALSE; // HW TnL
- else {
- bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE;
- }
- } else {
- // No HW TnL, so no choice possible
- bSoftwareTnL = TRUE;
- }
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL);
-
-// Dump this in a Release build as well, now.
-//#ifdef _DEBUG
- ddlogPrintf(DDLOG_INFO, "HW TnL: %s",
- gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable");
-//#endif
-
- gldEnableExtensions_DX8(lpCtx->glCtx);
- gldInstallPipeline_DX8(lpCtx->glCtx);
- gldSetupDriverPointers_DX8(lpCtx->glCtx);
-
- // Signal a complete state update
- lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL);
-
- // Start a scene
- IDirect3DDevice8_BeginScene(gld->pDev);
- lpCtx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_DX(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- HRESULT hr;
- GLD_driver_dx8 *gld = NULL;
-
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice8_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- // Swap the buffers. hWnd may override the hWnd used for CreateDevice()
- hr = IDirect3DDevice8_Present(gld->pDev, NULL, NULL, hWnd, NULL);
-
- IDirect3DDevice8_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return (FAILED(hr)) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_DX(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
- D3DDISPLAYMODE d3ddm;
- HRESULT hr;
- GLD_driver_dx8 *lpCtx = NULL;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-
- if ((glddm == NULL) || (ctx == NULL))
- return FALSE;
-
- lpCtx = ctx->glPriv;
- if (lpCtx == NULL)
- return FALSE;
-
- if (lpCtx->pD3D == NULL)
- return FALSE;
-
- hr = IDirect3D8_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr))
- return FALSE;
-
- // Get info from the display format
- _BitsFromDisplayFormat(d3ddm.Format,
- &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- glddm->Width = d3ddm.Width;
- glddm->Height = d3ddm.Height;
- glddm->BPP = cColorBits;
- glddm->Refresh = d3ddm.RefreshRate;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c
deleted file mode 100644
index 1b01cb1f7f3..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c
+++ /dev/null
@@ -1,1206 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Driver interface code to Mesa
-*
-****************************************************************************/
-
-//#include <windows.h>
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-extern BOOL dglSwapBuffers(HDC hDC);
-
-// HACK: Hack the _33 member of the OpenGL perspective projection matrix
-const float _fPersp_33 = 1.6f;
-
-//---------------------------------------------------------------------------
-// Internal functions
-//---------------------------------------------------------------------------
-
-void _gld_mesa_warning(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal warning mechanism
- gldLogPrintf(GLDLOG_WARN, "Mesa warning: %s", str);
-}
-
-//---------------------------------------------------------------------------
-
-void _gld_mesa_fatal(
- __GLcontext *gc,
- char *str)
-{
- // Intercept Mesa's internal fatal-message mechanism
- gldLogPrintf(GLDLOG_CRITICAL, "Mesa FATAL: %s", str);
-
- // Mesa calls abort(0) here.
- ddlogClose();
- exit(0);
-}
-
-//---------------------------------------------------------------------------
-
-D3DSTENCILOP _gldConvertStencilOp(
- GLenum StencilOp)
-{
- // Used by Stencil: pass, fail and zfail
-
- switch (StencilOp) {
- case GL_KEEP:
- return D3DSTENCILOP_KEEP;
- case GL_ZERO:
- return D3DSTENCILOP_ZERO;
- case GL_REPLACE:
- return D3DSTENCILOP_REPLACE;
- case GL_INCR:
- return D3DSTENCILOP_INCRSAT;
- case GL_DECR:
- return D3DSTENCILOP_DECRSAT;
- case GL_INVERT:
- return D3DSTENCILOP_INVERT;
- case GL_INCR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_INCR;
- case GL_DECR_WRAP_EXT: // GL_EXT_stencil_wrap
- return D3DSTENCILOP_DECR;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertStencilOp: Unknown StencilOp\n");
-#endif
-
- return D3DSTENCILOP_KEEP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DCMPFUNC _gldConvertCompareFunc(
- GLenum CmpFunc)
-{
- // Used for Alpha func, depth func and stencil func.
-
- switch (CmpFunc) {
- case GL_NEVER:
- return D3DCMP_NEVER;
- case GL_LESS:
- return D3DCMP_LESS;
- case GL_EQUAL:
- return D3DCMP_EQUAL;
- case GL_LEQUAL:
- return D3DCMP_LESSEQUAL;
- case GL_GREATER:
- return D3DCMP_GREATER;
- case GL_NOTEQUAL:
- return D3DCMP_NOTEQUAL;
- case GL_GEQUAL:
- return D3DCMP_GREATEREQUAL;
- case GL_ALWAYS:
- return D3DCMP_ALWAYS;
- };
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertCompareFunc: Unknown CompareFunc\n");
-#endif
-
- return D3DCMP_ALWAYS;
-}
-
-//---------------------------------------------------------------------------
-
-D3DBLEND _gldConvertBlendFunc(
- GLenum blend,
- GLenum DefaultBlend)
-{
- switch (blend) {
- case GL_ZERO:
- return D3DBLEND_ZERO;
- case GL_ONE:
- return D3DBLEND_ONE;
- case GL_DST_COLOR:
- return D3DBLEND_DESTCOLOR;
- case GL_SRC_COLOR:
- return D3DBLEND_SRCCOLOR;
- case GL_ONE_MINUS_DST_COLOR:
- return D3DBLEND_INVDESTCOLOR;
- case GL_ONE_MINUS_SRC_COLOR:
- return D3DBLEND_INVSRCCOLOR;
- case GL_SRC_ALPHA:
- return D3DBLEND_SRCALPHA;
- case GL_ONE_MINUS_SRC_ALPHA:
- return D3DBLEND_INVSRCALPHA;
- case GL_DST_ALPHA:
- return D3DBLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return D3DBLEND_INVDESTALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return D3DBLEND_SRCALPHASAT;
- }
-
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "_gldConvertBlendFunc: Unknown BlendFunc\n");
-#endif
-
- return DefaultBlend;
-}
-
-//---------------------------------------------------------------------------
-// Misc. functions
-//---------------------------------------------------------------------------
-
-void gld_Noop_DX9(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Error_DX9(
- GLcontext *ctx)
-{
-#ifdef _DEBUG
- // Quite useless.
-// gldLogMessage(GLDLOG_ERROR, "ctx->Driver.Error called!\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Required Mesa functions
-//---------------------------------------------------------------------------
-
-static GLboolean gld_set_draw_buffer_DX9(
- GLcontext *ctx,
- GLenum mode)
-{
- (void) ctx;
- if ((mode==GL_FRONT_LEFT) || (mode == GL_BACK_LEFT)) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_set_read_buffer_DX9(
- GLcontext *ctx,
- GLframebuffer *buffer,
- GLenum mode)
-{
- /* separate read buffer not supported */
-/*
- ASSERT(buffer == ctx->DrawBuffer);
- ASSERT(mode == GL_FRONT_LEFT);
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Clear_DX9(
- GLcontext *ctx,
- GLbitfield mask,
- GLboolean all,
- GLint x,
- GLint y,
- GLint width,
- GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DCOLOR Color = 0;
- float Z = 0.0f;
- DWORD Stencil = 0;
- D3DRECT d3dClearRect;
-
- // TODO: Colourmask
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (!gld->pDev)
- return;
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_UBYTE(col[3], ctx->Color.ClearColor[3]);
- dwFlags |= D3DCLEAR_TARGET;
- Color = D3DCOLOR_RGBA(col[0], col[1], col[2], col[3]);
- }
-
- if (mask & DD_DEPTH_BIT) {
- // D3D8 will fail the Clear call if we try and clear a
- // depth buffer and we haven't created one.
- // Also, some apps try and clear a depth buffer,
- // when a depth buffer hasn't been requested by the app.
- if (ctx->Visual.depthBits == 0) {
- mask &= ~DD_DEPTH_BIT; // Remove depth bit from mask
- } else {
- dwFlags |= D3DCLEAR_ZBUFFER;
- Z = ctx->Depth.Clear;
- }
- }
-
- if (mask & DD_STENCIL_BIT) {
- if (ctx->Visual.stencilBits == 0) {
- // No stencil bits in depth buffer
- mask &= ~DD_STENCIL_BIT; // Remove stencil bit from mask
- } else {
- dwFlags |= D3DCLEAR_STENCIL;
- Stencil = ctx->Stencil.Clear;
- }
- }
-
- // Some apps do really weird things with the rect, such as Quake3.
- if ((x < 0) || (y < 0) || (width <= 0) || (height <= 0)) {
- all = GL_TRUE;
- }
-
- if (!all) {
- // Calculate clear subrect
- d3dClearRect.x1 = x;
- d3dClearRect.y1 = gldCtx->dwHeight - (y + height);
- d3dClearRect.x2 = x + width;
- d3dClearRect.y2 = d3dClearRect.y1 + height;
-// gldLogPrintf(GLDLOG_INFO, "Rect %d,%d %d,%d", x,y,width,height);
- }
-
- // dwFlags will be zero if there's nothing to clear
- if (dwFlags) {
- _GLD_DX9_DEV(Clear(
- gld->pDev,
- all ? 0 : 1,
- all ? NULL : &d3dClearRect,
- dwFlags,
- Color, Z, Stencil));
- }
-
- if (mask & DD_ACCUM_BIT) {
- // Clear accumulation buffer
- }
-}
-
-//---------------------------------------------------------------------------
-
-// Mesa 5: Parameter change
-static void gld_buffer_size_DX9(
-// GLcontext *ctx,
- GLframebuffer *fb,
- GLuint *width,
- GLuint *height)
-{
-// GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
-
- *width = fb->Width; // gldCtx->dwWidth;
- *height = fb->Height; // gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Finish_DX9(
- GLcontext *ctx)
-{
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_Flush_DX9(
- GLcontext *ctx)
-{
- GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- // TODO: Detect apps that glFlush() then SwapBuffers() ?
-
- if (gld->EmulateSingle) {
- // Emulating a single-buffered context.
- // [Direct3D doesn't allow rendering to front buffer]
- dglSwapBuffers(gld->hDC);
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_STENCIL(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Two-sided stencil. New for Mesa 5
- const GLuint uiFace = 0UL;
-
- struct gl_stencil_attrib *pStencil = &ctx->Stencil;
-
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILENABLE, pStencil->Enabled ? TRUE : FALSE));
- if (pStencil->Enabled) {
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFUNC, _gldConvertCompareFunc(pStencil->Function[uiFace])));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILREF, pStencil->Ref[uiFace]));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILMASK, pStencil->ValueMask[uiFace]));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILWRITEMASK, pStencil->WriteMask[uiFace]));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILFAIL, _gldConvertStencilOp(pStencil->FailFunc[uiFace])));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILZFAIL, _gldConvertStencilOp(pStencil->ZFailFunc[uiFace])));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_STENCILPASS, _gldConvertStencilOp(pStencil->ZPassFunc[uiFace])));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_COLOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- DWORD dwFlags = 0;
- D3DBLEND src;
- D3DBLEND dest;
-
- // Alpha func
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, _gldConvertCompareFunc(ctx->Color.AlphaFunc)));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHAREF, (DWORD)ctx->Color.AlphaRef));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, ctx->Color.AlphaEnabled));
-
- // Blend func
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ALPHABLENDENABLE, ctx->Color.BlendEnabled));
- src = _gldConvertBlendFunc(ctx->Color.BlendSrcRGB, GL_ONE);
- dest = _gldConvertBlendFunc(ctx->Color.BlendDstRGB, GL_ZERO);
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SRCBLEND, src));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_DESTBLEND, dest));
-
- // Color mask
- if (ctx->Color.ColorMask[0]) dwFlags |= D3DCOLORWRITEENABLE_RED;
- if (ctx->Color.ColorMask[1]) dwFlags |= D3DCOLORWRITEENABLE_GREEN;
- if (ctx->Color.ColorMask[2]) dwFlags |= D3DCOLORWRITEENABLE_BLUE;
- if (ctx->Color.ColorMask[3]) dwFlags |= D3DCOLORWRITEENABLE_ALPHA;
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_COLORWRITEENABLE, dwFlags));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_DEPTH(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZENABLE, ctx->Depth.Test ? D3DZB_TRUE : D3DZB_FALSE));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZFUNC, _gldConvertCompareFunc(ctx->Depth.Func)));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_ZWRITEENABLE, ctx->Depth.Mask ? TRUE : FALSE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_POLYGON(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DFILLMODE d3dFillMode = D3DFILL_SOLID;
- D3DCULL d3dCullMode = D3DCULL_NONE;
- float fOffset = 0; // Changed from int to float for DX9
-
- // Fillmode
- switch (ctx->Polygon.FrontMode) {
- case GL_POINT:
- d3dFillMode = D3DFILL_POINT;
- break;
- case GL_LINE:
- d3dFillMode = D3DFILL_WIREFRAME;
- break;
- case GL_FILL:
- d3dFillMode = D3DFILL_SOLID;
- break;
- }
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FILLMODE, d3dFillMode));
-
- if (ctx->Polygon.CullFlag) {
- switch (ctx->Polygon.CullFaceMode) {
- case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CW;
- else
- d3dCullMode = D3DCULL_CCW;
- break;
- case GL_FRONT:
- if (ctx->Polygon.FrontFace == GL_CCW)
- d3dCullMode = D3DCULL_CCW;
- else
- d3dCullMode = D3DCULL_CW;
- break;
- case GL_FRONT_AND_BACK:
- d3dCullMode = D3DCULL_NONE;
- break;
- default:
- break;
- }
- } else {
- d3dCullMode = D3DCULL_NONE;
- }
-// d3dCullMode = D3DCULL_NONE; // FOR DEBUGGING
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CULLMODE, d3dCullMode));
-
- // Polygon offset
- // ZBIAS ranges from 0 to 16 and can only move towards the viewer
- // Mesa5: ctx->Polygon._OffsetAny removed
- if (ctx->Polygon.OffsetFill) {
- fOffset = ctx->Polygon.OffsetUnits;
-// if (iOffset < 0.0f)
-// iOffset = -iOffset;
-// else
-// iOffset = 0.0f; // D3D can't push away
- }
- // NOTE: SetRenderState() required a DWORD, so need to cast
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_DEPTHBIAS, *((DWORD*)&fOffset)));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_FOG(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DCOLOR d3dFogColour;
- D3DFOGMODE d3dFogMode = D3DFOG_LINEAR;
-
- // TODO: Fog is calculated seperately in the Mesa pipeline
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, FALSE));
- return;
-
- // Fog enable
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGENABLE, ctx->Fog.Enabled));
- if (!ctx->Fog.Enabled) {
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, D3DFOG_NONE));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
- return; // If disabled, don't bother setting any fog state
- }
-
- // Fog colour
- d3dFogColour = D3DCOLOR_COLORVALUE( ctx->Fog.Color[0],
- ctx->Fog.Color[1],
- ctx->Fog.Color[2],
- ctx->Fog.Color[3]);
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGCOLOR, d3dFogColour));
-
- // Fog density
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGDENSITY, *((DWORD*) (&ctx->Fog.Density))));
-
- // Fog start
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGSTART, *((DWORD*) (&ctx->Fog.Start))));
-
- // Fog end
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGEND, *((DWORD*) (&ctx->Fog.End))));
-
- // Fog mode
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- d3dFogMode = D3DFOG_LINEAR;
- break;
- case GL_EXP:
- d3dFogMode = D3DFOG_EXP;
- break;
- case GL_EXP2:
- d3dFogMode = D3DFOG_EXP2;
- break;
- }
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGTABLEMODE, d3dFogMode));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_FOGVERTEXMODE, D3DFOG_NONE));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_LIGHT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- DWORD dwSpecularEnable;
-
- // Shademode
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SHADEMODE, (ctx->Light.ShadeModel == GL_SMOOTH) ? D3DSHADE_GOURAUD : D3DSHADE_FLAT));
-
- // Separate specular colour
- if (ctx->Light.Enabled)
- dwSpecularEnable = (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) ? TRUE: FALSE;
- else
- dwSpecularEnable = FALSE;
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SPECULARENABLE, dwSpecularEnable));
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_MODELVIEW(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ModelView.m;
- // Mesa5: Model-view is now a stack
- GLfloat *pM = ctx->ModelviewMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10];
- m._34 = pM[11];
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14];
- m._44 = pM[15];
-
- gld->matModelView = m;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_PROJECTION(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DMATRIX m;
- //GLfloat *pM = ctx->ProjectionMatrix.m;
- // Mesa 5: Now a stack
- GLfloat *pM = ctx->ProjectionMatrixStack.Top->m;
- m._11 = pM[0];
- m._12 = pM[1];
- m._13 = pM[2];
- m._14 = pM[3];
-
- m._21 = pM[4];
- m._22 = pM[5];
- m._23 = pM[6];
- m._24 = pM[7];
-
- m._31 = pM[8];
- m._32 = pM[9];
- m._33 = pM[10] / _fPersp_33; // / 1.6f;
- m._34 = pM[11];
-
- m._41 = pM[12];
- m._42 = pM[13];
- m._43 = pM[14] / 2.0f;
- m._44 = pM[15];
-
- gld->matProjection = m;
-}
-
-//---------------------------------------------------------------------------
-/*
-void gldFrustumHook_DX9(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Frustum(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = farval / (nearval - farval);
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Frustum: %f", farval/nearval);
-}
-
-//---------------------------------------------------------------------------
-
-void gldOrthoHook_DX9(
- GLdouble left,
- GLdouble right,
- GLdouble bottom,
- GLdouble top,
- GLdouble nearval,
- GLdouble farval)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Pass values on to Mesa first (in case we mess with them)
- _mesa_Ortho(left, right, bottom, top, nearval, farval);
-
- _fPersp_33 = 1.6f;
-
-// ddlogPrintf(GLDLOG_SYSTEM, "Ortho: %f", farval/nearval);
-}
-*/
-//---------------------------------------------------------------------------
-
-void gld_NEW_VIEWPORT(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DVIEWPORT9 d3dvp;
-// GLint x, y;
-// GLsizei w, h;
-
- // Set depth range
- _GLD_DX9_DEV(GetViewport(gld->pDev, &d3dvp));
- // D3D can't do Quake1/Quake2 z-trick
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-/* x = ctx->Viewport.X;
- y = ctx->Viewport.Y;
- w = ctx->Viewport.Width;
- h = ctx->Viewport.Height;
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;*/
- _GLD_DX9_DEV(SetViewport(gld->pDev, &d3dvp));
-
-// gld->fFlipWindowY = (float)gldCtx->dwHeight;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_SCISSOR(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Bail if IHV driver cannot scissor
- if (!gld->bCanScissor)
- return;
-
- // Set scissor rect
- if (ctx->Scissor.Enabled) {
- RECT rcRect;
- // Keep in mind that RECT's need an extra row and column
- rcRect.left = ctx->Scissor.X;
- rcRect.right = ctx->Scissor.X + ctx->Scissor.Width; // + 1;
- rcRect.top = gldCtx->dwHeight - (ctx->Scissor.Y + ctx->Scissor.Height);
- rcRect.bottom = rcRect.top + ctx->Scissor.Height;
- IDirect3DDevice9_SetScissorRect(gld->pDev, &rcRect);
- }
-
- // Enable/disable scissor as required
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SCISSORTESTENABLE, ctx->Scissor.Enabled));
-}
-
-//---------------------------------------------------------------------------
-
-__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
-{
- struct gl_eval_attrib *eval = &ctx->Eval;
-
- if ((eval->AutoNormal) ||
- (eval->Map1Color4) ||
- (eval->Map1Index) ||
- (eval->Map1Normal) ||
- (eval->Map1TextureCoord1) ||
- (eval->Map1TextureCoord2) ||
- (eval->Map1TextureCoord3) ||
- (eval->Map1TextureCoord4) ||
- (eval->Map1Vertex3) ||
- (eval->Map1Vertex4) ||
- (eval->Map2Color4) ||
- (eval->Map2Index) ||
- (eval->Map2Normal) ||
- (eval->Map2TextureCoord1) ||
- (eval->Map2TextureCoord2) ||
- (eval->Map2TextureCoord3) ||
- (eval->Map2TextureCoord4) ||
- (eval->Map2Vertex3) ||
- (eval->Map2Vertex4)
- )
- return TRUE;
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
- GLD_driver_dx9 *gld)
-{
-// return TRUE; // DEBUGGING: ALWAYS USE MESA
-// return FALSE; // DEBUGGING: ALWAYS USE D3D
-
- if ((glb.dwTnL == GLDS_TNL_MESA) || (gld->bHasHWTnL == FALSE))
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE; // Force Mesa TnL
- }
-
- if ((ctx->Light.Enabled) ||
- (1) ||
- (ctx->Texture._TexGenEnabled) ||
- (ctx->Texture._TexMatEnabled) ||
-// (ctx->Transform._AnyClip) ||
- (ctx->Scissor.Enabled) ||
- _gldAnyEvalEnabled(ctx) // Put this last so we can early-out
- )
- {
- gld->PipelineUsage.qwMesa.QuadPart++;
- return TRUE;
- }
-
- gld->PipelineUsage.qwD3DFVF.QuadPart++;
- return FALSE;
-
-/* // Force Mesa pipeline?
- if (glb.dwTnL == GLDS_TNL_MESA) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Test for functionality not exposed in the D3D pathways
- if ((ctx->Texture._GenFlags)) {
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
-
- // Now decide if vertex shader can be used.
- // If two sided lighting is enabled then we must either
- // use Mesa TnL or the vertex shader
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
- if (gld->VStwosidelight.hShader && !ctx->Fog.Enabled) {
- // Use Vertex Shader
- gld->PipelineUsage.dwD3D2SVS.QuadPart++;
- return GLD_PIPELINE_D3D_VS_TWOSIDE;
- } else {
- // Use Mesa TnL
- gld->PipelineUsage.dwMesa.QuadPart++;
- return GLD_PIPELINE_MESA;
- }
- }
-
- // Must be D3D fixed-function pipeline
- gld->PipelineUsage.dwD3DFVF.QuadPart++;
- return GLD_PIPELINE_D3D_FVF;
-*/
-}
-
-//---------------------------------------------------------------------------
-
-void gld_update_state_DX9(
- GLcontext *ctx,
- GLuint new_state)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLD_pb_dx9 *gldPB;
-
- if (!gld || !gld->pDev)
- return;
-
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-
- // SetupIndex will be used in the pipelines for choosing setup function
- if ((ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE | DD_SEPARATE_SPECULAR)) ||
- (ctx->Fog.Enabled))
- {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT_EXTRAS;
- else
- gld->iSetupFunc = GLD_SI_SMOOTH_EXTRAS;
- } else {
- if (ctx->_TriangleCaps & DD_FLATSHADE)
- gld->iSetupFunc = GLD_SI_FLAT; // Setup flat shade + texture
- else
- gld->iSetupFunc = GLD_SI_SMOOTH; // Setup smooth shade + texture
- }
-
- gld->bUseMesaTnL = _gldChooseInternalPipeline(ctx, gld);
- if (gld->bUseMesaTnL) {
- gldPB = &gld->PB2d;
- _GLD_DX9_DEV(SetSoftwareVertexProcessing(gld->pDev, TRUE));
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, FALSE));
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL));
- _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF));
- } else {
- gldPB = &gld->PB3d;
- _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE));
-// if (gld->TnLPipeline == GLD_PIPELINE_D3D_VS_TWOSIDE) {
-// _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware));
-// _GLD_DX9_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
-// } else {
-// _GLD_DX9_DEV(SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->bHasHWTnL));
- _GLD_DX9_DEV(SetSoftwareVertexProcessing(gld->pDev, !gld->bHasHWTnL));
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL));
- _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF));
-// }
- }
-
-#define _GLD_TEST_STATE(a) \
- if (new_state & (a)) { \
- gld##a(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_TEST_STATE_DX9(a) \
- if (new_state & (a)) { \
- gld##a##_DX9(ctx); \
- new_state &= ~(a); \
- }
-
-#define _GLD_IGNORE_STATE(a) new_state &= ~(a);
-
-// if (!gld->bUseMesaTnL) {
- // Not required if Mesa is doing the TnL.
- // Problem: If gld->bUseMesaTnL is TRUE when these are signaled,
- // then we'll miss updating the D3D TnL pipeline.
- // Therefore, don't test for gld->bUseMesaTnL
- _GLD_TEST_STATE(_NEW_MODELVIEW);
- _GLD_TEST_STATE(_NEW_PROJECTION);
-// }
-
- _GLD_TEST_STATE_DX9(_NEW_TEXTURE); // extern, so guard with _DX9
- _GLD_TEST_STATE(_NEW_COLOR);
- _GLD_TEST_STATE(_NEW_DEPTH);
- _GLD_TEST_STATE(_NEW_POLYGON);
- _GLD_TEST_STATE(_NEW_STENCIL);
- _GLD_TEST_STATE(_NEW_FOG);
- _GLD_TEST_STATE(_NEW_LIGHT);
- _GLD_TEST_STATE(_NEW_VIEWPORT);
-
- _GLD_IGNORE_STATE(_NEW_TRANSFORM);
-
- // Scissor Test: New for DX9
- _GLD_TEST_STATE(_NEW_SCISSOR);
-
-// Stubs for future use.
-/* _GLD_TEST_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_STATE(_NEW_ACCUM);
- _GLD_TEST_STATE(_NEW_EVAL);
- _GLD_TEST_STATE(_NEW_HINT);
- _GLD_TEST_STATE(_NEW_LINE);
- _GLD_TEST_STATE(_NEW_PIXEL);
- _GLD_TEST_STATE(_NEW_POINT);
- _GLD_TEST_STATE(_NEW_POLYGONSTIPPLE);
- _GLD_TEST_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_STATE(_NEW_ARRAY);
- _GLD_TEST_STATE(_NEW_RENDERMODE);
- _GLD_TEST_STATE(_NEW_BUFFERS);
- _GLD_TEST_STATE(_NEW_MULTISAMPLE);
-*/
-
-// For debugging.
-#if 0
-#define _GLD_TEST_UNHANDLED_STATE(a) \
- if (new_state & (a)) { \
- gldLogMessage(GLDLOG_ERROR, "Unhandled " #a "\n"); \
- }
- _GLD_TEST_UNHANDLED_STATE(_NEW_TEXTURE_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_COLOR_MATRIX);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ACCUM);
- _GLD_TEST_UNHANDLED_STATE(_NEW_EVAL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_HINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_LINE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PIXEL);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POINT);
- _GLD_TEST_UNHANDLED_STATE(_NEW_POLYGONSTIPPLE);
-// _GLD_TEST_UNHANDLED_STATE(_NEW_SCISSOR);
- _GLD_TEST_UNHANDLED_STATE(_NEW_PACKUNPACK);
- _GLD_TEST_UNHANDLED_STATE(_NEW_ARRAY);
- _GLD_TEST_UNHANDLED_STATE(_NEW_RENDERMODE);
- _GLD_TEST_UNHANDLED_STATE(_NEW_BUFFERS);
- _GLD_TEST_UNHANDLED_STATE(_NEW_MULTISAMPLE);
-#undef _GLD_UNHANDLED_STATE
-#endif
-
-#undef _GLD_TEST_STATE
-}
-
-//---------------------------------------------------------------------------
-// Viewport
-//---------------------------------------------------------------------------
-
-void gld_Viewport_DX9(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DVIEWPORT9 d3dvp;
-
- if (!gld || !gld->pDev)
- return;
-
- // This is a hack. When the app is minimized, Mesa passes
- // w=1 and h=1 for viewport dimensions. Without this test
- // we get a GPF in gld_wgl_resize_buffers().
- if ((w==1) && (h==1))
- return;
-
- // Call ResizeBuffersMESA. This function will early-out
- // if no resize is needed.
- //ctx->Driver.ResizeBuffersMESA(ctx);
- // Mesa 5: Changed parameters
- ctx->Driver.ResizeBuffers(gldCtx->glBuffer);
-
-#if 0
- ddlogPrintf(GLDLOG_SYSTEM, ">> Viewport x=%d y=%d w=%d h=%d", x,y,w,h);
-#endif
-
- // ** D3D viewport must not be outside the render target surface **
- // Sanity check the GL viewport dimensions
- if (x < 0) x = 0;
- if (y < 0) y = 0;
- if (w > gldCtx->dwWidth) w = gldCtx->dwWidth;
- if (h > gldCtx->dwHeight) h = gldCtx->dwHeight;
- // Ditto for D3D viewport dimensions
- if (w+x > gldCtx->dwWidth) w = gldCtx->dwWidth-x;
- if (h+y > gldCtx->dwHeight) h = gldCtx->dwHeight-y;
-
- d3dvp.X = x;
- d3dvp.Y = gldCtx->dwHeight - (y + h);
- d3dvp.Width = w;
- d3dvp.Height = h;
- if (ctx->Viewport.Near <= ctx->Viewport.Far) {
- d3dvp.MinZ = ctx->Viewport.Near;
- d3dvp.MaxZ = ctx->Viewport.Far;
- } else {
- d3dvp.MinZ = ctx->Viewport.Far;
- d3dvp.MaxZ = ctx->Viewport.Near;
- }
-
- // TODO: DEBUGGING
-// d3dvp.MinZ = 0.0f;
-// d3dvp.MaxZ = 1.0f;
-
- _GLD_DX9_DEV(SetViewport(gld->pDev, &d3dvp));
-
-}
-
-//---------------------------------------------------------------------------
-
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
-
-// Mesa 5: Parameter change
-void gldResizeBuffers_DX9(
-// GLcontext *ctx)
- GLframebuffer *fb)
-{
- GET_CURRENT_CONTEXT(ctx);
- dglWglResizeBuffers(ctx, TRUE);
-}
-
-//---------------------------------------------------------------------------
-#ifdef _DEBUG
-// This is only for debugging.
-// To use, plug into ctx->Driver.Enable pointer below.
-void gld_Enable(
- GLcontext *ctx,
- GLenum e,
- GLboolean b)
-{
- char buf[1024];
- sprintf(buf, "Enable: %s (%s)\n", _mesa_lookup_enum_by_nr(e), b?"TRUE":"FALSE");
- ddlogMessage(DDLOG_SYSTEM, buf);
-}
-#endif
-//---------------------------------------------------------------------------
-// Driver pointer setup
-//---------------------------------------------------------------------------
-
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
-
-void gldSetupDriverPointers_DX9(
- GLcontext *ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- // Mandatory functions
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = gld_update_state_DX9;
- ctx->Driver.Clear = gld_Clear_DX9;
- ctx->Driver.DrawBuffer = gld_set_draw_buffer_DX9;
- ctx->Driver.GetBufferSize = gld_buffer_size_DX9;
- ctx->Driver.Finish = gld_Finish_DX9;
- ctx->Driver.Flush = gld_Flush_DX9;
- ctx->Driver.Error = gld_Error_DX9;
-
- // Hardware accumulation buffer
- ctx->Driver.Accum = NULL; // TODO: gld_Accum;
-
- // Bitmap functions
- ctx->Driver.CopyPixels = gld_CopyPixels_DX9;
- ctx->Driver.DrawPixels = gld_DrawPixels_DX9;
- ctx->Driver.ReadPixels = gld_ReadPixels_DX9;
- ctx->Driver.Bitmap = gld_Bitmap_DX9;
-
- // Buffer resize
- ctx->Driver.ResizeBuffers = gldResizeBuffers_DX9;
-
- // Texture image functions
- ctx->Driver.ChooseTextureFormat = gld_ChooseTextureFormat_DX9;
- ctx->Driver.TexImage1D = gld_TexImage1D_DX9;
- ctx->Driver.TexImage2D = gld_TexImage2D_DX9;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = gld_TexSubImage1D_DX9;
- ctx->Driver.TexSubImage2D = gld_TexSubImage2D_DX9;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = gldCopyTexImage1D_DX9; //NULL;
- ctx->Driver.CopyTexImage2D = gldCopyTexImage2D_DX9; //NULL;
- ctx->Driver.CopyTexSubImage1D = gldCopyTexSubImage1D_DX9; //NULL;
- ctx->Driver.CopyTexSubImage2D = gldCopyTexSubImage2D_DX9; //NULL;
- ctx->Driver.CopyTexSubImage3D = gldCopyTexSubImage3D_DX9;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- // Texture object functions
- ctx->Driver.BindTexture = NULL;
- ctx->Driver.NewTextureObject = NULL; // Not yet implemented by Mesa!;
- ctx->Driver.DeleteTexture = gld_DeleteTexture_DX9;
- ctx->Driver.PrioritizeTexture = NULL;
-
- // Imaging functionality
- ctx->Driver.CopyColorTable = NULL;
- ctx->Driver.CopyColorSubTable = NULL;
- ctx->Driver.CopyConvolutionFilter1D = NULL;
- ctx->Driver.CopyConvolutionFilter2D = NULL;
-
- // State changing functions
- ctx->Driver.AlphaFunc = NULL; //gld_AlphaFunc;
- ctx->Driver.BlendFuncSeparate = NULL; //gld_BlendFunc;
- ctx->Driver.ClearColor = NULL; //gld_ClearColor;
- ctx->Driver.ClearDepth = NULL; //gld_ClearDepth;
- ctx->Driver.ClearStencil = NULL; //gld_ClearStencil;
- ctx->Driver.ColorMask = NULL; //gld_ColorMask;
- ctx->Driver.CullFace = NULL; //gld_CullFace;
- ctx->Driver.ClipPlane = NULL; //gld_ClipPlane;
- ctx->Driver.FrontFace = NULL; //gld_FrontFace;
- ctx->Driver.DepthFunc = NULL; //gld_DepthFunc;
- ctx->Driver.DepthMask = NULL; //gld_DepthMask;
- ctx->Driver.DepthRange = NULL;
- ctx->Driver.Enable = NULL; //gld_Enable;
- ctx->Driver.Fogfv = NULL; //gld_Fogfv;
- ctx->Driver.Hint = NULL; //gld_Hint;
- ctx->Driver.Lightfv = NULL; //gld_Lightfv;
- ctx->Driver.LightModelfv = NULL; //gld_LightModelfv;
- ctx->Driver.LineStipple = NULL; //gld_LineStipple;
- ctx->Driver.LineWidth = NULL; //gld_LineWidth;
- ctx->Driver.LogicOpcode = NULL; //gld_LogicOpcode;
- ctx->Driver.PointParameterfv = NULL; //gld_PointParameterfv;
- ctx->Driver.PointSize = NULL; //gld_PointSize;
- ctx->Driver.PolygonMode = NULL; //gld_PolygonMode;
- ctx->Driver.PolygonOffset = NULL; //gld_PolygonOffset;
- ctx->Driver.PolygonStipple = NULL; //gld_PolygonStipple;
- ctx->Driver.RenderMode = NULL; //gld_RenderMode;
- ctx->Driver.Scissor = NULL; //gld_Scissor;
- ctx->Driver.ShadeModel = NULL; //gld_ShadeModel;
- ctx->Driver.StencilFunc = NULL; //gld_StencilFunc;
- ctx->Driver.StencilMask = NULL; //gld_StencilMask;
- ctx->Driver.StencilOp = NULL; //gld_StencilOp;
- ctx->Driver.TexGen = NULL; //gld_TexGen;
- ctx->Driver.TexEnv = NULL;
- ctx->Driver.TexParameter = NULL;
- ctx->Driver.TextureMatrix = NULL; //gld_TextureMatrix;
- ctx->Driver.Viewport = gld_Viewport_DX9;
-
- _swsetup_Wakeup(ctx);
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- tnl->Driver.Render.ResetLineStipple = gld_ResetLineStipple_DX9;
- tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
- tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
-
- // Hook into glFrustum() and glOrtho()
-// ctx->Exec->Frustum = gldFrustumHook_DX9;
-// ctx->Exec->Ortho = gldOrthoHook_DX9;
-
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h
deleted file mode 100644
index aec40ac9dd1..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_dx9.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 9.0 header file
-*
-****************************************************************************/
-
-#ifndef _GLD_DX9_H
-#define _GLD_DX9_H
-
-//---------------------------------------------------------------------------
-// Windows includes
-//---------------------------------------------------------------------------
-
-//#ifndef STRICT
-//#define STRICT
-//#endif
-
-//#define WIN32_LEAN_AND_MEAN
-//#include <windows.h>
-#include <d3d9.h>
-#include <d3dx9.h>
-
-// MS screwed up with the DX8.1 SDK - there's no compile-time
-// method of compiling for 8.0 via the 8.1 SDK unless you
-// "make sure you don't use any 8.1 interfaces".
-// We CAN use 8.1 D3DX static functions, though - just not new 8.1 interfaces.
-//
-// D3D_SDK_VERSION is 120 for 8.0 (supported by Windows 95).
-// D3D_SDK_VERSION is 220 for 8.1 (NOT supported by Windows 95).
-//
-//#define D3D_SDK_VERSION_DX9_SUPPORT_WIN95 120
-//#define D3D_SDK_VERSION_DX91 220
-
-// Typedef for obtaining function from d3d8.dll
-typedef IDirect3D9* (WINAPI *FNDIRECT3DCREATE9) (UINT);
-
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-
-#ifdef _DEBUG
-#define _GLD_TEST_HRESULT(h) \
-{ \
- HRESULT _hr = (h); \
- if (FAILED(_hr)) { \
- gldLogError(GLDLOG_ERROR, #h, _hr); \
- } \
-}
-#define _GLD_DX9(func) _GLD_TEST_HRESULT(IDirect3D9_##func##)
-#define _GLD_DX9_DEV(func) _GLD_TEST_HRESULT(IDirect3DDevice9_##func##)
-#define _GLD_DX9_VB(func) _GLD_TEST_HRESULT(IDirect3DVertexBuffer9_##func##)
-#define _GLD_DX9_TEX(func) _GLD_TEST_HRESULT(IDirect3DTexture9_##func##)
-#else
-#define _GLD_DX9(func) IDirect3D9_##func
-#define _GLD_DX9_DEV(func) IDirect3DDevice9_##func
-#define _GLD_DX9_VB(func) IDirect3DVertexBuffer9_##func
-#define _GLD_DX9_TEX(func) IDirect3DTexture9_##func
-#endif
-
-#define SAFE_RELEASE(p) \
-{ \
- if (p) { \
- (p)->lpVtbl->Release(p); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_VB9(p) \
-{ \
- if (p) { \
- IDirect3DVertexBuffer9_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-#define SAFE_RELEASE_SURFACE9(p) \
-{ \
- if (p) { \
- IDirect3DSurface9_Release((p)); \
- (p) = NULL; \
- } \
-}
-
-// Setup index.
-enum {
- GLD_SI_FLAT = 0,
- GLD_SI_SMOOTH = 1,
- GLD_SI_FLAT_EXTRAS = 2,
- GLD_SI_SMOOTH_EXTRAS = 3,
-};
-/*
-// Internal pipeline
-typedef enum {
- GLD_PIPELINE_MESA = 0, // Mesa pipeline
- GLD_PIPELINE_D3D_FVF = 1, // Direct3D Fixed-function pipeline
- GLD_PIPELINE_D3D_VS_TWOSIDE = 2 // Direct3D two-sided-lighting vertex shader
-} GLD_tnl_pipeline;
-*/
-//---------------------------------------------------------------------------
-// Vertex definitions for Fixed-Function pipeline
-//---------------------------------------------------------------------------
-
-//
-// NOTE: If the number of texture units is altered then most of
-// the texture code will need to be revised.
-//
-
-#define GLD_MAX_TEXTURE_UNITS_DX9 2
-
-//
-// 2D vertex transformed by Mesa
-//
-#define GLD_FVF_2D_VERTEX ( D3DFVF_XYZRHW | \
- D3DFVF_DIFFUSE | \
- D3DFVF_SPECULAR | \
- D3DFVF_TEX2)
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT sz; // Screen Z (depth)
- FLOAT rhw; // Reciprocal homogenous W
- DWORD diffuse; // Diffuse colour
- DWORD specular; // For separate-specular support
- FLOAT t0_u, t0_v; // 1st set of texture coords
- FLOAT t1_u, t1_v; // 2nd set of texture coords
-} GLD_2D_VERTEX;
-
-
-//
-// 3D vertex transformed by Direct3D
-//
-#define GLD_FVF_3D_VERTEX ( D3DFVF_XYZ | \
- D3DFVF_DIFFUSE | \
- D3DFVF_TEX2)
-
-typedef struct {
- D3DXVECTOR3 Position; // XYZ Vector in object space
- D3DCOLOR Diffuse; // Diffuse colour
- D3DXVECTOR2 TexUnit0; // Texture unit 0
- D3DXVECTOR2 TexUnit1; // Texture unit 1
-} GLD_3D_VERTEX;
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// DX8 Vertex Shader
-typedef struct {
- DWORD hShader; // If NULL, shader is invalid and cannot be used
- BOOL bHardware; // If TRUE then shader was created for hardware,
- // otherwise shader was created for software.
-} GLD_vertexShader;
-*/
-//---------------------------------------------------------------------------
-// Structs
-//---------------------------------------------------------------------------
-
-// This keeps a count of how many times we choose each individual internal
-// pathway. Useful for seeing if a certain pathway was ever used by an app, and
-// how much each pathway is biased.
-// Zero the members at context creation and dump stats at context deletion.
-typedef struct {
- // Note: DWORD is probably too small
- ULARGE_INTEGER qwMesa; // Mesa TnL pipeline
- ULARGE_INTEGER qwD3DFVF; // Direct3D Fixed-Function pipeline
-// ULARGE_INTEGER dwD3D2SVS; // Direct3D Two-Sided Vertex Shader pipeline
-} GLD_pipeline_usage;
-
-// GLDirect Primitive Buffer (points, lines, triangles and quads)
-typedef struct {
- // Data for IDirect3DDevice9::CreateVertexBuffer()
- DWORD dwStride; // Stride of vertex
- DWORD dwUsage; // Usage flags
- DWORD dwFVF; // Direct3D Flexible Vertex Format
- DWORD dwPool; // Pool flags
-
- IDirect3DVertexBuffer9 *pVB; // Holds points, lines, tris and quads.
-
- // Point list is assumed to be at start of buffer
- DWORD iFirstLine; // Index of start of line list
- DWORD iFirstTriangle; // Index of start of triangle list
-
- BYTE *pPoints; // Pointer to next free point
- BYTE *pLines; // Pointer to next free line
- BYTE *pTriangles; // Pointer to next free triangle
-
- DWORD nPoints; // Number of points ready to render
- DWORD nLines; // Number of lines ready to render
- DWORD nTriangles; // Number of triangles ready to render
-} GLD_pb_dx9;
-
-// GLDirect DX9 driver data
-typedef struct {
- // GLDirect vars
- BOOL bDoublebuffer; // Doublebuffer (otherwise single-buffered)
- BOOL bDepthStencil; // Depth buffer needed (stencil optional)
- D3DFORMAT RenderFormat; // Format of back/front buffer
- D3DFORMAT DepthFormat; // Format of depth/stencil
-// float fFlipWindowY; // Value for flipping viewport Y coord
-
- // Direct3D vars
- D3DCAPS9 d3dCaps9;
- BOOL bHasHWTnL; // Device has Hardware Transform/Light?
- IDirect3D9 *pD3D; // Base Direct3D9 interface
- IDirect3DDevice9 *pDev; // Direct3D9 Device interface
- GLD_pb_dx9 PB2d; // Vertices transformed by Mesa
- GLD_pb_dx9 PB3d; // Vertices transformed by Direct3D
- D3DPRIMITIVETYPE d3dpt; // Current Direct3D primitive type
- D3DXMATRIX matProjection; // Projection matrix for D3D TnL
- D3DXMATRIX matModelView; // Model/View matrix for D3D TnL
- int iSetupFunc; // Which setup functions to use
- BOOL bUseMesaTnL; // Whether to use Mesa or D3D for TnL
-
- // Direct3D vars for two-sided lighting
-// GLD_vertexShader VStwosidelight; // Vertex Shader for two-sided lighting
-// D3DXMATRIX matWorldViewProj;// World/View/Projection matrix for shaders
-
-
-// GLD_tnl_pipeline TnLPipeline; // Index of current internal pipeline
- GLD_pipeline_usage PipelineUsage;
-
- BOOL bCanScissor; // Scissor test - new for DX9
-} GLD_driver_dx9;
-
-#define GLD_GET_DX9_DRIVER(c) (GLD_driver_dx9*)(c)->glPriv
-
-//---------------------------------------------------------------------------
-// Function prototypes
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX9(LPCSTR a);
-void gldEnableExtensions_DX9(GLcontext *ctx);
-void gldInstallPipeline_DX9(GLcontext *ctx);
-void gldSetupDriverPointers_DX9(GLcontext *ctx);
-//void gldResizeBuffers_DX9(GLcontext *ctx);
-void gldResizeBuffers_DX9(GLframebuffer *fb);
-
-
-// Texture functions
-
-void gldCopyTexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX9(GLcontext *ctx);
-void gld_DrawPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX9(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX9(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX9(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX9(GLcontext *ctx);
-
-// 2D primitive functions
-
-void gld_Points2D_DX9(GLcontext *ctx, GLuint first, GLuint last);
-
-void gld_Line2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-
-void gld_Triangle2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-
-void gld_Quad2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// 3D primitive functions
-
-void gld_Points3D_DX9(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-// Primitive functions for Two-sided-lighting Vertex Shader
-
-void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-
-#endif
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h b/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h
deleted file mode 100644
index 1d6b7b1c760..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_dxerr9.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*==========================================================================;
- *
- *
- * File: dxerr9.h
- * Content: DirectX Error Library Include File
- *
- ****************************************************************************/
-
-#ifndef _GLD_DXERR9_H_
-#define _GLD_DXERR9_H_
-
-
-#include <d3d9.h>
-
-//
-// DXGetErrorString9
-//
-// Desc: Converts an DirectX HRESULT to a string
-//
-// Args: HRESULT hr Can be any error code from
-// DPLAY D3D8 D3DX8 DMUSIC DSOUND
-//
-// Return: Converted string
-//
-const char* __stdcall DXGetErrorString9A(HRESULT hr);
-const WCHAR* __stdcall DXGetErrorString9W(HRESULT hr);
-
-#ifdef UNICODE
- #define DXGetErrorString9 DXGetErrorString9W
-#else
- #define DXGetErrorString9 DXGetErrorString9A
-#endif
-
-
-//
-// DXTrace
-//
-// Desc: Outputs a formatted error message to the debug stream
-//
-// Args: CHAR* strFile The current file, typically passed in using the
-// __FILE__ macro.
-// DWORD dwLine The current line number, typically passed in using the
-// __LINE__ macro.
-// HRESULT hr An HRESULT that will be traced to the debug stream.
-// CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
-// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
-//
-// Return: The hr that was passed in.
-//
-//HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox = FALSE );
-//HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox = FALSE );
-HRESULT __stdcall DXTraceA( char* strFile, DWORD dwLine, HRESULT hr, char* strMsg, BOOL bPopMsgBox);
-HRESULT __stdcall DXTraceW( char* strFile, DWORD dwLine, HRESULT hr, WCHAR* strMsg, BOOL bPopMsgBox);
-
-#ifdef UNICODE
- #define DXTrace DXTraceW
-#else
- #define DXTrace DXTraceA
-#endif
-
-
-//
-// Helper macros
-//
-#if defined(DEBUG) | defined(_DEBUG)
- #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
- #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
- #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
-#else
- #define DXTRACE_MSG(str) (0L)
- #define DXTRACE_ERR(str,hr) (hr)
- #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
-#endif
-
-
-#endif
-
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c
deleted file mode 100644
index 745c987602b..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GL extensions
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "../gld_settings.h"
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-//#include "ddlog.h"
-//#include "gld_dx8.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "extensions.h"
-
-// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
-
-//---------------------------------------------------------------------------
-// Hack for the SGIS_multitexture extension that was removed from Mesa
-// NOTE: SGIS_multitexture enums also clash with GL_SGIX_async_pixel
-
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // To enable, uncomment:
- // _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
-//---------------------------------------------------------------------------
-
-enum {
- /* Quake2 GL_SGIS_multitexture */
- GL_SELECTED_TEXTURE_SGIS = 0x835B,
- GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835C,
- GL_MAX_TEXTURES_SGIS = 0x835D,
- GL_TEXTURE0_SGIS = 0x835E,
- GL_TEXTURE1_SGIS = 0x835F,
- GL_TEXTURE2_SGIS = 0x8360,
- GL_TEXTURE3_SGIS = 0x8361,
- GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363,
-};
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldSelectTextureSGIS(
- GLenum target)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glActiveTextureARB(ARB_target);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fSGIS(
- GLenum target,
- GLfloat s,
- GLfloat t)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fARB(ARB_target, s, t);
-}
-
-//---------------------------------------------------------------------------
-
-void APIENTRY gldMTexCoord2fvSGIS(
- GLenum target,
- const GLfloat *v)
-{
- GLenum ARB_target = GL_TEXTURE0_ARB + (target - GL_TEXTURE0_SGIS);
- glMultiTexCoord2fvARB(ARB_target, v);
-}
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
-
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-GLD_extension GLD_multitexList[] = {
-/*
- { (PROC)glMultiTexCoord1dSGIS, "glMTexCoord1dSGIS" },
- { (PROC)glMultiTexCoord1dvSGIS, "glMTexCoord1dvSGIS" },
- { (PROC)glMultiTexCoord1fSGIS, "glMTexCoord1fSGIS" },
- { (PROC)glMultiTexCoord1fvSGIS, "glMTexCoord1fvSGIS" },
- { (PROC)glMultiTexCoord1iSGIS, "glMTexCoord1iSGIS" },
- { (PROC)glMultiTexCoord1ivSGIS, "glMTexCoord1ivSGIS" },
- { (PROC)glMultiTexCoord1sSGIS, "glMTexCoord1sSGIS" },
- { (PROC)glMultiTexCoord1svSGIS, "glMTexCoord1svSGIS" },
- { (PROC)glMultiTexCoord2dSGIS, "glMTexCoord2dSGIS" },
- { (PROC)glMultiTexCoord2dvSGIS, "glMTexCoord2dvSGIS" },
- { (PROC)glMultiTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)glMultiTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
- { (PROC)glMultiTexCoord2iSGIS, "glMTexCoord2iSGIS" },
- { (PROC)glMultiTexCoord2ivSGIS, "glMTexCoord2ivSGIS" },
- { (PROC)glMultiTexCoord2sSGIS, "glMTexCoord2sSGIS" },
- { (PROC)glMultiTexCoord2svSGIS, "glMTexCoord2svSGIS" },
- { (PROC)glMultiTexCoord3dSGIS, "glMTexCoord3dSGIS" },
- { (PROC)glMultiTexCoord3dvSGIS, "glMTexCoord3dvSGIS" },
- { (PROC)glMultiTexCoord3fSGIS, "glMTexCoord3fSGIS" },
- { (PROC)glMultiTexCoord3fvSGIS, "glMTexCoord3fvSGIS" },
- { (PROC)glMultiTexCoord3iSGIS, "glMTexCoord3iSGIS" },
- { (PROC)glMultiTexCoord3ivSGIS, "glMTexCoord3ivSGIS" },
- { (PROC)glMultiTexCoord3sSGIS, "glMTexCoord3sSGIS" },
- { (PROC)glMultiTexCoord3svSGIS, "glMTexCoord3svSGIS" },
- { (PROC)glMultiTexCoord4dSGIS, "glMTexCoord4dSGIS" },
- { (PROC)glMultiTexCoord4dvSGIS, "glMTexCoord4dvSGIS" },
- { (PROC)glMultiTexCoord4fSGIS, "glMTexCoord4fSGIS" },
- { (PROC)glMultiTexCoord4fvSGIS, "glMTexCoord4fvSGIS" },
- { (PROC)glMultiTexCoord4iSGIS, "glMTexCoord4iSGIS" },
- { (PROC)glMultiTexCoord4ivSGIS, "glMTexCoord4ivSGIS" },
- { (PROC)glMultiTexCoord4sSGIS, "glMTexCoord4sSGIS" },
- { (PROC)glMultiTexCoord4svSGIS, "glMTexCoord4svSGIS" },
- { (PROC)glMultiTexCoordPointerSGIS, "glMTexCoordPointerSGIS" },
- { (PROC)glSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)glSelectTextureCoordSetSGIS, "glSelectTextureCoordSetSGIS" },
-*/
- { (PROC)glActiveTextureARB, "glActiveTextureARB" },
- { (PROC)glClientActiveTextureARB, "glClientActiveTextureARB" },
- { (PROC)glMultiTexCoord1dARB, "glMultiTexCoord1dARB" },
- { (PROC)glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB" },
- { (PROC)glMultiTexCoord1fARB, "glMultiTexCoord1fARB" },
- { (PROC)glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB" },
- { (PROC)glMultiTexCoord1iARB, "glMultiTexCoord1iARB" },
- { (PROC)glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB" },
- { (PROC)glMultiTexCoord1sARB, "glMultiTexCoord1sARB" },
- { (PROC)glMultiTexCoord1svARB, "glMultiTexCoord1svARB" },
- { (PROC)glMultiTexCoord2dARB, "glMultiTexCoord2dARB" },
- { (PROC)glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB" },
- { (PROC)glMultiTexCoord2fARB, "glMultiTexCoord2fARB" },
- { (PROC)glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB" },
- { (PROC)glMultiTexCoord2iARB, "glMultiTexCoord2iARB" },
- { (PROC)glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB" },
- { (PROC)glMultiTexCoord2sARB, "glMultiTexCoord2sARB" },
- { (PROC)glMultiTexCoord2svARB, "glMultiTexCoord2svARB" },
- { (PROC)glMultiTexCoord3dARB, "glMultiTexCoord3dARB" },
- { (PROC)glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB" },
- { (PROC)glMultiTexCoord3fARB, "glMultiTexCoord3fARB" },
- { (PROC)glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB" },
- { (PROC)glMultiTexCoord3iARB, "glMultiTexCoord3iARB" },
- { (PROC)glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB" },
- { (PROC)glMultiTexCoord3sARB, "glMultiTexCoord3sARB" },
- { (PROC)glMultiTexCoord3svARB, "glMultiTexCoord3svARB" },
- { (PROC)glMultiTexCoord4dARB, "glMultiTexCoord4dARB" },
- { (PROC)glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB" },
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4fARB" },
- { (PROC)glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB" },
- { (PROC)glMultiTexCoord4iARB, "glMultiTexCoord4iARB" },
- { (PROC)glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB" },
- { (PROC)glMultiTexCoord4sARB, "glMultiTexCoord4sARB" },
- { (PROC)glMultiTexCoord4svARB, "glMultiTexCoord4svARB" },
-
- // Descent3 doesn't use correct string, hence this hack
- { (PROC)glMultiTexCoord4fARB, "glMultiTexCoord4f" },
-
- // Quake2 SGIS multitexture
- { (PROC)gldSelectTextureSGIS, "glSelectTextureSGIS" },
- { (PROC)gldMTexCoord2fSGIS, "glMTexCoord2fSGIS" },
- { (PROC)gldMTexCoord2fvSGIS, "glMTexCoord2fvSGIS" },
-
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_DX(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- if (glb.bMultitexture) {
- for (i=0; GLD_multitexList[i].proc; i++) {
- if (!strcmp(a, GLD_multitexList[i].name)) {
- proc = GLD_multitexList[i].proc;
- break;
- }
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-void gldEnableExtensions_DX9(
- GLcontext *ctx)
-{
- GLuint i;
-
- // Mesa enables some extensions by default.
- // This table decides which ones we want to switch off again.
-
- // NOTE: GL_EXT_compiled_vertex_array appears broken.
-
- const char *gld_disable_extensions[] = {
-// "GL_ARB_transpose_matrix",
-// "GL_EXT_compiled_vertex_array",
-// "GL_EXT_polygon_offset",
-// "GL_EXT_rescale_normal",
- "GL_EXT_texture3D",
-// "GL_NV_texgen_reflection",
- NULL
- };
-
- const char *gld_multitex_extensions[] = {
- "GL_ARB_multitexture", // Quake 3
- NULL
- };
-
- // Quake 2 engines
- const char *szGL_SGIS_multitexture = "GL_SGIS_multitexture";
-
- const char *gld_enable_extensions[] = {
- "GL_EXT_texture_env_add", // Quake 3
- "GL_ARB_texture_env_add", // Quake 3
- NULL
- };
-
- for (i=0; gld_disable_extensions[i]; i++) {
- _mesa_disable_extension(ctx, gld_disable_extensions[i]);
- }
-
- for (i=0; gld_enable_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_enable_extensions[i]);
- }
-
- if (glb.bMultitexture) {
- for (i=0; gld_multitex_extensions[i]; i++) {
- _mesa_enable_extension(ctx, gld_multitex_extensions[i]);
- }
-
- // GL_SGIS_multitexture
- // NOTE: Quake2 ran *slower* with this enabled, so I've
- // disabled it for now.
- // Fair bit slower on GeForce256,
- // Much slower on 3dfx Voodoo5 5500.
-// _mesa_add_extension(ctx, GL_TRUE, szGL_SGIS_multitexture, 0);
-
- }
-
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
- _mesa_enable_1_4_extensions(ctx);
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c
deleted file mode 100644
index 2b272aa6281..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_pipeline_dx9.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa transformation pipeline with GLDirect fastpath
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-extern struct tnl_pipeline_stage _gld_d3d_render_stage;
-extern struct tnl_pipeline_stage _gld_mesa_render_stage;
-
-static const struct tnl_pipeline_stage *gld_pipeline[] = {
- &_gld_d3d_render_stage, // Direct3D TnL
- &_tnl_vertex_transform_stage,
- &_tnl_normal_transform_stage,
- &_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage. ??? */
- &_tnl_texgen_stage,
- &_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
- &_gld_mesa_render_stage, // Mesa TnL, D3D rendering
- 0,
-};
-
-//---------------------------------------------------------------------------
-
-void gldInstallPipeline_DX9(
- GLcontext *ctx)
-{
- // Remove any existing pipeline stages,
- // then install GLDirect pipeline stages.
-
- _tnl_destroy_pipeline(ctx);
- _tnl_install_pipeline(ctx, gld_pipeline);
-}
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
deleted file mode 100644
index 65fd821276e..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
+++ /dev/null
@@ -1,1446 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Primitive (points/lines/tris/quads) rendering
-*
-****************************************************************************/
-
-//#include "../GLDirect.h"
-
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include "glheader.h"
-#include "context.h"
-#include "colormac.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "array_cache/acache.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast_setup/ss_context.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-// Disable compiler complaints about unreferenced local variables
-#pragma warning (disable:4101)
-
-//---------------------------------------------------------------------------
-// Helper defines for primitives
-//---------------------------------------------------------------------------
-
-//static const float ooZ = 1.0f / 65536.0f; // One over Z
-
-#define GLD_COLOUR (D3DCOLOR_RGBA(swv->color[0], swv->color[1], swv->color[2], swv->color[3]))
-#define GLD_SPECULAR (D3DCOLOR_RGBA(swv->specular[0], swv->specular[1], swv->specular[2], swv->specular[3]))
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-//---------------------------------------------------------------------------
-// 2D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_2D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pPoints; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pLines; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour
-
-#define GLD_SETUP_2D_VARS_TRIANGLES \
- BOOL bFog = ctx->Fog.Enabled; \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_2D_VERTEX *pV = (GLD_2D_VERTEX*)gld->PB2d.pTriangles; \
- SScontext *ss = SWSETUP_CONTEXT(ctx); \
- SWvertex *swv; \
- DWORD dwSpecularColour; \
- DWORD dwFlatColour; \
- GLuint facing = 0; \
- struct vertex_buffer *VB; \
- GLchan (*vbcolor)[4]; \
- GLchan (*vbspec)[4]
-
-#define GLD_SETUP_GET_SWVERT(s) \
- swv = &ss->verts[##s]
-
-#define GLD_SETUP_2D_VERTEX \
- pV->x = swv->win[0]; \
- pV->y = GLD_FLIP_Y(swv->win[1]); \
- pV->rhw = swv->win[3]
-
-#define GLD_SETUP_SMOOTH_COLOUR \
- pV->diffuse = GLD_COLOUR
-
-#define GLD_SETUP_GET_FLAT_COLOUR \
- dwFlatColour = GLD_COLOUR
-#define GLD_SETUP_GET_FLAT_FOG_COLOUR \
- dwFlatColour = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_USE_FLAT_COLOUR \
- pV->diffuse = dwFlatColour
-
-#define GLD_SETUP_GET_FLAT_SPECULAR \
- dwSpecularColour= GLD_SPECULAR
-
-#define GLD_SETUP_USE_FLAT_SPECULAR \
- pV->specular = dwSpecularColour
-
-#define GLD_SETUP_DEPTH \
- pV->sz = swv->win[2] / ctx->DepthMaxF
-// pV->z = swv->win[2] * ooZ;
-
-#define GLD_SETUP_SPECULAR \
- pV->specular = GLD_SPECULAR
-
-#define GLD_SETUP_FOG \
- pV->diffuse = _gldComputeFog(ctx, swv)
-
-#define GLD_SETUP_TEX0 \
- pV->t0_u = swv->texcoord[0][0]; \
- pV->t0_v = swv->texcoord[0][1]
-
-#define GLD_SETUP_TEX1 \
- pV->t1_u = swv->texcoord[1][0]; \
- pV->t1_v = swv->texcoord[1][1]
-
-#define GLD_SETUP_LIGHTING(v) \
- if (facing == 1) { \
- pV->diffuse = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- pV->specular = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- } else { \
- if (bFog) \
- GLD_SETUP_FOG; \
- else \
- GLD_SETUP_SMOOTH_COLOUR; \
- GLD_SETUP_SPECULAR; \
- }
-
-#define GLD_SETUP_GET_FLAT_LIGHTING(v) \
- if (facing == 1) { \
- dwFlatColour = D3DCOLOR_RGBA(vbcolor[##v][0], vbcolor[##v][1], vbcolor[##v][2], vbcolor[##v][3]); \
- if (vbspec) { \
- dwSpecularColour = D3DCOLOR_RGBA(vbspec[##v][0], vbspec[##v][1], vbspec[##v][2], vbspec[##v][3]); \
- } \
- }
-
-#define GLD_SETUP_TWOSIDED_LIGHTING \
- /* Two-sided lighting */ \
- if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) { \
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; \
- SWvertex *v[3]; \
- GLfloat ex,ey,fx,fy,cc; \
- /* Get vars for later */ \
- VB = &TNL_CONTEXT(ctx)->vb; \
- vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \
- if (VB->SecondaryColorPtr[1]) { \
- vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \
- } else { \
- vbspec = NULL; \
- } \
- v[0] = &verts[v0]; \
- v[1] = &verts[v1]; \
- v[2] = &verts[v2]; \
- ex = v[0]->win[0] - v[2]->win[0]; \
- ey = v[0]->win[1] - v[2]->win[1]; \
- fx = v[1]->win[0] - v[2]->win[0]; \
- fy = v[1]->win[1] - v[2]->win[1]; \
- cc = ex*fy - ey*fx; \
- facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; \
- }
-
-//---------------------------------------------------------------------------
-// 3D vertex setup
-//---------------------------------------------------------------------------
-
-#define GLD_SETUP_3D_VARS_POINTS \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pPoints; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_LINES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pLines; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VARS_TRIANGLES \
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); \
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx); \
- GLD_3D_VERTEX *pV = (GLD_3D_VERTEX*)gld->PB3d.pTriangles; \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- GLfloat (*p4f)[4]; \
- GLfloat (*tc)[4]; \
- DWORD dwColor;
-
-#define GLD_SETUP_3D_VERTEX(v) \
- p4f = VB->ObjPtr->data; \
- pV->Position.x = p4f[##v][0]; \
- pV->Position.y = p4f[##v][1]; \
- pV->Position.z = p4f[##v][2];
-
-#define GLD_SETUP_SMOOTH_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-
-#define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \
- p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \
- dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]);
-
-#define GLD_SETUP_USE_FLAT_COLOUR_3D \
- pV->Diffuse = dwColor;
-
-#define GLD_SETUP_TEX0_3D(v) \
- if (VB->TexCoordPtr[0]) { \
- tc = VB->TexCoordPtr[0]->data; \
- pV->TexUnit0.x = tc[##v][0]; \
- pV->TexUnit0.y = tc[##v][1]; \
- }
-
-#define GLD_SETUP_TEX1_3D(v) \
- if (VB->TexCoordPtr[1]) { \
- tc = VB->TexCoordPtr[1]->data; \
- pV->TexUnit1.x = tc[##v][0]; \
- pV->TexUnit1.y = tc[##v][1]; \
- }
-
-//---------------------------------------------------------------------------
-// Helper functions
-//---------------------------------------------------------------------------
-
-__inline DWORD _gldComputeFog(
- GLcontext *ctx,
- SWvertex *swv)
-{
- // Full fog calculation.
- // Based on Mesa code.
-
- GLchan rFog, gFog, bFog;
- GLchan fR, fG, fB;
- const GLfloat f = swv->fog;
- const GLfloat g = 1.0 - f;
-
- UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
- UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
- fR = f * swv->color[0] + g * rFog;
- fG = f * swv->color[1] + g * gFog;
- fB = f * swv->color[2] + g * bFog;
- return D3DCOLOR_RGBA(fR, fG, fB, swv->color[3]);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ResetLineStipple_DX9(
- GLcontext *ctx)
-{
- // TODO: Fake stipple with a 32x32 texture.
-}
-
-//---------------------------------------------------------------------------
-// 2D (post-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points2D_DX9(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_2D_VARS_POINTS;
-
- unsigned i;
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
- GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- } else {
- GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, swv++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- }
- }
- }
-
- gld->PB2d.pPoints = (BYTE*)pV;
- gld->PB2d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_2D_VARS_LINES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_SPECULAR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pLines = (BYTE*)pV;
- gld->PB2d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
-
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v2);
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v2);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_SMOOTH_COLOUR;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v3);
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- if (bFog)
- GLD_SETUP_GET_FLAT_FOG_COLOUR;
- else
- GLD_SETUP_GET_FLAT_COLOUR;
- GLD_SETUP_GET_FLAT_SPECULAR;
- GLD_SETUP_GET_FLAT_LIGHTING(v3);
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_USE_FLAT_COLOUR;
- GLD_SETUP_USE_FLAT_SPECULAR;
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothExtras_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_2D_VARS_TRIANGLES;
-
- GLD_SETUP_TWOSIDED_LIGHTING(v0);
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v1);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v1);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v2);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v2);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v3);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v3);
- pV++;
-
- GLD_SETUP_GET_SWVERT(v0);
- GLD_SETUP_2D_VERTEX;
- GLD_SETUP_DEPTH;
- GLD_SETUP_TEX0;
- GLD_SETUP_TEX1;
- GLD_SETUP_LIGHTING(v0);
- pV++;
-
- gld->PB2d.pTriangles = (BYTE*)pV;
- gld->PB2d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// 3D (pre-transformed) primitives
-//---------------------------------------------------------------------------
-
-void gld_Points3D_DX9(
- GLcontext *ctx,
- GLuint first,
- GLuint last)
-{
- GLD_SETUP_3D_VARS_POINTS
-
- unsigned i;
-// struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-
- // _Size is already clamped to MaxPointSize and MinPointSize
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_POINTSIZE, *((DWORD*)&ctx->Point._Size));
-
- if (VB->Elts) {
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[VB->Elts[i]] == 0) {
-// _swrast_Point( ctx, &verts[VB->Elts[i]] );
-// GLD_SETUP_GET_SWVERT(VB->Elts[i]);
- GLD_SETUP_3D_VERTEX(VB->Elts[i])
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- } else {
-// GLD_SETUP_GET_SWVERT(first);
- for (i=first; i<last; i++, pV++) {
- if (VB->ClipMask[i] == 0) {
-// _swrast_Point( ctx, &verts[i] );
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
- }
- }
-/*
- for (i=first; i<last; i++, pV++) {
- GLD_SETUP_3D_VERTEX(i)
- GLD_SETUP_SMOOTH_COLOUR_3D(i)
- GLD_SETUP_TEX0_3D(i)
- GLD_SETUP_TEX1_3D(i)
- }
-*/
- gld->PB3d.pPoints = (BYTE*)pV;
- gld->PB3d.nPoints += (last-first);
-}
-
-//---------------------------------------------------------------------------
-// Line functions
-//---------------------------------------------------------------------------
-
-void gld_Line3DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line3DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1)
-{
- GLD_SETUP_3D_VARS_LINES
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pLines = (BYTE*)pV;
- gld->PB3d.nLines++;
-}
-
-//---------------------------------------------------------------------------
-// Triangle functions
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle3DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-// Quad functions
-//---------------------------------------------------------------------------
-
-void gld_Quad3DFlat_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_GET_FLAT_COLOUR_3D(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_USE_FLAT_COLOUR_3D
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad3DSmooth_DX9(
- GLcontext *ctx,
- GLuint v0,
- GLuint v1,
- GLuint v2,
- GLuint v3)
-{
- GLD_SETUP_3D_VARS_TRIANGLES
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v1)
- GLD_SETUP_SMOOTH_COLOUR_3D(v1)
- GLD_SETUP_TEX0_3D(v1)
- GLD_SETUP_TEX1_3D(v1)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v2)
- GLD_SETUP_SMOOTH_COLOUR_3D(v2)
- GLD_SETUP_TEX0_3D(v2)
- GLD_SETUP_TEX1_3D(v2)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v3)
- GLD_SETUP_SMOOTH_COLOUR_3D(v3)
- GLD_SETUP_TEX0_3D(v3)
- GLD_SETUP_TEX1_3D(v3)
- pV++;
-
- GLD_SETUP_3D_VERTEX(v0)
- GLD_SETUP_SMOOTH_COLOUR_3D(v0)
- GLD_SETUP_TEX0_3D(v0)
- GLD_SETUP_TEX1_3D(v0)
- pV++;
-
- gld->PB3d.pTriangles = (BYTE*)pV;
- gld->PB3d.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-// Vertex setup for two-sided-lighting vertex shader
-//---------------------------------------------------------------------------
-
-/*
-
-void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last)
-{
- // NOTE: Two-sided lighting does not apply to Points
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1)
-{
- // NOTE: Two-sided lighting does not apply to Lines
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles++;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- GLD_TWOSIDED_VERTEX *pV = (GLD_TWOSIDED_VERTEX*)gld->PBtwosidelight.pTriangles;
- SScontext *ss = SWSETUP_CONTEXT(ctx);
- SWvertex *swv;
- DWORD dwSpecularColour;
- DWORD dwFlatColour;
- GLuint facing = 0;
- struct vertex_buffer *VB;
- GLchan (*vbcolor)[4];
- GLchan (*vbspec)[4];
-
- // Reciprocal of DepthMax
- const float ooDepthMax = 1.0f / ctx->DepthMaxF;
-
- // 1st vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 2nd vert
- swv = &ss->verts[v1];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 3rd vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 4th vert
- swv = &ss->verts[v2];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 5th vert
- swv = &ss->verts[v3];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- // 6th vert
- swv = &ss->verts[v0];
- pV->Position.x = swv->win[0];
- pV->Position.y = GLD_FLIP_Y(swv->win[1]);
- pV->Position.z = swv->win[2] * ooDepthMax;
- pV->Position.w = swv->win[3];
- pV->TexUnit0.x = swv->texcoord[0][0];
- pV->TexUnit0.y = swv->texcoord[0][1];
- pV->TexUnit1.x = swv->texcoord[1][0];
- pV->TexUnit1.y = swv->texcoord[1][1];
- pV->FrontDiffuse = GLD_COLOUR;
- pV->FrontSpecular = GLD_SPECULAR;
- pV++;
-
- gld->PBtwosidelight.pTriangles = (BYTE*)pV;
- gld->PBtwosidelight.nTriangles += 2;
-}
-
-//---------------------------------------------------------------------------
-
-*/
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c
deleted file mode 100644
index 5a822356164..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_texture_dx9.c
+++ /dev/null
@@ -1,2104 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Texture / Bitmap functions
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-#include <d3dx9tex.h>
-
-#include "texformat.h"
-#include "colormac.h"
-#include "texstore.h"
-#include "image.h"
-// #include "mem.h"
-
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_HEIGHT(y,h) (gldCtx->dwHeight - (y) - (h))
-
-//---------------------------------------------------------------------------
-// 1D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + (i) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (i) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (i))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (i))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_1d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 2D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + ((t)->Width * (j) + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_2d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// 3D texture fetch
-//---------------------------------------------------------------------------
-
-#define CHAN_SRC( t, i, j, k, sz ) \
- (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz)
-#define UBYTE_SRC( t, i, j, k, sz ) \
- ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)) * (sz))
-#define USHORT_SRC( t, i, j, k ) \
- ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-#define FLOAT_SRC( t, i, j, k ) \
- ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \
- (t)->Width + (i)))
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- GLchan *rgba = (GLchan *)texel;
- rgba[RCOMP] = src[2];
- rgba[GCOMP] = src[1];
- rgba[BCOMP] = src[0];
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X8R8G8B8(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLchan *src = CHAN_SRC( texImage, i, j, k, 4 );
- texel[RCOMP] = CHAN_TO_FLOAT(src[0]);
- texel[GCOMP] = CHAN_TO_FLOAT(src[1]);
- texel[BCOMP] = CHAN_TO_FLOAT(src[2]);
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf8) * 255 / 0xf8 );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X1R5G5B5(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 10) & 0xf8) * 255 / 0xf8 );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 5) & 0xf8) * 255 / 0xf8 );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf8) * 255 / 0xf8 );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLchan *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLchan *rgba = (GLchan *) texel; GLushort s = *src;
- rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf );
- rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf );
- rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf );
- rgba[ACOMP] = CHAN_MAX;
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_fetch_3d_texel_f_X4R4G4B4(
- const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- const GLushort *src = USHORT_SRC( texImage, i, j, k );
- GLushort s = *src;
- texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf) * 255 / 0xf );
- texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 4) & 0xf) * 255 / 0xf );
- texel[BCOMP] = UBYTE_TO_FLOAT( ((s ) & 0xf) * 255 / 0xf );
- texel[ACOMP] = 1.f;
-}
-
-//---------------------------------------------------------------------------
-
-#undef CHAN_SRC
-#undef UBYTE_SRC
-#undef USHORT_SRC
-#undef FLOAT_SRC
-
-//---------------------------------------------------------------------------
-// Direct3D texture formats that have no Mesa equivalent
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format _gld_texformat_X8R8G8B8 = {
- MESA_FORMAT_ARGB8888, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 8, /* RedBits */
- 8, /* GreenBits */
- 8, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 4, /* TexelBytes */
- _mesa_texstore_argb8888, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X8R8G8B8, /* FetchTexel1D */
- gld_fetch_2d_texel_X8R8G8B8, /* FetchTexel2D */
- gld_fetch_3d_texel_X8R8G8B8, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X8R8G8B8, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X8R8G8B8, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X8R8G8B8, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X1R5G5B5 = {
- MESA_FORMAT_ARGB1555, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 5, /* RedBits */
- 5, /* GreenBits */
- 5, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb1555, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X1R5G5B5, /* FetchTexel1D */
- gld_fetch_2d_texel_X1R5G5B5, /* FetchTexel2D */
- gld_fetch_3d_texel_X1R5G5B5, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X1R5G5B5, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X1R5G5B5, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X1R5G5B5, /* FetchTexel3Df */
-};
-
-const struct gl_texture_format _gld_texformat_X4R4G4B4 = {
- MESA_FORMAT_ARGB4444, /* MesaFormat */
- GL_RGBA, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
- 4, /* RedBits */
- 4, /* GreenBits */
- 4, /* BlueBits */
- 0, /* AlphaBits */
- 0, /* LuminanceBits */
- 0, /* IntensityBits */
- 0, /* IndexBits */
- 0, /* DepthBits */
- 2, /* TexelBytes */
- _mesa_texstore_argb4444, /* StoreTexImageFunc */
- gld_fetch_1d_texel_X4R4G4B4, /* FetchTexel1D */
- gld_fetch_2d_texel_X4R4G4B4, /* FetchTexel2D */
- gld_fetch_3d_texel_X4R4G4B4, /* FetchTexel3D */
- gld_fetch_1d_texel_f_X4R4G4B4, /* FetchTexel1Df */
- gld_fetch_2d_texel_f_X4R4G4B4, /* FetchTexel2Df */
- gld_fetch_3d_texel_f_X4R4G4B4, /* FetchTexel3Df */
-};
-
-//---------------------------------------------------------------------------
-// Texture unit constants
-//---------------------------------------------------------------------------
-
-// List of possible combinations of texture environments.
-// Example: GLD_TEXENV_MODULATE_RGBA means
-// GL_MODULATE, GL_RGBA base internal format.
-#define GLD_TEXENV_DECAL_RGB 0
-#define GLD_TEXENV_DECAL_RGBA 1
-#define GLD_TEXENV_DECAL_ALPHA 2
-#define GLD_TEXENV_REPLACE_RGB 3
-#define GLD_TEXENV_REPLACE_RGBA 4
-#define GLD_TEXENV_REPLACE_ALPHA 5
-#define GLD_TEXENV_MODULATE_RGB 6
-#define GLD_TEXENV_MODULATE_RGBA 7
-#define GLD_TEXENV_MODULATE_ALPHA 8
-#define GLD_TEXENV_BLEND_RGB 9
-#define GLD_TEXENV_BLEND_RGBA 10
-#define GLD_TEXENV_BLEND_ALPHA 11
-#define GLD_TEXENV_ADD_RGB 12
-#define GLD_TEXENV_ADD_RGBA 13
-#define GLD_TEXENV_ADD_ALPHA 14
-
-// Per-stage (i.e. per-unit) texture environment
-typedef struct {
- DWORD ColorArg1; // Colour argument 1
- D3DTEXTUREOP ColorOp; // Colour operation
- DWORD ColorArg2; // Colour argument 2
- DWORD AlphaArg1; // Alpha argument 1
- D3DTEXTUREOP AlphaOp; // Alpha operation
- DWORD AlphaArg2; // Alpha argument 2
-} GLD_texenv;
-
-// TODO: Do we really need to set ARG1 and ARG2 every time?
-// They seem to always be TEXTURE and CURRENT respectively.
-
-// C = Colour out
-// A = Alpha out
-// Ct = Colour from Texture
-// Cf = Colour from fragment (diffuse)
-// At = Alpha from Texture
-// Af = Alpha from fragment (diffuse)
-// Cc = GL_TEXTURE_ENV_COLOUR (GL_BLEND)
-const GLD_texenv gldTexEnv[] = {
- // DECAL_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_RGBA: C=Cf(1-At)+CtAt, A=Af
- {D3DTA_TEXTURE, D3DTOP_BLENDTEXTUREALPHA, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // DECAL_ALPHA: <undefined> use DECAL_RGB
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
-
- // REPLACE_RGB: C=Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // REPLACE_RGBA: C=Ct, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
- // REPLACE_ALPHA: C=Cf, A=At
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG1, D3DTA_CURRENT},
-
- // MODULATE_RGB: C=CfCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // MODULATE_RGBA: C=CfCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // MODULATE_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // BLEND_RGB: C=Cf(1-Ct)+CcCt, A=Af
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // BLEND_RGBA: C=Cf(1-Ct)+CcCt, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_LERP, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // BLEND_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-
- // ADD_RGB: C=Cf+Ct, A=Af
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT},
- // ADD_RGBA: C=Cf+Ct, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_ADD, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
- // ADD_ALPHA: C=Cf, A=AfAt
- {D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_CURRENT,
- D3DTA_TEXTURE, D3DTOP_MODULATE, D3DTA_CURRENT},
-};
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREADDRESS _gldConvertWrap(
- GLenum wrap)
-{
- return (wrap == GL_CLAMP) ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP;
-}
-
-//---------------------------------------------------------------------------
-
-D3DTEXTUREFILTERTYPE _gldConvertMagFilter(
- GLenum magfilter)
-{
- return (magfilter == GL_LINEAR) ? D3DTEXF_LINEAR : D3DTEXF_POINT;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldConvertMinFilter(
- GLenum minfilter,
- D3DTEXTUREFILTERTYPE *min_filter,
- D3DTEXTUREFILTERTYPE *mip_filter)
-{
- switch (minfilter) {
- case GL_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_NONE;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_POINT;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- *min_filter = D3DTEXF_LINEAR;
- *mip_filter = D3DTEXF_LINEAR;
- break;
- }
-}
-
-//---------------------------------------------------------------------------
-
-D3DFORMAT _gldGLFormatToD3DFormat(
- GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- // LUNIMANCE != INTENSITY, but D3D doesn't have I8 textures
- return D3DFMT_L8;
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return D3DFMT_L8;
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return D3DFMT_A8;
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return D3DFMT_X8R8G8B8;
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return D3DFMT_A8L8;
- case GL_R3_G3_B2:
- // TODO: Mesa does not support RGB332 internally
- return D3DFMT_X4R4G4B4; //D3DFMT_R3G3B2;
- case GL_RGB4:
- return D3DFMT_X4R4G4B4;
- case GL_RGB5:
- return D3DFMT_X1R5G5B5;
- case 3:
- case GL_RGB:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return D3DFMT_R8G8B8;
- case GL_RGBA4:
- return D3DFMT_A4R4G4B4;
- case 4:
- case GL_RGBA:
- case GL_RGBA2:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return D3DFMT_A8R8G8B8;
- case GL_RGB5_A1:
- return D3DFMT_A1R5G5B5;
- }
-
- // Return an acceptable default
- return D3DFMT_A8R8G8B8;
-}
-
-//---------------------------------------------------------------------------
-
-GLenum _gldDecodeBaseFormat(
- IDirect3DTexture9 *pTex)
-{
- // Examine Direct3D texture and return base OpenGL internal texture format
- // NOTE: We can't use any base format info from Mesa because D3D might have
- // used a different texture format when we used D3DXCreateTexture().
-
- // Base internal format is one of (Red Book p355):
- // GL_ALPHA,
- // GL_LUMINANCE,
- // GL_LUMINANCE_ALPHA,
- // GL_INTENSITY,
- // GL_RGB,
- // GL_RGBA
-
- // NOTE: INTENSITY not used (not supported by Direct3D)
- // LUMINANCE has same texture functions as RGB
- // LUMINANCE_ALPHA has same texture functions as RGBA
-
- // TODO: cache format instead of using GetLevelDesc()
- D3DSURFACE_DESC desc;
- _GLD_DX9_TEX(GetLevelDesc(pTex, 0, &desc));
-
- switch (desc.Format) {
- case D3DFMT_R8G8B8:
- case D3DFMT_X8R8G8B8:
- case D3DFMT_R5G6B5:
- case D3DFMT_X1R5G5B5:
- case D3DFMT_R3G3B2:
- case D3DFMT_X4R4G4B4:
- case D3DFMT_P8:
- case D3DFMT_L8:
- return GL_RGB;
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A1R5G5B5:
- case D3DFMT_A4R4G4B4:
- case D3DFMT_A8R3G3B2:
- case D3DFMT_A8P8:
- case D3DFMT_A8L8:
- case D3DFMT_A4L4:
- return GL_RGBA;
- case D3DFMT_A8:
- return GL_ALPHA;
- // Compressed texture formats. Need to check these...
- case D3DFMT_DXT1:
- return GL_RGBA;
- case D3DFMT_DXT2:
- return GL_RGB;
- case D3DFMT_DXT3:
- return GL_RGBA;
- case D3DFMT_DXT4:
- return GL_RGB;
- case D3DFMT_DXT5:
- return GL_RGBA;
- }
-
- // Fell through. Return arbitary default.
- return GL_RGBA;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* _gldMesaFormatForD3DFormat(
- D3DFORMAT d3dfmt)
-{
- switch (d3dfmt) {
- case D3DFMT_A8R8G8B8:
- return &_mesa_texformat_argb8888;
- case D3DFMT_R8G8B8:
- return &_mesa_texformat_rgb888;
- case D3DFMT_R5G6B5:
- return &_mesa_texformat_rgb565;
- case D3DFMT_A4R4G4B4:
- return &_mesa_texformat_argb4444;
- case D3DFMT_A1R5G5B5:
- return &_mesa_texformat_argb1555;
- case D3DFMT_A8L8:
- return &_mesa_texformat_al88;
- case D3DFMT_R3G3B2:
- return &_mesa_texformat_rgb332;
- case D3DFMT_A8:
- return &_mesa_texformat_a8;
- case D3DFMT_L8:
- return &_mesa_texformat_l8;
- case D3DFMT_X8R8G8B8:
- return &_gld_texformat_X8R8G8B8;
- case D3DFMT_X1R5G5B5:
- return &_gld_texformat_X1R5G5B5;
- case D3DFMT_X4R4G4B4:
- return &_gld_texformat_X4R4G4B4;
- }
-
- // If we reach here then we've made an error somewhere else
- // by allowing a format that is not supported.
- assert(0);
-
- return NULL; // Shut up compiler warning
-}
-
-//---------------------------------------------------------------------------
-// Copy* functions
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage1D_DX9(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y,
- GLsizei width, GLint border )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLenum internalFormat,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- GLint border)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage1D_DX9(
- GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width )
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height)
-{
- // TODO
-}
-
-//---------------------------------------------------------------------------
-
-void gldCopyTexSubImage3D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint xoffset,
- GLint yoffset,
- GLint zoffset,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height )
-{
- // TODO ?
-}
-
-//---------------------------------------------------------------------------
-// Bitmap/Pixel functions
-//---------------------------------------------------------------------------
-
-#define GLD_FLIP_Y(y) (gldCtx->dwHeight - (y))
-
-#define _GLD_FVF_IMAGE (D3DFVF_XYZRHW | D3DFVF_TEX1)
-
-typedef struct {
- FLOAT x, y; // 2D raster coords
- FLOAT z; // depth value
- FLOAT rhw; // reciprocal homogenous W (always 1.0f)
- FLOAT tu, tv; // texture coords
-} _GLD_IMAGE_VERTEX;
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldDrawPixels(
- GLcontext *ctx,
- BOOL bChromakey, // Alpha test for glBitmap() images
- GLint x, // GL x position
- GLint y, // GL y position (needs flipping)
- GLsizei width, // Width of input image
- GLsizei height, // Height of input image
- IDirect3DSurface9 *pImage)
-{
- //
- // Draw input image as texture implementing PixelZoom and clipping.
- // Any fragment operations currently enabled will be used.
- //
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTexture;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface9 *pSurface;
- _GLD_IMAGE_VERTEX v[4];
- HRESULT hr;
-
- float ZoomWidth, ZoomHeight;
- float ScaleWidth, ScaleHeight;
-
- // Create a texture to hold image
- hr = D3DXCreateTexture(
- gld->pDev,
- width, height,
- 1, // miplevels
- 0, // usage
- D3DFMT_A8R8G8B8, // format
- D3DPOOL_MANAGED, // pool
- &pTexture);
- if (FAILED(hr))
- return hr;
-
- hr = IDirect3DTexture9_GetSurfaceLevel(pTexture, 0, &pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture9_Release(pTexture);
- return hr;
- }
-
- // Copy image into texture
- hr = D3DXLoadSurfaceFromSurface(
- pSurface, NULL, NULL, // Dest surface
- pImage, NULL, NULL, // Src surface
- D3DX_FILTER_NONE,
- 0);
- IDirect3DSurface9_Release(pSurface);
- if (FAILED(hr)) {
- IDirect3DTexture9_Release(pTexture);
- return hr;
- }
-
- //
- // Set up the quad like this (ascii-art ahead!)
- //
- // 3--2
- // | |
- // 0--1
- //
- //
-
- // Set depth
- v[0].z = v[1].z = v[2].z = v[3].z = ctx->Current.RasterPos[2];
- // Set Reciprocal Homogenous W
- v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw = 1.0f;
-
- // Set texcoords
- // Examine texture size - if different to input width and height
- // then we'll need to munge the texcoords to fit.
- IDirect3DTexture9_GetLevelDesc(pTexture, 0, &d3dsd);
- ScaleWidth = (float)width / (float)d3dsd.Width;
- ScaleHeight = (float)height / (float)d3dsd.Height;
- v[0].tu = 0.0f; v[0].tv = 0.0f;
- v[1].tu = ScaleWidth; v[1].tv = 0.0f;
- v[2].tu = ScaleWidth; v[2].tv = ScaleHeight;
- v[3].tu = 0.0f; v[3].tv = ScaleHeight;
-
- // Set raster positions
- ZoomWidth = (float)width * ctx->Pixel.ZoomX;
- ZoomHeight = (float)height * ctx->Pixel.ZoomY;
-
- v[0].x = x; v[0].y = GLD_FLIP_Y(y);
- v[1].x = x+ZoomWidth; v[1].y = GLD_FLIP_Y(y);
- v[2].x = x+ZoomWidth; v[2].y = GLD_FLIP_Y(y+ZoomHeight);
- v[3].x = x; v[3].y = GLD_FLIP_Y(y+ZoomHeight);
-
- // Draw image with full HW acceleration
- // NOTE: Be nice to use a State Block for all this state...
- IDirect3DDevice9_SetTexture(gld->pDev, 0, pTexture);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CLIPPING, TRUE);
-
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MINFILTER, D3DTEXF_POINT);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MIPFILTER, D3DTEXF_POINT);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
-// IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
- IDirect3DDevice9_SetSamplerState(gld->pDev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
-
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- IDirect3DDevice9_SetTextureStageState(gld->pDev, 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
-
- IDirect3DDevice9_SetVertexShader(gld->pDev, NULL);
- IDirect3DDevice9_SetFVF(gld->pDev, _GLD_FVF_IMAGE);
-
- //
- // Emulate Chromakey with an Alpha Test.
- // [Alpha Test is more widely supported anyway]
- //
- if (bChromakey) {
- // Switch on alpha testing
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHATESTENABLE, TRUE);
- // Fragment passes is alpha is greater than reference value
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHAFUNC, D3DCMP_GREATER);
- // Set alpha reference value between Bitmap alpha values of
- // zero (transparent) and one (opaque).
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ALPHAREF, 0x7f);
- }
-
- IDirect3DDevice9_DrawPrimitiveUP(gld->pDev, D3DPT_TRIANGLEFAN, 2, &v, sizeof(_GLD_IMAGE_VERTEX));
-
- // Release texture
- IDirect3DDevice9_SetTexture(gld->pDev, 0, NULL);
- IDirect3DTexture9_Release(pTexture);
-
- // Reset state to before we messed it up
- FLUSH_VERTICES(ctx, _NEW_ALL);
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DrawPixels_DX9(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
-
- const struct gl_texture_format *MesaFormat;
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
-
- // Mesa does not currently handle this format.
- if (format == GL_BGR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- D3DPOOL_SCRATCH,
- &pImage,
- NULL);
- if (FAILED(hr)) {
- return;
- }
-
- //
- // Use Mesa to fill in image
- //
-
- // Lock all of surface
- hr = IDirect3DSurface9_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, /* dstImageStride */
- format, type, pixels, unpack);
-
- IDirect3DSurface9_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, FALSE, x, y, width, height, pImage);
-
- IDirect3DSurface9_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_ReadPixels_DX9(
- GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *dest)
-{
-
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pBackbuffer = NULL;
- IDirect3DSurface9 *pNativeImage = NULL;
- IDirect3DSurface9 *pCanonicalImage = NULL;
-
- D3DSURFACE_DESC d3dsd;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- struct gl_pixelstore_attrib srcPacking;
- int i;
- GLint DstRowStride;
- const struct gl_texture_format *MesaFormat;
-
- switch (format) {
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- return;
- }
-
- MesaFormat = _mesa_choose_tex_format(ctx, format, format, type);
- DstRowStride = _mesa_image_row_stride(pack, width, format, type);
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice9_GetBackBuffer(
- gld->pDev,
- 0, // First swapchain
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface9_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- D3DPOOL_SCRATCH,
- &pNativeImage,
- NULL);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, x, GLD_FLIP_HEIGHT(y, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels.
- //
- // This intermediate surface ensure that we can use CopyRects()
- // instead of relying on D3DXLoadSurfaceFromSurface(), which may
- // try and lock the backbuffer. This way seems safer.
- //
- // CopyRects has been removed for DX9.
- //
-/* hr = IDirect3DDevice9_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pNativeImage,
- &ptDst);*/
- hr = D3DXLoadSurfaceFromSurface(
- pNativeImage, // Dest surface
- NULL, // Dest palette
- &rcSrc, // Dest rect
- pBackbuffer, // Src surface
- NULL, // Src palette
- &rcSrc, // Src rect
- D3DX_FILTER_NONE, // Filter
- 0 // Colorkey (0=no colorkey)
- );
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Create an RGBA8888 surface
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- D3DPOOL_SCRATCH,
- &pCanonicalImage,
- NULL);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // Convert to RGBA8888
- hr = D3DXLoadSurfaceFromSurface(
- pCanonicalImage, // Dest surface
- NULL, NULL, // Dest palette, RECT
- pNativeImage, // Src surface
- NULL, NULL, // Src palette, RECT
- D3DX_FILTER_NONE, // Filter
- 0); // Colourkey
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- srcPacking.Alignment = 1;
- srcPacking.ImageHeight = height;
- srcPacking.LsbFirst = GL_FALSE;
- srcPacking.RowLength = 0;
- srcPacking.SkipImages = 0;
- srcPacking.SkipPixels = 0;
- srcPacking.SkipRows = 0;
- srcPacking.SwapBytes = GL_FALSE;
-
- // Lock all of image
- hr = IDirect3DSurface9_LockRect(pCanonicalImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- goto gld_ReadPixels_DX9_return;
- }
-
- // We need to flip the data. Yuck.
- // Perhaps Mesa has a span packer we can use in future...
- for (i=0; i<height; i++) {
- BYTE *pDestRow = (BYTE*)_mesa_image_address(2,pack, dest, width, height, format, type, 0, i, 0);
- BYTE *pSrcRow = (BYTE*)d3dLockedRect.pBits + (d3dLockedRect.Pitch * (height-i-1));
- MesaFormat->StoreImage(
- ctx,
- 2,
- GL_RGBA, // base format
- MesaFormat, // dst format
- pDestRow, // dest addr
- width, 1, 1, 0, 0, 0, // src x,y,z & dst offsets x,y,z
- DstRowStride, // dst row stride
- 0, // dstImageStride
- GL_BGRA, // src format
- GL_UNSIGNED_BYTE, // src type
- pSrcRow, // src addr
- &srcPacking); // packing params of source image
- }
-
- IDirect3DSurface9_UnlockRect(pCanonicalImage);
-
-gld_ReadPixels_DX9_return:
- SAFE_RELEASE_SURFACE9(pCanonicalImage);
- SAFE_RELEASE_SURFACE9(pNativeImage);
- SAFE_RELEASE_SURFACE9(pBackbuffer);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_CopyPixels_DX9(
- GLcontext *ctx,
- GLint srcx,
- GLint srcy,
- GLsizei width,
- GLsizei height,
- GLint dstx,
- GLint dsty,
- GLenum type)
-{
- //
- // NOTE: Not allowed to copy vidmem to vidmem!
- // Therefore we use an intermediate image surface.
- //
-
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pBackbuffer;
- D3DSURFACE_DESC d3dsd;
- IDirect3DSurface9 *pImage;
- RECT rcSrc; // Source rect
- POINT ptDst; // Dest point
- HRESULT hr;
-
- // Only backbuffer
- if (type != GL_COLOR)
- return;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // Get backbuffer
- hr = IDirect3DDevice9_GetBackBuffer(
- gld->pDev,
- 0, // First swapchain
- 0, // First backbuffer
- D3DBACKBUFFER_TYPE_MONO,
- &pBackbuffer);
- if (FAILED(hr))
- return;
-
- // Get backbuffer description
- hr = IDirect3DSurface9_GetDesc(pBackbuffer, &d3dsd);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pBackbuffer);
- return;
- }
-
- // Create a surface compatible with backbuffer
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- d3dsd.Format,
- D3DPOOL_SCRATCH,
- &pImage,
- NULL);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pBackbuffer);
- return;
- }
-
- // Compute source rect and dest point
- SetRect(&rcSrc, 0, 0, width, height);
- OffsetRect(&rcSrc, srcx, GLD_FLIP_HEIGHT(srcy, height));
- ptDst.x = ptDst.y = 0;
-
- // Get source pixels
-/* hr = IDirect3DDevice8_CopyRects(
- gld->pDev,
- pBackbuffer,
- &rcSrc,
- 1,
- pImage,
- &ptDst);*/
- hr = D3DXLoadSurfaceFromSurface(
- pImage, // Dest surface
- NULL, // Dest palette
- &rcSrc, // Dest rect
- pBackbuffer, // Src surface
- NULL, // Src palette
- &rcSrc, // Src rect
- D3DX_FILTER_NONE, // Filter
- 0 // Colorkey (0=no colorkey)
- );
- IDirect3DSurface9_Release(pBackbuffer);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- _gldDrawPixels(ctx, FALSE, dstx, dsty, width, height, pImage);
-
- IDirect3DSurface9_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_Bitmap_DX9(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei width,
- GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap)
-{
- GLD_context *gldCtx;
- GLD_driver_dx9 *gld;
-
- IDirect3DSurface9 *pImage;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- BYTE *pTempBitmap;
- D3DCOLOR clBitmapOne, clBitmapZero;
- D3DCOLOR *pBits;
- const GLubyte *src;
- int i, j, k;
-
- gldCtx = GLD_GET_CONTEXT(ctx);
- gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- // A NULL bitmap is valid, but merely advances the raster position
- if ((bitmap == NULL) || (width == 0) || (height == 0))
- return;
-
- clBitmapZero = D3DCOLOR_RGBA(0,0,0,0); // NOTE: Alpha is Zero
- clBitmapOne = D3DCOLOR_COLORVALUE(
- ctx->Current.RasterColor[0],
- ctx->Current.RasterColor[1],
- ctx->Current.RasterColor[2],
- 1.0f); // NOTE: Alpha is One
-
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(
- gld->pDev,
- width,
- height,
- D3DFMT_A8R8G8B8,
- D3DPOOL_SCRATCH,
- &pImage,
- NULL);
- if (FAILED(hr)) {
- return;
- }
-
- // Lock all of surface
- hr = IDirect3DSurface9_LockRect(pImage, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- pTempBitmap = _mesa_unpack_bitmap(width, height, bitmap, unpack);
- if (pTempBitmap == NULL) {
- IDirect3DSurface9_Release(pImage);
- return;
- }
-
- pBits = (D3DCOLOR*)d3dLockedRect.pBits;
-
- for (i=0; i<height; i++) {
- GLubyte byte;
- pBits = (D3DCOLOR*)((BYTE*)d3dLockedRect.pBits + (i*d3dLockedRect.Pitch));
- src = (const GLubyte *) _mesa_image_address(2,
- &ctx->DefaultPacking, pTempBitmap, width, height, GL_COLOR_INDEX, GL_BITMAP,
- 0, i, 0);
- for (j=0; j<(width>>3); j++) {
- byte = *src++;
- for (k=0; k<8; k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- // Fill remaining bits from bitmap
- if (width & 7) {
- byte = *src;
- for (k=0; k<(width & 7); k++) {
- *pBits++ = (byte & 128) ? clBitmapOne : clBitmapZero;
- byte <<= 1;
- }
- }
- }
-
- FREE(pTempBitmap);
-
-/*
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- GL_BITMAP,
- &_mesa_texformat_argb8888,
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- GL_BITMAP, GL_COLOR_INDEX, bitmap, unpack);
-*/
- IDirect3DSurface9_UnlockRect(pImage);
-
- _gldDrawPixels(ctx, TRUE, x, y, width, height, pImage);
-
- IDirect3DSurface9_Release(pImage);
-}
-
-//---------------------------------------------------------------------------
-// Texture functions
-//---------------------------------------------------------------------------
-
-void _gldAllocateTexture(
- GLcontext *ctx,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- D3DFORMAT d3dFormat;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (pTex) {
- // Decide whether we can keep existing D3D texture
- // by examining top-level surface.
- D3DSURFACE_DESC d3dsd;
- _GLD_DX9_TEX(GetLevelDesc(pTex, 0, &d3dsd));
- // Release existing texture if not compatible
- if ((d3dsd.Width == texImage->Width) ||
- (d3dsd.Height == texImage->Height))
- {
- return; // Keep the existing texture
- }
- tObj->DriverData = NULL;
- _GLD_DX9_TEX(Release(pTex));
- }
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->IntFormat);
- D3DXCreateTexture(
- gld->pDev,
- texImage->Width,
- texImage->Height,
- // TODO: Re-evaluate mipmapping
- (glb.bUseMipmaps) ? D3DX_DEFAULT : 1,
- 0, // Usage
- d3dFormat,
- D3DPOOL_MANAGED,
- &pTex);
- tObj->DriverData = pTex;
-}
-
-//---------------------------------------------------------------------------
-
-const struct gl_texture_format* gld_ChooseTextureFormat_DX9(
- GLcontext *ctx,
- GLint internalFormat,
- GLenum srcFormat,
- GLenum srcType)
-{
- // [Based on mesa_choose_tex_format()]
- //
- // We will choose only texture formats that are supported
- // by Direct3D. If the hardware doesn't support a particular
- // texture format, then the D3DX texture calls that we use
- // will automatically use a HW supported format.
- //
- // The most critical aim is to reduce copying; if we can use
- // texture-image data directly then it will be a big performance assist.
- //
-
- switch (internalFormat) {
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- return &_mesa_texformat_l8; // D3DFMT_L8
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- case GL_ALPHA12:
- case GL_ALPHA16:
- return &_mesa_texformat_a8; // D3DFMT_A8
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX8_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_rgb565; // D3DFMT_R5G6B5
- // Mesa will convert this for us later...
- // return &_mesa_texformat_ci8; // D3DFMT_R5G6B5
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE4_ALPHA4:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- return &_mesa_texformat_al88; // D3DFMT_A8L8
- case GL_R3_G3_B2:
- return &_mesa_texformat_rgb332; // D3DFMT_R3G3B2
- case GL_RGB4:
- case GL_RGBA4:
- case GL_RGBA2:
- return &_mesa_texformat_argb4444; // D3DFMT_A4R4G4B4
- case 3:
- case GL_RGB:
- case GL_RGB5:
- case GL_RGB8:
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- return &_mesa_texformat_rgb565;
- case 4:
- case GL_RGBA:
- case GL_RGBA8:
- case GL_RGB10_A2:
- case GL_RGBA12:
- case GL_RGBA16:
- return &_mesa_texformat_argb8888;
- case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
- default:
- _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
- return NULL;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
-// Safer(?), slower version.
-void gld_TexImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- RECT rcSrcRect;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
-
- if (!tObj || !texImage)
- return;
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture9_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface9_Release(pSurface);
- return;
- }
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- SetRect(&rcSrcRect, 0, 0, width, height);
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- NULL,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface9_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexImage2D_DX9(
- GLcontext *ctx,
- GLenum target,
- GLint level,
- GLint internalFormat,
- GLint width,
- GLint height,
- GLint border,
- GLenum format,
- GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- HRESULT hr;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- // GLQUAKE FIX
- // Test for input alpha data with non-alpha internalformat
- if (((internalFormat==3) || (internalFormat==GL_RGB)) && (format==GL_RGBA)) {
- // Input format has alpha, but a non-alpha format has been requested.
- texImage->IntFormat = GL_RGBA;
- internalFormat = GL_RGBA;
- }
-
- if (level == 0) {
- _gldAllocateTexture(ctx, tObj, texImage);
- }
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture9_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface9_GetDesc(pSurface, &d3dsd);
-
- // Lock all of surface
- hr = IDirect3DSurface9_LockRect(pSurface, &d3dLockedRect, NULL, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(
- ctx,
- 2,
- texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1, 0, 0, 0,
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- IDirect3DSurface9_UnlockRect(pSurface);
- IDirect3DSurface9_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat,
- GLint width, GLint border,
- GLenum format, GLenum type, const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- // A 1D texture is a 2D texture with a height of zero
- gld_TexImage2D_DX9(ctx, target, level, internalFormat, width, 1, border, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_GET_CONTEXT
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- D3DFORMAT d3dFormat;
- HRESULT hr;
- GLint texelBytes = 4;
- GLvoid *tempImage;
- RECT rcSrcRect;
- RECT rcDstRect;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= _GLD_DX9_TEX(GetLevelCount(pTex))
- return; // Level does not exist
- hr = _GLD_DX9_TEX(GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- d3dFormat = _gldGLFormatToD3DFormat(texImage->Format);
- tempImage = MALLOC(width * height * texelBytes);
- if (!tempImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
- IDirect3DSurface9_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store in tempImage
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- &_mesa_texformat_argb8888, // dest format
- tempImage,
- width, height, 1, 0, 0, 0,
- width * texelBytes,
- 0, // dstImageStride
- format, type, pixels, packing);
-
- // Source rectangle is whole of input image
- SetRect(&rcSrcRect, 0, 0, width, height);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- D3DXLoadSurfaceFromMemory(
- pSurface,
- NULL,
- &rcDstRect,
- tempImage,
- D3DFMT_A8R8G8B8,
- width * texelBytes,
- NULL,
- &rcSrcRect,
- D3DX_FILTER_NONE,
- 0);
-
- FREE(tempImage);
- IDirect3DSurface9_Release(pSurface);
-}
-*/
-
-//---------------------------------------------------------------------------
-
-// Faster, more efficient version.
-// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *tObj,
- struct gl_texture_image *texImage )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- IDirect3DTexture9 *pTex;
- IDirect3DSurface9 *pSurface;
- HRESULT hr;
- RECT rcDstRect;
- D3DLOCKED_RECT d3dLockedRect;
- D3DSURFACE_DESC d3dsd;
-
- if (!tObj || !texImage)
- return;
-
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (!pTex)
- return; // Texture has not been created
- if (level >= IDirect3DTexture9_GetLevelCount(pTex))
- return; // Level does not exist
- hr = IDirect3DTexture9_GetSurfaceLevel(pTex, level, &pSurface);
- if (FAILED(hr))
- return; // Surface level doesn't exist (or just a plain error)
-
- IDirect3DSurface9_GetDesc(pSurface, &d3dsd);
-
- // Dest rectangle must be offset to dest image
- SetRect(&rcDstRect, 0, 0, width, height);
- OffsetRect(&rcDstRect, xoffset, yoffset);
-
- // Lock sub-rect of surface
- hr = IDirect3DSurface9_LockRect(pSurface, &d3dLockedRect, &rcDstRect, 0);
- if (FAILED(hr)) {
- IDirect3DSurface9_Release(pSurface);
- return;
- }
-
- // unpack image, apply transfer ops and store directly in texture
- texImage->TexFormat->StoreImage(ctx, 2, texImage->Format,
- _gldMesaFormatForD3DFormat(d3dsd.Format),
- d3dLockedRect.pBits,
- width, height, 1,
- 0, 0, 0, // NOTE: d3dLockedRect.pBits is already offset!!!
- d3dLockedRect.Pitch,
- 0, // dstImageStride
- format, type, pixels, packing);
-
-
- IDirect3DSurface9_UnlockRect(pSurface);
- IDirect3DSurface9_Release(pSurface);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLsizei width,
- GLenum format, GLenum type,
- const GLvoid *pixels,
- const struct gl_pixelstore_attrib *packing,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage )
-{
- gld_TexSubImage2D_DX9(ctx, target, level, xoffset, 0, width, 1, format, type, pixels, packing, texObj, texImage);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_DeleteTexture_DX9(
- GLcontext *ctx,
- struct gl_texture_object *tObj)
-{
- GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
-
- if (tObj) {
- IDirect3DTexture9 *pTex = (IDirect3DTexture9*)tObj->DriverData;
- if (pTex) {
-/* // Make sure texture is not bound to a stage before releasing it
- for (int i=0; i<MAX_TEXTURE_UNITS; i++) {
- if (gld->CurrentTexture[i] == pTex) {
- gld->pDev->SetTexture(i, NULL);
- gld->CurrentTexture[i] = NULL;
- }
- }*/
- _GLD_DX9_TEX(Release(pTex));
- tObj->DriverData = NULL;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetColorOps(
- const GLD_driver_dx9 *gld,
- GLuint unit,
- DWORD ColorArg1,
- D3DTEXTUREOP ColorOp,
- DWORD ColorArg2)
-{
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG1, ColorArg1));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLOROP, ColorOp));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG2, ColorArg2));
-}
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetAlphaOps(
- const GLD_driver_dx9 *gld,
- GLuint unit,
- DWORD AlphaArg1,
- D3DTEXTUREOP AlphaOp,
- DWORD AlphaArg2)
-{
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG1, AlphaArg1));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAOP, AlphaOp));
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ALPHAARG2, AlphaArg2));
-}
-
-//---------------------------------------------------------------------------
-
-void gldUpdateTextureUnit(
- GLcontext *ctx,
- GLuint unit,
- BOOL bPassThrough)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- D3DTEXTUREFILTERTYPE minfilter;
- D3DTEXTUREFILTERTYPE mipfilter;
- GLenum BaseFormat;
- DWORD dwColorArg0;
- int iTexEnv = 0;
- GLD_texenv *pTexenv;
-
- // NOTE: If bPassThrough is FALSE then texture stage can be
- // disabled otherwise it must pass-through it's current fragment.
-
- const struct gl_texture_unit *pUnit = &ctx->Texture.Unit[unit];
- const struct gl_texture_object *tObj = pUnit->_Current;
-
- IDirect3DTexture9 *pTex = NULL;
- if (tObj) {
- pTex = (IDirect3DTexture9*)tObj->DriverData;
- }
-
- // Enable texturing if unit is enabled and a valid D3D texture exists
- // Mesa 5: TEXTUREn_x altered to TEXTURE_nD_BIT
- //if (pTex && (pUnit->Enabled & (TEXTURE0_1D | TEXTURE0_2D))) {
- if (pTex && (pUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT))) {
- // Enable texturing
- _GLD_DX9_DEV(SetTexture(gld->pDev, unit, pTex));
- } else {
- // Disable texturing, then return
- _GLD_DX9_DEV(SetTexture(gld->pDev, unit, NULL));
- if (bPassThrough) {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_SELECTARG2, D3DTA_DIFFUSE);
- } else {
- _gldSetColorOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- _gldSetAlphaOps(gld, unit, D3DTA_TEXTURE, D3DTOP_DISABLE, D3DTA_DIFFUSE);
- }
- return;
- }
-
- // Texture parameters
- _gldConvertMinFilter(tObj->MinFilter, &minfilter, &mipfilter);
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MINFILTER, minfilter));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MIPFILTER, mipfilter));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
-// _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MINFILTER, minfilter));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MIPFILTER, mipfilter));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_MAGFILTER, _gldConvertMagFilter(tObj->MagFilter)));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_ADDRESSU, _gldConvertWrap(tObj->WrapS)));
- _GLD_DX9_DEV(SetSamplerState(gld->pDev, unit, D3DSAMP_ADDRESSV, _gldConvertWrap(tObj->WrapT)));
-
- // Texture priority
- _GLD_DX9_TEX(SetPriority(pTex, (DWORD)(tObj->Priority*65535.0f)));
-
- // Texture environment
- // TODO: Examine input texture for alpha and use specific alpha/non-alpha ops.
- // See Page 355 of the Red Book.
- BaseFormat = _gldDecodeBaseFormat(pTex);
-
- switch (BaseFormat) {
- case GL_RGB:
- iTexEnv = 0;
- break;
- case GL_RGBA:
- iTexEnv = 1;
- break;
- case GL_ALPHA:
- iTexEnv = 2;
- break;
- }
-
- switch (pUnit->EnvMode) {
- case GL_DECAL:
- iTexEnv += 0;
- break;
- case GL_REPLACE:
- iTexEnv += 3;
- break;
- case GL_MODULATE:
- iTexEnv += 6;
- break;
- case GL_BLEND:
- // Set blend colour
- dwColorArg0 = D3DCOLOR_COLORVALUE(pUnit->EnvColor[0], pUnit->EnvColor[1], pUnit->EnvColor[2], pUnit->EnvColor[3]);
- _GLD_DX9_DEV(SetTextureStageState(gld->pDev, unit, D3DTSS_COLORARG0, dwColorArg0));
- iTexEnv += 9;
- break;
- case GL_ADD:
- iTexEnv += 12;
- break;
- }
- pTexenv = (GLD_texenv*)&gldTexEnv[iTexEnv];
- _gldSetColorOps(gld, unit, pTexenv->ColorArg1, pTexenv->ColorOp, pTexenv->ColorArg2);
- _gldSetAlphaOps(gld, unit, pTexenv->AlphaArg1, pTexenv->AlphaOp, pTexenv->AlphaArg2);
-}
-
-//---------------------------------------------------------------------------
-
-void gld_NEW_TEXTURE_DX9(
- GLcontext *ctx)
-{
- // TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
-
- BOOL bUnit0Enabled;
- BOOL bUnit1Enabled;
-
- if (!ctx)
- return; // Sanity check
-
- if (ctx->Const.MaxTextureUnits == 1) {
- gldUpdateTextureUnit(ctx, 0, TRUE);
- return;
- }
-
- //
- // NOTE: THE FOLLOWING RELATES TO TWO TEXTURE UNITS, AND TWO ONLY!!
- //
-
- // Mesa 5: Texture Units altered
- //bUnit0Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE0_2D)) ? TRUE : FALSE;
- //bUnit1Enabled = (ctx->Texture._ReallyEnabled & (TEXTURE1_1D | TEXTURE1_2D)) ? TRUE : FALSE;
- bUnit0Enabled = (ctx->Texture.Unit[0]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
- bUnit1Enabled = (ctx->Texture.Unit[1]._ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) ? TRUE : FALSE;
-
- // If Unit0 is disabled and Unit1 is enabled then we must pass-though
- gldUpdateTextureUnit(ctx, 0, (!bUnit0Enabled && bUnit1Enabled) ? TRUE : FALSE);
- // We can always disable the last texture unit
- gldUpdateTextureUnit(ctx, 1, FALSE);
-
-#ifdef _DEBUG
-#if 0
- {
- // Find out whether device supports current renderstates
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-// GLD_context *gld = GLD_GET_CONTEXT(ctx);
-
- DWORD dwPasses;
- _GLD_DX9_DEV(ValidateDevice(gld->pDev, &dwPasses));
-// if (FAILED(hr)) {
-// gldLogError(GLDLOG_ERROR, "ValidateDevice failed", hr);
-// }
- if (dwPasses != 1) {
- gldLogMessage(GLDLOG_ERROR, "ValidateDevice: Can't do in one pass\n");
- }
- }
-#endif
-#endif
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
deleted file mode 100644
index 4fa6bcaf1ab..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect fastpath pipeline stage
-*
-****************************************************************************/
-
-//---------------------------------------------------------------------------
-
-//#include "../GLDirect.h"
-//#include "../gld_log.h"
-//#include "gld_dx8.h"
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-// #include "mem.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-//---------------------------------------------------------------------------
-
-__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
- GLD_driver_dx9 *gld)
-{
- D3DXMATRIX mat, matView, matProj;
- GLfloat *pM;
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ModelView.m;
- pM = ctx->ModelviewMatrixStack.Top->m;
- matView._11 = pM[0];
- matView._12 = pM[1];
- matView._13 = pM[2];
- matView._14 = pM[3];
- matView._21 = pM[4];
- matView._22 = pM[5];
- matView._23 = pM[6];
- matView._24 = pM[7];
- matView._31 = pM[8];
- matView._32 = pM[9];
- matView._33 = pM[10];
- matView._34 = pM[11];
- matView._41 = pM[12];
- matView._42 = pM[13];
- matView._43 = pM[14];
- matView._44 = pM[15];
-
- // Mesa 5: Altered to a Stack
- //pM = ctx->ProjectionMatrix.m;
- pM = ctx->ProjectionMatrixStack.Top->m;
- matProj._11 = pM[0];
- matProj._12 = pM[1];
- matProj._13 = pM[2];
- matProj._14 = pM[3];
- matProj._21 = pM[4];
- matProj._22 = pM[5];
- matProj._23 = pM[6];
- matProj._24 = pM[7];
- matProj._31 = pM[8];
- matProj._32 = pM[9];
- matProj._33 = pM[10];
- matProj._34 = pM[11];
- matProj._41 = pM[12];
- matProj._42 = pM[13];
- matProj._43 = pM[14];
- matProj._44 = pM[15];
-
- D3DXMatrixMultiply( &mat, &matView, &matProj );
- D3DXMatrixTranspose( &mat, &mat );
-
- _GLD_DX9_DEV(SetVertexShaderConstantF(gld->pDev, 0, (float*)&mat, 4));
-}
-
-//---------------------------------------------------------------------------
-
-static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- TNLcontext *tnl;
- struct vertex_buffer *VB;
- tnl_render_func *tab;
- GLint pass;
- GLD_pb_dx9 *gldPB = &gld->PB3d;
-/*
- static int count = 0;
- count++;
- if (count != 2)
- return GL_FALSE;
-*/
- // The "check" function should disable this stage,
- // but we'll test gld->bUseMesaTnL anyway.
- if (gld->bUseMesaTnL) {
- // Do nothing in this stage, but continue pipeline
- return GL_TRUE;
- }
-
- tnl = TNL_CONTEXT(ctx);
- VB = &tnl->vb;
- pass = 0;
-
- tnl->Driver.Render.Start( ctx );
-
-#if 0
- // For debugging: Useful to see if an app passes colour data in
- // an unusual format.
- switch (VB->ColorPtr[0]->Type) {
- case GL_FLOAT:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n");
- break;
- case GL_UNSIGNED_BYTE:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_UNSIGNED_BYTE\n");
- break;
- default:
- ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: *?*\n");
- break;
- }
-#endif
-
- tnl->Driver.Render.Points = gld_Points3D_DX9;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line3DFlat_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle3DFlat_DX9;
- tnl->Driver.Render.Quad = gld_Quad3DFlat_DX9;
- } else {
- tnl->Driver.Render.Line = gld_Line3DSmooth_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle3DSmooth_DX9;
- tnl->Driver.Render.Quad = gld_Quad3DSmooth_DX9;
- }
-
- _GLD_DX9_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tab = (VB->Elts ? tnl->Driver.Render.PrimTabElts : tnl->Driver.Render.PrimTabVerts);
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length)
- {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
- _GLD_DX9_VB(Unlock(gldPB->pVB));
-
- _GLD_DX9_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, 0, gldPB->dwStride));
-
- _GLD_DX9_DEV(SetTransform(gld->pDev, D3DTS_PROJECTION, &gld->matProjection));
- _GLD_DX9_DEV(SetTransform(gld->pDev, D3DTS_WORLD, &gld->matModelView));
-
- if (gldPB->nPoints) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-//---------------------------------------------------------------------------
-
-static void gld_d3d_render_stage_check(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
- // Is this thread safe?
- stage->active = (gld->bUseMesaTnL) ? GL_FALSE : GL_TRUE;
- return;
-}
-
-
-//---------------------------------------------------------------------------
-
-const struct tnl_pipeline_stage _gld_d3d_render_stage =
-{
- "gld_d3d_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- gld_d3d_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c
deleted file mode 100644
index 372be2fb569..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_mesa_render_dx9.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* $Id: gld_vb_mesa_render_dx9.c,v 1.6 2005-08-27 13:56:08 brianp Exp $ */
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.5
- *
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keithw@valinux.com>
- */
-
-
-/*
- * Render whole vertex buffers, including projection of vertices from
- * clip space and clipping of primitives.
- *
- * This file makes calls to project vertices and to the point, line
- * and triangle rasterizers via the function pointers:
- *
- * context->Driver.Render.*
- *
- */
-
-
-//---------------------------------------------------------------------------
-
-#include "dglcontext.h"
-#include "ddlog.h"
-#include "gld_dx9.h"
-
-//---------------------------------------------------------------------------
-
-#include "glheader.h"
-#include "context.h"
-#include "macros.h"
-#include "mtypes.h"
-//#include "mmath.h"
-
-#include "math/m_matrix.h"
-#include "math/m_xform.h"
-
-#include "tnl/t_pipeline.h"
-
-/**********************************************************************/
-/* Clip single primitives */
-/**********************************************************************/
-
-
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-//#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-//#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
-#define W(i) coord[i][3]
-#define Z(i) coord[i][2]
-#define Y(i) coord[i][1]
-#define X(i) coord[i][0]
-#define SIZE 4
-#define TAG(x) x##_4
-#include "tnl/t_vb_cliptmp.h"
-
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, with the possibility of clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte ormask = c1|c2; \
- if (!ormask) \
- LineFunc( ctx, v1, v2 ); \
- else if (!(c1 & c2 & 0x3f)) \
- clip_line_4( ctx, v1, v2, ormask ); \
-} while (0)
-
-#define RENDER_TRI( v1, v2, v3 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
- GLubyte ormask = c1|c2|c3; \
- if (!ormask) \
- TriangleFunc( ctx, v1, v2, v3 ); \
- else if (!(c1 & c2 & c3 & 0x3f)) \
- clip_tri_4( ctx, v1, v2, v3, ormask ); \
-} while (0)
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
-do { \
- GLubyte c1 = mask[v1], c2 = mask[v2]; \
- GLubyte c3 = mask[v3], c4 = mask[v4]; \
- GLubyte ormask = c1|c2|c3|c4; \
- if (!ormask) \
- QuadFunc( ctx, v1, v2, v3, v4 ); \
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) \
- clip_quad_4( ctx, v1, v2, v3, v4, ormask ); \
-} while (0)
-
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
-
-#define TAG(x) clip_##x##_verts
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-
-/* Elts, with the possibility of clipping.
- */
-#undef ELT
-#undef TAG
-#define ELT(x) elt[x]
-#define TAG(x) clip_##x##_elts
-#include "tnl/t_vb_rendertmp.h"
-
-/* TODO: do this for all primitives, verts and elts:
- */
-static void clip_elt_triangles( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl_render_func render_tris = tnl->Driver.Render.PrimTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &tnl->vb;
- const GLuint * const elt = VB->Elts;
- GLubyte *mask = VB->ClipMask;
- GLuint last = count-2;
- GLuint j;
- (void) flags;
-
- tnl->Driver.Render.PrimitiveNotify( ctx, GL_TRIANGLES );
-
- for (j=start; j < last; j+=3 ) {
- GLubyte c1 = mask[elt[j]];
- GLubyte c2 = mask[elt[j+1]];
- GLubyte c3 = mask[elt[j+2]];
- GLubyte ormask = c1|c2|c3;
- if (ormask) {
- if (start < j)
- render_tris( ctx, start, j, 0 );
- if (!(c1&c2&c3&0x3f))
- clip_tri_4( ctx, elt[j], elt[j+1], elt[j+2], ormask );
- start = j+3;
- }
- }
-
- if (start < j)
- render_tris( ctx, start, j, 0 );
-}
-
-/**********************************************************************/
-/* Render whole begin/end objects */
-/**********************************************************************/
-
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-
-
-/* Vertices, no clipping.
- */
-#define RENDER_POINTS( start, count ) \
- tnl->Driver.Render.Points( ctx, start, count )
-
-#define RENDER_LINE( v1, v2 ) \
- LineFunc( ctx, v1, v2 )
-
-#define RENDER_TRI( v1, v2, v3 ) \
- TriangleFunc( ctx, v1, v2, v3 )
-
-#define RENDER_QUAD( v1, v2, v3, v4 ) \
- QuadFunc( ctx, v1, v2, v3, v4 )
-
-#define TAG(x) _gld_tnl_##x##_verts
-
-#define LOCAL_VARS \
- TNLcontext *tnl = TNL_CONTEXT(ctx); \
- struct vertex_buffer *VB = &tnl->vb; \
- const GLuint * const elt = VB->Elts; \
- const tnl_line_func LineFunc = tnl->Driver.Render.Line; \
- const tnl_triangle_func TriangleFunc = tnl->Driver.Render.Triangle; \
- const tnl_quad_func QuadFunc = tnl->Driver.Render.Quad; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
-#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
-#define PRESERVE_VB_DEFS
-#include "tnl/t_vb_rendertmp.h"
-
-
-/* Elts, no clipping.
- */
-#undef ELT
-#define TAG(x) _gld_tnl_##x##_elts
-#define ELT(x) elt[x]
-#include "tnl/t_vb_rendertmp.h"
-
-
-/**********************************************************************/
-/* Helper functions for drivers */
-/**********************************************************************/
-/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- GLuint *tmp = VB->Elts;
-
- VB->Elts = (GLuint *)elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
- VB->Elts = tmp;
-}
-
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.Render.Line( ctx, ii, jj );
-}
-*/
-
-
-/**********************************************************************/
-/* Clip and render whole vertex buffers */
-/**********************************************************************/
-
-tnl_points_func _gldSetupPoints[4] = {
- gld_Points2D_DX9,
- gld_Points2D_DX9,
- gld_Points2D_DX9,
- gld_Points2D_DX9
-};
-tnl_line_func _gldSetupLine[4] = {
- gld_Line2DFlat_DX9,
- gld_Line2DSmooth_DX9,
- gld_Line2DFlat_DX9,
- gld_Line2DSmooth_DX9,
-};
-tnl_triangle_func _gldSetupTriangle[4] = {
- gld_Triangle2DFlat_DX9,
- gld_Triangle2DSmooth_DX9,
- gld_Triangle2DFlatExtras_DX9,
- gld_Triangle2DSmoothExtras_DX9
-};
-tnl_quad_func _gldSetupQuad[4] = {
- gld_Quad2DFlat_DX9,
- gld_Quad2DSmooth_DX9,
- gld_Quad2DFlatExtras_DX9,
- gld_Quad2DSmoothExtras_DX9
-};
-
-//---------------------------------------------------------------------------
-
-static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
- struct tnl_pipeline_stage *stage)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
-
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &tnl->vb;
- tnl_render_func *tab;
- GLint pass = 0;
- GLD_pb_dx9 *gldPB;
-
- /* Allow the drivers to lock before projected verts are built so
- * that window coordinates are guarenteed not to change before
- * rendering.
- */
- ASSERT(tnl->Driver.Render.Start);
-
- tnl->Driver.Render.Start( ctx );
-
- // NOTE: Setting D3DRS_SOFTWAREVERTEXPROCESSING for a mixed-mode device resets
- // stream, indices and shader to default values of NULL or 0.
-/* if ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) &&
- gld->VStwosidelight.hShader &&
- !ctx->Fog.Enabled)
- {
- IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, !gld->VStwosidelight.bHardware);
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, gld->VStwosidelight.hShader));
- gldPB = &gld->PBtwosidelight;
- tnl->Driver.Render.Points = gld_Points2DTwoside_DX9;
- if (ctx->_TriangleCaps & DD_FLATSHADE) {
- tnl->Driver.Render.Line = gld_Line2DFlatTwoside_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle2DFlatTwoside_DX9;
- tnl->Driver.Render.Quad = gld_Quad2DFlatTwoside_DX9;
- } else {
- tnl->Driver.Render.Line = gld_Line2DSmoothTwoside_DX9;
- tnl->Driver.Render.Triangle = gld_Triangle2DSmoothTwoside_DX9;
- tnl->Driver.Render.Quad = gld_Quad2DSmoothTwoside_DX9;
- }
- } else {*/
-// IDirect3DDevice8_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, TRUE);
- IDirect3DDevice9_SetSoftwareVertexProcessing(gld->pDev, TRUE);
- gldPB = &gld->PB2d;
- _GLD_DX9_DEV(SetVertexShader(gld->pDev, NULL));
- _GLD_DX9_DEV(SetFVF(gld->pDev, gldPB->dwFVF));
- tnl->Driver.Render.Points = _gldSetupPoints[gld->iSetupFunc];
- tnl->Driver.Render.Line = _gldSetupLine[gld->iSetupFunc];
- tnl->Driver.Render.Triangle = _gldSetupTriangle[gld->iSetupFunc];
- tnl->Driver.Render.Quad = _gldSetupQuad[gld->iSetupFunc];
-// }
-
- _GLD_DX9_VB(Lock(gldPB->pVB, 0, 0, &gldPB->pPoints, D3DLOCK_DISCARD));
- gldPB->nPoints = gldPB->nLines = gldPB->nTriangles = 0;
- // Allocate primitive pointers
- // gldPB->pPoints is always first
- gldPB->pLines = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstLine);
- gldPB->pTriangles = gldPB->pPoints + (gldPB->dwStride * gldPB->iFirstTriangle);
-
- ASSERT(tnl->Driver.Render.BuildVertices);
- ASSERT(tnl->Driver.Render.PrimitiveNotify);
- ASSERT(tnl->Driver.Render.Points);
- ASSERT(tnl->Driver.Render.Line);
- ASSERT(tnl->Driver.Render.Triangle);
- ASSERT(tnl->Driver.Render.Quad);
- ASSERT(tnl->Driver.Render.ResetLineStipple);
- ASSERT(tnl->Driver.Render.Interp);
- ASSERT(tnl->Driver.Render.CopyPV);
- ASSERT(tnl->Driver.Render.ClippedLine);
- ASSERT(tnl->Driver.Render.ClippedPolygon);
- ASSERT(tnl->Driver.Render.Finish);
-
- tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 );
-
- if (VB->ClipOrMask) {
- tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
- }
- else {
- tab = (VB->Elts ?
- tnl->Driver.Render.PrimTabElts :
- tnl->Driver.Render.PrimTabVerts);
- }
-
- do {
- GLuint i, length, flags = 0;
- for (i = 0 ; !(flags & PRIM_END) ; i += length) {
- flags = VB->Primitive[i].mode;
- length= VB->Primitive[i].count;
- ASSERT(length || (flags & PRIM_END));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
- }
- } while (tnl->Driver.Render.Multipass &&
- tnl->Driver.Render.Multipass( ctx, ++pass ));
-
-
-// tnl->Driver.Render.Finish( ctx );
-
- _GLD_DX9_VB(Unlock(gldPB->pVB));
-
- _GLD_DX9_DEV(SetStreamSource(gld->pDev, 0, gldPB->pVB, 0, gldPB->dwStride));
-
- if (gldPB->nPoints) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_POINTLIST, 0, gldPB->nPoints));
- gldPB->nPoints = 0;
- }
-
- if (gldPB->nLines) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_LINELIST, gldPB->iFirstLine, gldPB->nLines));
- gldPB->nLines = 0;
- }
-
- if (gldPB->nTriangles) {
- _GLD_DX9_DEV(DrawPrimitive(gld->pDev, D3DPT_TRIANGLELIST, gldPB->iFirstTriangle, gldPB->nTriangles));
- gldPB->nTriangles = 0;
- }
-
- return GL_FALSE; /* finished the pipe */
-}
-
-
-/**********************************************************************/
-/* Render pipeline stage */
-/**********************************************************************/
-
-
-
-
-const struct tnl_pipeline_stage _gld_mesa_render_stage =
-{
- "gld_mesa_render_stage",
- NULL,
- NULL,
- NULL,
- NULL,
- _gld_mesa_render_stage_run /* run */
-};
-
-//---------------------------------------------------------------------------
diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c
deleted file mode 100644
index dc465c54185..00000000000
--- a/src/mesa/drivers/windows/gldirect/dx9/gld_wgl_dx9.c
+++ /dev/null
@@ -1,1345 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: GLDirect Direct3D 8.x WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-#include "gld_dxerr9.h"
-#include "gld_dx9.h"
-
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-
-// Copied from dglcontect.c
-#define GLDERR_NONE 0
-#define GLDERR_MEM 1
-#define GLDERR_DDRAW 2
-#define GLDERR_D3D 3
-#define GLDERR_BPP 4
-#define GLDERR_DDS 5
-// This external var keeps track of any error
-extern int nContextError;
-
-#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
-
-//---------------------------------------------------------------------------
-
-static char szColorDepthWarning[] =
-"GLDirect does not support the current desktop\n\
-color depth.\n\n\
-You may need to change the display resolution to\n\
-16 bits per pixel or higher color depth using\n\
-the Windows Display Settings control panel\n\
-before running this OpenGL application.\n";
-
-// The only depth-stencil formats currently supported by Direct3D
-// Surface Format Depth Stencil Total Bits
-// D3DFMT_D32 32 - 32
-// D3DFMT_D15S1 15 1 16
-// D3DFMT_D24S8 24 8 32
-// D3DFMT_D16 16 - 16
-// D3DFMT_D24X8 24 - 32
-// D3DFMT_D24X4S4 24 4 32
-
-// This pixel format will be used as a template when compiling the list
-// of pixel formats supported by the hardware. Many fields will be
-// filled in at runtime.
-// PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
-static DGL_pixelFormat pfTemplateHW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 16, // Total colour bitplanes (excluding alpha bitplanes)
- 5, 0, // Red bits, shift
- 5, 0, // Green bits, shift
- 5, 0, // Blue bits, shift
- 0, 0, // Alpha bits, shift (destination alpha)
- 0, // Accumulator bits (total)
- 0, 0, 0, 0, // Accumulator bits: Red, Green, Blue, Alpha
- 0, // Depth bits
- 0, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- D3DFMT_UNKNOWN, // No depth/stencil buffer
-};
-
-//---------------------------------------------------------------------------
-// Vertex Shaders
-//---------------------------------------------------------------------------
-/*
-// Vertex Shader Declaration
-static DWORD dwTwoSidedLightingDecl[] =
-{
- D3DVSD_STREAM(0),
- D3DVSD_REG(0, D3DVSDT_FLOAT3), // XYZ position
- D3DVSD_REG(1, D3DVSDT_FLOAT3), // XYZ normal
- D3DVSD_REG(2, D3DVSDT_D3DCOLOR), // Diffuse color
- D3DVSD_REG(3, D3DVSDT_D3DCOLOR), // Specular color
- D3DVSD_REG(4, D3DVSDT_FLOAT2), // 2D texture unit 0
- D3DVSD_REG(5, D3DVSDT_FLOAT2), // 2D texture unit 1
- D3DVSD_END()
-};
-
-// Vertex Shader for two-sided lighting
-static char *szTwoSidedLightingVS =
-// This is a test shader!
-"vs.1.0\n"
-"m4x4 oPos,v0,c0\n"
-"mov oD0,v2\n"
-"mov oD1,v3\n"
-"mov oT0,v4\n"
-"mov oT1,v5\n"
-;
-*/
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-typedef struct {
- HINSTANCE hD3D9DLL; // Handle to d3d9.dll
- FNDIRECT3DCREATE9 fnDirect3DCreate9; // Direct3DCreate9 function prototype
- BOOL bDirect3D; // Persistant Direct3D9 exists
- BOOL bDirect3DDevice; // Persistant Direct3DDevice9 exists
- IDirect3D9 *pD3D; // Persistant Direct3D9
- IDirect3DDevice9 *pDev; // Persistant Direct3DDevice9
-} GLD_dx9_globals;
-
-// These are "global" to all DX9 contexts. KeithH
-static GLD_dx9_globals dx9Globals;
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-BOOL gldGetDXErrorString_DX(
- HRESULT hr,
- char *buf,
- int nBufSize)
-{
- //
- // Return a string describing the input HRESULT error code
- //
-
- const char *pStr = DXGetErrorString9(hr);
-
- if (pStr == NULL)
- return FALSE;
-
- if (strlen(pStr) > nBufSize)
- strncpy(buf, pStr, nBufSize);
- else
- strcpy(buf, pStr);
-
-// D3DXGetErrorString(hr, buf, nBufSize);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static D3DMULTISAMPLE_TYPE _gldGetDeviceMultiSampleType(
- IDirect3D9 *pD3D9,
- D3DFORMAT SurfaceFormat,
- D3DDEVTYPE d3dDevType,
- BOOL Windowed)
-{
- int i;
- HRESULT hr;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_NONE)
- return D3DMULTISAMPLE_NONE;
-
- if (glb.dwMultisample == GLDS_MULTISAMPLE_FASTEST) {
- // Find fastest multisample
- for (i=2; i<17; i++) {
- hr = IDirect3D9_CheckDeviceMultiSampleType(
- pD3D9,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i,
- NULL);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- } else {
- // Find nicest multisample
- for (i=16; i>1; i--) {
- hr = IDirect3D9_CheckDeviceMultiSampleType(
- pD3D9,
- glb.dwAdapter,
- d3dDevType,
- SurfaceFormat,
- Windowed,
- (D3DMULTISAMPLE_TYPE)i,
- NULL);
- if (SUCCEEDED(hr)) {
- return (D3DMULTISAMPLE_TYPE)i;
- }
- }
- }
-
- // Nothing found - return default
- return D3DMULTISAMPLE_NONE;
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyPrimitiveBuffer(
- GLD_pb_dx9 *gldVB)
-{
- SAFE_RELEASE(gldVB->pVB);
-
- // Sanity check...
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
-}
-
-//---------------------------------------------------------------------------
-
-HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
- GLD_driver_dx9 *lpCtx,
- GLD_pb_dx9 *gldVB)
-{
- HRESULT hResult;
- char *szCreateVertexBufferFailed = "CreateVertexBuffer failed";
- DWORD dwMaxVertices; // Max number of vertices in vertex buffer
- DWORD dwVBSize; // Total size of vertex buffer
-
- // If CVA (Compiled Vertex Array) is used by an OpenGL app, then we
- // will need enough vertices to cater for Mesa::Const.MaxArrayLockSize.
- // We'll use IMM_SIZE if it's larger (which it should not be).
- dwMaxVertices = MAX_ARRAY_LOCK_SIZE;
-
- // Now calculate how many vertices to allow for in total
- // 1 per point, 2 per line, 6 per quad = 9
- dwVBSize = dwMaxVertices * 9 * gldVB->dwStride;
-
- hResult = IDirect3DDevice9_CreateVertexBuffer(
- lpCtx->pDev,
- dwVBSize,
- gldVB->dwUsage,
- gldVB->dwFVF,
- gldVB->dwPool,
- &gldVB->pVB,
- NULL);
- if (FAILED(hResult)) {
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, szCreateVertexBufferFailed);
- return hResult;
- }
-
- gldVB->nLines = gldVB->nPoints = gldVB->nTriangles = 0;
- gldVB->pPoints = gldVB->pLines = gldVB->pTriangles = NULL;
- gldVB->iFirstLine = dwMaxVertices; // Index of first line in VB
- gldVB->iFirstTriangle = dwMaxVertices*3; // Index of first triangle in VB
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-// Function: _gldCreateVertexShaders
-// Create DX9 Vertex Shaders.
-//---------------------------------------------------------------------------
-/*
-void _gldCreateVertexShaders(
- GLD_driver_dx9 *gld)
-{
- DWORD dwFlags;
- LPD3DXBUFFER pVSOpcodeBuffer; // Vertex Shader opcode buffer
- HRESULT hr;
-
-#ifdef _DEBUG
- dwFlags = D3DXASM_DEBUG;
-#else
- dwFlags = 0; // D3DXASM_SKIPVALIDATION;
-#endif
-
- ddlogMessage(DDLOG_INFO, "Creating shaders...\n");
-
- // Init the shader handle
- gld->VStwosidelight.hShader = 0;
-
- if (gld->d3dCaps8.MaxStreams == 0) {
- // Lame DX8 driver doesn't support streams
- // Not fatal, as defaults will be used
- ddlogMessage(DDLOG_WARN, "Driver doesn't support Vertex Shaders (MaxStreams==0)\n");
- return;
- }
-
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-// return;
- // ** THIS DISABLES VERTEX SHADER SUPPORT **
-
- //
- // Two-sided lighting
- //
-
-#if 0
- //
- // DEBUGGING: Load shader from a text file
- //
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- hr = D3DXAssembleShaderFromFile(
- "twoside.vsh",
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#else
- {
- LPD3DXBUFFER pVSErrorBuffer; // Vertex Shader error buffer
- // Assemble ascii shader text into shader opcodes
- hr = D3DXAssembleShader(
- szTwoSidedLightingVS,
- strlen(szTwoSidedLightingVS),
- dwFlags,
- NULL, // No constants
- &pVSOpcodeBuffer,
- &pVSErrorBuffer);
- if (pVSErrorBuffer && pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer))
- ddlogMessage(DDLOG_INFO, pVSErrorBuffer->lpVtbl->GetBufferPointer(pVSErrorBuffer));
- SAFE_RELEASE(pVSErrorBuffer);
- }
-#endif
- if (FAILED(hr)) {
- ddlogError(DDLOG_WARN, "AssembleShader failed", hr);
- SAFE_RELEASE(pVSOpcodeBuffer);
- return;
- }
-
-// This is for debugging. Remove to enable vertex shaders in HW
-#define _GLD_FORCE_SW_VS 0
-
- if (_GLD_FORCE_SW_VS) {
- // _GLD_FORCE_SW_VS should be disabled for Final Release
- ddlogMessage(DDLOG_SYSTEM, "[Forcing shaders in SW]\n");
- }
-
- // Try and create shader in hardware.
- // NOTE: The D3D Ref device appears to succeed when trying to
- // create the device in hardware, but later complains
- // when trying to set it with SetVertexShader(). Go figure.
- if (_GLD_FORCE_SW_VS || glb.dwDriver == GLDS_DRIVER_REF) {
- // Don't try and create a hardware shader with the Ref device
- hr = E_FAIL; // COM error/fail result
- } else {
- gld->VStwosidelight.bHardware = TRUE;
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- 0);
- }
- if (FAILED(hr)) {
- ddlogMessage(DDLOG_INFO, "... HW failed, trying SW...\n");
- // Failed. Try and create shader for software processing
- hr = IDirect3DDevice8_CreateVertexShader(
- gld->pDev,
- dwTwoSidedLightingDecl,
- pVSOpcodeBuffer->lpVtbl->GetBufferPointer(pVSOpcodeBuffer),
- &gld->VStwosidelight.hShader,
- D3DUSAGE_SOFTWAREPROCESSING);
- if (FAILED(hr)) {
- gld->VStwosidelight.hShader = 0; // Sanity check
- ddlogError(DDLOG_WARN, "CreateVertexShader failed", hr);
- return;
- }
- // Succeeded, but for software processing
- gld->VStwosidelight.bHardware = FALSE;
- }
-
- SAFE_RELEASE(pVSOpcodeBuffer);
-
- ddlogMessage(DDLOG_INFO, "... OK\n");
-}
-
-//---------------------------------------------------------------------------
-
-void _gldDestroyVertexShaders(
- GLD_driver_dx9 *gld)
-{
- if (gld->VStwosidelight.hShader) {
- IDirect3DDevice8_DeleteVertexShader(gld->pDev, gld->VStwosidelight.hShader);
- gld->VStwosidelight.hShader = 0;
- }
-}
-*/
-//---------------------------------------------------------------------------
-
-BOOL gldCreateDrawable_DX(
- DGL_ctx *ctx,
-// BOOL bDefaultDriver,
- BOOL bDirectDrawPersistant,
- BOOL bPersistantBuffers)
-{
- //
- // bDirectDrawPersistant: applies to IDirect3D9
- // bPersistantBuffers: applies to IDirect3DDevice9
- //
-
- HRESULT hResult;
- GLD_driver_dx9 *lpCtx = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- DWORD dwBehaviourFlags;
- D3DADAPTER_IDENTIFIER9 d3dIdent;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- if (ctx->glPriv) {
- lpCtx = ctx->glPriv;
- // Release any existing interfaces
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- } else {
- lpCtx = (GLD_driver_dx9*)malloc(sizeof(GLD_driver_dx9));
- ZeroMemory(lpCtx, sizeof(lpCtx));
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- // TODO: Check this
-// if (bDefaultDriver)
-// d3dDevType = D3DDEVTYPE_REF;
-
- // Use persistant interface if needed
- if (bDirectDrawPersistant && dx9Globals.bDirect3D) {
- lpCtx->pD3D = dx9Globals.pD3D;
- IDirect3D9_AddRef(lpCtx->pD3D);
- goto SkipDirectDrawCreate;
- }
-
- // Create Direct3D9 object
- lpCtx->pD3D = dx9Globals.fnDirect3DCreate9(D3D_SDK_VERSION);
- if (lpCtx->pD3D == NULL) {
- MessageBox(NULL, "Unable to initialize Direct3D9", "GLDirect", MB_OK);
- ddlogMessage(DDLOG_CRITICAL_OR_WARN, "Unable to create Direct3D9 interface");
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Cache Direct3D interface for subsequent GLRCs
- if (bDirectDrawPersistant && !dx9Globals.bDirect3D) {
- dx9Globals.pD3D = lpCtx->pD3D;
- IDirect3D9_AddRef(dx9Globals.pD3D);
- dx9Globals.bDirect3D = TRUE;
- }
-SkipDirectDrawCreate:
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D9_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Get device caps
- hResult = IDirect3D9_GetDeviceCaps(lpCtx->pD3D, glb.dwAdapter, d3dDevType, &lpCtx->d3dCaps9);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D9_GetDeviceCaps failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- // Check for hardware transform & lighting
- lpCtx->bHasHWTnL = lpCtx->d3dCaps9.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ? TRUE : FALSE;
-
-/*
- //
- // GONE FOR DX9?
- //
- // If this flag is present then we can't default to Mesa
- // SW rendering between BeginScene() and EndScene().
- if (lpCtx->d3dCaps9.Caps2 & D3DCAPS2_NO2DDURING3DSCENE) {
- ddlogMessage(DDLOG_WARN,
- "Warning : No 2D allowed during 3D scene.\n");
- }
-*/
-
- //
- // Create the Direct3D context
- //
-
- // Re-use original IDirect3DDevice if persistant buffers exist.
- // Note that we test for persistant IDirect3D9 as well
- // bDirectDrawPersistant == persistant IDirect3D9 (DirectDraw9 does not exist)
- if (bDirectDrawPersistant && bPersistantBuffers && dx9Globals.pD3D && dx9Globals.pDev) {
- lpCtx->pDev = dx9Globals.pDev;
- IDirect3DDevice9_AddRef(dx9Globals.pDev);
- goto skip_direct3ddevice_create;
- }
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 2; //1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(lpCtx->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
-
- // Support for vertical retrace synchronisation.
- // Set default presentation interval in case caps bits are missing
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- if (lpCtx->d3dCaps9.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- if (lpCtx->d3dCaps9.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- // PresentationInterval Windowed mode is optional now in DX9 (DaveM)
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- if (glb.bWaitForRetrace) {
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- } else {
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
- }
- }
-
- // Decide if we can use hardware TnL
- dwBehaviourFlags = (lpCtx->bHasHWTnL) ?
- D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
- // Add flag to tell D3D to be thread-safe
- if (glb.bMultiThreaded)
- dwBehaviourFlags |= D3DCREATE_MULTITHREADED;
- // Add flag to tell D3D to be FPU-safe
- if (!glb.bFastFPU)
- dwBehaviourFlags |= D3DCREATE_FPU_PRESERVE;
- hResult = IDirect3D9_CreateDevice(lpCtx->pD3D,
- glb.dwAdapter,
- d3dDevType,
- ctx->hWnd,
- dwBehaviourFlags,
- &d3dpp,
- &lpCtx->pDev);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "IDirect3D9_CreateDevice failed", hResult);
- nContextError = GLDERR_D3D;
- goto return_with_error;
- }
-
- if (bDirectDrawPersistant && bPersistantBuffers && dx9Globals.pD3D) {
- dx9Globals.pDev = lpCtx->pDev;
- dx9Globals.bDirect3DDevice = TRUE;
- }
-
- // Dump some useful stats
- hResult = IDirect3D9_GetAdapterIdentifier(
- lpCtx->pD3D,
- glb.dwAdapter,
- 0, // No WHQL detection (avoid few seconds delay)
- &d3dIdent);
- if (SUCCEEDED(hResult)) {
- ddlogPrintf(DDLOG_INFO, "[Driver Description: %s]", &d3dIdent.Description);
- ddlogPrintf(DDLOG_INFO, "[Driver file: %s %d.%d.%02d.%d]",
- d3dIdent.Driver,
- HIWORD(d3dIdent.DriverVersion.HighPart),
- LOWORD(d3dIdent.DriverVersion.HighPart),
- HIWORD(d3dIdent.DriverVersion.LowPart),
- LOWORD(d3dIdent.DriverVersion.LowPart));
- ddlogPrintf(DDLOG_INFO, "[VendorId: 0x%X, DeviceId: 0x%X, SubSysId: 0x%X, Revision: 0x%X]",
- d3dIdent.VendorId, d3dIdent.DeviceId, d3dIdent.SubSysId, d3dIdent.Revision);
- }
-
- // Test to see if IHV driver exposes Scissor Test (new for DX9)
- lpCtx->bCanScissor = lpCtx->d3dCaps9.RasterCaps & D3DPRASTERCAPS_SCISSORTEST;
- ddlogPrintf(DDLOG_INFO, "Can Scissor: %s", lpCtx->bCanScissor ? "Yes" : "No");
-
- // Init projection matrix for D3D TnL
- D3DXMatrixIdentity(&lpCtx->matProjection);
- lpCtx->matModelView = lpCtx->matProjection;
-// gld->bUseMesaProjection = TRUE;
-
-skip_direct3ddevice_create:
-
- // Create buffers to hold primitives
- lpCtx->PB2d.dwFVF = GLD_FVF_2D_VERTEX;
- lpCtx->PB2d.dwPool = D3DPOOL_SYSTEMMEM;
- lpCtx->PB2d.dwStride = sizeof(GLD_2D_VERTEX);
- lpCtx->PB2d.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB2d);
- if (FAILED(hResult))
- goto return_with_error;
-
- lpCtx->PB3d.dwFVF = GLD_FVF_3D_VERTEX;
- lpCtx->PB3d.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PB3d.dwStride = sizeof(GLD_3D_VERTEX);
- lpCtx->PB3d.dwUsage = D3DUSAGE_DYNAMIC |
-//DaveM D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PB3d);
- if (FAILED(hResult))
- goto return_with_error;
-
-/* // NOTE: A FVF code of zero indicates a non-FVF vertex buffer (for vertex shaders)
- lpCtx->PBtwosidelight.dwFVF = 0; //GLD_FVF_TWOSIDED_VERTEX;
- lpCtx->PBtwosidelight.dwPool = D3DPOOL_DEFAULT;
- lpCtx->PBtwosidelight.dwStride = sizeof(GLD_TWOSIDED_VERTEX);
- lpCtx->PBtwosidelight.dwUsage = D3DUSAGE_DONOTCLIP |
- D3DUSAGE_DYNAMIC |
- D3DUSAGE_SOFTWAREPROCESSING |
- D3DUSAGE_WRITEONLY;
- hResult = _gldCreatePrimitiveBuffer(ctx->glCtx, lpCtx, &lpCtx->PBtwosidelight);
- if (FAILED(hResult))
- goto return_with_error;*/
-
- // Now try and create the DX9 Vertex Shaders
-// _gldCreateVertexShaders(lpCtx);
-
- // Zero the pipeline usage counters
- lpCtx->PipelineUsage.qwMesa.QuadPart =
-// lpCtx->PipelineUsage.dwD3D2SVS.QuadPart =
- lpCtx->PipelineUsage.qwD3DFVF.QuadPart = 0;
-
- // Assign drawable to GL private
- ctx->glPriv = lpCtx;
- return TRUE;
-
-return_with_error:
- // Clean up and bail
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_DX(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- GLD_driver_dx9 *gld = NULL;
- D3DDEVTYPE d3dDevType;
- D3DPRESENT_PARAMETERS d3dpp;
- D3DDISPLAYMODE d3ddm;
- HRESULT hResult;
-
- // Error if context is NULL.
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice9_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- d3dDevType = (glb.dwDriver == GLDS_DRIVER_HAL) ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF;
- if (!bDefaultDriver)
- d3dDevType = D3DDEVTYPE_REF; // Force Direct3D Reference Rasterise (software)
-
- // Get the display mode so we can make a compatible backbuffer
- hResult = IDirect3D9_GetAdapterDisplayMode(gld->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hResult)) {
- nContextError = GLDERR_D3D;
-// goto return_with_error;
- return FALSE;
- }
-
- // Destroy DX9 Vertex Shaders before Reset()
-// _gldDestroyVertexShaders(gld);
-
- // Release POOL_DEFAULT objects before Reset()
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB2d);
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT)
- _gldDestroyPrimitiveBuffer(&gld->PB3d);
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT)
-// _gldDestroyPrimitiveBuffer(&gld->PBtwosidelight);
-
- // Clear the presentation parameters (sets all members to zero)
- ZeroMemory(&d3dpp, sizeof(d3dpp));
-
- // Recommended by MS; needed for MultiSample.
- // Be careful if altering this for FullScreenBlit
- d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
-
- d3dpp.BackBufferFormat = d3ddm.Format;
- d3dpp.BackBufferCount = 1;
- d3dpp.MultiSampleType = _gldGetDeviceMultiSampleType(gld->pD3D, d3ddm.Format, d3dDevType, !ctx->bFullscreen);
- d3dpp.AutoDepthStencilFormat = ctx->lpPF->dwDriverData;
- d3dpp.EnableAutoDepthStencil = (d3dpp.AutoDepthStencilFormat == D3DFMT_UNKNOWN) ? FALSE : TRUE;
-
- // TODO: Sync to refresh
-
- if (ctx->bFullscreen) {
- ddlogWarnOption(FALSE); // Don't popup any messages in fullscreen
- d3dpp.Windowed = FALSE;
- d3dpp.BackBufferWidth = d3ddm.Width;
- d3dpp.BackBufferHeight = d3ddm.Height;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- // Get better benchmark results? KeithH
-// d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_UNLIMITED;
- } else {
- ddlogWarnOption(glb.bMessageBoxWarnings); // OK to popup messages
- d3dpp.Windowed = TRUE;
- d3dpp.BackBufferWidth = ctx->dwWidth;
- d3dpp.BackBufferHeight = ctx->dwHeight;
- d3dpp.hDeviceWindow = ctx->hWnd;
- d3dpp.FullScreen_RefreshRateInHz = 0;
- d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
- }
- hResult = IDirect3DDevice9_Reset(gld->pDev, &d3dpp);
- if (FAILED(hResult)) {
- ddlogError(DDLOG_CRITICAL_OR_WARN, "dglResize: Reset failed", hResult);
- return FALSE;
- //goto cleanup_and_return_with_error;
- }
-
- //
- // Recreate POOL_DEFAULT objects
- //
- if (gld->PB2d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
- }
- if (gld->PB3d.dwPool == D3DPOOL_DEFAULT) {
- _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB3d);
- }
-// if (gld->PBtwosidelight.dwPool == D3DPOOL_DEFAULT) {
-// _gldCreatePrimitiveBuffer(ctx->glCtx, gld, &gld->PB2d);
-// }
-
- // Recreate DX9 Vertex Shaders
-// _gldCreateVertexShaders(gld);
-
- // Signal a complete state update
- ctx->glCtx->Driver.UpdateState(ctx->glCtx, _NEW_ALL);
-
- // Begin a new scene
- IDirect3DDevice9_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_DX(
- DGL_ctx *ctx)
-{
- GLD_driver_dx9 *lpCtx = NULL;
-
- // Error if context is NULL.
- if (!ctx)
- return FALSE;
-
- // Error if the drawable does not exist.
- if (!ctx->glPriv)
- return FALSE;
-
- lpCtx = ctx->glPriv;
-
-#ifdef _DEBUG
- // Dump out stats
- ddlogPrintf(DDLOG_SYSTEM, "Usage: M:0x%X%X, D:0x%X%X",
- lpCtx->PipelineUsage.qwMesa.HighPart,
- lpCtx->PipelineUsage.qwMesa.LowPart,
- lpCtx->PipelineUsage.qwD3DFVF.HighPart,
- lpCtx->PipelineUsage.qwD3DFVF.LowPart);
-#endif
-
-// _gldDestroyVertexShaders(lpCtx);
-
-// _gldDestroyPrimitiveBuffer(&lpCtx->PBtwosidelight);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB3d);
- _gldDestroyPrimitiveBuffer(&lpCtx->PB2d);
-
- SAFE_RELEASE(lpCtx->pDev);
- SAFE_RELEASE(lpCtx->pD3D);
-
- // Free the private drawable data
- free(ctx->glPriv);
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_DX(void)
-{
- ZeroMemory(&dx9Globals, sizeof(dx9Globals));
-
- // Load d3d9.dll
- dx9Globals.hD3D9DLL = LoadLibrary("D3D9.DLL");
- if (dx9Globals.hD3D9DLL == NULL)
- return FALSE;
-
- // Now try and obtain Direct3DCreate9
- dx9Globals.fnDirect3DCreate9 = (FNDIRECT3DCREATE9)GetProcAddress(dx9Globals.hD3D9DLL, "Direct3DCreate9");
- if (dx9Globals.fnDirect3DCreate9 == NULL) {
- FreeLibrary(dx9Globals.hD3D9DLL);
- return FALSE;
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_DX(void)
-{
- if (dx9Globals.bDirect3DDevice) {
- SAFE_RELEASE(dx9Globals.pDev);
- dx9Globals.bDirect3DDevice = FALSE;
- }
- if (dx9Globals.bDirect3D) {
- SAFE_RELEASE(dx9Globals.pD3D);
- dx9Globals.bDirect3D = FALSE;
- }
-
- FreeLibrary(dx9Globals.hD3D9DLL);
- dx9Globals.hD3D9DLL = NULL;
- dx9Globals.fnDirect3DCreate9 = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDisplayFormat(
- D3DFORMAT fmt,
- BYTE *cColorBits,
- BYTE *cRedBits,
- BYTE *cGreenBits,
- BYTE *cBlueBits,
- BYTE *cAlphaBits)
-{
- switch (fmt) {
- case D3DFMT_X1R5G5B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 5;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_R5G6B5:
- *cColorBits = 16;
- *cRedBits = 5;
- *cGreenBits = 6;
- *cBlueBits = 5;
- *cAlphaBits = 0;
- return;
- case D3DFMT_X8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
- return;
- case D3DFMT_A8R8G8B8:
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 8;
- return;
- }
-
- // Should not get here!
- *cColorBits = 32;
- *cRedBits = 8;
- *cGreenBits = 8;
- *cBlueBits = 8;
- *cAlphaBits = 0;
-}
-
-//---------------------------------------------------------------------------
-
-static void _BitsFromDepthStencilFormat(
- D3DFORMAT fmt,
- BYTE *cDepthBits,
- BYTE *cStencilBits)
-{
- // NOTE: GL expects either 32 or 16 as depth bits.
- switch (fmt) {
- case D3DFMT_D32:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D15S1:
- *cDepthBits = 16;
- *cStencilBits = 1;
- return;
- case D3DFMT_D24S8:
- *cDepthBits = 32;
- *cStencilBits = 8;
- return;
- case D3DFMT_D16:
- *cDepthBits = 16;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X8:
- *cDepthBits = 32;
- *cStencilBits = 0;
- return;
- case D3DFMT_D24X4S4:
- *cDepthBits = 32;
- *cStencilBits = 4;
- return;
- }
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_DX(void)
-{
- D3DDISPLAYMODE d3ddm;
- D3DFORMAT fmt[6];
- IDirect3D9 *pD3D = NULL;
- HRESULT hr;
- int nSupportedFormats = 0;
- int i;
- DGL_pixelFormat *pPF;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-// char buf[128];
-// char cat[8];
-
- // Direct3D (SW or HW)
- // These are arranged so that 'best' pixelformat
- // is higher in the list (for ChoosePixelFormat).
- const D3DFORMAT DepthStencil[6] = {
-// New order: increaing Z, then increasing stencil
- D3DFMT_D15S1,
- D3DFMT_D16,
- D3DFMT_D24X4S4,
- D3DFMT_D24X8,
- D3DFMT_D24S8,
- D3DFMT_D32,
- };
-
- // Dump DX version
- ddlogMessage(GLDLOG_SYSTEM, "DirectX Version : 9.0\n");
-
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- //
- // Pixelformats for Direct3D (SW or HW) rendering
- //
-
- // Get a Direct3D 9.0 interface
- pD3D = dx9Globals.fnDirect3DCreate9(D3D_SDK_VERSION);
- if (!pD3D) {
- return FALSE;
- }
-
- // We will use the display mode format when finding compliant
- // rendertarget/depth-stencil surfaces.
- hr = IDirect3D9_GetAdapterDisplayMode(pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr)) {
- IDirect3D9_Release(pD3D);
- return FALSE;
- }
-
- // Run through the possible formats and detect supported formats
- for (i=0; i<6; i++) {
- hr = IDirect3D9_CheckDeviceFormat(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- D3DUSAGE_DEPTHSTENCIL,
- D3DRTYPE_SURFACE,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal.
- continue;
-
- // Verify that the depth format is compatible.
- hr = IDirect3D9_CheckDepthStencilMatch(
- pD3D,
- glb.dwAdapter,
- glb.dwDriver==GLDS_DRIVER_HAL ? D3DDEVTYPE_HAL : D3DDEVTYPE_REF,
- d3ddm.Format,
- d3ddm.Format,
- DepthStencil[i]);
- if (FAILED(hr))
- // A failure here is not fatal, just means depth-stencil
- // format is not compatible with this display mode.
- continue;
-
- fmt[nSupportedFormats++] = DepthStencil[i];
- }
-
- IDirect3D9_Release(pD3D);
-
- if (nSupportedFormats == 0)
- return FALSE; // Bail: no compliant pixelformats
-
- // Total count of pixelformats is:
- // (nSupportedFormats+1)*2
- // UPDATED: nSupportedFormats*2
- glb.lpPF = (DGL_pixelFormat *)calloc(nSupportedFormats*2, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = nSupportedFormats*2;
- if (glb.lpPF == NULL) {
- glb.nPixelFormatCount = 0;
- return FALSE;
- }
-
- // Get a copy of pointer that we can alter
- pPF = glb.lpPF;
-
- // Cache colour bits from display format
- _BitsFromDisplayFormat(d3ddm.Format, &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- //
- // Add single-buffer formats
- //
-/*
- // NOTE: No longer returning pixelformats that don't contain depth
- // Single-buffer, no depth-stencil buffer
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;
-*/
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- //
- // Add double-buffer formats
- //
-
- // NOTE: No longer returning pixelformats that don't contain depth
-/*
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- pPF->pfd.cDepthBits = 0;
- pPF->pfd.cStencilBits = 0;
- pPF->dwDriverData = D3DFMT_UNKNOWN;
- pPF++;
-*/
- for (i=0; i<nSupportedFormats; i++, pPF++) {
- memcpy(pPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
- pPF->pfd.cColorBits = cColorBits;
- pPF->pfd.cRedBits = cRedBits;
- pPF->pfd.cGreenBits = cGreenBits;
- pPF->pfd.cBlueBits = cBlueBits;
- pPF->pfd.cAlphaBits = cAlphaBits;
- _BitsFromDepthStencilFormat(fmt[i], &pPF->pfd.cDepthBits, &pPF->pfd.cStencilBits);
- pPF->dwDriverData = fmt[i];
- }
-
- // Popup warning message if non RGB color mode
- {
- // This is a hack. KeithH
- HDC hdcDesktop = GetDC(NULL);
- DWORD dwDisplayBitDepth = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- ReleaseDC(0, hdcDesktop);
- if (dwDisplayBitDepth <= 8) {
- ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
- MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
- }
- }
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_DX(
- DGL_ctx *lpCtx)
-{
- GLD_driver_dx9 *gld = NULL;
- int MaxTextureSize, TextureLevels;
- BOOL bSoftwareTnL;
-
- if (lpCtx == NULL)
- return FALSE;
-
- gld = lpCtx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (glb.bMultitexture) {
- lpCtx->glCtx->Const.MaxTextureUnits = gld->d3dCaps9.MaxSimultaneousTextures;
- // Only support MAX_TEXTURE_UNITS texture units.
- // ** If this is altered then the FVF formats must be reviewed **.
- if (lpCtx->glCtx->Const.MaxTextureUnits > GLD_MAX_TEXTURE_UNITS_DX9)
- lpCtx->glCtx->Const.MaxTextureUnits = GLD_MAX_TEXTURE_UNITS_DX9;
- } else {
- // Multitexture override
- lpCtx->glCtx->Const.MaxTextureUnits = 1;
- }
-
- // max texture size
- MaxTextureSize = min(gld->d3dCaps9.MaxTextureHeight, gld->d3dCaps9.MaxTextureWidth);
- if (MaxTextureSize == 0)
- MaxTextureSize = 256; // Sanity check
-
- //
- // HACK!!
- if (MaxTextureSize > 1024)
- MaxTextureSize = 1024; // HACK - CLAMP TO 1024
- // HACK!!
- //
-
- // Got to set MAX_TEXTURE_SIZE as max levels.
- // Who thought this stupid idea up? ;)
- TextureLevels = 0;
- // Calculate power-of-two.
- while (MaxTextureSize) {
- TextureLevels++;
- MaxTextureSize >>= 1;
- }
- lpCtx->glCtx->Const.MaxTextureLevels = (TextureLevels) ? TextureLevels : 8;
-
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_LIGHTING, FALSE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_CULLMODE, D3DCULL_NONE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_DITHERENABLE, TRUE);
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
-
- IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_ZENABLE,
- (lpCtx->lpPF->dwDriverData!=D3DFMT_UNKNOWN) ? D3DZB_TRUE : D3DZB_FALSE);
-
- // Set the view matrix
- {
- D3DXMATRIX vm;
-#if 1
- D3DXMatrixIdentity(&vm);
-#else
- D3DXVECTOR3 Eye(0.0f, 0.0f, 0.0f);
- D3DXVECTOR3 At(0.0f, 0.0f, -1.0f);
- D3DXVECTOR3 Up(0.0f, 1.0f, 0.0f);
- D3DXMatrixLookAtRH(&vm, &Eye, &At, &Up);
- vm._31 = -vm._31;
- vm._32 = -vm._32;
- vm._33 = -vm._33;
- vm._34 = -vm._34;
-#endif
- IDirect3DDevice9_SetTransform(gld->pDev, D3DTS_VIEW, &vm);
- }
-
- if (gld->bHasHWTnL) {
- if (glb.dwTnL == GLDS_TNL_DEFAULT)
- bSoftwareTnL = FALSE; // HW TnL
- else {
- bSoftwareTnL = ((glb.dwTnL == GLDS_TNL_MESA) || (glb.dwTnL == GLDS_TNL_D3DSW)) ? TRUE : FALSE;
- }
- } else {
- // No HW TnL, so no choice possible
- bSoftwareTnL = TRUE;
- }
-// IDirect3DDevice9_SetRenderState(gld->pDev, D3DRS_SOFTWAREVERTEXPROCESSING, bSoftwareTnL);
- IDirect3DDevice9_SetSoftwareVertexProcessing(gld->pDev, bSoftwareTnL);
-
-// Dump this in a Release build as well, now.
-//#ifdef _DEBUG
- ddlogPrintf(DDLOG_INFO, "HW TnL: %s",
- gld->bHasHWTnL ? (bSoftwareTnL ? "Disabled" : "Enabled") : "Unavailable");
-//#endif
-
- gldEnableExtensions_DX9(lpCtx->glCtx);
- gldInstallPipeline_DX9(lpCtx->glCtx);
- gldSetupDriverPointers_DX9(lpCtx->glCtx);
-
- // Signal a complete state update
- lpCtx->glCtx->Driver.UpdateState(lpCtx->glCtx, _NEW_ALL);
-
- // Start a scene
- IDirect3DDevice9_BeginScene(gld->pDev);
- lpCtx->bSceneStarted = TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_DX(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- HRESULT hr;
- GLD_driver_dx9 *gld = NULL;
-
- if (ctx == NULL)
- return FALSE;
-
- gld = ctx->glPriv;
- if (gld == NULL)
- return FALSE;
-
- if (ctx->bSceneStarted) {
- IDirect3DDevice9_EndScene(gld->pDev);
- ctx->bSceneStarted = FALSE;
- }
-
- // Swap the buffers. hWnd may override the hWnd used for CreateDevice()
- hr = IDirect3DDevice9_Present(gld->pDev, NULL, NULL, hWnd, NULL);
-
-exit_swap:
-
- IDirect3DDevice9_BeginScene(gld->pDev);
- ctx->bSceneStarted = TRUE;
-
-// Debugging code
-#ifdef _DEBUG
-// ddlogMessage(GLDLOG_WARN, "SwapBuffers\n");
-#endif
-
- return (FAILED(hr)) ? FALSE : TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_DX(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
- D3DDISPLAYMODE d3ddm;
- HRESULT hr;
- GLD_driver_dx9 *lpCtx = NULL;
- BYTE cColorBits, cRedBits, cGreenBits, cBlueBits, cAlphaBits;
-
- if ((glddm == NULL) || (ctx == NULL))
- return FALSE;
-
- lpCtx = ctx->glPriv;
- if (lpCtx == NULL)
- return FALSE;
-
- if (lpCtx->pD3D == NULL)
- return FALSE;
-
- hr = IDirect3D9_GetAdapterDisplayMode(lpCtx->pD3D, glb.dwAdapter, &d3ddm);
- if (FAILED(hr))
- return FALSE;
-
- // Get info from the display format
- _BitsFromDisplayFormat(d3ddm.Format,
- &cColorBits, &cRedBits, &cGreenBits, &cBlueBits, &cAlphaBits);
-
- glddm->Width = d3ddm.Width;
- glddm->Height = d3ddm.Height;
- glddm->BPP = cColorBits;
- glddm->Refresh = d3ddm.RefreshRate;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/src/mesa/drivers/windows/gldirect/gldirect.rc b/src/mesa/drivers/windows/gldirect/gldirect.rc
deleted file mode 100644
index ba09631538a..00000000000
--- a/src/mesa/drivers/windows/gldirect/gldirect.rc
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: Windows Resource Compiler
-* Environment: Windows 95
-*
-****************************************************************************/
-
-#ifndef WORKSHOP_INVOKED
- #include <windows.h>
-#endif
-
-#define FILE_DESCRIPTION "SciTech GLDirect"
-#define ORIG_FILENAME "opengl32.dll"
-#define FILE_TYPE VFT_DLL
-
-#include "gldirect/gldver.ver"
diff --git a/src/mesa/drivers/windows/gldirect/mesasw/colors.h b/src/mesa/drivers/windows/gldirect/mesasw/colors.h
deleted file mode 100644
index 5660907aa51..00000000000
--- a/src/mesa/drivers/windows/gldirect/mesasw/colors.h
+++ /dev/null
@@ -1,523 +0,0 @@
-/* File name : colors.h
- * Version : 2.3
- *
- * Header file for display driver for Mesa 2.3 under
- * Windows95 and WindowsNT
- * This file defines macros and global variables needed
- * for converting color format
- *
- * Copyright (C) 1996- Li Wei
- * Address : Institute of Artificial Intelligence
- * : & Robotics
- * : Xi'an Jiaotong University
- * Email : liwei@aiar.xjtu.edu.cn
- * Web page : http://sun.aiar.xjtu.edu.cn
- *
- * This file and its associations are partially based on the
- * Windows NT driver for Mesa, written by Mark Leaming
- * (mark@rsinc.com).
- */
-
-/* $Log: ddcolors.h 1997/6/14 by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Macros for pixel format defined
- */
-
-/*
- * $Log: colors.h,v $
- * Revision 1.1 2004-04-20 11:13:11 alanh
- * add SciTech's GLDirect driver for Windows.
- *
- * This code is donated to Mesa which allows the usage of
- * a Direct3D layer (DX7, DX8, DX9 or complete software fallback).
- *
- * No build system exists for this code yet, that will come.....
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1999/01/03 03:08:57 brianp
- * Ted Jump's changes
- *
- * Revision 1.1 1999/01/03 03:08:12 brianp
- * Initial revision
- *
- * Revision 2.0.2 1997/4/30 15:58:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Add LUTs need for dithering
- */
-
-/*
- * $Log: colors.h,v $
- * Revision 1.1 2004-04-20 11:13:11 alanh
- * add SciTech's GLDirect driver for Windows.
- *
- * This code is donated to Mesa which allows the usage of
- * a Direct3D layer (DX7, DX8, DX9 or complete software fallback).
- *
- * No build system exists for this code yet, that will come.....
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1999/01/03 03:08:57 brianp
- * Ted Jump's changes
- *
- * Revision 1.1 1999/01/03 03:08:12 brianp
- * Initial revision
- *
- * Revision 2.0.1 1997/4/29 15:52:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Add BGR8 Macro
- */
-
-/*
- * $Log: colors.h,v $
- * Revision 1.1 2004-04-20 11:13:11 alanh
- * add SciTech's GLDirect driver for Windows.
- *
- * This code is donated to Mesa which allows the usage of
- * a Direct3D layer (DX7, DX8, DX9 or complete software fallback).
- *
- * No build system exists for this code yet, that will come.....
- *
- * Revision 1.1.1.1 1999/08/19 00:55:42 jtg
- * Imported sources
- *
- * Revision 1.2 1999/01/03 03:08:57 brianp
- * Ted Jump's changes
- *
- * Revision 1.1 1999/01/03 03:08:12 brianp
- * Initial revision
- *
- * Revision 2.0 1996/11/15 10:55:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
- * Initial revision
- */
-/* Values for wmesa->pixelformat: */
-
-#define PF_8A8B8G8R 3 /* 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */
-#define PF_8R8G8B 4 /* 32-bit TrueColor: 8-R, 8-G, 8-B */
-#define PF_5R6G5B 5 /* 16-bit TrueColor: 5-R, 6-G, 5-B bits */
-#define PF_DITHER8 6 /* Dithered RGB using a lookup table */
-#define PF_LOOKUP 7 /* Undithered RGB using a lookup table */
-#define PF_GRAYSCALE 10 /* Grayscale or StaticGray */
-#define PF_BADFORMAT 11
-#define PF_INDEX8 12
-
-char ColorMap16[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
-0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
-0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
-0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
-0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
-0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
-0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,
-0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
-0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,
-0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,
-0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,
-0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,
-0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
-0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
-0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
-0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
-0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,
-0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
-0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
-0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
-0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
-0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,
-0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
-0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,
-0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,
-0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,
-0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
-0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
-
-#define BGR8(r,g,b) (unsigned)(((BYTE)(b & 0xc0 | (g & 0xe0)>>2 | (r & 0xe0)>>5)))
-#ifdef DDRAW
-#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(g&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[r])) << 11)))
-#else
-#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(ColorMap16[g]) << 5)) | (((WORD)(BYTE)(ColorMap16[r])) << 10)))
-#endif
-#define BGR24(r,g,b) (unsigned long)(((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16))) << 8)
-#define BGR32(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))
-
-
-
-/*
- * If pixelformat==PF_8A8B8G8R:
- */
-#define PACK_8A8B8G8R( R, G, B, A ) \
- ( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) )
-
-
-/*
- * If pixelformat==PF_8R8G8B:
- */
-#define PACK_8R8G8B( R, G, B) ( ((R) << 16) | ((G) << 8) | (B) )
-
-
-/*
- * If pixelformat==PF_5R6G5B:
- */
-
-
-#ifdef DDRAW
-#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(G&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[R])) << 11)))
-#else
-#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(ColorMap16[G]) << 5)) | (((WORD)(BYTE)(ColorMap16[R])) << 10)))
-#endif
-/*----------------------------------------------------------------------------
-
-Division lookup tables. These tables compute 0-255 divided by 51 and
-modulo 51. These tables could approximate gamma correction.
-
-*/
-
-char unsigned const aDividedBy51Rounded[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-};
-
-char unsigned const aDividedBy51[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
-};
-
-char unsigned const aModulo51[256] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0,
-};
-
-/*----------------------------------------------------------------------------
-
-Multiplication LUTs. These compute 0-5 times 6 and 36.
-
-*/
-
-char unsigned const aTimes6[6] =
-{
- 0, 6, 12, 18, 24, 30
-};
-
-char unsigned const aTimes36[6] =
-{
- 0, 36, 72, 108, 144, 180
-};
-
-
-/*----------------------------------------------------------------------------
-
-Dither matrices for 8 bit to 2.6 bit halftones.
-
-*/
-
-char unsigned const aHalftone16x16[256] =
-{
- 0, 44, 9, 41, 3, 46, 12, 43, 1, 44, 10, 41, 3, 46, 12, 43,
- 34, 16, 25, 19, 37, 18, 28, 21, 35, 16, 26, 19, 37, 18, 28, 21,
- 38, 6, 47, 3, 40, 9, 50, 6, 38, 7, 47, 4, 40, 9, 49, 6,
- 22, 28, 13, 31, 25, 31, 15, 34, 22, 29, 13, 32, 24, 31, 15, 34,
- 2, 46, 12, 43, 1, 45, 10, 42, 2, 45, 11, 42, 1, 45, 11, 42,
- 37, 18, 27, 21, 35, 17, 26, 20, 36, 17, 27, 20, 36, 17, 26, 20,
- 40, 8, 49, 5, 38, 7, 48, 4, 39, 8, 48, 5, 39, 7, 48, 4,
- 24, 30, 15, 33, 23, 29, 13, 32, 23, 30, 14, 33, 23, 29, 14, 32,
- 2, 46, 12, 43, 0, 44, 10, 41, 3, 47, 12, 44, 0, 44, 10, 41,
- 37, 18, 27, 21, 35, 16, 25, 19, 37, 19, 28, 22, 35, 16, 25, 19,
- 40, 9, 49, 5, 38, 7, 47, 4, 40, 9, 50, 6, 38, 6, 47, 3,
- 24, 30, 15, 34, 22, 29, 13, 32, 25, 31, 15, 34, 22, 28, 13, 31,
- 1, 45, 11, 42, 2, 46, 11, 42, 1, 45, 10, 41, 2, 46, 11, 43,
- 36, 17, 26, 20, 36, 17, 27, 21, 35, 16, 26, 20, 36, 18, 27, 21,
- 39, 8, 48, 4, 39, 8, 49, 5, 38, 7, 48, 4, 39, 8, 49, 5,
- 23, 29, 14, 33, 24, 30, 14, 33, 23, 29, 13, 32, 24, 30, 14, 33,
-};
-
-char unsigned const aHalftone8x8[64] =
-{
- 0, 38, 9, 47, 2, 40, 11, 50,
- 25, 12, 35, 22, 27, 15, 37, 24,
- 6, 44, 3, 41, 8, 47, 5, 43,
- 31, 19, 28, 15, 34, 21, 31, 18,
- 1, 39, 11, 49, 0, 39, 10, 48,
- 27, 14, 36, 23, 26, 13, 35, 23,
- 7, 46, 4, 43, 7, 45, 3, 42,
- 33, 20, 30, 17, 32, 19, 29, 16,
-};
-
-char unsigned const aHalftone4x4_1[16] =
-{
- 0, 25, 6, 31,
- 38, 12, 44, 19,
- 9, 35, 3, 28,
- 47, 22, 41, 15
-};
-
-char unsigned const aHalftone4x4_2[16] =
-{
- 41, 3, 9, 28,
- 35, 15, 22, 47,
- 6, 25, 38, 0,
- 19, 44, 31, 12
-};
-
-/***************************************************************************
- aWinGHalftoneTranslation
-
- Translates a 2.6 bit-per-pixel halftoned representation into the
- slightly rearranged WinG Halftone Palette.
-*/
-
-char unsigned const aWinGHalftoneTranslation[216] =
-{
- 0,
- 29,
- 30,
- 31,
- 32,
- 249,
- 33,
- 34,
- 35,
- 36,
- 37,
- 38,
- 39,
- 40,
- 41,
- 42,
- 43,
- 44,
- 45,
- 46,
- 47,
- 48,
- 49,
- 50,
- 51,
- 52,
- 53,
- 54,
- 55,
- 56,
- 250,
- 250,
- 57,
- 58,
- 59,
- 251,
- 60,
- 61,
- 62,
- 63,
- 64,
- 65,
- 66,
- 67,
- 68,
- 69,
- 70,
- 71,
- 72,
- 73,
- 74,
- 75,
- 76,
- 77,
- 78,
- 79,
- 80,
- 81,
- 82,
- 83,
- 84,
- 85,
- 86,
- 87,
- 88,
- 89,
- 250,
- 90,
- 91,
- 92,
- 93,
- 94,
- 95,
- 96,
- 97,
- 98,
- 99,
- 100,
- 101,
- 102,
- 103,
- 104,
- 105,
- 106,
- 107,
- 108,
- 109,
- 110,
- 111,
- 227,
- 112,
- 113,
- 114,
- 115,
- 116,
- 117,
- 118,
- 119,
- 151,
- 120,
- 121,
- 122,
- 123,
- 124,
- 228,
- 125,
- 126,
- 229,
- 133,
- 162,
- 135,
- 131,
- 132,
- 137,
- 166,
- 134,
- 140,
- 130,
- 136,
- 143,
- 138,
- 139,
- 174,
- 141,
- 142,
- 177,
- 129,
- 144,
- 145,
- 146,
- 147,
- 148,
- 149,
- 150,
- 157,
- 152,
- 153,
- 154,
- 155,
- 156,
- 192,
- 158,
- 159,
- 160,
- 161,
- 196,
- 163,
- 164,
- 165,
- 127,
- 199,
- 167,
- 168,
- 169,
- 170,
- 171,
- 172,
- 173,
- 207,
- 175,
- 176,
- 210,
- 178,
- 179,
- 180,
- 181,
- 182,
- 183,
- 184,
- 185,
- 186,
- 187,
- 188,
- 189,
- 190,
- 191,
- 224,
- 193,
- 194,
- 195,
- 252,
- 252,
- 197,
- 198,
- 128,
- 253,
- 252,
- 200,
- 201,
- 202,
- 203,
- 204,
- 205,
- 206,
- 230,
- 208,
- 209,
- 231,
- 211,
- 212,
- 213,
- 214,
- 215,
- 216,
- 217,
- 218,
- 219,
- 220,
- 221,
- 222,
- 254,
- 223,
- 232,
- 225,
- 226,
- 255,
-}; \ No newline at end of file
diff --git a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
deleted file mode 100644
index 0f11b4fe513..00000000000
--- a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
+++ /dev/null
@@ -1,1719 +0,0 @@
-/****************************************************************************
-*
-* Mesa 3-D graphics library
-* Direct3D Driver Interface
-*
-* ========================================================================
-*
-* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, 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
-* SCITECH SOFTWARE INC 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.
-*
-* ======================================================================
-*
-* Language: ANSI C
-* Environment: Windows 9x/2000/XP/XBox (Win32)
-*
-* Description: Mesa Software WGL (WindowsGL)
-*
-****************************************************************************/
-
-#include <windows.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-#include "glheader.h"
-#include "colors.h"
-#include "context.h"
-#include "colormac.h"
-#include "dd.h"
-#include "depth.h"
-#include "extensions.h"
-#include "macros.h"
-#include "matrix.h"
-// #include "mem.h"
-//#include "mmath.h"
-#include "mtypes.h"
-#include "texformat.h"
-#include "texstore.h"
-#include "teximage.h"
-#include "array_cache/acache.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/s_context.h"
-#include "swrast/s_depth.h"
-#include "swrast/s_lines.h"
-#include "swrast/s_triangle.h"
-#include "swrast/s_trispan.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-
-#include "dglcontext.h"
-#include "gld_driver.h"
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-DGL_pixelFormat pfTemplateMesaSW =
-{
- {
- sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure
- 1, // Structure version - should be 1
- // Flags:
- PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface.
- PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM)
- PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM)
- PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing.
- PFD_DOUBLEBUFFER | // The buffer is double-buffered.
- 0, // Placeholder for easy commenting of above flags
- PFD_TYPE_RGBA, // Pixel type RGBA.
- 32, // Total colour bitplanes (excluding alpha bitplanes)
- 8, 0, // Red bits, shift
- 8, 8, // Green bits, shift
- 8, 16, // Blue bits, shift
- 8, 24, // Alpha bits, shift (destination alpha)
- 64, // Accumulator bits (total)
- 16, 16, 16, 16, // Accumulator bits: Red, Green, Blue, Alpha
- 16, // Depth bits
- 8, // Stencil bits
- 0, // Number of auxiliary buffers
- 0, // Layer type
- 0, // Specifies the number of overlay and underlay planes.
- 0, // Layer mask
- 0, // Specifies the transparent color or index of an underlay plane.
- 0 // Damage mask
- },
- 0, // Unused
-};
-
-//---------------------------------------------------------------------------
-// Extensions
-//---------------------------------------------------------------------------
-
-typedef struct {
- PROC proc;
- char *name;
-} GLD_extension;
-
-static GLD_extension GLD_extList[] = {
-#ifdef GL_EXT_polygon_offset
- { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" },
-#endif
- { (PROC)glBlendEquationEXT, "glBlendEquationEXT" },
- { (PROC)glBlendColorEXT, "glBlendColorExt" },
- { (PROC)glVertexPointerEXT, "glVertexPointerEXT" },
- { (PROC)glNormalPointerEXT, "glNormalPointerEXT" },
- { (PROC)glColorPointerEXT, "glColorPointerEXT" },
- { (PROC)glIndexPointerEXT, "glIndexPointerEXT" },
- { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" },
- { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" },
- { (PROC)glGetPointervEXT, "glGetPointervEXT" },
- { (PROC)glArrayElementEXT, "glArrayElementEXT" },
- { (PROC)glDrawArraysEXT, "glDrawArrayEXT" },
- { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" },
- { (PROC)glBindTextureEXT, "glBindTextureEXT" },
- { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" },
- { (PROC)glGenTexturesEXT, "glGenTexturesEXT" },
- { (PROC)glIsTextureEXT, "glIsTextureEXT" },
- { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" },
- { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" },
- { (PROC)glTexImage3DEXT, "glTexImage3DEXT" },
- { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" },
- { (PROC)glPointParameterfEXT, "glPointParameterfEXT" },
- { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" },
- { (PROC)glLockArraysEXT, "glLockArraysEXT" },
- { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" },
- { NULL, "\0" }
-};
-
-//---------------------------------------------------------------------------
-// WMesa Internal Functions
-//---------------------------------------------------------------------------
-
-#define PAGE_FILE 0xffffffff
-
-#define REDBITS 0x03
-#define REDSHIFT 0x00
-#define GREENBITS 0x03
-#define GREENSHIFT 0x03
-#define BLUEBITS 0x02
-#define BLUESHIFT 0x06
-
-typedef struct _dibSection {
- HDC hDC;
- HANDLE hFileMap;
- BOOL fFlushed;
- LPVOID base;
-} WMDIBSECTION, *PWMDIBSECTION;
-
-typedef struct wmesa_context {
- HWND Window;
- HDC hDC;
- HPALETTE hPalette;
- HPALETTE hOldPalette;
- HPEN hPen;
- HPEN hOldPen;
- HCURSOR hOldCursor;
- COLORREF crColor;
- // 3D projection stuff
- RECT drawRect;
- UINT uiDIBoffset;
- // OpenGL stuff
- HPALETTE hGLPalette;
- GLuint width;
- GLuint height;
- GLuint ScanWidth;
- GLboolean db_flag; //* double buffered?
- GLboolean rgb_flag; //* RGB mode?
- GLboolean dither_flag; //* use dither when 256 color mode for RGB?
- GLuint depth; //* bits per pixel (1, 8, 24, etc)
- ULONG pixel; // current color index or RGBA pixel value
- ULONG clearpixel; //* pixel for clearing the color buffers
- PBYTE ScreenMem; // WinG memory
- BITMAPINFO *IndexFormat;
- HPALETTE hPal; // Current Palette
- HPALETTE hPalHalfTone;
-
-
- WMDIBSECTION dib;
- BITMAPINFO bmi;
- HBITMAP hbmDIB;
- HBITMAP hOldBitmap;
- HBITMAP Old_Compat_BM;
- HBITMAP Compat_BM; // Bitmap for double buffering
- PBYTE pbPixels;
- int nColors;
- BYTE cColorBits;
- int pixelformat;
-
- RECT rectOffScreen;
- RECT rectSurface;
-// HWND hwnd;
- DWORD pitch;
- PBYTE addrOffScreen;
-
- // We always double-buffer, for performance reasons, but
- // we need to know which of SwapBuffers() or glFlush() to
- // handle. If we're emulating, then we update on Flush(),
- // otherwise we update on SwapBufers(). KeithH
- BOOL bEmulateSingleBuffer;
-} WMesaContext, *PWMC;
-
-#define GLD_GET_WMESA_DRIVER(c) (WMesaContext*)(c)->glPriv
-
-// TODO:
-GLint stereo_flag = 0 ;
-
-/* If we are double-buffering, we want to get the DC for the
- * off-screen DIB, otherwise the DC for the window.
- */
-#define DD_GETDC ((Current->db_flag) ? Current->dib.hDC : Current->hDC )
-#define DD_RELEASEDC
-
-#define FLIP(Y) (Current->height-(Y)-1)
-
-struct DISPLAY_OPTIONS {
- int stereo;
- int fullScreen;
- int mode;
- int bpp;
-};
-
-struct DISPLAY_OPTIONS displayOptions;
-
-//---------------------------------------------------------------------------
-
-static unsigned char threeto8[8] = {
- 0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377
-};
-
-static unsigned char twoto8[4] = {
- 0, 0x55, 0xaa, 0xff
-};
-
-static unsigned char oneto8[2] = {
- 0, 255
-};
-
-//---------------------------------------------------------------------------
-
-BYTE DITHER_RGB_2_8BIT( int red, int green, int blue, int pixel, int scanline)
-{
- char unsigned redtemp, greentemp, bluetemp, paletteindex;
-
- //*** now, look up each value in the halftone matrix
- //*** using an 8x8 ordered dither.
- redtemp = aDividedBy51[red]
- + (aModulo51[red] > aHalftone8x8[(pixel%8)*8
- + scanline%8]);
- greentemp = aDividedBy51[(char unsigned)green]
- + (aModulo51[green] > aHalftone8x8[
- (pixel%8)*8 + scanline%8]);
- bluetemp = aDividedBy51[(char unsigned)blue]
- + (aModulo51[blue] > aHalftone8x8[
- (pixel%8)*8 +scanline%8]);
-
- //*** recombine the halftoned rgb values into a palette index
- paletteindex =
- redtemp + aTimes6[greentemp] + aTimes36[bluetemp];
-
- //*** and translate through the wing halftone palette
- //*** translation vector to give the correct value.
- return aWinGHalftoneTranslation[paletteindex];
-}
-
-//---------------------------------------------------------------------------
-
-static unsigned char componentFromIndex(UCHAR i, UINT nbits, UINT shift)
-{
- unsigned char val;
-
- val = i >> shift;
- switch (nbits) {
-
- case 1:
- val &= 0x1;
- return oneto8[val];
-
- case 2:
- val &= 0x3;
- return twoto8[val];
-
- case 3:
- val &= 0x7;
- return threeto8[val];
-
- default:
- return 0;
- }
-}
-
-//---------------------------------------------------------------------------
-
-
-void wmSetPixel(PWMC pwc, int iScanLine, int iPixel, BYTE r, BYTE g, BYTE b)
-{
- WMesaContext *Current = pwc;
-
- // Test for invalid scanline parameter. KeithH
- if ((iScanLine < 0) || (iScanLine >= pwc->height))
- return;
-
- if (Current->db_flag) {
- LPBYTE lpb = pwc->pbPixels;
- UINT nBypp = pwc->cColorBits >> 3;
- UINT nOffset = iPixel % nBypp;
-
- lpb += pwc->ScanWidth * iScanLine;
- lpb += iPixel * nBypp;
-
- if(nBypp == 1){
- if(pwc->dither_flag)
- *lpb = DITHER_RGB_2_8BIT(r,g,b,iScanLine,iPixel);
- else
- *lpb = BGR8(r,g,b);
- }
- else if(nBypp == 2)
- *((LPWORD)lpb) = BGR16(r,g,b);
- else if (nBypp == 3)
- *((LPDWORD)lpb) = BGR24(r,g,b);
- else if (nBypp == 4)
- *((LPDWORD)lpb) = BGR32(r,g,b);
- }
- else{
- SetPixel(Current->hDC, iPixel, iScanLine, RGB(r,g,b));
- }
-}
-
-//---------------------------------------------------------------------------
-
-void wmCreateDIBSection(
- HDC hDC,
- PWMC pwc, // handle of device context
- CONST BITMAPINFO *pbmi, // bitmap size, format, and color data
- UINT iUsage // color data type indicator: RGB values or palette indices
- )
-{
- DWORD dwSize = 0;
- DWORD dwScanWidth;
- UINT nBypp = pwc->cColorBits / 8;
- HDC hic;
-
- dwScanWidth = (((pwc->ScanWidth * nBypp)+ 3) & ~3);
-
- pwc->ScanWidth =pwc->pitch = dwScanWidth;
-
- if (stereo_flag)
- pwc->ScanWidth = 2* pwc->pitch;
-
- dwSize = sizeof(BITMAPINFO) + (dwScanWidth * pwc->height);
-
- pwc->dib.hFileMap = CreateFileMapping((HANDLE)PAGE_FILE,
- NULL,
- PAGE_READWRITE | SEC_COMMIT,
- 0,
- dwSize,
- NULL);
-
- if (!pwc->dib.hFileMap)
- return;
-
- pwc->dib.base = MapViewOfFile(pwc->dib.hFileMap,
- FILE_MAP_ALL_ACCESS,
- 0,
- 0,
- 0);
-
- if(!pwc->dib.base){
- CloseHandle(pwc->dib.hFileMap);
- return;
- }
-
-
- CopyMemory(pwc->dib.base, pbmi, sizeof(BITMAPINFO));
-
- hic = CreateIC("display", NULL, NULL, NULL);
- pwc->dib.hDC = CreateCompatibleDC(hic);
-
-
- pwc->hbmDIB = CreateDIBSection(hic,
- &(pwc->bmi),
- (iUsage ? DIB_PAL_COLORS : DIB_RGB_COLORS),
- &(pwc->pbPixels),
- pwc->dib.hFileMap,
- 0);
- pwc->ScreenMem = pwc->addrOffScreen = pwc->pbPixels;
- pwc->hOldBitmap = SelectObject(pwc->dib.hDC, pwc->hbmDIB);
-
- DeleteDC(hic);
-
- return;
-
-}
-
-//---------------------------------------------------------------------------
-
-void wmCreatePalette( PWMC pwdc )
-{
- /* Create a compressed and re-expanded 3:3:2 palette */
- int i;
- LOGPALETTE *pPal;
- BYTE rb, rs, gb, gs, bb, bs;
-
- pwdc->nColors = 0x100;
-
- pPal = (PLOGPALETTE)malloc(sizeof(LOGPALETTE) +
- pwdc->nColors * sizeof(PALETTEENTRY));
- memset( pPal, 0, sizeof(LOGPALETTE) + pwdc->nColors * sizeof(PALETTEENTRY) );
-
- pPal->palVersion = 0x300;
-
- rb = REDBITS;
- rs = REDSHIFT;
- gb = GREENBITS;
- gs = GREENSHIFT;
- bb = BLUEBITS;
- bs = BLUESHIFT;
-
- if (pwdc->db_flag) {
-
- /* Need to make two palettes: one for the screen DC and one for the DIB. */
- pPal->palNumEntries = pwdc->nColors;
- for (i = 0; i < pwdc->nColors; i++) {
- pPal->palPalEntry[i].peRed = componentFromIndex( i, rb, rs );
- pPal->palPalEntry[i].peGreen = componentFromIndex( i, gb, gs );
- pPal->palPalEntry[i].peBlue = componentFromIndex( i, bb, bs );
- pPal->palPalEntry[i].peFlags = 0;
- }
- pwdc->hGLPalette = CreatePalette( pPal );
- pwdc->hPalette = CreatePalette( pPal );
- }
-
- else {
- pPal->palNumEntries = pwdc->nColors;
- for (i = 0; i < pwdc->nColors; i++) {
- pPal->palPalEntry[i].peRed = componentFromIndex( i, rb, rs );
- pPal->palPalEntry[i].peGreen = componentFromIndex( i, gb, gs );
- pPal->palPalEntry[i].peBlue = componentFromIndex( i, bb, bs );
- pPal->palPalEntry[i].peFlags = 0;
- }
- pwdc->hGLPalette = CreatePalette( pPal );
- }
-
- free(pPal);
-
-}
-
-//---------------------------------------------------------------------------
-
-/* This function sets the color table of a DIB section
- * to match that of the destination DC
- */
-BOOL wmSetDibColors(PWMC pwc)
-{
- RGBQUAD *pColTab, *pRGB;
- PALETTEENTRY *pPal, *pPE;
- int i, nColors;
- BOOL bRet=TRUE;
- DWORD dwErr=0;
-
- /* Build a color table in the DIB that maps to the
- * selected palette in the DC.
- */
- nColors = 1 << pwc->cColorBits;
- pPal = (PALETTEENTRY *)malloc( nColors * sizeof(PALETTEENTRY));
- memset( pPal, 0, nColors * sizeof(PALETTEENTRY) );
- GetPaletteEntries( pwc->hGLPalette, 0, nColors, pPal );
- pColTab = (RGBQUAD *)malloc( nColors * sizeof(RGBQUAD));
- for (i = 0, pRGB = pColTab, pPE = pPal; i < nColors; i++, pRGB++, pPE++) {
- pRGB->rgbRed = pPE->peRed;
- pRGB->rgbGreen = pPE->peGreen;
- pRGB->rgbBlue = pPE->peBlue;
- }
- if(pwc->db_flag)
- bRet = SetDIBColorTable(pwc->dib.hDC, 0, nColors, pColTab );
-
- if(!bRet)
- dwErr = GetLastError();
-
- free( pColTab );
- free( pPal );
-
- return bRet;
-}
-
-//---------------------------------------------------------------------------
-
-static void wmSetPixelFormat( PWMC wc, HDC hDC)
-{
- if(wc->rgb_flag)
- wc->cColorBits = GetDeviceCaps(hDC, BITSPIXEL);
- else
- wc->cColorBits = 8;
- switch(wc->cColorBits){
- case 8:
- if(wc->dither_flag != GL_TRUE)
- wc->pixelformat = PF_INDEX8;
- else
- wc->pixelformat = PF_DITHER8;
- break;
- case 16:
- wc->pixelformat = PF_5R6G5B;
- break;
- case 32:
- wc->pixelformat = PF_8R8G8B;
- break;
- default:
- wc->pixelformat = PF_BADFORMAT;
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * This function creates the DIB section that is used for combined
- * GL and GDI calls
- */
-BOOL wmCreateBackingStore(PWMC pwc, long lxSize, long lySize)
-{
- HDC hdc = pwc->hDC;
- LPBITMAPINFO pbmi = &(pwc->bmi);
- int iUsage;
-
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = lxSize;
- pbmi->bmiHeader.biHeight= -lySize;
- pbmi->bmiHeader.biPlanes = 1;
- if(pwc->rgb_flag)
- pbmi->bmiHeader.biBitCount = GetDeviceCaps(pwc->hDC, BITSPIXEL);
- else
- pbmi->bmiHeader.biBitCount = 8;
- pbmi->bmiHeader.biCompression = BI_RGB;
- pbmi->bmiHeader.biSizeImage = 0;
- pbmi->bmiHeader.biXPelsPerMeter = 0;
- pbmi->bmiHeader.biYPelsPerMeter = 0;
- pbmi->bmiHeader.biClrUsed = 0;
- pbmi->bmiHeader.biClrImportant = 0;
-
- iUsage = (pbmi->bmiHeader.biBitCount <= 8) ? DIB_PAL_COLORS : DIB_RGB_COLORS;
-
- pwc->cColorBits = pbmi->bmiHeader.biBitCount;
- pwc->ScanWidth = pwc->pitch = lxSize;
- pwc->width = lxSize;
- pwc->height = lySize;
-
- wmCreateDIBSection(hdc, pwc, pbmi, iUsage);
-
- if ((iUsage == DIB_PAL_COLORS) && !(pwc->hGLPalette)) {
- wmCreatePalette( pwc );
- wmSetDibColors( pwc );
- }
- wmSetPixelFormat(pwc, pwc->hDC);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * Free up the dib section that was created
- */
-BOOL wmDeleteBackingStore(PWMC pwc)
-{
- SelectObject(pwc->dib.hDC, pwc->hOldBitmap);
- DeleteDC(pwc->dib.hDC);
- DeleteObject(pwc->hbmDIB);
- UnmapViewOfFile(pwc->dib.base);
- CloseHandle(pwc->dib.hFileMap);
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * Blit memory DC to screen DC
- */
-BOOL wmFlush(PWMC pwc, HDC hDC)
-{
- BOOL bRet = 0;
- DWORD dwErr = 0;
-
-// Now using bEmulateSingleBuffer in the calling function. KeithH
-
-// if(pwc->db_flag){
- bRet = BitBlt(hDC, 0, 0, pwc->width, pwc->height,
- pwc->dib.hDC, 0, 0, SRCCOPY);
-// }
-
- return bRet;
-
-}
-
-//---------------------------------------------------------------------------
-// Support Functions
-//---------------------------------------------------------------------------
-
-static void flush(GLcontext* ctx)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
-/*
- if((Current->rgb_flag &&!(Current->db_flag))
- ||(!Current->rgb_flag))
- {
- wmFlush(Current, Current->hDC);
- }
-*/
- // Only flush if we're not in double-buffer mode. KeithH
- // The demo fractal.c calls glutSwapBuffers() then glFlush()!
- if (Current->bEmulateSingleBuffer) {
- wmFlush(Current, Current->hDC);
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Set the color index used to clear the color buffer.
- */
-static void clear_index(GLcontext* ctx, GLuint index)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- Current->clearpixel = index;
-}
-
-
-
-//---------------------------------------------------------------------------
-
-/*
- * Set the color used to clear the color buffer.
- */
-//static void clear_color( GLcontext* ctx, const GLchan color[4] )
-// Changed for Mesa 5.x. KeithH
-static void clear_color(
- GLcontext* ctx,
- const GLfloat color[4])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLubyte col[4];
- CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
- Current->clearpixel = RGB(col[0], col[1], col[2]);
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Clear the specified region of the color buffer using the clear color
- * or index as specified by one of the two functions above.
- *
- * This procedure clears either the front and/or the back COLOR buffers.
- * Only the "left" buffer is cleared since we are not stereo.
- * Clearing of the other non-color buffers is left to the swrast.
- * We also only clear the color buffers if the color masks are all 1's.
- * Otherwise, we let swrast do it.
- */
-
-static clear(GLcontext* ctx, GLbitfield mask,
- GLboolean all, GLint x, GLint y, GLint width, GLint height)
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- DWORD dwColor;
- WORD wColor;
- BYTE bColor;
- LPDWORD lpdw = (LPDWORD)Current->pbPixels;
- LPWORD lpw = (LPWORD)Current->pbPixels;
- LPBYTE lpb = Current->pbPixels;
- int lines;
- const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
-
- if (all){
- x=y=0;
- width=Current->width;
- height=Current->height;
- }
-
-
- /* sanity check - can't have right(stereo) buffers */
- assert((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT)) == 0);
-
- /* clear alpha */
- if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_RIGHT_BIT)) &&
- ctx->DrawBuffer->UseSoftwareAlphaBuffers &&
- ctx->Color.ColorMask[ACOMP]) {
- _swrast_clear_alpha_buffers( ctx );
- }
-
- if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) {
- if (mask & DD_BACK_LEFT_BIT) {
- /* Double-buffering - clear back buffer */
- UINT nBypp = Current->cColorBits / 8;
- int i = 0;
- int iSize = 0;
-
- assert(Current->db_flag==GL_TRUE); /* we'd better be double buffer */
- if(nBypp ==1 ){
- iSize = Current->width/4;
- bColor = BGR8(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- wColor = MAKEWORD(bColor,bColor);
- dwColor = MAKELONG(wColor, wColor);
- }
- if(nBypp == 2){
- iSize = Current->width / 2;
- wColor = BGR16(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- dwColor = MAKELONG(wColor, wColor);
- }
- else if(nBypp == 4){
- iSize = Current->width;
- dwColor = BGR32(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- }
-
- /* clear a line */
- while(i < iSize){
- *lpdw = dwColor;
- lpdw++;
- i++;
- }
-
- /* This is the 24bit case */
- if (nBypp == 3) {
- iSize = Current->width *3/4;
- dwColor = BGR24(GetRValue(Current->clearpixel),
- GetGValue(Current->clearpixel),
- GetBValue(Current->clearpixel));
- while(i < iSize){
- *lpdw = dwColor;
- lpb += nBypp;
- lpdw = (LPDWORD)lpb;
- i++;
- }
- }
-
- i = 0;
- if (stereo_flag)
- lines = height /2;
- else
- lines = height;
- /* copy cleared line to other lines in buffer */
- do {
- memcpy(lpb, Current->pbPixels, iSize*4);
- lpb += Current->ScanWidth;
- i++;
- }
- while (i<lines-1);
- mask &= ~DD_BACK_LEFT_BIT;
- } /* double-buffer */
-
- if (mask & DD_FRONT_LEFT_BIT) {
- /* single-buffer */
- HDC DC=DD_GETDC;
- HPEN Pen=CreatePen(PS_SOLID,1,Current->clearpixel);
- HBRUSH Brush=CreateSolidBrush(Current->clearpixel);
- HPEN Old_Pen=SelectObject(DC,Pen);
- HBRUSH Old_Brush=SelectObject(DC,Brush);
- Rectangle(DC,x,y,x+width,y+height);
- SelectObject(DC,Old_Pen);
- SelectObject(DC,Old_Brush);
- DeleteObject(Pen);
- DeleteObject(Brush);
- DD_RELEASEDC;
- mask &= ~DD_FRONT_LEFT_BIT;
- } /* single-buffer */
- } /* if masks are all 1's */
-
- /* Call swrast if there is anything left to clear (like DEPTH) */
- if (mask)
- _swrast_Clear( ctx, mask, all, x, y, width, height );
-}
-
-
-//---------------------------------------------------------------------------
-
-
-static void enable( GLcontext* ctx, GLenum pname, GLboolean enable )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
-
- if (!Current)
- return;
-
- if (pname == GL_DITHER) {
- if(enable == GL_FALSE){
- Current->dither_flag = GL_FALSE;
- if(Current->cColorBits == 8)
- Current->pixelformat = PF_INDEX8;
- }
- else{
- if (Current->rgb_flag && Current->cColorBits == 8){
- Current->pixelformat = PF_DITHER8;
- Current->dither_flag = GL_TRUE;
- }
- else
- Current->dither_flag = GL_FALSE;
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode )
-{
- /* TODO: this could be better */
- if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) {
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-//---------------------------------------------------------------------------
-
-
-static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum buffer )
-{
- /* XXX todo */
- return;
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/* Return characteristics of the output buffer. */
-//static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height )
-// Altered for Mesa 5.x. KeithH
-static void buffer_size(
- GLframebuffer *buffer,
- GLuint *width,
- GLuint *height)
-{
- // For some reason the context is not passed into this function.
- // Therefore we have to explicitly retrieve it.
- GET_CURRENT_CONTEXT(ctx);
-
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- int New_Size;
- RECT CR;
-
- GetClientRect(Current->Window,&CR);
-
- *width=CR.right;
- *height=CR.bottom;
-
- New_Size=((*width)!=Current->width) || ((*height)!=Current->height);
-
- if (New_Size){
- Current->width=*width;
- Current->height=*height;
- Current->ScanWidth=Current->width;
- if ((Current->ScanWidth%sizeof(long))!=0)
- Current->ScanWidth+=(sizeof(long)-(Current->ScanWidth%sizeof(long)));
-
- if (Current->db_flag){
- if (Current->rgb_flag==GL_TRUE && Current->dither_flag!=GL_TRUE){
- wmDeleteBackingStore(Current);
- wmCreateBackingStore(Current, Current->width, Current->height);
- }
- }
-
- }
-}
-
-
-
-/**********************************************************************/
-/***** Accelerated point, line, polygon rendering *****/
-/**********************************************************************/
-
-/* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */
-
-static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last )
-{
-}
-
-//---------------------------------------------------------------------------
-
-/* Return pointer to accelerated points function */
-extern tnl_points_func choose_points_function( GLcontext* ctx )
-{
- return NULL;
-}
-
-//---------------------------------------------------------------------------
-
-static void fast_flat_rgb_line( GLcontext* ctx, GLuint v0,
- GLuint v1, GLuint pv )
-{
-}
-
-//---------------------------------------------------------------------------
-
-static tnl_line_func choose_line_function( GLcontext* ctx )
-{
-}
-
-
-/**********************************************************************/
-/***** Span-based pixel drawing *****/
-/**********************************************************************/
-
-
-/* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */
-static void write_ci32_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLuint index[],
- const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PBYTE Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i]=index[i];
-}
-
-
-//---------------------------------------------------------------------------
-
-/* Write a horizontal span of 8-bit color-index pixels with a boolean mask. */
-static void write_ci8_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte index[],
- const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PBYTE Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i]=index[i];
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Write a horizontal span of pixels with a boolean mask. The current
- * color index is used for all pixels.
- */
-static void write_mono_ci_span(const GLcontext* ctx,
- GLuint n,GLint x,GLint y,
- GLuint colorIndex, const GLubyte mask[])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- BYTE *Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i]=colorIndex;
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * To improve the performance of this routine, frob the data into an actual
- * scanline and call bitblt on the complete scan line instead of SetPixel.
- */
-
-/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- PWMC pwc = Current;
-
- if (pwc->rgb_flag==GL_TRUE)
- {
- GLuint i;
- HDC DC=DD_GETDC;
- y=FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, y, x + i,
- rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);
- }
- else {
- for (i=0; i<n; i++)
- wmSetPixel(pwc, y, x + i,
- rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
- }
- DD_RELEASEDC;
- }
- else
- {
- GLuint i;
- BYTE *Mem=Current->ScreenMem+y*Current->ScanWidth+x;
- y = FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]));
- }
- else {
- for (i=0; i<n; i++)
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgba[i][RCOMP],
- rgba[i][GCOMP],
- rgba[i][BCOMP]));
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- PWMC pwc = Current;
-
- if (pwc->rgb_flag==GL_TRUE)
- {
- GLuint i;
- HDC DC=DD_GETDC;
- y=FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, y, x + i,
- rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);
- }
- else {
- for (i=0; i<n; i++)
- wmSetPixel(pwc, y, x + i,
- rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );
- }
- DD_RELEASEDC;
- }
- else
- {
- GLuint i;
- BYTE *Mem=Current->ScreenMem+y*Current->ScanWidth+x;
- y = FLIP(y);
- if (mask) {
- for (i=0; i<n; i++)
- if (mask[i])
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgb[i][RCOMP],
- rgb[i][GCOMP],
- rgb[i][BCOMP]));
- }
- else {
- for (i=0; i<n; i++)
- Mem[i] = GetNearestPaletteIndex(Current->hPal,
- RGB(rgb[i][RCOMP],
- rgb[i][GCOMP],
- rgb[i][BCOMP]));
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-/*
- * Write a horizontal span of pixels with a boolean mask. The current color
- * is used for all pixels.
- */
-static void write_mono_rgba_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- ULONG pixel = RGB( color[RCOMP], color[GCOMP], color[BCOMP] );
- GLuint i;
- HDC DC=DD_GETDC;
- PWMC pwc = Current;
- assert(Current->rgb_flag==GL_TRUE);
- y=FLIP(y);
- if(Current->rgb_flag==GL_TRUE){
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc,y,x+i,color[RCOMP], color[GCOMP], color[BCOMP]);
- }
- else {
- for (i=0; i<n; i++)
- if (mask[i])
- SetPixel(DC, y, x+i, pixel);
- }
- DD_RELEASEDC;
-}
-
-
-
-/**********************************************************************/
-/***** Array-based pixel drawing *****/
-/**********************************************************************/
-
-
-/* Write an array of 32-bit index pixels with a boolean mask. */
-static void write_ci32_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint index[], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i];
- *Mem = index[i];
- }
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Write an array of pixels with a boolean mask. The current color
- * index is used for all pixels.
- */
-static void write_mono_ci_pixels( const GLcontext* ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- GLuint colorIndex, const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i];
- *Mem = colorIndex;
- }
- }
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PWMC pwc = Current;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, FLIP(y[i]), x[i],
- rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);
- DD_RELEASEDC;
-}
-
-
-//---------------------------------------------------------------------------
-
-
-/*
- * Write an array of pixels with a boolean mask. The current color
- * is used for all pixels.
- */
-static void write_mono_rgba_pixels( const GLcontext* ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4],
- const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- PWMC pwc = Current;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- for (i=0; i<n; i++)
- if (mask[i])
- wmSetPixel(pwc, FLIP(y[i]),x[i],color[RCOMP],
- color[GCOMP], color[BCOMP]);
- DD_RELEASEDC;
-}
-
-/**********************************************************************/
-/***** Read spans/arrays of pixels *****/
-/**********************************************************************/
-
-/* Read a horizontal span of color-index pixels. */
-static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y,
- GLuint index[])
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- BYTE *Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++)
- index[i]=Mem[i];
-}
-
-//---------------------------------------------------------------------------
-
-/* Read an array of color index pixels. */
-static void read_ci32_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint indx[], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- assert(Current->rgb_flag==GL_FALSE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- indx[i]=*(Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]);
- }
- }
-}
-
-//---------------------------------------------------------------------------
-
-/* Read a horizontal span of color pixels. */
-static void read_rgba_span( const GLcontext* ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- UINT i;
- COLORREF Color;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- y = Current->height - y - 1;
- for (i=0; i<n; i++) {
- Color=GetPixel(DC,x+i,y);
- rgba[i][RCOMP] = GetRValue(Color);
- rgba[i][GCOMP] = GetGValue(Color);
- rgba[i][BCOMP] = GetBValue(Color);
- rgba[i][ACOMP] = 255;
- }
- DD_RELEASEDC;
-}
-
-//---------------------------------------------------------------------------
-
-/* Read an array of color pixels. */
-static void read_rgba_pixels( const GLcontext* ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[] )
-{
- GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
- WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
- GLuint i;
- COLORREF Color;
- HDC DC=DD_GETDC;
- assert(Current->rgb_flag==GL_TRUE);
- for (i=0; i<n; i++) {
- if (mask[i]) {
- GLint y2 = Current->height - y[i] - 1;
- Color=GetPixel(DC,x[i],y2);
- rgba[i][RCOMP] = GetRValue(Color);
- rgba[i][GCOMP] = GetGValue(Color);
- rgba[i][BCOMP] = GetBValue(Color);
- rgba[i][ACOMP] = 255;
- }
- }
- DD_RELEASEDC;
-}
-
-//---------------------------------------------------------------------------
-
-static void wmesa_update_state(
- GLcontext *ctx,
- GLuint new_state)
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-//---------------------------------------------------------------------------
-
-static void wmesa_viewport(
- GLcontext *ctx,
- GLint x,
- GLint y,
- GLsizei w,
- GLsizei h)
-{
-// ctx->Driver.ResizeBuffersMESA(ctx);
-}
-
-//---------------------------------------------------------------------------
-
-static void wmesa_update_state_first_time(
- GLcontext *ctx,
- GLuint new_state)
-{
- struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- /*
- * XXX these function pointers could be initialized just once during
- * context creation since they don't depend on any state changes.
- * kws - This is true - this function gets called a lot and it
- * would be good to minimize setting all this when not needed.
- */
- // Good idea, so I'll do it. KeithH. :-)
-
- ctx->Driver.GetString = _gldGetStringGeneric;
- ctx->Driver.UpdateState = wmesa_update_state;
- ctx->Driver.DrawBuffer = set_draw_buffer;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetBufferSize = buffer_size;
-
- ctx->Driver.Viewport = wmesa_viewport;
-
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.Clear = clear;
-
- ctx->Driver.Flush = flush;
- ctx->Driver.ClearIndex = clear_index;
- ctx->Driver.ClearColor = clear_color;
- ctx->Driver.Enable = enable;
-
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
-
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- // Does not apply for Mesa 5.x
- //ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
- //ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
- //ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
-
- swdd->SetBuffer = set_read_buffer;
-
-
- /* Pixel/span writing functions: */
- swdd->WriteRGBASpan = write_rgba_span;
- swdd->WriteRGBSpan = write_rgb_span;
- swdd->WriteMonoRGBASpan = write_mono_rgba_span;
- swdd->WriteRGBAPixels = write_rgba_pixels;
- swdd->WriteMonoRGBAPixels = write_mono_rgba_pixels;
- swdd->WriteCI32Span = write_ci32_span;
- swdd->WriteCI8Span = write_ci8_span;
- swdd->WriteMonoCISpan = write_mono_ci_span;
- swdd->WriteCI32Pixels = write_ci32_pixels;
- swdd->WriteMonoCIPixels = write_mono_ci_pixels;
-
- swdd->ReadCI32Span = read_ci32_span;
- swdd->ReadRGBASpan = read_rgba_span;
- swdd->ReadCI32Pixels = read_ci32_pixels;
- swdd->ReadRGBAPixels = read_rgba_pixels;
-
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
- wmesa_update_state(ctx, new_state);
-}
-
-//---------------------------------------------------------------------------
-// Driver interface functions
-//---------------------------------------------------------------------------
-
-BOOL gldCreateDrawable_MesaSW(
- DGL_ctx *pCtx,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- WMesaContext *c;
- GLboolean true_color_flag;
- GLboolean rgb_flag = GL_TRUE;
- GLboolean db_flag = GL_TRUE;
-
- if (pCtx == NULL)
- return FALSE;
-
- c = (struct wmesa_context * ) calloc(1,sizeof(struct wmesa_context));
- if (!c)
- return FALSE;
-
- pCtx->glPriv = c;
-
- c->hDC = pCtx->hDC;
- c->Window = pCtx->hWnd;
-
- true_color_flag = GetDeviceCaps(pCtx->hDC, BITSPIXEL) > 8;
-
-
-#ifdef DITHER
- if ((true_color_flag==GL_FALSE) && (rgb_flag == GL_TRUE)){
- c->dither_flag = GL_TRUE;
- c->hPalHalfTone = WinGCreateHalftonePalette();
- }
- else
- c->dither_flag = GL_FALSE;
-#else
- c->dither_flag = GL_FALSE;
-#endif
-
-
- if (rgb_flag==GL_FALSE)
- {
- c->rgb_flag = GL_FALSE;
-#if 0
- /* Old WinG stuff???? */
- c->db_flag = db_flag =GL_TRUE; /* WinG requires double buffering */
- printf("Single buffer is not supported in color index mode, ",
- "setting to double buffer.\n");
-#endif
- }
- else
- {
- c->rgb_flag = GL_TRUE;
- }
-
-// db_flag = pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER ? GL_TRUE : GL_FALSE;
- db_flag = GL_TRUE; // Force double-buffer
- if (db_flag) {
- c->db_flag = 1;
- /* Double buffered */
- {
- wmCreateBackingStore(c, pCtx->dwWidth, pCtx->dwHeight);
-
- }
- } else {
- /* Single Buffered */
- if (c->rgb_flag)
- c->db_flag = 0;
- }
-
- c->bEmulateSingleBuffer = (pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER)
- ? FALSE : TRUE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldResizeDrawable_MesaSW(
- DGL_ctx *ctx,
- BOOL bDefaultDriver,
- BOOL bPersistantInterface,
- BOOL bPersistantBuffers)
-{
- WMesaContext *c;
-
- if (ctx == NULL)
- return FALSE;
-
- c = ctx->glPriv;
- if (c == NULL)
- return FALSE;
-
- c->hDC = ctx->hDC;
- c->Window = ctx->hWnd;
-// c->width = ctx->dwWidth;
-// c->height = ctx->dwHeight;
-
- if (c->db_flag) {
- wmDeleteBackingStore(c);
- wmCreateBackingStore(c, ctx->dwWidth, ctx->dwHeight);
- }
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyDrawable_MesaSW(
- DGL_ctx *ctx)
-{
- WMesaContext *c;
-
- if (ctx == NULL)
- return FALSE;
-
- c = ctx->glPriv;
- if (c == NULL)
- return FALSE;
-
- if (c->hPalHalfTone != NULL)
- DeleteObject(c->hPalHalfTone);
-
- if (c->db_flag)
- wmDeleteBackingStore(c);
-
- free(c);
-
- ctx->glPriv = NULL;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldCreatePrivateGlobals_MesaSW(void)
-{
- // Mesa Software driver needs no private globals
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldDestroyPrivateGlobals_MesaSW(void)
-{
- // Mesa Software driver needs no private globals
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldBuildPixelformatList_MesaSW(void)
-{
- // Release any existing pixelformat list
- if (glb.lpPF) {
- free(glb.lpPF);
- }
-
- glb.nPixelFormatCount = 0;
- glb.lpPF = NULL;
-
- glb.lpPF = (DGL_pixelFormat *)calloc(2, sizeof(DGL_pixelFormat));
- if (glb.lpPF == NULL)
- return FALSE;
- // Single-buffered
- memcpy(&glb.lpPF[0], &pfTemplateMesaSW, sizeof(DGL_pixelFormat));
- glb.lpPF[0].pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag
- // Double-buffered
- memcpy(&glb.lpPF[1], &pfTemplateMesaSW, sizeof(DGL_pixelFormat));
- glb.nPixelFormatCount = 2;
-
- // Mark list as 'current'
- glb.bPixelformatsDirty = FALSE;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldInitialiseMesa_MesaSW(
- DGL_ctx *gld)
-{
- GLcontext *ctx;
-
- if (gld == NULL)
- return FALSE;
-
- ctx = gld->glCtx;
-
- // Set max texture size to 256
- ctx->Const.MaxTextureLevels = 8;
-
- // Multitexture enable/disable
- ctx->Const.MaxTextureUnits = (glb.bMultitexture) ? MAX_TEXTURE_UNITS : 1;
-
- /* Initialize the software rasterizer and helper modules.*/
-
- // Added this to force max texture diminsion to 256. KeithH
- ctx->Const.MaxTextureLevels = 8;
-
- _mesa_enable_sw_extensions(ctx);
- _mesa_enable_imaging_extensions(ctx);
- _mesa_enable_1_3_extensions(ctx);
-
-// _swrast_CreateContext( ctx );
-// _ac_CreateContext( ctx );
-// _tnl_CreateContext( ctx );
-// _swsetup_CreateContext( ctx );
-
- _swsetup_Wakeup( ctx );
-
- wmesa_update_state_first_time(ctx, ~0);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldSwapBuffers_MesaSW(
- DGL_ctx *ctx,
- HDC hDC,
- HWND hWnd)
-{
- WMesaContext *c;
-
- if (ctx == NULL)
- return FALSE;
-
- c = ctx->glPriv;
- if (c == NULL)
- return FALSE;
-
- /* If we're swapping the buffer associated with the current context
- * we have to flush any pending rendering commands first.
- */
-
- // Altered to respect bEmulateSingleBuffer. KeithH
-// if (c->db_flag)
- if (!c->bEmulateSingleBuffer)
- wmFlush(c, hDC);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
-PROC gldGetProcAddress_MesaSW(
- LPCSTR a)
-{
- int i;
- PROC proc = NULL;
-
- for (i=0; GLD_extList[i].proc; i++) {
- if (!strcmp(a, GLD_extList[i].name)) {
- proc = GLD_extList[i].proc;
- break;
- }
- }
-
- gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed");
-
- return proc;
-}
-
-//---------------------------------------------------------------------------
-
-BOOL gldGetDisplayMode_MesaSW(
- DGL_ctx *ctx,
- GLD_displayMode *glddm)
-{
- HDC hdcDesktop;
-
- if (glddm == NULL)
- return FALSE;
-
- //
- // A bit hacky... KeithH
- //
-
- hdcDesktop = GetDC(NULL);
- glddm->Width = GetDeviceCaps(hdcDesktop, HORZRES);
- glddm->Height = GetDeviceCaps(hdcDesktop, VERTRES);
- glddm->BPP = GetDeviceCaps(hdcDesktop, BITSPIXEL);
- glddm->Refresh = 0;
- ReleaseDC(0, hdcDesktop);
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-
diff --git a/src/mesa/drivers/windows/gldirect/opengl32.ref b/src/mesa/drivers/windows/gldirect/opengl32.ref
deleted file mode 100644
index 2f71faf2167..00000000000
--- a/src/mesa/drivers/windows/gldirect/opengl32.ref
+++ /dev/null
@@ -1,495 +0,0 @@
-;****************************************************************************
-;*
-;* Mesa 3-D graphics library
-;* Direct3D Driver Interface
-;*
-;* ========================================================================
-;*
-;* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
-;*
-;* Permission is hereby granted, free of charge, to any person obtaining a
-;* copy of this software and associated documentation files (the "Software"),
-;* to deal in the Software without restriction, including without limitation
-;* the rights to use, copy, modify, merge, publish, distribute, 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
-;* SCITECH SOFTWARE INC 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.
-;*
-;* ======================================================================
-;*
-;* Language: ANSI C
-;* Environment: Windows 9x/2000/XP/XBox (Win32)
-;*
-;* Description: DLL Module definition file
-;*
-;****************************************************************************/
-
-DESCRIPTION 'GLDirect'
-
-VERSION 3.0
-
-EXPORTS
- glAccum
- glAlphaFunc
- glAreTexturesResident
- glArrayElement
- glBegin
- glBindTexture
- glBitmap
- glBlendFunc
- glCallList
- glCallLists
- glClear
- glClearAccum
- glClearIndex
- glClearColor
- glClearDepth
- glClearStencil
- glClipPlane
- glColor3b
- glColor3d
- glColor3f
- glColor3i
- glColor3s
- glColor3ub
- glColor3ui
- glColor3us
- glColor4b
- glColor4d
- glColor4f
- glColor4i
- glColor4s
- glColor4ub
- glColor4ui
- glColor4us
- glColor3bv
- glColor3dv
- glColor3fv
- glColor3iv
- glColor3sv
- glColor3ubv
- glColor3uiv
- glColor3usv
- glColor4bv
- glColor4dv
- glColor4fv
- glColor4iv
- glColor4sv
- glColor4ubv
- glColor4uiv
- glColor4usv
- glColorMask
- glColorMaterial
- glColorPointer
- glColorTableEXT
- glColorSubTableEXT
- glCopyPixels
- glCopyTexImage1D
- glCopyTexImage2D
- glCopyTexSubImage1D
- glCopyTexSubImage2D
- glCullFace
- glDepthFunc
- glDepthMask
- glDepthRange
- glDeleteLists
- glDeleteTextures
- glDisable
- glDisableClientState
- glDrawArrays
- glDrawBuffer
- glDrawElements
- glDrawPixels
- glEnable
- glEnableClientState
- glEnd
- glEndList
- glEvalCoord1d
- glEvalCoord1f
- glEvalCoord1dv
- glEvalCoord1fv
- glEvalCoord2d
- glEvalCoord2f
- glEvalCoord2dv
- glEvalCoord2fv
- glEvalPoint1
- glEvalPoint2
- glEvalMesh1
- glEdgeFlag
- glEdgeFlagv
- glEdgeFlagPointer
- glEvalMesh2
- glFeedbackBuffer
- glFinish
- glFlush
- glFogf
- glFogi
- glFogfv
- glFogiv
- glFrontFace
- glFrustum
- glGenLists
- glGenTextures
- glGetBooleanv
- glGetClipPlane
- glGetColorTableEXT
- glGetColorTableParameterivEXT
- glGetColorTableParameterfvEXT
- glGetDoublev
- glGetError
- glGetFloatv
- glGetIntegerv
- glGetLightfv
- glGetLightiv
- glGetMapdv
- glGetMapfv
- glGetMapiv
- glGetMaterialfv
- glGetMaterialiv
- glGetPixelMapfv
- glGetPixelMapuiv
- glGetPixelMapusv
- glGetPointerv
- glGetPolygonStipple
- glGetString
- glGetTexEnvfv
- glGetTexEnviv
- glGetTexGeniv
- glGetTexGendv
- glGetTexGenfv
- glGetTexImage
- glGetTexLevelParameterfv
- glGetTexLevelParameteriv
- glGetTexParameterfv
- glGetTexParameteriv
- glHint
- glIndexd
- glIndexf
- glIndexi
- glIndexs
- glIndexub
- glIndexdv
- glIndexfv
- glIndexiv
- glIndexsv
- glIndexubv
- glIndexMask
- glIndexPointer
- glInterleavedArrays
- glInitNames
- glIsList
- glIsTexture
- glLightf
- glLighti
- glLightfv
- glLightiv
- glLightModelf
- glLightModeli
- glLightModelfv
- glLightModeliv
- glLineWidth
- glLineStipple
- glListBase
- glLoadIdentity
- glLoadMatrixd
- glLoadMatrixf
- glLoadName
- glLogicOp
- glMap1d
- glMap1f
- glMap2d
- glMap2f
- glMapGrid1d
- glMapGrid1f
- glMapGrid2d
- glMapGrid2f
- glMaterialf
- glMateriali
- glMaterialfv
- glMaterialiv
- glMatrixMode
- glMultMatrixd
- glMultMatrixf
- glNewList
- glNormal3b
- glNormal3d
- glNormal3f
- glNormal3i
- glNormal3s
- glNormal3bv
- glNormal3dv
- glNormal3fv
- glNormal3iv
- glNormal3sv
- glNormalPointer
- glOrtho
- glPassThrough
- glPixelMapfv
- glPixelMapuiv
- glPixelMapusv
- glPixelStoref
- glPixelStorei
- glPixelTransferf
- glPixelTransferi
- glPixelZoom
- glPointSize
- glPolygonMode
- glPolygonOffset
- glPolygonOffsetEXT
- glPolygonStipple
- glPopAttrib
- glPopClientAttrib
- glPopMatrix
- glPopName
- glPrioritizeTextures
- glPushMatrix
- glRasterPos2d
- glRasterPos2f
- glRasterPos2i
- glRasterPos2s
- glRasterPos3d
- glRasterPos3f
- glRasterPos3i
- glRasterPos3s
- glRasterPos4d
- glRasterPos4f
- glRasterPos4i
- glRasterPos4s
- glRasterPos2dv
- glRasterPos2fv
- glRasterPos2iv
- glRasterPos2sv
- glRasterPos3dv
- glRasterPos3fv
- glRasterPos3iv
- glRasterPos3sv
- glRasterPos4dv
- glRasterPos4fv
- glRasterPos4iv
- glRasterPos4sv
- glReadBuffer
- glReadPixels
- glRectd
- glRectf
- glRecti
- glRects
- glRectdv
- glRectfv
- glRectiv
- glRectsv
- glScissor
- glIsEnabled
- glPushAttrib
- glPushClientAttrib
- glPushName
- glRenderMode
- glRotated
- glRotatef
- glSelectBuffer
- glScaled
- glScalef
- glShadeModel
- glStencilFunc
- glStencilMask
- glStencilOp
- glTexCoord1d
- glTexCoord1f
- glTexCoord1i
- glTexCoord1s
- glTexCoord2d
- glTexCoord2f
- glTexCoord2i
- glTexCoord2s
- glTexCoord3d
- glTexCoord3f
- glTexCoord3i
- glTexCoord3s
- glTexCoord4d
- glTexCoord4f
- glTexCoord4i
- glTexCoord4s
- glTexCoord1dv
- glTexCoord1fv
- glTexCoord1iv
- glTexCoord1sv
- glTexCoord2dv
- glTexCoord2fv
- glTexCoord2iv
- glTexCoord2sv
- glTexCoord3dv
- glTexCoord3fv
- glTexCoord3iv
- glTexCoord3sv
- glTexCoord4dv
- glTexCoord4fv
- glTexCoord4iv
- glTexCoord4sv
- glTexCoordPointer
- glTexGend
- glTexGenf
- glTexGeni
- glTexGendv
- glTexGeniv
- glTexGenfv
- glTexEnvf
- glTexEnvi
- glTexEnvfv
- glTexEnviv
- glTexImage1D
- glTexImage2D
- glTexParameterf
- glTexParameteri
- glTexParameterfv
- glTexParameteriv
- glTexSubImage1D
- glTexSubImage2D
- glTranslated
- glTranslatef
- glVertex2d
- glVertex2f
- glVertex2i
- glVertex2s
- glVertex3d
- glVertex3f
- glVertex3i
- glVertex3s
- glVertex4d
- glVertex4f
- glVertex4i
- glVertex4s
- glVertex2dv
- glVertex2fv
- glVertex2iv
- glVertex2sv
- glVertex3dv
- glVertex3fv
- glVertex3iv
- glVertex3sv
- glVertex4dv
- glVertex4fv
- glVertex4iv
- glVertex4sv
- glVertexPointer
- glViewport
-
- glBlendEquationEXT
- glBlendColorEXT
- glVertexPointerEXT
- glNormalPointerEXT
- glColorPointerEXT
- glIndexPointerEXT
- glTexCoordPointerEXT
- glEdgeFlagPointerEXT
- glGetPointervEXT
- glArrayElementEXT
- glDrawArraysEXT
- glBindTextureEXT
- glDeleteTexturesEXT
- glGenTexturesEXT
- glPrioritizeTexturesEXT
- glCopyTexSubImage3DEXT
- glTexImage3DEXT
- glTexSubImage3DEXT
-
- glWindowPos4fMESA
- glWindowPos2iMESA
- glWindowPos2sMESA
- glWindowPos2fMESA
- glWindowPos2dMESA
- glWindowPos2ivMESA
- glWindowPos2svMESA
- glWindowPos2fvMESA
- glWindowPos2dvMESA
- glWindowPos3iMESA
- glWindowPos3sMESA
- glWindowPos3fMESA
- glWindowPos3dMESA
- glWindowPos3ivMESA
- glWindowPos3svMESA
- glWindowPos3fvMESA
- glWindowPos3dvMESA
- glWindowPos4iMESA
- glWindowPos4sMESA
- glWindowPos4dMESA
- glWindowPos4ivMESA
- glWindowPos4svMESA
- glWindowPos4fvMESA
- glWindowPos4dvMESA
- glResizeBuffersMESA
-
- wglCopyContext
- wglCreateContext
- wglCreateLayerContext
- wglDeleteContext
- wglDescribeLayerPlane
- wglGetCurrentContext
- wglGetCurrentDC
- wglGetLayerPaletteEntries
- wglGetProcAddress
- wglMakeCurrent
- wglRealizeLayerPalette
- wglSetLayerPaletteEntries
- wglShareLists
- wglSwapLayerBuffers
- wglUseFontBitmapsA
- wglUseFontBitmapsW
- wglUseFontOutlinesA
- wglUseFontOutlinesW
-
-;These functions are identical and therefore share the same addresses
- ChoosePixelFormat = wglChoosePixelFormat
- DescribePixelFormat = wglDescribePixelFormat
- GetPixelFormat = wglGetPixelFormat
- SetPixelFormat = wglSetPixelFormat
- SwapBuffers = wglSwapBuffers
-
- wglChoosePixelFormat
- wglDescribePixelFormat
- wglGetPixelFormat
- wglSetPixelFormat
- wglSwapBuffers
-
- glActiveTextureARB
- glClientActiveTextureARB
- glMultiTexCoord1dARB
- glMultiTexCoord1dvARB
- glMultiTexCoord1fARB
- glMultiTexCoord1fvARB
- glMultiTexCoord1iARB
- glMultiTexCoord1ivARB
- glMultiTexCoord1sARB
- glMultiTexCoord1svARB
- glMultiTexCoord2dARB
- glMultiTexCoord2dvARB
- glMultiTexCoord2fARB
- glMultiTexCoord2fvARB
- glMultiTexCoord2iARB
- glMultiTexCoord2ivARB
- glMultiTexCoord2sARB
- glMultiTexCoord2svARB
- glMultiTexCoord3dARB
- glMultiTexCoord3dvARB
- glMultiTexCoord3fARB
- glMultiTexCoord3fvARB
- glMultiTexCoord3iARB
- glMultiTexCoord3ivARB
- glMultiTexCoord3sARB
- glMultiTexCoord3svARB
- glMultiTexCoord4dARB
- glMultiTexCoord4dvARB
- glMultiTexCoord4fARB
- glMultiTexCoord4fvARB
- glMultiTexCoord4iARB
- glMultiTexCoord4ivARB
- glMultiTexCoord4sARB
- glMultiTexCoord4svARB
diff --git a/src/mesa/glapi/.cvsignore b/src/mesa/glapi/.cvsignore
deleted file mode 100644
index e706bc23cab..00000000000
--- a/src/mesa/glapi/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.cvsignore
-glX_proto_common.pyo
-glX_proto_common.pyc
-typeexpr.pyo
-typeexpr.pyc
-license.pyo
-license.pyc
-gl_XML.pyo
-gl_XML.pyc
-glX_XML.pyo
-glX_XML.pyc
diff --git a/src/mesa/glapi/EXT_framebuffer_object.xml b/src/mesa/glapi/EXT_framebuffer_object.xml
deleted file mode 100644
index 5057bdc8bf6..00000000000
--- a/src/mesa/glapi/EXT_framebuffer_object.xml
+++ /dev/null
@@ -1,188 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-<category name="GL_EXT_framebuffer_object" number="310">
- <enum name="FRAMEBUFFER_EXT" value="0x8D40"/>
- <enum name="RENDERBUFFER_EXT" value="0x8D41"/>
- <enum name="RENDERBUFFER_WIDTH_EXT" value="0x8D42"/>
- <enum name="RENDERBUFFER_HEIGHT_EXT" value="0x8D43"/>
- <enum name="RENDERBUFFER_INTERNAL_FORMAT_EXT" value="0x8D44"/>
- <enum name="STENCIL_INDEX_EXT" value="0x8D45"/>
- <enum name="STENCIL_INDEX1_EXT" value="0x8D46"/>
- <enum name="STENCIL_INDEX4_EXT" value="0x8D47"/>
- <enum name="STENCIL_INDEX8_EXT" value="0x8D48"/>
- <enum name="STENCIL_INDEX16_EXT" value="0x8D49"/>
-
- <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT" count="1" value="0x8CD0">
- <size name="GetFramebufferAttachmentParameterivEXT" mode="get"/>
- </enum>
- <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT" count="1" value="0x8CD1">
- <size name="GetFramebufferAttachmentParameterivEXT" mode="get"/>
- </enum>
- <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT" count="1" value="0x8CD2">
- <size name="GetFramebufferAttachmentParameterivEXT" mode="get"/>
- </enum>
- <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT" count="1" value="0x8CD3">
- <size name="GetFramebufferAttachmentParameterivEXT" mode="get"/>
- </enum>
- <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT" count="1" value="0x8CD4">
- <size name="GetFramebufferAttachmentParameterivEXT" mode="get"/>
- </enum>
-
- <enum name="COLOR_ATTACHMENT0_EXT" value="0x8CE0"/>
- <enum name="COLOR_ATTACHMENT1_EXT" value="0x8CE1"/>
- <enum name="COLOR_ATTACHMENT2_EXT" value="0x8CE2"/>
- <enum name="COLOR_ATTACHMENT3_EXT" value="0x8CE3"/>
- <enum name="COLOR_ATTACHMENT4_EXT" value="0x8CE4"/>
- <enum name="COLOR_ATTACHMENT5_EXT" value="0x8CE5"/>
- <enum name="COLOR_ATTACHMENT6_EXT" value="0x8CE6"/>
- <enum name="COLOR_ATTACHMENT7_EXT" value="0x8CE7"/>
- <enum name="COLOR_ATTACHMENT8_EXT" value="0x8CE8"/>
- <enum name="COLOR_ATTACHMENT9_EXT" value="0x8CE9"/>
- <enum name="COLOR_ATTACHMENT10_EXT" value="0x8CEA"/>
- <enum name="COLOR_ATTACHMENT11_EXT" value="0x8CEB"/>
- <enum name="COLOR_ATTACHMENT12_EXT" value="0x8CEC"/>
- <enum name="COLOR_ATTACHMENT13_EXT" value="0x8CED"/>
- <enum name="COLOR_ATTACHMENT14_EXT" value="0x8CEE"/>
- <enum name="COLOR_ATTACHMENT15_EXT" value="0x8CEF"/>
- <enum name="DEPTH_ATTACHMENT_EXT" value="0x8D00"/>
- <enum name="STENCIL_ATTACHMENT_EXT" value="0x8D20"/>
-
- <enum name="FRAMEBUFFER_COMPLETE_EXT" value="0x8CD5"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT" value="0x8CD6"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT" value="0x8CD7"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT" value="0x8CD8"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT" value="0x8CD9"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_FORMATS_EXT" value="0x8CDA"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT" value="0x8CDB"/>
- <enum name="FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT" value="0x8CDC"/>
- <enum name="FRAMEBUFFER_UNSUPPORTED_EXT" value="0x8CDD"/>
- <enum name="FRAMEBUFFER_STATUS_ERROR_EXT" value="0x8CDE"/>
-
- <enum name="FRAMEBUFFER_BINDING_EXT" value="0x8CA6"/>
- <enum name="RENDERBUFFER_BINDING_EXT" value="0x8CA7"/>
- <enum name="MAX_COLOR_ATTACHMENTS_EXT" value="0x8CDF"/>
- <enum name="MAX_RENDERBUFFER_SIZE_EXT" value="0x84E8"/>
-
- <enum name="INVALID_FRAMEBUFFER_OPERATION_EXT" value="0x0506"/>
-
- <function name="IsRenderbufferEXT" offset="796">
- <param name="renderbuffer" type="GLuint"/>
- <return type="GLboolean"/>
- <glx vendorpriv="1422"/>
- </function>
-
- <function name="BindRenderbufferEXT" offset="797">
- <param name="target" type="GLenum"/>
- <param name="renderbuffer" type="GLuint"/>
- <glx rop="4316"/>
- </function>
-
- <function name="DeleteRenderbuffersEXT" offset="798">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="renderbuffers" type="const GLuint *" count="n"/>
- <glx rop="4317"/>
- </function>
-
- <function name="GenRenderbuffersEXT" offset="799">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="renderbuffers" type="GLuint *" count="n" output="true"/>
- <glx vendorpriv="1423" always_array="true"/>
- </function>
-
- <function name="RenderbufferStorageEXT" offset="800">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <glx rop="4318"/>
- </function>
-
- <function name="GetRenderbufferParameterivEXT" offset="801">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx vendorpriv="1424"/>
- </function>
-
- <function name="IsFramebufferEXT" offset="802">
- <param name="framebuffer" type="GLuint"/>
- <return type="GLboolean"/>
- <glx vendorpriv="1425"/>
- </function>
-
- <function name="BindFramebufferEXT" offset="803">
- <param name="target" type="GLenum"/>
- <param name="framebuffer" type="GLuint"/>
- <glx rop="4319"/>
- </function>
-
- <function name="DeleteFramebuffersEXT" offset="804">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="framebuffers" type="const GLuint *" count="n"/>
- <glx rop="4320"/>
- </function>
-
- <function name="GenFramebuffersEXT" offset="805">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="framebuffers" type="GLuint *" count="n" output="true"/>
- <glx vendorpriv="1426" always_array="true"/>
- </function>
-
- <function name="CheckFramebufferStatusEXT" offset="806">
- <param name="target" type="GLenum"/>
- <return type="GLenum"/>
- <glx vendorpriv="1427"/>
- </function>
-
- <function name="FramebufferTexture1DEXT" offset="807">
- <param name="target" type="GLenum"/>
- <param name="attachment" type="GLenum"/>
- <param name="textarget" type="GLenum"/>
- <param name="texture" type="GLuint"/>
- <param name="level" type="GLint"/>
- <glx rop="4321"/>
- </function>
-
- <function name="FramebufferTexture2DEXT" offset="808">
- <param name="target" type="GLenum"/>
- <param name="attachment" type="GLenum"/>
- <param name="textarget" type="GLenum"/>
- <param name="texture" type="GLuint"/>
- <param name="level" type="GLint"/>
- <glx rop="4322"/>
- </function>
-
- <function name="FramebufferTexture3DEXT" offset="809">
- <param name="target" type="GLenum"/>
- <param name="attachment" type="GLenum"/>
- <param name="textarget" type="GLenum"/>
- <param name="texture" type="GLuint"/>
- <param name="level" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <glx rop="4323"/>
- </function>
-
- <function name="FramebufferRenderbufferEXT" offset="810">
- <param name="target" type="GLenum"/>
- <param name="attachment" type="GLenum"/>
- <param name="renderbuffertarget" type="GLenum"/>
- <param name="renderbuffer" type="GLuint"/>
- <glx rop="4324"/>
- </function>
-
- <function name="GetFramebufferAttachmentParameterivEXT" offset="811">
- <param name="target" type="GLenum"/>
- <param name="attachment" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx vendorpriv="1428"/>
- </function>
-
- <function name="GenerateMipmapEXT" offset="812">
- <param name="target" type="GLenum"/>
- <glx rop="4325"/>
- </function>
-</category>
-</OpenGLAPI>
diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile
deleted file mode 100644
index 4eba897e4bf..00000000000
--- a/src/mesa/glapi/Makefile
+++ /dev/null
@@ -1,102 +0,0 @@
-# This file isn't used during a normal compilation since we don't want to
-# require Python in order to compile Mesa.
-# Instead, when the Mesa developers update/change the API interface it's
-# up to him/her to re-run this makefile and check in the newly generated files.
-
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h dispatch.h \
- ../main/enums.c \
- ../x86/glapi_x86.S \
- ../x86-64/glapi_x86-64.S \
- ../sparc/glapi_sparc.S \
- ../drivers/dri/common/extension_helper.h \
- ../../glx/x11/indirect.c \
- ../../glx/x11/indirect.h \
- ../../glx/x11/indirect_init.c \
- ../../glx/x11/indirect_size.h \
- ../../glx/x11/indirect_size.c
-
-
-#XORG_BASE = /home/idr/devel/graphics/Xorg/xserver/xorg
-GLX_DIR = $(XORG_BASE)/GL/glx
-
-SERVER_OUTPUTS = $(GLX_DIR)/indirect_dispatch.c \
- $(GLX_DIR)/indirect_dispatch_swap.c \
- $(GLX_DIR)/indirect_dispatch.h \
- $(GLX_DIR)/indirect_size_get.c \
- $(GLX_DIR)/indirect_size_get.h
-
-COMMON = gl_XML.py license.py gl_API.xml typeexpr.py
-COMMON_GLX = $(COMMON) glX_XML.py glX_proto_common.py
-
-all: $(OUTPUTS)
-
-server: $(SERVER_OUTPUTS)
-
-glprocs.h: $(COMMON) gl_procs.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_procs.py > glprocs.h
-
-glapitemp.h: $(COMMON) gl_apitemp.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_apitemp.py > glapitemp.h
-
-glapioffsets.h: $(COMMON) gl_offsets.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_offsets.py > glapioffsets.h
-
-glapitable.h: $(COMMON) gl_table.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_table.py > glapitable.h
-
-dispatch.h: $(COMMON) gl_table.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_table.py -m remap_table > dispatch.h
-
-../main/enums.c: $(COMMON) gl_enums.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_enums.py > ../main/enums.c
-
-../x86/glapi_x86.S: $(COMMON) gl_x86_asm.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_x86_asm.py > ../x86/glapi_x86.S
-
-../x86-64/glapi_x86-64.S: $(COMMON) gl_x86-64_asm.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_x86-64_asm.py > ../x86-64/glapi_x86-64.S
-
-../sparc/glapi_sparc.S: $(COMMON) gl_SPARC_asm.py
- $(PYTHON2) $(PYTHON_FLAGS) gl_SPARC_asm.py > ../sparc/glapi_sparc.S
-
-
-../drivers/dri/common/extension_helper.h: $(COMMON) extension_helper.py
- $(PYTHON2) $(PYTHON_FLAGS) extension_helper.py > ../drivers/dri/common/extension_helper.h
-
-../../glx/x11/indirect.c: $(COMMON_GLX) glX_proto_send.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_send.py -m proto > ../../glx/x11/indirect.c
-
-../../glx/x11/indirect.h: $(COMMON_GLX) glX_proto_send.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_send.py -m init_h > ../../glx/x11/indirect.h
-
-../../glx/x11/indirect_init.c: $(COMMON_GLX) glX_proto_send.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_send.py -m init_c > ../../glx/x11/indirect_init.c
-
-../../glx/x11/indirect_size.h: $(COMMON_GLX) glX_proto_size.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_h --only-set -h _INDIRECT_SIZE_H_ > ../../glx/x11/indirect_size.h
-
-../../glx/x11/indirect_size.c: $(COMMON_GLX) glX_proto_size.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_c --only-set > ../../glx/x11/indirect_size.c
-
-$(GLX_DIR)/indirect_dispatch.c: $(COMMON_GLX) glX_proto_recv.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_recv.py -m dispatch_c > $@
-
-$(GLX_DIR)/indirect_dispatch_swap.c: $(COMMON_GLX) glX_proto_recv.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_recv.py -m dispatch_c -s > $@
-
-$(GLX_DIR)/indirect_dispatch.h: $(COMMON_GLX) glX_proto_recv.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_recv.py -m dispatch_h -s > $@
-
-$(GLX_DIR)/indirect_size_get.h: $(COMMON_GLX) glX_proto_size.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' > $@
-
-$(GLX_DIR)/indirect_size_get.c: $(COMMON_GLX) glX_proto_size.py
- $(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_c > $@
-
-clean:
- rm -f *~ *.pyo
- rm -f $(OUTPUTS)
diff --git a/src/mesa/glapi/extension_helper.py b/src/mesa/glapi/extension_helper.py
deleted file mode 100644
index a2a16a8b364..00000000000
--- a/src/mesa/glapi/extension_helper.py
+++ /dev/null
@@ -1,316 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML
-import license
-import sys, getopt, string
-
-vtxfmt = [
- "ArrayElement", \
- "Color3f", \
- "Color3fv", \
- "Color4f", \
- "Color4fv", \
- "EdgeFlag", \
- "EdgeFlagv", \
- "EvalCoord1f", \
- "EvalCoord1fv", \
- "EvalCoord2f", \
- "EvalCoord2fv", \
- "EvalPoint1", \
- "EvalPoint2", \
- "FogCoordfEXT", \
- "FogCoordfvEXT", \
- "Indexf", \
- "Indexfv", \
- "Materialfv", \
- "MultiTexCoord1fARB", \
- "MultiTexCoord1fvARB", \
- "MultiTexCoord2fARB", \
- "MultiTexCoord2fvARB", \
- "MultiTexCoord3fARB", \
- "MultiTexCoord3fvARB", \
- "MultiTexCoord4fARB", \
- "MultiTexCoord4fvARB", \
- "Normal3f", \
- "Normal3fv", \
- "SecondaryColor3fEXT", \
- "SecondaryColor3fvEXT", \
- "TexCoord1f", \
- "TexCoord1fv", \
- "TexCoord2f", \
- "TexCoord2fv", \
- "TexCoord3f", \
- "TexCoord3fv", \
- "TexCoord4f", \
- "TexCoord4fv", \
- "Vertex2f", \
- "Vertex2fv", \
- "Vertex3f", \
- "Vertex3fv", \
- "Vertex4f", \
- "Vertex4fv", \
- "CallList", \
- "CallLists", \
- "Begin", \
- "End", \
- "VertexAttrib1fNV", \
- "VertexAttrib1fvNV", \
- "VertexAttrib2fNV", \
- "VertexAttrib2fvNV", \
- "VertexAttrib3fNV", \
- "VertexAttrib3fvNV", \
- "VertexAttrib4fNV", \
- "VertexAttrib4fvNV", \
- "VertexAttrib1fARB", \
- "VertexAttrib1fvARB", \
- "VertexAttrib2fARB", \
- "VertexAttrib2fvARB", \
- "VertexAttrib3fARB", \
- "VertexAttrib3fvARB", \
- "VertexAttrib4fARB", \
- "VertexAttrib4fvARB", \
- "Rectf", \
- "DrawArrays", \
- "DrawElements", \
- "DrawRangeElements", \
- "EvalMesh1", \
- "EvalMesh2", \
-]
-
-def all_entrypoints_in_abi(f, abi, api):
- for n in f.entry_points:
- [category, num] = api.get_category_for_name( n )
- if category not in abi:
- return 0
-
- return 1
-
-
-def any_entrypoints_in_abi(f, abi, api):
- for n in f.entry_points:
- [category, num] = api.get_category_for_name( n )
- if category in abi:
- return 1
-
- return 0
-
-
-def condition_for_function(f, abi, all_not_in_ABI):
- """Create a C-preprocessor condition for the function.
-
- There are two modes of operation. If all_not_in_ABI is set, a
- condition is only created is all of the entry-point names for f are
- not in the selected ABI. If all_not_in_ABI is not set, a condition
- is created if any entryp-point name is not in the selected ABI.
- """
-
- condition = []
- for n in f.entry_points:
- [category, num] = api.get_category_for_name( n )
- if category not in abi:
- condition.append( 'defined(need_%s)' % (gl_XML.real_category_name( category )) )
- elif all_not_in_ABI:
- return []
-
- return condition
-
-
-class PrintGlExtensionGlue(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "extension_helper.py (from Mesa)"
- self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
- return
-
-
- def printRealHeader(self):
- print '#include "utils.h"'
- print '#include "dispatch.h"'
- print ''
- return
-
-
- def printBody(self, api):
- abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
-
- category_list = {}
-
- print '#ifndef NULL'
- print '# define NULL 0'
- print '#endif'
- print ''
-
- for f in api.functionIterateAll():
- condition = condition_for_function(f, abi, 0)
- if len(condition):
- print '#if %s' % (string.join(condition, " || "))
- print 'static const char %s_names[] = ' % (f.name)
-
- parameter_signature = ''
- for p in f.parameterIterator():
- # FIXME: This is a *really* ugly hack. :(
-
- tn = p.type_expr.get_base_type_node()
- if p.is_pointer():
- parameter_signature += 'p'
- elif tn.integer:
- parameter_signature += 'i'
- elif tn.size == 4:
- parameter_signature += 'f'
- else:
- parameter_signature += 'd'
-
- print ' "%s\\0" /* Parameter signature */' % (parameter_signature)
-
- for n in f.entry_points:
- print ' "gl%s\\0"' % (n)
-
- [category, num] = api.get_category_for_name( n )
- if category not in abi:
- c = gl_XML.real_category_name(category)
- if not category_list.has_key(c):
- category_list[ c ] = []
-
- category_list[ c ].append( f )
-
- print ' "";'
- print '#endif'
- print ''
-
- keys = category_list.keys()
- keys.sort()
-
- for category in keys:
- print '#if defined(need_%s)' % (category)
- print 'static const struct dri_extension_function %s_functions[] = {' % (category)
-
- for f in category_list[ category ]:
- if any_entrypoints_in_abi(f, abi, api):
- index_name = "-1"
- else:
- index_name = "%s_remap_index" % (f.name)
-
- print ' { %s_names, %s, %d },' % (f.name, index_name, f.offset)
-
-
- print ' { NULL, 0, 0 }'
- print '};'
- print '#endif'
- print ''
-
- return
-
-
-class PrintInitDispatch(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "extension_helper.py (from Mesa)"
- self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
- return
-
-
- def do_function_body(self, api, abi, vtxfmt_only):
- last_condition_string = None
- for f in api.functionIterateByOffset():
- if (f.name in vtxfmt) and not vtxfmt_only:
- continue
-
- if (f.name not in vtxfmt) and vtxfmt_only:
- continue
-
- condition = condition_for_function(f, abi, 1)
- condition_string = string.join(condition, " || ")
-
- if condition_string != last_condition_string:
- if last_condition_string:
- print '#endif /* %s */' % (last_condition_string)
-
- if condition_string:
- print '#if %s' % (condition_string)
-
- if vtxfmt_only:
- print ' disp->%s = vfmt->%s;' % (f.name, f.name)
- else:
- print ' disp->%s = _mesa_%s;' % (f.name, f.name)
-
- last_condition_string = condition_string
-
- if last_condition_string:
- print '#endif /* %s */' % (last_condition_string)
-
-
-
- def printBody(self, api):
- abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
-
- print 'void driver_init_exec_table(struct _glapi_table *disp)'
- print '{'
- self.do_function_body(api, abi, 0)
- print '}'
- print ''
- print 'void driver_install_vtxfmt(struct _glapi_table *disp, const GLvertexformat *vfmt)'
- print '{'
- self.do_function_body(api, abi, 1)
- print '}'
-
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
- print " -m output_mode Output mode can be one of 'extensions' or 'exec_init'."
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
- except Exception,e:
- show_usage()
-
- mode = "extensions"
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- if arg == '-m':
- mode = val
-
-
- api = gl_XML.parse_GL_API( file_name )
-
- if mode == "extensions":
- printer = PrintGlExtensionGlue()
- elif mode == "exec_init":
- printer = PrintInitDispatch()
- else:
- show_usage()
-
- printer.Print( api )
diff --git a/src/mesa/glapi/glX_XML.py b/src/mesa/glapi/glX_XML.py
deleted file mode 100644
index 7cc9d8d6649..00000000000
--- a/src/mesa/glapi/glX_XML.py
+++ /dev/null
@@ -1,531 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML
-import license
-import sys, getopt, string
-
-
-class glx_item_factory(gl_XML.gl_item_factory):
- """Factory to create GLX protocol oriented objects derived from gl_item."""
-
- def create_item(self, name, element, context):
- if name == "function":
- return glx_function(element, context)
- elif name == "enum":
- return glx_enum(element, context)
- elif name == "api":
- return glx_api(self)
- else:
- return gl_XML.gl_item_factory.create_item(self, name, element, context)
-
-
-class glx_enum(gl_XML.gl_enum):
- def __init__(self, element, context):
- gl_XML.gl_enum.__init__(self, element, context)
-
- self.functions = {}
-
- child = element.children
- while child:
- if child.type == "element" and child.name == "size":
- n = child.nsProp( "name", None )
- c = child.nsProp( "count", None )
- m = child.nsProp( "mode", None )
-
- if not c:
- c = self.default_count
- else:
- c = int(c)
-
- if m == "get":
- mode = 0
- else:
- mode = 1
-
- if not self.functions.has_key(n):
- self.functions[ n ] = [c, mode]
-
- child = child.next
-
- return
-
-
-class glx_function(gl_XML.gl_function):
- def __init__(self, element, context):
- self.glx_rop = 0
- self.glx_sop = 0
- self.glx_vendorpriv = 0
-
- # If this is set to true, it means that GLdouble parameters should be
- # written to the GLX protocol packet in the order they appear in the
- # prototype. This is different from the "classic" ordering. In the
- # classic ordering GLdoubles are written to the protocol packet first,
- # followed by non-doubles. NV_vertex_program was the first extension
- # to break with this tradition.
-
- self.glx_doubles_in_order = 0
-
- self.vectorequiv = None
- self.output = None
- self.can_be_large = 0
- self.reply_always_array = 0
- self.dimensions_in_reply = 0
- self.img_reset = None
-
- self.server_handcode = 0
- self.client_handcode = 0
- self.ignore = 0
-
- self.count_parameter_list = []
- self.counter_list = []
- self.parameters_by_name = {}
- self.offsets_calculated = 0
-
- gl_XML.gl_function.__init__(self, element, context)
- return
-
-
- def process_element(self, element):
- gl_XML.gl_function.process_element(self, element)
-
- self.vectorequiv = element.nsProp( "vectorequiv", None )
-
-
- if element.nsProp( "name", None ) == self.name:
- for param in self.parameters:
- self.parameters_by_name[ param.name ] = param
-
- if len(param.count_parameter_list):
- self.count_parameter_list.extend( param.count_parameter_list )
-
- if param.counter and param.counter not in self.counter_list:
- self.counter_list.append(param.counter)
-
-
- child = element.children
- while child:
- if child.type == "element":
- if child.name == "glx":
- rop = child.nsProp( 'rop', None )
- sop = child.nsProp( 'sop', None )
- vop = child.nsProp( 'vendorpriv', None )
-
- if rop:
- self.glx_rop = int(rop)
- else:
- self.glx_rop = 0
-
- if sop:
- self.glx_sop = int(sop)
- else:
- self.glx_sop = 0
-
- if vop:
- self.glx_vendorpriv = int(vop)
- else:
- self.glx_vendorpriv = 0
-
- self.img_reset = child.nsProp( 'img_reset', None )
-
- # The 'handcode' attribute can be one of 'true',
- # 'false', 'client', or 'server'.
-
- handcode = child.nsProp( 'handcode', None )
- if handcode == "false":
- self.server_handcode = 0
- self.client_handcode = 0
- elif handcode == "true":
- self.server_handcode = 1
- self.client_handcode = 1
- elif handcode == "client":
- self.server_handcode = 0
- self.client_handcode = 1
- elif handcode == "server":
- self.server_handcode = 1
- self.client_handcode = 0
- else:
- raise RuntimeError('Invalid handcode mode "%s" in function "%s".' % (handcode, self.name))
-
- self.ignore = gl_XML.is_attr_true( child, 'ignore' )
- self.can_be_large = gl_XML.is_attr_true( child, 'large' )
- self.glx_doubles_in_order = gl_XML.is_attr_true( child, 'doubles_in_order' )
- self.reply_always_array = gl_XML.is_attr_true( child, 'always_array' )
- self.dimensions_in_reply = gl_XML.is_attr_true( child, 'dimensions_in_reply' )
-
- child = child.next
-
-
- # Do some validation of the GLX protocol information. As
- # new tests are discovered, they should be added here.
-
- for param in self.parameters:
- if param.is_output and self.glx_rop != 0:
- raise RuntimeError("Render / RenderLarge commands cannot have outputs (%s)." % (self.name))
-
- return
-
-
- def has_variable_size_request(self):
- """Determine if the GLX request packet is variable sized.
-
- The GLX request packet is variable sized in several common
- situations.
-
- 1. The function has a non-output parameter that is counted
- by another parameter (e.g., the 'textures' parameter of
- glDeleteTextures).
-
- 2. The function has a non-output parameter whose count is
- determined by another parameter that is an enum (e.g., the
- 'params' parameter of glLightfv).
-
- 3. The function has a non-output parameter that is an
- image.
-
- 4. The function must be hand-coded on the server.
- """
-
- if self.glx_rop == 0:
- return 0
-
- if self.server_handcode or self.images:
- return 1
-
- for param in self.parameters:
- if not param.is_output:
- if param.counter or len(param.count_parameter_list):
- return 1
-
- return 0
-
-
- def variable_length_parameter(self):
- for param in self.parameters:
- if not param.is_output:
- if param.counter or len(param.count_parameter_list):
- return param
-
- return None
-
-
- def calculate_offsets(self):
- if not self.offsets_calculated:
- # Calculate the offset of the first function parameter
- # in the GLX command packet. This byte offset is
- # measured from the end of the Render / RenderLarge
- # header. The offset for all non-pixel commends is
- # zero. The offset for pixel commands depends on the
- # number of dimensions of the pixel data.
-
- if len(self.images) and not self.images[0].is_output:
- [dim, junk, junk, junk, junk] = self.images[0].get_dimensions()
-
- # The base size is the size of the pixel pack info
- # header used by images with the specified number
- # of dimensions.
-
- if dim <= 2:
- offset = 20
- elif dim <= 4:
- offset = 36
- else:
- raise RuntimeError('Invalid number of dimensions %u for parameter "%s" in function "%s".' % (dim, self.image.name, self.name))
- else:
- offset = 0
-
- for param in self.parameterIterateGlxSend():
- if param.img_null_flag:
- offset += 4
-
- if param.name != self.img_reset:
- param.offset = offset
- if not param.is_variable_length():
- offset += param.size()
-
- if self.pad_after( param ):
- offset += 4
-
-
- self.offsets_calculated = 1
- return
-
-
- def offset_of(self, param_name):
- self.calculate_offsets()
- return self.parameters_by_name[ param_name ].offset
-
-
- def parameterIterateGlxSend(self, include_variable_parameters = 1):
- """Create an iterator for parameters in GLX request order."""
-
- # The parameter lists are usually quite short, so it's easier
- # (i.e., less code) to just generate a new list with the
- # required elements than it is to create a new iterator class.
-
- temp = [ [], [], [] ]
- for param in self.parameters:
- if param.is_output: continue
-
- if param.is_variable_length():
- temp[2].append( param )
- elif not self.glx_doubles_in_order and param.is_64_bit():
- temp[0].append( param )
- else:
- temp[1].append( param )
-
- parameters = temp[0]
- parameters.extend( temp[1] )
- if include_variable_parameters:
- parameters.extend( temp[2] )
- return parameters.__iter__()
-
-
- def parameterIterateCounters(self):
- temp = []
- for name in self.counter_list:
- temp.append( self.parameters_by_name[ name ] )
-
- return temp.__iter__()
-
-
- def parameterIterateOutputs(self):
- temp = []
- for p in self.parameters:
- if p.is_output:
- temp.append( p )
-
- return temp
-
-
- def command_fixed_length(self):
- """Return the length, in bytes as an integer, of the
- fixed-size portion of the command."""
-
- if len(self.parameters) == 0:
- return 0
-
- self.calculate_offsets()
-
- size = 0
- for param in self.parameterIterateGlxSend(0):
- if param.name != self.img_reset:
- if size == 0:
- size = param.offset + param.size()
- else:
- size += param.size()
-
- if self.pad_after( param ):
- size += 4
-
- for param in self.images:
- if param.img_null_flag or param.is_output:
- size += 4
-
- return size
-
-
- def command_variable_length(self):
- """Return the length, as a string, of the variable-sized
- portion of the command."""
-
- size_string = ""
- for p in self.parameterIterateGlxSend():
- if (not p.is_output) and (p.is_variable_length() or p.is_image()):
- # FIXME Replace the 1 in the size_string call
- # FIXME w/0 to eliminate some un-needed parnes
- # FIXME This would already be done, but it
- # FIXME adds some extra diffs to the generated
- # FIXME code.
-
- size_string = size_string + " + __GLX_PAD(%s)" % (p.size_string(1))
-
- return size_string
-
-
- def command_length(self):
- size = self.command_fixed_length()
-
- if self.glx_rop != 0:
- size += 4
-
- size = ((size + 3) & ~3)
- return "%u%s" % (size, self.command_variable_length())
-
-
- def opcode_real_value(self):
- """Get the true numeric value of the GLX opcode
-
- Behaves similarly to opcode_value, except for
- X_GLXVendorPrivate and X_GLXVendorPrivateWithReply commands.
- In these cases the value for the GLX opcode field (i.e.,
- 16 for X_GLXVendorPrivate or 17 for
- X_GLXVendorPrivateWithReply) is returned. For other 'single'
- commands, the opcode for the command (e.g., 101 for
- X_GLsop_NewList) is returned."""
-
- if self.glx_vendorpriv != 0:
- if self.needs_reply():
- return 17
- else:
- return 16
- else:
- return self.opcode_value()
-
-
- def opcode_value(self):
- """Get the unique protocol opcode for the glXFunction"""
-
- if (self.glx_rop == 0) and self.vectorequiv:
- equiv = self.context.functions_by_name[ self.vectorequiv ]
- self.glx_rop = equiv.glx_rop
-
-
- if self.glx_rop != 0:
- return self.glx_rop
- elif self.glx_sop != 0:
- return self.glx_sop
- elif self.glx_vendorpriv != 0:
- return self.glx_vendorpriv
- else:
- return -1
-
-
- def opcode_rop_basename(self):
- """Return either the name to be used for GLX protocol enum.
-
- Returns either the name of the function or the name of the
- name of the equivalent vector (e.g., glVertex3fv for
- glVertex3f) function."""
-
- if self.vectorequiv == None:
- return self.name
- else:
- return self.vectorequiv
-
-
- def opcode_name(self):
- """Get the unique protocol enum name for the glXFunction"""
-
- if (self.glx_rop == 0) and self.vectorequiv:
- equiv = self.context.functions_by_name[ self.vectorequiv ]
- self.glx_rop = equiv.glx_rop
- self.glx_doubles_in_order = equiv.glx_doubles_in_order
-
-
- if self.glx_rop != 0:
- return "X_GLrop_%s" % (self.opcode_rop_basename())
- elif self.glx_sop != 0:
- return "X_GLsop_%s" % (self.name)
- elif self.glx_vendorpriv != 0:
- return "X_GLvop_%s" % (self.name)
- else:
- raise RuntimeError('Function "%s" has no opcode.' % (self.name))
-
-
- def opcode_real_name(self):
- """Get the true protocol enum name for the GLX opcode
-
- Behaves similarly to opcode_name, except for
- X_GLXVendorPrivate and X_GLXVendorPrivateWithReply commands.
- In these cases the string 'X_GLXVendorPrivate' or
- 'X_GLXVendorPrivateWithReply' is returned. For other
- single or render commands 'X_GLsop' or 'X_GLrop' plus the
- name of the function returned."""
-
- if self.glx_vendorpriv != 0:
- if self.needs_reply():
- return "X_GLXVendorPrivateWithReply"
- else:
- return "X_GLXVendorPrivate"
- else:
- return self.opcode_name()
-
-
- def needs_reply(self):
- try:
- x = self._needs_reply
- except Exception, e:
- x = 0
- if self.return_type != 'void':
- x = 1
-
- for param in self.parameters:
- if param.is_output:
- x = 1
- break
-
- self._needs_reply = x
-
- return x
-
-
- def pad_after(self, p):
- """Returns the name of the field inserted after the
- specified field to pad out the command header."""
-
- for image in self.images:
- if image.img_pad_dimensions:
- if not image.height:
- if p.name == image.width:
- return "height"
- elif p.name == image.img_xoff:
- return "yoffset"
- elif not image.extent:
- if p.name == image.depth:
- # Should this be "size4d"?
- return "extent"
- elif p.name == image.img_zoff:
- return "woffset"
-
- return None
-
-
-class glx_function_iterator:
- """Class to iterate over a list of glXFunctions"""
-
- def __init__(self, context):
- self.iterator = context.functionIterateByOffset()
- return
-
-
- def __iter__(self):
- return self
-
-
- def next(self):
- f = self.iterator.next()
- if f.ignore or not (f.glx_rop or f.glx_sop or f.glx_vendorpriv or f.vectorequiv or f.client_handcode):
- return self.next()
- else:
- return f
-
-
-class glx_api(gl_XML.gl_api):
- def functionIterateGlx(self):
- return glx_function_iterator(self)
-
diff --git a/src/mesa/glapi/glX_doc.py b/src/mesa/glapi/glX_doc.py
deleted file mode 100644
index e9fbbe6f169..00000000000
--- a/src/mesa/glapi/glX_doc.py
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt
-
-
-class glx_doc_item_factory(glX_proto_common.glx_proto_item_factory):
- """Factory to create GLX protocol documentation oriented objects derived from glItem."""
-
- def create_item(self, name, element, context):
- if name == "parameter":
- return glx_doc_parameter(element, context)
- else:
- return glX_proto_common.glx_proto_item_factory.create_item(self, name, element, context)
-
-
-class glx_doc_parameter(gl_XML.gl_parameter):
- def packet_type(self, type_dict):
- """Get the type string for the packet header
-
- GLX protocol documentation uses type names like CARD32,
- FLOAT64, LISTofCARD8, and ENUM. This function converts the
- type of the parameter to one of these names."""
-
- list_of = ""
- if self.is_array():
- list_of = "LISTof"
-
- t_name = self.get_base_type_string()
- if not type_dict.has_key( t_name ):
- type_name = "CARD8"
- else:
- type_name = type_dict[ t_name ]
-
- return "%s%s" % (list_of, type_name)
-
-
- def packet_size(self):
- p = None
- s = self.size()
- if s == 0:
- a_prod = "n"
- b_prod = self.p_type.size
-
- if not self.count_parameter_list and self.counter:
- a_prod = self.counter
- elif self.count_parameter_list and not self.counter or self.is_output:
- pass
- elif self.count_parameter_list and self.counter:
- b_prod = self.counter
- else:
- raise RuntimeError("Parameter '%s' to function '%s' has size 0." % (self.name, self.context.name))
-
- ss = "%s*%s" % (a_prod, b_prod)
-
- return [ss, p]
- else:
- if s % 4 != 0:
- p = "p"
-
- return [str(s), p]
-
-class PrintGlxProtoText(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
- self.license = ""
-
-
- def printHeader(self):
- return
-
-
- def body_size(self, f):
- # At some point, refactor this function and
- # glXFunction::command_payload_length.
-
- size = 0;
- size_str = ""
- pad_str = ""
- plus = ""
- for p in f.parameterIterateGlxSend():
- [s, pad] = p.packet_size()
- try:
- size += int(s)
- except Exception,e:
- size_str += "%s%s" % (plus, s)
- plus = "+"
-
- if pad != None:
- pad_str = pad
-
- return [size, size_str, pad_str]
-
-
- def print_render_header(self, f):
- [size, size_str, pad_str] = self.body_size(f)
- size += 4;
-
- if size_str == "":
- s = "%u" % ((size + 3) & ~3)
- elif pad_str != "":
- s = "%u+%s+%s" % (size, size_str, pad_str)
- else:
- s = "%u+%s" % (size, size_str)
-
- print ' 2 %-15s rendering command length' % (s)
- print ' 2 %-4u rendering command opcode' % (f.glx_rop)
- return
-
-
- def print_single_header(self, f):
- [size, size_str, pad_str] = self.body_size(f)
- size = ((size + 3) / 4) + 2;
-
- if f.glx_vendorpriv != 0:
- size += 1
-
- print ' 1 CARD8 opcode (X assigned)'
- print ' 1 %-4u GLX opcode (%s)' % (f.opcode_real_value(), f.opcode_real_name())
-
- if size_str == "":
- s = "%u" % (size)
- elif pad_str != "":
- s = "%u+((%s+%s)/4)" % (size, size_str, pad_str)
- else:
- s = "%u+((%s)/4)" % (size, size_str)
-
- print ' 2 %-15s request length' % (s)
-
- if f.glx_vendorpriv != 0:
- print ' 4 %-4u vendor specific opcode' % (f.opcode_value())
-
- print ' 4 GLX_CONTEXT_TAG context tag'
-
- return
-
-
- def print_reply(self, f):
- print ' =>'
- print ' 1 1 reply'
- print ' 1 unused'
- print ' 2 CARD16 sequence number'
-
- if f.output == None:
- print ' 4 0 reply length'
- elif f.reply_always_array:
- print ' 4 m reply length'
- else:
- print ' 4 m reply length, m = (n == 1 ? 0 : n)'
-
-
- output = None
- for x in f.parameterIterateOutputs():
- output = x
- break
-
-
- unused = 24
- if f.return_type != 'void':
- print ' 4 %-15s return value' % (f.return_type)
- unused -= 4
- elif output != None:
- print ' 4 unused'
- unused -= 4
-
- if output != None:
- print ' 4 CARD32 n'
- unused -= 4
-
- if output != None:
- if not f.reply_always_array:
- print ''
- print ' if (n = 1) this follows:'
- print ''
- print ' 4 CARD32 %s' % (output.name)
- print ' %-2u unused' % (unused - 4)
- print ''
- print ' otherwise this follows:'
- print ''
-
- print ' %-2u unused' % (unused)
-
- [s, pad] = output.packet_size()
- print ' %-8s %-15s %s' % (s, output.packet_type( self.type_map ), output.name)
- if pad != None:
- try:
- bytes = int(s)
- bytes = 4 - (bytes & 3)
- print ' %-8u %-15s unused' % (bytes, "")
- except Exception,e:
- print ' %-8s %-15s unused, %s=pad(%s)' % (pad, "", pad, s)
- else:
- print ' %-2u unused' % (unused)
-
-
- def print_body(self, f):
- for p in f.parameterIterateGlxSend():
- [s, pad] = p.packet_size()
- print ' %-8s %-15s %s' % (s, p.packet_type( self.type_map ), p.name)
- if pad != None:
- try:
- bytes = int(s)
- bytes = 4 - (bytes & 3)
- print ' %-8u %-15s unused' % (bytes, "")
- except Exception,e:
- print ' %-8s %-15s unused, %s=pad(%s)' % (pad, "", pad, s)
-
- def printBody(self, api):
- self.type_map = {}
- for t in api.typeIterate():
- self.type_map[ "GL" + t.name ] = t.glx_name
-
-
- # At some point this should be expanded to support pixel
- # functions, but I'm not going to lose any sleep over it now.
-
- for f in api.functionIterateByOffset():
- if f.client_handcode or f.server_handcode or f.vectorequiv or len(f.get_images()):
- continue
-
-
- if f.glx_rop:
- print ' %s' % (f.name)
- self.print_render_header(f)
- elif f.glx_sop or f.glx_vendorpriv:
- print ' %s' % (f.name)
- self.print_single_header(f)
- else:
- continue
-
- self.print_body(f)
-
- if f.needs_reply():
- self.print_reply(f)
-
- print ''
- return
-
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
-
- api = gl_XML.parse_GL_API( file_name, glx_doc_item_factory() )
-
- printer = PrintGlxProtoText()
- printer.Print( api )
diff --git a/src/mesa/glapi/glX_proto_common.py b/src/mesa/glapi/glX_proto_common.py
deleted file mode 100644
index 6f094e22b31..00000000000
--- a/src/mesa/glapi/glX_proto_common.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, glX_XML
-import string
-
-
-class glx_proto_item_factory(glX_XML.glx_item_factory):
- """Factory to create GLX protocol oriented objects derived from gl_item."""
-
- def create_item(self, name, element, context):
- if name == "type":
- return glx_proto_type(element, context)
- else:
- return glX_XML.glx_item_factory.create_item(self, name, element, context)
-
-
-class glx_proto_type(gl_XML.gl_type):
- def __init__(self, element, context):
- gl_XML.gl_type.__init__(self, element, context)
-
- self.glx_name = element.nsProp( "glx_name", None )
- return
-
-
-class glx_print_proto(gl_XML.gl_print_base):
- def size_call(self, func, outputs_also = 0):
- """Create C code to calculate 'compsize'.
-
- Creates code to calculate 'compsize'. If the function does
- not need 'compsize' to be calculated, None will be
- returned."""
-
- compsize = None
-
- for param in func.parameterIterator():
- if outputs_also or not param.is_output:
- if param.is_image():
- [dim, w, h, d, junk] = param.get_dimensions()
-
- compsize = '__glImageSize(%s, %s, %s, %s, %s, %s)' % (w, h, d, param.img_format, param.img_type, param.img_target)
- if not param.img_send_null:
- compsize = '(%s != NULL) ? %s : 0' % (param.name, compsize)
-
- return compsize
-
- elif len(param.count_parameter_list):
- parameters = string.join( param.count_parameter_list, "," )
- compsize = "__gl%s_size(%s)" % (func.name, parameters)
-
- return compsize
-
- return None
-
-
- def emit_packet_size_calculation(self, f, bias):
- # compsize is only used in the command size calculation if
- # the function has a non-output parameter that has a non-empty
- # counter_parameter_list.
-
- compsize = self.size_call(f)
- if compsize:
- print ' const GLuint compsize = %s;' % (compsize)
-
- if bias:
- print ' const GLuint cmdlen = %s - %u;' % (f.command_length(), bias)
- else:
- print ' const GLuint cmdlen = %s;' % (f.command_length())
-
- #print ''
- return compsize
diff --git a/src/mesa/glapi/glX_proto_recv.py b/src/mesa/glapi/glX_proto_recv.py
deleted file mode 100644
index 86bdd0ec93a..00000000000
--- a/src/mesa/glapi/glX_proto_recv.py
+++ /dev/null
@@ -1,563 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt, string
-
-
-class PrintGlxDispatch_h(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_recv.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
-
- self.header_tag = "_INDIRECT_DISPATCH_H_"
- return
-
-
- def printRealHeader(self):
- self.printVisibility( "HIDDEN", "hidden" )
- print 'struct __GLXclientStateRec;'
- print ''
- return
-
-
- def printBody(self, api):
- for func in api.functionIterateAll():
- if not func.ignore and not func.vectorequiv:
- if func.glx_rop != 0:
- print 'extern HIDDEN void __glXDisp_%s(GLbyte * pc);' % (func.name)
- print 'extern HIDDEN void __glXDispSwap_%s(GLbyte * pc);' % (func.name)
- elif func.glx_sop != 0 or func.glx_vendorpriv != 0:
- print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
- print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
-
- return
-
-
-class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
- def __init__(self, do_swap):
- gl_XML.gl_print_base.__init__(self)
- self.name = "glX_proto_recv.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
-
- self.real_types = [ '', '', 'uint16_t', '', 'uint32_t', '', '', '', 'uint64_t' ]
- self.do_swap = do_swap
- return
-
-
- def printRealHeader(self):
- print '#include <X11/Xmd.h>'
- print '#include <GL/gl.h>'
- print '#include <GL/glxproto.h>'
-
-
- # FIXME: Since this block will require changes as other
- # FIXME: platforms are added, it should probably be in a
- # FIXME: header file that is not generated by a script.
-
- if self.do_swap:
- print '#ifdef __linux__'
- print '#include <byteswap.h>'
- print '#elif defined(__OpenBSD__)'
- print '#include <sys/endian.h>'
- print '#define bswap_16 __swap16'
- print '#define bswap_32 __swap32'
- print '#define bswap_64 __swap64'
- print '#else'
- print '#include <sys/endian.h>'
- print '#define bswap_16 bswap16'
- print '#define bswap_32 bswap32'
- print '#define bswap_64 bswap64'
- print '#endif'
-
- print '#include <inttypes.h>'
- print '#include "indirect_size.h"'
- print '#include "indirect_size_get.h"'
- print '#include "indirect_dispatch.h"'
- print '#include "glxserver.h"'
- print '#include "indirect_util.h"'
- print '#include "singlesize.h"'
- print '#include "glapitable.h"'
- print '#include "glapi.h"'
- print '#include "glthread.h"'
- print '#include "dispatch.h"'
- print ''
- print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
- print ''
- print 'typedef struct {'
- print ' __GLX_PIXEL_3D_HDR;'
- print '} __GLXpixel3DHeader;'
- print ''
- print 'extern GLboolean __glXErrorOccured( void );'
- print 'extern void __glXClearErrorOccured( void );'
- print ''
- print 'static const unsigned dummy_answer[2] = {0, 0};'
- print ''
- return
-
-
- def printBody(self, api):
- if self.do_swap:
- self.emit_swap_wrappers(api)
-
-
- for func in api.functionIterateByOffset():
- if not func.ignore and not func.server_handcode and not func.vectorequiv and (func.glx_rop or func.glx_sop or func.glx_vendorpriv):
- self.printFunction(func)
-
- return
-
-
- def printFunction(self, f):
- if (f.glx_sop or f.glx_vendorpriv) and (len(f.get_images()) != 0):
- return
-
- if not self.do_swap:
- base = '__glXDisp'
- else:
- base = '__glXDispSwap'
-
- if f.glx_rop:
- print 'void %s_%s(GLbyte * pc)' % (base, f.name)
- else:
- print 'int %s_%s(__GLXclientState *cl, GLbyte *pc)' % (base, f.name)
-
- print '{'
-
- if f.glx_rop or f.vectorequiv:
- self.printRenderFunction(f)
- elif f.glx_sop or f.glx_vendorpriv:
- if len(f.get_images()) == 0:
- self.printSingleFunction(f)
- else:
- print "/* Missing GLX protocol for %s. */" % (f.name)
-
- print '}'
- print ''
- return
-
-
- def swap_name(self, bytes):
- return 'bswap_%u_array' % (8 * bytes)
-
-
- def emit_swap_wrappers(self, api):
- self.type_map = {}
- already_done = [ ]
-
- for t in api.typeIterate():
- te = t.get_type_expression()
- t_size = te.get_element_size()
-
- if t_size > 1 and t.glx_name:
-
- t_name = "GL" + t.name
- self.type_map[ t_name ] = t.glx_name
-
- if t.glx_name not in already_done:
- real_name = self.real_types[t_size]
-
- print 'static %s' % (t_name)
- print 'bswap_%s( const void * src )' % (t.glx_name)
- print '{'
- print ' union { %s dst; %s ret; } x;' % (real_name, t_name)
- print ' x.dst = bswap_%u( *(%s *) src );' % (t_size * 8, real_name)
- print ' return x.ret;'
- print '}'
- print ''
- already_done.append( t.glx_name )
-
- for bits in [16, 32, 64]:
- print 'static void *'
- print 'bswap_%u_array( uint%u_t * src, unsigned count )' % (bits, bits)
- print '{'
- print ' unsigned i;'
- print ''
- print ' for ( i = 0 ; i < count ; i++ ) {'
- print ' uint%u_t temp = bswap_%u( src[i] );' % (bits, bits)
- print ' src[i] = temp;'
- print ' }'
- print ''
- print ' return src;'
- print '}'
- print ''
-
-
- def fetch_param(self, param):
- t = param.type_string()
- o = param.offset
- element_size = param.size() / param.get_element_count()
-
- if self.do_swap and (element_size != 1):
- if param.is_array():
- real_name = self.real_types[ element_size ]
-
- swap_func = self.swap_name( element_size )
- return ' (%-8s)%s( (%s *) (pc + %2s), %s )' % (t, swap_func, real_name, o, param.count)
- else:
- t_name = param.get_base_type_string()
- return ' (%-8s)bswap_%-7s( pc + %2s )' % (t, self.type_map[ t_name ], o)
- else:
- if param.is_array():
- return ' (%-8s)(pc + %2u)' % (t, o)
- else:
- return '*(%-8s *)(pc + %2u)' % (t, o)
-
- return None
-
-
- def emit_function_call(self, f, retval_assign, indent):
- list = []
-
- for param in f.parameterIterator():
-
- if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list):
- location = param.name
- else:
- location = self.fetch_param(param)
-
- list.append( '%s %s' % (indent, location) )
-
-
- if len( list ):
- print '%s %sCALL_%s( GET_DISPATCH(), (' % (indent, retval_assign, f.name)
- print string.join( list, ",\n" )
- print '%s ) );' % (indent)
- else:
- print '%s %sCALL_%s( GET_DISPATCH(), () );' % (indent, retval_assign, f.name)
- return
-
-
- def common_func_print_just_start(self, f, indent):
- align64 = 0
- need_blank = 0
-
-
- f.calculate_offsets()
- for param in f.parameterIterateGlxSend():
- # If any parameter has a 64-bit base type, then we
- # have to do alignment magic for the while thing.
-
- if param.is_64_bit():
- align64 = 1
-
-
- # FIXME img_null_flag is over-loaded. In addition to
- # FIXME being used for images, it is used to signify
- # FIXME NULL data pointers for vertex buffer object
- # FIXME related functions. Re-name it to null_data
- # FIXME or something similar.
-
- if param.img_null_flag:
- print '%s const CARD32 ptr_is_null = *(CARD32 *)(pc + %s);' % (indent, param.offset - 4)
- cond = '(ptr_is_null != 0) ? NULL : '
- else:
- cond = ""
-
-
- type_string = param.type_string()
-
- if param.is_image():
- offset = f.offset_of( param.name )
-
- print '%s %s const %s = (%s) %s(pc + %s);' % (indent, type_string, param.name, type_string, cond, offset)
-
- if param.depth:
- print '%s __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent)
- else:
- print '%s __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);' % (indent)
-
- need_blank = 1
- elif param.is_counter or param.name in f.count_parameter_list:
- location = self.fetch_param(param)
- print '%s const %s %s = %s;' % (indent, type_string, param.name, location)
- need_blank = 1
- elif len(param.count_parameter_list):
- if param.size() == 1 and not self.do_swap:
- location = self.fetch_param(param)
- print '%s %s %s = %s%s;' % (indent, type_string, param.name, cond, location)
- else:
- print '%s %s %s;' % (indent, type_string, param.name)
- need_blank = 1
-
-
-
- if need_blank:
- print ''
-
- if align64:
- print '#ifdef __GLX_ALIGN64'
-
- if f.has_variable_size_request():
- self.emit_packet_size_calculation(f, 4)
- s = "cmdlen"
- else:
- s = str((f.command_fixed_length() + 3) & ~3)
-
- print ' if ((unsigned long)(pc) & 7) {'
- print ' (void) memmove(pc-4, pc, %s);' % (s)
- print ' pc -= 4;'
- print ' }'
- print '#endif'
- print ''
-
-
- need_blank = 0
- if self.do_swap:
- for param in f.parameterIterateGlxSend():
- if param.count_parameter_list:
- o = param.offset
- count = param.get_element_count()
- type_size = param.size() / count
-
- if param.counter:
- count_name = param.counter
- else:
- count_name = str(count)
-
- # This is basically an ugly special-
- # case for glCallLists.
-
- if type_size == 1:
- x = []
- x.append( [1, ['BYTE', 'UNSIGNED_BYTE', '2_BYTES', '3_BYTES', '4_BYTES']] )
- x.append( [2, ['SHORT', 'UNSIGNED_SHORT']] )
- x.append( [4, ['INT', 'UNSIGNED_INT', 'FLOAT']] )
-
- print ' switch(%s) {' % (param.count_parameter_list[0])
- for sub in x:
- for t_name in sub[1]:
- print ' case GL_%s:' % (t_name)
-
- if sub[0] == 1:
- print ' %s = (%s) (pc + %s); break;' % (param.name, param.type_string(), o)
- else:
- swap_func = self.swap_name(sub[0])
- print ' %s = (%s) %s( (%s *) (pc + %s), %s ); break;' % (param.name, param.type_string(), swap_func, self.real_types[sub[0]], o, count_name)
- print ' default:'
- print ' return;'
- print ' }'
- else:
- swap_func = self.swap_name(type_size)
- compsize = self.size_call(f, 1)
- print ' %s = (%s) %s( (%s *) (pc + %s), %s );' % (param.name, param.type_string(), swap_func, self.real_types[type_size], o, compsize)
-
- need_blank = 1
-
- else:
- for param in f.parameterIterateGlxSend():
- if param.count_parameter_list:
- print '%s %s = (%s) (pc + %s);' % (indent, param.name, param.type_string(), param.offset)
- need_blank = 1
-
-
- if need_blank:
- print ''
-
-
- return
-
-
- def printSingleFunction(self, f):
- if f.glx_sop:
- print ' xGLXSingleReq * const req = (xGLXSingleReq *) pc;'
- else:
- print ' xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;'
-
- print ' int error;'
-
- if self.do_swap:
- print ' __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);'
- else:
- print ' __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);'
-
- print ''
- if f.glx_sop:
- print ' pc += __GLX_SINGLE_HDR_SIZE;'
- else:
- print ' pc += __GLX_VENDPRIV_HDR_SIZE;'
-
- print ' if ( cx != NULL ) {'
- self.common_func_print_just_start(f, " ")
-
-
- if f.return_type != 'void':
- print ' %s retval;' % (f.return_type)
- retval_string = "retval"
- retval_assign = "retval = "
- else:
- retval_string = "0"
- retval_assign = ""
-
-
- type_size = 0
- answer_string = "dummy_answer"
- answer_count = "0"
- is_array_string = "GL_FALSE"
-
- for param in f.parameterIterateOutputs():
- answer_type = param.get_base_type_string()
- if answer_type == "GLvoid":
- answer_type = "GLubyte"
-
-
- c = param.get_element_count()
- type_size = (param.size() / c)
- if type_size == 1:
- size_scale = ""
- else:
- size_scale = " * %u" % (type_size)
-
-
- if param.count_parameter_list:
- print ' const GLuint compsize = %s;' % (self.size_call(f, 1))
- print ' %s answerBuffer[200];' % (answer_type)
- print ' %s %s = __glXGetAnswerBuffer(cl, compsize%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, size_scale, type_size )
- answer_string = param.name
- answer_count = "compsize"
-
- print ''
- print ' if (%s == NULL) return BadAlloc;' % (param.name)
- print ' __glXClearErrorOccured();'
- print ''
- elif param.counter:
- print ' %s answerBuffer[200];' % (answer_type)
- print ' %s %s = __glXGetAnswerBuffer(cl, %s%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, param.counter, size_scale, type_size)
- answer_string = param.name
- answer_count = param.counter
- elif c >= 1:
- print ' %s %s[%u];' % (answer_type, param.name, c)
- answer_string = param.name
- answer_count = "%u" % (c)
-
- if f.reply_always_array:
- is_array_string = "GL_TRUE"
-
-
- self.emit_function_call(f, retval_assign, " ")
-
-
- if f.needs_reply():
- if self.do_swap:
- for param in f.parameterIterateOutputs():
- c = param.get_element_count()
- type_size = (param.size() / c)
-
- if type_size > 1:
- swap_name = self.swap_name( type_size )
- print ' (void) %s( (uint%u_t *) %s, %s );' % (swap_name, 8 * type_size, param.name, answer_count)
-
-
- reply_func = '__glXSendReplySwap'
- else:
- reply_func = '__glXSendReply'
-
- print ' %s(cl->client, %s, %s, %u, %s, %s);' % (reply_func, answer_string, answer_count, type_size, is_array_string, retval_string)
- #elif f.note_unflushed:
- # print ' cx->hasUnflushedCommands = GL_TRUE;'
-
- print ' error = Success;'
- print ' }'
- print ''
- print ' return error;'
- return
-
-
- def printRenderFunction(self, f):
- # There are 4 distinct phases in a rendering dispatch function.
- # In the first phase we compute the sizes and offsets of each
- # element in the command. In the second phase we (optionally)
- # re-align 64-bit data elements. In the third phase we
- # (optionally) byte-swap array data. Finally, in the fourth
- # phase we actually dispatch the function.
-
- self.common_func_print_just_start(f, "")
-
- images = f.get_images()
- if len(images):
- if self.do_swap:
- pre = "bswap_CARD32( & "
- post = " )"
- else:
- pre = ""
- post = ""
-
- img = images[0]
-
- # swapBytes and lsbFirst are single byte fields, so
- # the must NEVER be byte-swapped.
-
- if not (img.img_type == "GL_BITMAP" and img.img_format == "GL_COLOR_INDEX"):
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );'
-
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );'
-
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) %shdr->rowLength%s) );' % (pre, post)
- if img.depth:
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) %shdr->imageHeight%s) );' % (pre, post)
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) %shdr->skipRows%s) );' % (pre, post)
- if img.depth:
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) %shdr->skipImages%s) );' % (pre, post)
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) %shdr->skipPixels%s) );' % (pre, post)
- print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) %shdr->alignment%s) );' % (pre, post)
- print ''
-
-
- self.emit_function_call(f, "", "")
- return
-
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:s")
- except Exception,e:
- show_usage()
-
- mode = "dispatch_c"
- do_swap = 0
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- mode = val
- elif arg == "-s":
- do_swap = 1
-
- if mode == "dispatch_c":
- printer = PrintGlxDispatchFunctions(do_swap)
- elif mode == "dispatch_h":
- printer = PrintGlxDispatch_h()
- else:
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name, glX_proto_common.glx_proto_item_factory() )
-
- printer.Print( api )
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py
deleted file mode 100644
index 3fa665dbcec..00000000000
--- a/src/mesa/glapi/glX_proto_send.py
+++ /dev/null
@@ -1,1044 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt, copy, string
-
-def hash_pixel_function(func):
- """Generate a 'unique' key for a pixel function. The key is based on
- the parameters written in the command packet. This includes any
- padding that might be added for the original function and the 'NULL
- image' flag."""
-
-
- h = ""
- hash_pre = ""
- hash_suf = ""
- for param in func.parameterIterateGlxSend():
- if param.is_image():
- [dim, junk, junk, junk, junk] = param.get_dimensions()
-
- d = (dim + 1) & ~1
- hash_pre = "%uD%uD_" % (d - 1, d)
-
- if param.img_null_flag:
- hash_suf = "_NF"
-
- h += "%u" % (param.size())
-
- if func.pad_after(param):
- h += "4"
-
-
- n = func.name.replace("%uD" % (dim), "")
- n = "__glx_%s_%uD%uD" % (n, d - 1, d)
-
- h = hash_pre + h + hash_suf
- return [h, n]
-
-
-class glx_pixel_function_stub(glX_XML.glx_function):
- """Dummy class used to generate pixel "utility" functions that are
- shared by multiple dimension image functions. For example, these
- objects are used to generate shared functions used to send GLX
- protocol for TexImage1D and TexImage2D, TexSubImage1D and
- TexSubImage2D, etc."""
-
- def __init__(self, func, name):
- # The parameters to the utility function are the same as the
- # parameters to the real function except for the added "pad"
- # parameters.
-
- self.name = name
- self.images = []
- self.parameters = []
- self.parameters_by_name = {}
- for _p in func.parameterIterator():
- p = copy.copy(_p)
- self.parameters.append(p)
- self.parameters_by_name[ p.name ] = p
-
-
- if p.is_image():
- self.images.append(p)
- p.height = "height"
-
- if p.img_yoff == None:
- p.img_yoff = "yoffset"
-
- if p.depth:
- if p.extent == None:
- p.extent = "extent"
-
- if p.img_woff == None:
- p.img_woff = "woffset"
-
-
- pad_name = func.pad_after(p)
- if pad_name:
- pad = copy.copy(p)
- pad.name = pad_name
- self.parameters.append(pad)
- self.parameters_by_name[ pad.name ] = pad
-
-
- self.return_type = func.return_type
-
- self.glx_rop = ~0
- self.glx_sop = 0
- self.glx_vendorpriv = 0
-
- self.glx_doubles_in_order = func.glx_doubles_in_order
-
- self.vectorequiv = None
- self.output = None
- self.can_be_large = func.can_be_large
- self.reply_always_array = func.reply_always_array
- self.dimensions_in_reply = func.dimensions_in_reply
- self.img_reset = None
-
- self.server_handcode = 0
- self.client_handcode = 0
- self.ignore = 0
-
- self.count_parameter_list = func.count_parameter_list
- self.counter_list = func.counter_list
- self.offsets_calculated = 0
- return
-
-
-class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
- def __init__(self):
- glX_proto_common.glx_print_proto.__init__(self)
- self.name = "glX_proto_send.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
-
-
- self.last_category = ""
- self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
- self.pixel_stubs = {}
- self.debug = 0
- return
-
- def printRealHeader(self):
- print ''
- print '#include <GL/gl.h>'
- print '#include "indirect.h"'
- print '#include "glxclient.h"'
- print '#include "indirect_size.h"'
- print '#include <GL/glxproto.h>'
- print '#ifdef USE_XCB'
- print '#include <X11/xcl.h>'
- print '#include <X11/XCB/xcb.h>'
- print '#include <X11/XCB/glx.h>'
- print '#endif /* USE_XCB */'
-
- print ''
- print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
- print ''
- self.printFastcall()
- self.printNoinline()
- print ''
- print '#if !defined __GNUC__ || __GNUC__ < 3'
- print '# define __builtin_expect(x, y) x'
- print '#endif'
- print ''
- print '/* If the size and opcode values are known at compile-time, this will, on'
- print ' * x86 at least, emit them with a single instruction.'
- print ' */'
- print '#define emit_header(dest, op, size) \\'
- print ' do { union { short s[2]; int i; } temp; \\'
- print ' temp.s[0] = (size); temp.s[1] = (op); \\'
- print ' *((int *)(dest)) = temp.i; } while(0)'
- print ''
- print """NOINLINE CARD32
-__glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array )
-{
- xGLXSingleReply reply;
-
- (void) _XReply(dpy, (xReply *) & reply, 0, False);
- if (size != 0) {
- if ((reply.length > 0) || reply_is_always_array) {
- const GLint bytes = (reply_is_always_array)
- ? (4 * reply.length) : (reply.size * size);
- const GLint extra = 4 - (bytes & 3);
-
- _XRead(dpy, dest, bytes);
- if ( extra < 4 ) {
- _XEatData(dpy, extra);
- }
- }
- else {
- (void) memcpy( dest, &(reply.pad3), size);
- }
- }
-
- return reply.retval;
-}
-
-NOINLINE void
-__glXReadPixelReply( Display *dpy, __GLXcontext * gc, unsigned max_dim,
- GLint width, GLint height, GLint depth, GLenum format, GLenum type,
- void * dest, GLboolean dimensions_in_reply )
-{
- xGLXSingleReply reply;
- GLint size;
-
- (void) _XReply(dpy, (xReply *) & reply, 0, False);
-
- if ( dimensions_in_reply ) {
- width = reply.pad3;
- height = reply.pad4;
- depth = reply.pad5;
-
- if ((height == 0) || (max_dim < 2)) { height = 1; }
- if ((depth == 0) || (max_dim < 3)) { depth = 1; }
- }
-
- size = reply.length * 4;
- if (size != 0) {
- void * buf = Xmalloc( size );
-
- if ( buf == NULL ) {
- _XEatData(dpy, size);
- __glXSetError(gc, GL_OUT_OF_MEMORY);
- }
- else {
- const GLint extra = 4 - (size & 3);
-
- _XRead(dpy, buf, size);
- if ( extra < 4 ) {
- _XEatData(dpy, extra);
- }
-
- __glEmptyImage(gc, 3, width, height, depth, format, type,
- buf, dest);
- Xfree(buf);
- }
- }
-}
-
-#define X_GLXSingle 0
-
-NOINLINE FASTCALL GLubyte *
-__glXSetupSingleRequest( __GLXcontext * gc, GLint sop, GLint cmdlen )
-{
- xGLXSingleReq * req;
- Display * const dpy = gc->currentDpy;
-
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- LockDisplay(dpy);
- GetReqExtra(GLXSingle, cmdlen, req);
- req->reqType = gc->majorOpcode;
- req->contextTag = gc->currentContextTag;
- req->glxCode = sop;
- return (GLubyte *)(req) + sz_xGLXSingleReq;
-}
-
-NOINLINE FASTCALL GLubyte *
-__glXSetupVendorRequest( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
-{
- xGLXVendorPrivateReq * req;
- Display * const dpy = gc->currentDpy;
-
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate, cmdlen, req);
- req->reqType = gc->majorOpcode;
- req->glxCode = code;
- req->vendorCode = vop;
- req->contextTag = gc->currentContextTag;
- return (GLubyte *)(req) + sz_xGLXVendorPrivateReq;
-}
-
-const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
-
-#define zero (__glXDefaultPixelStore+0)
-#define one (__glXDefaultPixelStore+8)
-#define default_pixel_store_1D (__glXDefaultPixelStore+4)
-#define default_pixel_store_1D_size 20
-#define default_pixel_store_2D (__glXDefaultPixelStore+4)
-#define default_pixel_store_2D_size 20
-#define default_pixel_store_3D (__glXDefaultPixelStore+0)
-#define default_pixel_store_3D_size 36
-#define default_pixel_store_4D (__glXDefaultPixelStore+0)
-#define default_pixel_store_4D_size 36
-"""
-
- for size in self.generic_sizes:
- self.print_generic_function(size)
- return
-
-
- def printBody(self, api):
-
- self.pixel_stubs = {}
- generated_stubs = []
-
- for func in api.functionIterateGlx():
- if func.client_handcode: continue
-
- # If the function is a pixel function with a certain
- # GLX protocol signature, create a fake stub function
- # for it. For example, create a single stub function
- # that is used to implement both glTexImage1D and
- # glTexImage2D.
-
- if func.glx_rop != 0:
- do_it = 0
- for image in func.get_images():
- if image.img_pad_dimensions:
- do_it = 1
- break
-
-
- if do_it:
- [h, n] = hash_pixel_function(func)
-
-
- self.pixel_stubs[ func.name ] = n
- if h not in generated_stubs:
- generated_stubs.append(h)
-
- fake_func = glx_pixel_function_stub( func, n )
- self.printFunction( fake_func )
-
-
- self.printFunction( func )
-
- return
-
-
- def printFunction(self, func):
- if func.glx_rop == ~0:
- print 'static %s' % (func.return_type)
- print '%s( unsigned opcode, unsigned dim, %s )' % (func.name, func.get_parameter_string())
- else:
- print '#define %s %d' % (func.opcode_name(), func.opcode_value())
-
- print '%s' % (func.return_type)
- print '__indirect_gl%s(%s)' % (func.name, func.get_parameter_string())
-
-
- print '{'
-
-
- if func.glx_rop != 0 or func.vectorequiv != None:
- if len(func.images):
- self.printPixelFunction(func)
- else:
- self.printRenderFunction(func)
- elif func.glx_sop != 0 or func.glx_vendorpriv != 0:
- self.printSingleFunction(func)
- pass
- else:
- print "/* Missing GLX protocol for %s. */" % (func.name)
-
- print '}'
- print ''
-
- return
-
-
- def print_generic_function(self, n):
- size = (n + 3) & ~3
- print """static FASTCALL NOINLINE void
-generic_%u_byte( GLint rop, const void * ptr )
-{
- __GLXcontext * const gc = __glXGetCurrentContext();
- const GLuint cmdlen = %u;
-
- emit_header(gc->pc, rop, cmdlen);
- (void) memcpy((void *)(gc->pc + 4), ptr, %u);
- gc->pc += cmdlen;
- if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
-}
-""" % (n, size + 4, size)
- return
-
-
- def common_emit_one_arg(self, p, pc, indent, adjust, extra_offset):
- if p.is_array():
- src_ptr = p.name
- else:
- src_ptr = "&" + p.name
-
- if not extra_offset:
- print '%s (void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
- % (indent, pc, p.offset + adjust, src_ptr, p.size_string() )
- else:
- print '%s (void) memcpy((void *)(%s + %u + %s), (void *)(%s), %s);' \
- % (indent, pc, p.offset + adjust, extra_offset, src_ptr, p.size_string() )
-
- def common_emit_args(self, f, pc, indent, adjust, skip_vla):
- extra_offset = None
-
- for p in f.parameterIterateGlxSend( not skip_vla ):
- if p.name != f.img_reset:
- self.common_emit_one_arg(p, pc, indent, adjust, extra_offset)
-
- if p.is_variable_length():
- temp = p.size_string()
- if extra_offset:
- extra_offset += " + %s" % (temp)
- else:
- extra_offset = temp
-
- return
-
-
- def pixel_emit_args(self, f, pc, indent, large):
- """Emit the arguments for a pixel function. This differs from
- common_emit_args in that pixel functions may require padding
- be inserted (i.e., for the missing width field for
- TexImage1D), and they may also require a 'NULL image' flag
- be inserted before the image data."""
-
- if large:
- adjust = 8
- else:
- adjust = 4
-
- for param in f.parameterIterateGlxSend():
- if not param.is_image():
- self.common_emit_one_arg(param, pc, indent, adjust, None)
-
- if f.pad_after(param):
- print '%s (void) memcpy((void *)(%s + %u), zero, 4);' % (indent, pc, (param.offset + param.size()) + adjust)
-
- else:
- [dim, width, height, depth, extent] = param.get_dimensions()
- if f.glx_rop == ~0:
- dim_str = "dim"
- else:
- dim_str = str(dim)
-
- if param.img_null_flag:
- if large:
- print '%s (void) memcpy((void *)(%s + %u), zero, 4);' % (indent, pc, (param.offset - 4) + adjust)
- else:
- print '%s (void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (indent, pc, (param.offset - 4) + adjust, param.name)
-
-
- pixHeaderPtr = "%s + %u" % (pc, adjust)
- pcPtr = "%s + %u" % (pc, param.offset + adjust)
-
- if not large:
- if param.img_send_null:
- condition = '(compsize > 0) && (%s != NULL)' % (param.name)
- else:
- condition = 'compsize > 0'
-
- print '%s if (%s) {' % (indent, condition)
- print '%s (*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent, dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
- print '%s }' % (indent)
- print '%s else {' % (indent)
- print '%s (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (indent, pixHeaderPtr, dim, dim)
- print '%s }' % (indent)
- else:
- print '%s __glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent, dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
-
- return
-
-
- def large_emit_begin(self, indent, f, op_name = None):
- if not op_name:
- op_name = f.opcode_real_name()
-
- print '%s const GLint op = %s;' % (indent, op_name)
- print '%s const GLuint cmdlenLarge = cmdlen + 4;' % (indent)
- print '%s GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
- print '%s (void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);' % (indent)
- print '%s (void) memcpy((void *)(pc + 4), (void *)(&op), 4);' % (indent)
- return
-
-
- def common_func_print_just_start(self, f):
- print ' __GLXcontext * const gc = __glXGetCurrentContext();'
-
- # The only reason that single and vendor private commands need
- # a variable called 'dpy' is becuase they use the SyncHandle
- # macro. For whatever brain-dead reason, that macro is hard-
- # coded to use a variable called 'dpy' instead of taking a
- # parameter.
-
- # FIXME Simplify the logic related to skip_condition and
- # FIXME condition_list in this function. Basically, remove
- # FIXME skip_condition, and just append the "dpy != NULL" type
- # FIXME condition to condition_list from the start. The only
- # FIXME reason it's done in this confusing way now is to
- # FIXME minimize the diffs in the generated code.
-
- if not f.glx_rop:
- for p in f.parameterIterateOutputs():
- if p.is_image():
- print ' const __GLXattribute * const state = gc->client_state_private;'
- break
-
- print ' Display * const dpy = gc->currentDpy;'
- skip_condition = "dpy != NULL"
- elif f.can_be_large:
- skip_condition = "gc->currentDpy != NULL"
- else:
- skip_condition = None
-
-
- if f.return_type != 'void':
- print ' %s retval = (%s) 0;' % (f.return_type, f.return_type)
-
-
- self.emit_packet_size_calculation(f, 0)
-
- condition_list = []
- for p in f.parameterIterateCounters():
- condition_list.append( "%s >= 0" % (p.name) )
-
- if skip_condition:
- condition_list.append( skip_condition )
-
- if len( condition_list ) > 0:
- if len( condition_list ) > 1:
- skip_condition = "(%s)" % (string.join( condition_list, ") && (" ))
- else:
- skip_condition = "%s" % (condition_list.pop(0))
-
- print ' if (__builtin_expect(%s, 1)) {' % (skip_condition)
- return 1
- else:
- return 0
-
-
- def printSingleFunction(self, f):
- self.common_func_print_just_start(f)
-
- if self.debug:
- print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name)
-
- if f.glx_vendorpriv == 0:
-
- # XCB specific:
- print '#ifdef USE_XCB'
- if self.debug:
- print ' printf("\\tUsing XCB.\\n");'
- print ' XCBConnection *c = XCBConnectionOfDisplay(dpy);'
- print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
- xcb_name = 'XCBGlx%s' % f.name
-
- iparams=[]
- extra_iparams = []
- output = None
- for p in f.parameterIterator():
- if p.is_output:
- output = p
-
- if p.is_image():
- if p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP":
- extra_iparams.append("state->storePack.swapEndian")
- else:
- extra_iparams.append("0")
-
- # Hardcode this in. lsb_first param (apparently always GL_FALSE)
- # also present in GetPolygonStipple, but taken care of above.
- if xcb_name == "XCBGlxReadPixels":
- extra_iparams.append("0")
- else:
- iparams.append(p.name)
-
-
- xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams))
-
- if f.needs_reply():
- print ' %sRep *reply = %sReply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request)
- if output and f.reply_always_array:
- print ' (void)memcpy(%s, %sData(reply), %sDataLength(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
-
- elif output and not f.reply_always_array:
- if not output.is_image():
- print ' if (%sDataLength(reply) == 0)' % (xcb_name)
- print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name)
- print ' else'
- print ' (void)memcpy(%s, %sData(reply), %sDataLength(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
-
-
- if f.return_type != 'void':
- print ' retval = reply->ret_val;'
- print ' free(reply);'
- else:
- print ' ' + xcb_request + ';'
- print '#else'
- # End of XCB specific.
-
-
- if f.parameters != []:
- pc_decl = "GLubyte const * pc ="
- else:
- pc_decl = "(void)"
-
- if f.glx_vendorpriv != 0:
- print ' %s __glXSetupVendorRequest(gc, %s, %s, cmdlen);' % (pc_decl, f.opcode_real_name(), f.opcode_name())
- else:
- print ' %s __glXSetupSingleRequest(gc, %s, cmdlen);' % (pc_decl, f.opcode_name())
-
- self.common_emit_args(f, "pc", " ", 0, 0)
-
- images = f.get_images()
-
- for img in images:
- if img.is_output:
- o = f.command_fixed_length() - 4
- print ' *(int32_t *)(pc + %u) = 0;' % (o)
- if img.img_format != "GL_COLOR_INDEX" or img.img_type != "GL_BITMAP":
- print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o)
-
- if f.img_reset:
- print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset)
-
-
- return_name = ''
- if f.needs_reply():
- if f.return_type != 'void':
- return_name = " retval"
- return_str = " retval = (%s)" % (f.return_type)
- else:
- return_str = " (void)"
-
- got_reply = 0
-
- for p in f.parameterIterateOutputs():
- if p.is_image():
- [dim, w, h, d, junk] = p.get_dimensions()
- if f.dimensions_in_reply:
- print " __glXReadPixelReply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, p.img_format, p.img_type, p.name)
- else:
- print " __glXReadPixelReply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, p.img_format, p.img_type, p.name)
-
- got_reply = 1
- else:
- if f.reply_always_array:
- aa = "GL_TRUE"
- else:
- aa = "GL_FALSE"
-
- # gl_parameter.size() returns the size
- # of the entire data item. If the
- # item is a fixed-size array, this is
- # the size of the whole array. This
- # is not what __glXReadReply wants. It
- # wants the size of a single data
- # element in the reply packet.
- # Dividing by the array size (1 for
- # non-arrays) gives us this.
-
- s = p.size() / p.get_element_count()
- print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa)
- got_reply = 1
-
-
- # If a reply wasn't read to fill an output parameter,
- # read a NULL reply to get the return value.
-
- if not got_reply:
- print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str)
-
-
- elif self.debug:
- # Only emit the extra glFinish call for functions
- # that don't already require a reply from the server.
- print ' __indirect_glFinish();'
-
- if self.debug:
- print ' printf( "Exit %%s.\\n", "gl%s" );' % (f.name)
-
-
- print ' UnlockDisplay(dpy); SyncHandle();'
-
- if f.glx_vendorpriv == 0:
- print '#endif /* USE_XCB */'
-
- print ' }'
- print ' return%s;' % (return_name)
- return
-
-
- def printPixelFunction(self, f):
- if self.pixel_stubs.has_key( f.name ):
- # Normally gl_function::get_parameter_string could be
- # used. However, this call needs to have the missing
- # dimensions (e.g., a fake height value for
- # glTexImage1D) added in.
-
- p_string = ""
- for param in f.parameterIterateGlxSend():
- p_string += ", " + param.name
-
- if param.is_image():
- [dim, junk, junk, junk, junk] = param.get_dimensions()
-
- if f.pad_after(param):
- p_string += ", 1"
-
- print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string)
- return
-
-
- if self.common_func_print_just_start(f):
- indent = " "
- trailer = " }"
- else:
- indent = ""
- trailer = None
-
-
- if f.can_be_large:
- print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent)
- print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent)
- print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
- print '%s }' % (indent)
- indent += " "
-
- if f.glx_rop == ~0:
- opcode = "opcode"
- else:
- opcode = f.opcode_real_name()
-
- print '%s emit_header(gc->pc, %s, cmdlen);' % (indent, opcode)
-
- self.pixel_emit_args( f, "gc->pc", indent, 0 )
- print '%s gc->pc += cmdlen;' % (indent)
- print '%s if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent)
-
- if f.can_be_large:
- print '%s}' % (indent)
- print '%selse {' % (indent)
-
- self.large_emit_begin(indent, f, opcode)
- self.pixel_emit_args( f, "pc", indent, 1 )
-
- print '%s}' % (indent)
-
- if trailer: print trailer
- return
-
-
- def printRenderFunction(self, f):
- # There is a class of GL functions that take a single pointer
- # as a parameter. This pointer points to a fixed-size chunk
- # of data, and the protocol for this functions is very
- # regular. Since they are so regular and there are so many
- # of them, special case them with generic functions. On
- # x86, this saves about 26KB in the libGL.so binary.
-
- if f.variable_length_parameter() == None and len(f.parameters) == 1:
- p = f.parameters[0]
- if p.is_pointer():
- cmdlen = f.command_fixed_length()
- if cmdlen in self.generic_sizes:
- print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name)
- return
-
- if self.common_func_print_just_start(f):
- indent = " "
- trailer = " }"
- else:
- indent = ""
- trailer = None
-
- if self.debug:
- print '%s printf( "Enter %%s...\\n", "gl%s" );' % (indent, f.name)
-
- if f.can_be_large:
- print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent)
- print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent)
- print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent)
- print '%s }' % (indent)
- indent += " "
-
- print '%s emit_header(gc->pc, %s, cmdlen);' % (indent, f.opcode_real_name())
-
- self.common_emit_args(f, "gc->pc", indent, 4, 0)
- print '%s gc->pc += cmdlen;' % (indent)
- print '%s if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent)
-
- if f.can_be_large:
- print '%s}' % (indent)
- print '%selse {' % (indent)
-
- self.large_emit_begin(indent, f)
- self.common_emit_args(f, "pc", indent, 8, 1)
-
- p = f.variable_length_parameter()
- print '%s __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (indent, p.offset + 8, p.name, p.size_string())
- print '%s}' % (indent)
-
- if self.debug:
- print '%s __indirect_glFinish();' % (indent)
- print '%s printf( "Exit %%s.\\n", "gl%s" );' % (indent, f.name)
-
- if trailer: print trailer
- return
-
-
-class PrintGlxProtoInit_c(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_send.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
- return
-
-
- def printRealHeader(self):
- print """/**
- * \\file indirect_init.c
- * Initialize indirect rendering dispatch table.
- *
- * \\author Kevin E. Martin <kevin@precisioninsight.com>
- * \\author Brian Paul <brian@precisioninsight.com>
- * \\author Ian Romanick <idr@us.ibm.com>
- */
-
-#include "indirect_init.h"
-#include "indirect.h"
-#include "glapi.h"
-
-
-/**
- * No-op function used to initialize functions that have no GLX protocol
- * support.
- */
-static int NoOp(void)
-{
- return 0;
-}
-
-/**
- * Create and initialize a new GL dispatch table. The table is initialized
- * with GLX indirect rendering protocol functions.
- */
-__GLapi * __glXNewIndirectAPI( void )
-{
- __GLapi *glAPI;
- GLuint entries;
-
- entries = _glapi_get_dispatch_table_size();
- glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
-
- /* first, set all entries to point to no-op functions */
- {
- int i;
- void **dispatch = (void **) glAPI;
- for (i = 0; i < entries; i++) {
- dispatch[i] = (void *) NoOp;
- }
- }
-
- /* now, initialize the entries we understand */"""
-
- def printRealFooter(self):
- print """
- return glAPI;
-}
-"""
- return
-
-
- def printCategory(self, category_group, show_num):
- cat_keys = category_group.keys()
- cat_keys.sort()
- for cat_num in cat_keys:
- first = 1
- for offset in category_group[ cat_num ]:
- [cat_name, func_name] = category_group[ cat_num ][ offset ]
-
- if first:
- print ''
- if show_num:
- print ' /* %3u. %s */' % (cat_num, cat_name)
- else:
- print ' /* %s */' % (cat_name)
- print ''
- first = 0
-
- print ' glAPI->%s = __indirect_gl%s;' % (func_name, func_name)
-
-
- def printBody(self, api):
- core_categories = {}
- arb_categories = {}
- other_categories = {}
- next_unnum = 1000
-
- for func in api.functionIterateGlx():
- [cat, num] = api.get_category_for_name( func.name )
-
- # There are three groups of "categories" that we
- # care about here. We want to separate the core GL
- # version categories from extensions. We also want to
- # separate the ARB extensions from the non-ARB
- # extensions.
- #
- # This is done by first trying to convert the category
- # name to a floating point number. All core GL
- # versions are of the form "N.M" where both N and M
- # are integers. If the cast to float fails, an
- # exception will be thrown. Once down that path,
- # we can look at the start of the extension string.
- # If it begins with "GL_ARB_", it's an ARB extension.
- #
- # Once the categories are separated, the are ordered
- # by number. The un-numbered non-ARB extensions
- # (e.g., GL_INGR_blend_func_separate) are assigned
- # arbitrary numbers starting at 1000.
- #
- # FIXME In order to maintain repeatability, the
- # FIXME unnumbered extensions should be put in their
- # FIXME own dictionary and ordered by name (since they
- # FIXME have no number).
-
- try:
- num = float(cat)
- if not core_categories.has_key( num ):
- core_categories[ num ] = {}
-
- core_categories[ num ][ func.offset ] = [cat, func.name]
-
- except Exception, e:
- if not num:
- num = next_unnum
- next_unnum += 1
- else:
- num = int(num)
-
- if cat.startswith( "GL_ARB_" ):
- if not arb_categories.has_key( num ):
- arb_categories[ num ] = {}
-
- arb_categories[ num ][ func.offset ] = [cat, func.name]
- else:
- if not other_categories.has_key( num ):
- other_categories[ num ] = {}
-
- other_categories[ num ][ func.offset ] = [cat, func.name]
-
- self.printCategory( core_categories, 0 )
- self.printCategory( arb_categories, 1 )
- self.printCategory( other_categories, 1 )
- return
-
-
-class PrintGlxProtoInit_h(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_send.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
- self.header_tag = "_INDIRECT_H_"
-
- self.last_category = ""
- return
-
-
- def printRealHeader(self):
- print """/**
- * \\file
- * Prototypes for indirect rendering functions.
- *
- * \\author Kevin E. Martin <kevin@precisioninsight.com>
- * \\author Ian Romanick <idr@us.ibm.com>
- */
-"""
- self.printVisibility( "HIDDEN", "hidden" )
- self.printFastcall()
- self.printNoinline()
-
- print """
-#include "glxclient.h"
-
-extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size,
- void * dest, GLboolean reply_is_always_array );
-
-extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy,
- __GLXcontext * gc, unsigned max_dim, GLint width, GLint height,
- GLint depth, GLenum format, GLenum type, void * dest,
- GLboolean dimensions_in_reply );
-
-extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest(
- __GLXcontext * gc, GLint sop, GLint cmdlen );
-
-extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
- __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen );
-"""
-
-
- def printBody(self, api):
- for func in api.functionIterateGlx():
- print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, func.get_parameter_string())
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0]
- print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'."
- print " -d Enable extra debug information in the generated code."
- sys.exit(1)
-
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d")
- except Exception,e:
- show_usage()
-
- debug = 0
- mode = "proto"
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- mode = val
- elif arg == "-d":
- debug = 1
-
- if mode == "proto":
- printer = PrintGlxProtoStubs()
- elif mode == "init_c":
- printer = PrintGlxProtoInit_c()
- elif mode == "init_h":
- printer = PrintGlxProtoInit_h()
- else:
- show_usage()
-
-
- printer.debug = debug
- api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
-
- printer.Print( api )
diff --git a/src/mesa/glapi/glX_proto_size.py b/src/mesa/glapi/glX_proto_size.py
deleted file mode 100644
index 54232781d29..00000000000
--- a/src/mesa/glapi/glX_proto_size.py
+++ /dev/null
@@ -1,707 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, glX_XML
-import license
-import sys, getopt, copy, string
-
-
-class glx_enum_function:
- def __init__(self, func_name, enum_dict):
- self.name = func_name
- self.mode = 1
- self.sig = None
-
- # "enums" is a set of lists. The element in the set is the
- # value of the enum. The list is the list of names for that
- # value. For example, [0x8126] = {"POINT_SIZE_MIN",
- # "POINT_SIZE_MIN_ARB", "POINT_SIZE_MIN_EXT",
- # "POINT_SIZE_MIN_SGIS"}.
-
- self.enums = {}
-
- # "count" is indexed by count values. Each element of count
- # is a list of index to "enums" that have that number of
- # associated data elements. For example, [4] =
- # {GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION,
- # GL_AMBIENT_AND_DIFFUSE} (the enum names are used here,
- # but the actual hexadecimal values would be in the array).
-
- self.count = {}
-
-
- # Fill self.count and self.enums using the dictionary of enums
- # that was passed in. The generic Get functions (e.g.,
- # GetBooleanv and friends) are handled specially here. In
- # the data the generic Get functions are refered to as "Get".
-
- if func_name in ["GetIntegerv", "GetBooleanv", "GetFloatv", "GetDoublev"]:
- match_name = "Get"
- else:
- match_name = func_name
-
- mode_set = 0
- for enum_name in enum_dict:
- e = enum_dict[ enum_name ]
-
- if e.functions.has_key( match_name ):
- [count, mode] = e.functions[ match_name ]
-
- if mode_set and mode != self.mode:
- raise RuntimeError("Not all enums for %s have the same mode." % (func_name))
-
- self.mode = mode
-
- if self.enums.has_key( e.value ):
- if e.name not in self.enums[ e.value ]:
- self.enums[ e.value ].append( e )
- else:
- if not self.count.has_key( count ):
- self.count[ count ] = []
-
- self.enums[ e.value ] = [ e ]
- self.count[ count ].append( e.value )
-
-
- return
-
-
- def signature( self ):
- if self.sig == None:
- self.sig = ""
- for i in self.count:
- if i == None:
- raise RuntimeError("i is None. WTF?")
-
- self.count[i].sort()
- for e in self.count[i]:
- self.sig += "%04x,%d," % (e, i)
-
- return self.sig
-
-
- def is_set( self ):
- return self.mode
-
-
- def PrintUsingTable(self):
- """Emit the body of the __gl*_size function using a pair
- of look-up tables and a mask. The mask is calculated such
- that (e & mask) is unique for all the valid values of e for
- this function. The result of (e & mask) is used as an index
- into the first look-up table. If it matches e, then the
- same entry of the second table is returned. Otherwise zero
- is returned.
-
- It seems like this should cause better code to be generated.
- However, on x86 at least, the resulting .o file is about 20%
- larger then the switch-statment version. I am leaving this
- code in because the results may be different on other
- platforms (e.g., PowerPC or x86-64)."""
-
- return 0
- count = 0
- for a in self.enums:
- count += 1
-
- if self.count.has_key(-1):
- return 0
-
- # Determine if there is some mask M, such that M = (2^N) - 1,
- # that will generate unique values for all of the enums.
-
- mask = 0
- for i in [1, 2, 3, 4, 5, 6, 7, 8]:
- mask = (1 << i) - 1
-
- fail = 0;
- for a in self.enums:
- for b in self.enums:
- if a != b:
- if (a & mask) == (b & mask):
- fail = 1;
-
- if not fail:
- break;
- else:
- mask = 0
-
- if (mask != 0) and (mask < (2 * count)):
- masked_enums = {}
- masked_count = {}
-
- for i in range(0, mask + 1):
- masked_enums[i] = "0";
- masked_count[i] = 0;
-
- for c in self.count:
- for e in self.count[c]:
- i = e & mask
- enum_obj = self.enums[e][0]
- masked_enums[i] = '0x%04x /* %s */' % (e, enum_obj.name )
- masked_count[i] = c
-
-
- print ' static const GLushort a[%u] = {' % (mask + 1)
- for e in masked_enums:
- print ' %s, ' % (masked_enums[e])
- print ' };'
-
- print ' static const GLubyte b[%u] = {' % (mask + 1)
- for c in masked_count:
- print ' %u, ' % (masked_count[c])
- print ' };'
-
- print ' const unsigned idx = (e & 0x%02xU);' % (mask)
- print ''
- print ' return (e == a[idx]) ? (GLint) b[idx] : 0;'
- return 1;
- else:
- return 0;
-
-
- def PrintUsingSwitch(self, name):
- """Emit the body of the __gl*_size function using a
- switch-statement."""
-
- print ' switch( e ) {'
-
- for c in self.count:
- for e in self.count[c]:
- first = 1
-
- # There may be multiple enums with the same
- # value. This happens has extensions are
- # promoted from vendor-specific or EXT to
- # ARB and to the core. Emit the first one as
- # a case label, and emit the others as
- # commented-out case labels.
-
- list = {}
- for enum_obj in self.enums[e]:
- list[ enum_obj.priority() ] = enum_obj.name
-
- keys = list.keys()
- keys.sort()
- for k in keys:
- j = list[k]
- if first:
- print ' case GL_%s:' % (j)
- first = 0
- else:
- print '/* case GL_%s:*/' % (j)
-
- if c == -1:
- print ' return __gl%s_variable_size( e );' % (name)
- else:
- print ' return %u;' % (c)
-
- print ' default: return 0;'
- print ' }'
-
-
- def Print(self, name):
- print 'INTERNAL PURE FASTCALL GLint'
- print '__gl%s_size( GLenum e )' % (name)
- print '{'
-
- if not self.PrintUsingTable():
- self.PrintUsingSwitch(name)
-
- print '}'
- print ''
-
-
-class glx_server_enum_function(glx_enum_function):
- def __init__(self, func, enum_dict):
- glx_enum_function.__init__(self, func.name, enum_dict)
-
- self.function = func
- return
-
-
- def signature( self ):
- if self.sig == None:
- sig = glx_enum_function.signature(self)
-
- p = self.function.variable_length_parameter()
- if p:
- sig += "%u" % (p.size())
-
- self.sig = sig
-
- return self.sig;
-
-
- def Print(self, name, printer):
- f = self.function
- printer.common_func_print_just_header( f )
-
- fixup = []
-
- foo = {}
- for param_name in f.count_parameter_list:
- o = f.offset_of( param_name )
- foo[o] = param_name
-
- for param_name in f.counter_list:
- o = f.offset_of( param_name )
- foo[o] = param_name
-
- keys = foo.keys()
- keys.sort()
- for o in keys:
- p = f.parameters_by_name[ foo[o] ]
-
- printer.common_emit_one_arg(p, "pc", " ", 0)
- fixup.append( p.name )
-
-
- print ' GLsizei compsize;'
- print ''
-
- printer.common_emit_fixups(fixup)
-
- print ''
- print ' compsize = __gl%s_size(%s);' % (f.name, string.join(f.count_parameter_list, ","))
- p = f.variable_length_parameter()
- print ' return __GLX_PAD(%s);' % (p.size_string())
-
- print '}'
- print ''
-
-
-class PrintGlxSizeStubs_common(gl_XML.gl_print_base):
- do_get = (1 << 0)
- do_set = (1 << 1)
-
- def __init__(self, which_functions):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_size.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004", "IBM")
-
- self.emit_set = ((which_functions & PrintGlxSizeStubs_common.do_set) != 0)
- self.emit_get = ((which_functions & PrintGlxSizeStubs_common.do_get) != 0)
- return
-
-
-class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
- def printRealHeader(self):
- print ''
- print '#include <GL/gl.h>'
- if self.emit_get:
- print '#include "indirect_size_get.h"'
- print '#include "glxserver.h"'
- print '#include "indirect_util.h"'
-
- print '#include "indirect_size.h"'
-
- print ''
- self.printPure()
- print ''
- self.printFastcall()
- print ''
- self.printVisibility( "INTERNAL", "internal" )
- print ''
- print ''
- print '#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)'
- print '# undef HAVE_ALIAS'
- print '#endif'
- print '#ifdef HAVE_ALIAS'
- print '# define ALIAS2(from,to) \\'
- print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
- print ' __attribute__ ((alias( # to )));'
- print '# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )'
- print '#else'
- print '# define ALIAS(from,to) \\'
- print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
- print ' { return __gl ## to ## _size( e ); }'
- print '#endif'
- print ''
- print ''
-
-
- def printBody(self, api):
- enum_sigs = {}
- aliases = []
-
- for func in api.functionIterateGlx():
- ef = glx_enum_function( func.name, api.enums_by_name )
- if len(ef.enums) == 0:
- continue
-
- if (ef.is_set() and self.emit_set) or (not ef.is_set() and self.emit_get):
- sig = ef.signature()
- if enum_sigs.has_key( sig ):
- aliases.append( [func.name, enum_sigs[ sig ]] )
- else:
- enum_sigs[ sig ] = func.name
- ef.Print( func.name )
-
-
- for [alias_name, real_name] in aliases:
- print 'ALIAS( %s, %s )' % (alias_name, real_name)
-
-
-
-class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common):
- def printRealHeader(self):
- print """/**
- * \\file
- * Prototypes for functions used to determine the number of data elements in
- * various GLX protocol messages.
- *
- * \\author Ian Romanick <idr@us.ibm.com>
- */
-"""
- self.printPure();
- print ''
- self.printFastcall();
- print ''
- self.printVisibility( "INTERNAL", "internal" );
- print ''
-
-
- def printBody(self, api):
- for func in api.functionIterateGlx():
- ef = glx_enum_function( func.name, api.enums_by_name )
- if len(ef.enums) == 0:
- continue
-
- if (ef.is_set() and self.emit_set) or (not ef.is_set() and self.emit_get):
- print 'extern INTERNAL PURE FASTCALL GLint __gl%s_size(GLenum);' % (func.name)
-
-
-class PrintGlxReqSize_common(gl_XML.gl_print_base):
- """Common base class for PrintGlxSizeReq_h and PrintGlxSizeReq_h.
-
- The main purpose of this common base class is to provide the infrastructure
- for the derrived classes to iterate over the same set of functions.
- """
-
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "glX_proto_size.py (from Mesa)"
- self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
-
-
-class PrintGlxReqSize_h(PrintGlxReqSize_common):
- def __init__(self):
- PrintGlxReqSize_common.__init__(self)
- self.header_tag = "_INDIRECT_REQSIZE_H_"
-
-
- def printRealHeader(self):
- self.printVisibility("HIDDEN", "hidden")
- print ''
- self.printPure()
- print ''
-
-
- def printBody(self, api):
- for func in api.functionIterateGlx():
- if not func.ignore and func.has_variable_size_request():
- print 'extern PURE HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap);' % (func.name)
-
-
-class PrintGlxReqSize_c(PrintGlxReqSize_common):
- """Create the server-side 'request size' functions.
-
- Create the server-side functions that are used to determine what the
- size of a varible length command should be. The server then uses
- this value to determine if the incoming command packed it malformed.
- """
-
- def __init__(self):
- PrintGlxReqSize_common.__init__(self)
- self.counter_sigs = {}
-
-
- def printRealHeader(self):
- print ''
- print '#include <GL/gl.h>'
- print '#include "glxserver.h"'
- print '#include "indirect_size.h"'
- print '#include "indirect_reqsize.h"'
- print ''
- print '#if defined(linux)'
- print '# include <byteswap.h>'
- print '# define SWAP_32(v) do { (v) = bswap_32(v); } while(0)'
- print '#else'
- print '# include <X11/misc.h>'
- print '# define SWAP_32(v) do { char tmp; swapl(&v, tmp); } while(0)'
- print '#endif'
-
- print ''
- print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
- print ''
- print '#if defined(__CYGWIN__) || defined(__MINGW32__)'
- print '# undef HAVE_ALIAS'
- print '#endif'
- print '#ifdef HAVE_ALIAS'
- print '# define ALIAS2(from,to) \\'
- print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
- print ' __attribute__ ((alias( # to )));'
- print '# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )'
- print '#else'
- print '# define ALIAS(from,to) \\'
- print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
- print ' { return __glX ## to ## ReqSize( pc, swap ); }'
- print '#endif'
- print ''
- print ''
-
-
- def printBody(self, api):
- aliases = []
- enum_functions = {}
- enum_sigs = {}
-
- for func in api.functionIterateGlx():
- if not func.has_variable_size_request(): continue
-
- ef = glx_server_enum_function( func, api.enums_by_name )
- if len(ef.enums) == 0: continue
-
- sig = ef.signature()
-
- if not enum_functions.has_key(func.name):
- enum_functions[ func.name ] = sig
-
- if not enum_sigs.has_key( sig ):
- enum_sigs[ sig ] = ef
-
-
-
- for func in api.functionIterateGlx():
- # Even though server-handcode fuctions are on "the
- # list", and prototypes are generated for them, there
- # isn't enough information to generate a size
- # function. If there was enough information, they
- # probably wouldn't need to be handcoded in the first
- # place!
-
- if func.server_handcode: continue
- if not func.has_variable_size_request(): continue
-
- if enum_functions.has_key(func.name):
- sig = enum_functions[func.name]
- ef = enum_sigs[ sig ]
-
- if ef.name != func.name:
- aliases.append( [func.name, ef.name] )
- else:
- ef.Print( func.name, self )
-
- elif func.images:
- self.printPixelFunction(func)
- elif func.has_variable_size_request():
- a = self.printCountedFunction(func)
- if a: aliases.append(a)
-
-
- for [alias_name, real_name] in aliases:
- print 'ALIAS( %s, %s )' % (alias_name, real_name)
-
- return
-
-
- def common_emit_fixups(self, fixup):
- """Utility function to emit conditional byte-swaps."""
-
- if fixup:
- print ' if (swap) {'
- for name in fixup:
- print ' SWAP_32( %s );' % (name)
- print ' }'
-
- return
-
-
- def common_emit_one_arg(self, p, pc, indent, adjust):
- offset = p.offset
- dst = p.string()
- src = '(%s *)' % (p.type_string())
- print '%s%-18s = *%11s(%s + %u);' % (indent, dst, src, pc, offset + adjust);
- return
-
-
- def common_func_print_just_header(self, f):
- print 'int'
- print '__glX%sReqSize( const GLbyte * pc, Bool swap )' % (f.name)
- print '{'
-
-
- def printPixelFunction(self, f):
- self.common_func_print_just_header(f)
-
- f.offset_of( f.parameters[0].name )
- [dim, w, h, d, junk] = f.get_images()[0].get_dimensions()
-
- print ' GLint row_length = * (GLint *)(pc + 4);'
-
- if dim < 3:
- fixup = ['row_length', 'skip_rows', 'alignment']
- print ' GLint image_height = 0;'
- print ' GLint skip_images = 0;'
- print ' GLint skip_rows = * (GLint *)(pc + 8);'
- print ' GLint alignment = * (GLint *)(pc + 16);'
- else:
- fixup = ['row_length', 'image_height', 'skip_rows', 'skip_images', 'alignment']
- print ' GLint image_height = * (GLint *)(pc + 8);'
- print ' GLint skip_rows = * (GLint *)(pc + 16);'
- print ' GLint skip_images = * (GLint *)(pc + 20);'
- print ' GLint alignment = * (GLint *)(pc + 32);'
-
- img = f.images[0]
- for p in f.parameterIterateGlxSend():
- if p.name in [w, h, d, img.img_format, img.img_type, img.img_target]:
- self.common_emit_one_arg( p, "pc", " ", 0 )
- fixup.append( p.name )
-
- print ''
-
- self.common_emit_fixups(fixup)
-
- print ''
- print ' return __glXImageSize(%s, %s, %s, %s, %s, %s,' % (img.img_format, img.img_type, img.img_target, w, h, d )
- print ' image_height, row_length, skip_images,'
- print ' skip_rows, alignment);'
- print '}'
- print ''
- return
-
-
- def printCountedFunction(self, f):
-
- sig = ""
- offset = 0
- fixup = []
- params = []
- plus = ''
- size = ''
- param_offsets = {}
-
- # Calculate the offset of each counter parameter and the
- # size string for the variable length parameter(s). While
- # that is being done, calculate a unique signature for this
- # function.
-
- for p in f.parameterIterateGlxSend():
- if p.is_counter:
- fixup.append( p.name )
- params.append( p )
- elif p.counter:
- s = p.size()
- if s == 0: s = 1
-
- sig += "(%u,%u)" % (f.offset_of(p.counter), s)
- size += '%s%s' % (plus, p.size_string())
- plus = ' + '
-
-
- # If the calculated signature matches a function that has
- # already be emitted, don't emit this function. Instead, add
- # it to the list of function aliases.
-
- if self.counter_sigs.has_key(sig):
- n = self.counter_sigs[sig];
- alias = [f.name, n]
- else:
- alias = None
- self.counter_sigs[sig] = f.name
-
- self.common_func_print_just_header(f)
-
- for p in params:
- self.common_emit_one_arg(p, "pc", " ", 0 )
-
-
- print ''
- self.common_emit_fixups(fixup)
- print ''
-
- print ' return __GLX_PAD(%s);' % (size)
- print '}'
- print ''
-
- return alias
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] -m output_mode [--only-get | --only-set] [--get-alias-set]" % sys.argv[0]
- print " -m output_mode Output mode can be one of 'size_c' or 'size_h'."
- print " --only-get Only emit 'get'-type functions."
- print " --only-set Only emit 'set'-type functions."
- print ""
- print "By default, both 'get' and 'set'-type functions are emitted."
- sys.exit(1)
-
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:h:", ["only-get", "only-set", "header-tag"])
- except Exception,e:
- show_usage()
-
- mode = None
- header_tag = None
- which_functions = PrintGlxSizeStubs_common.do_get | PrintGlxSizeStubs_common.do_set
-
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- mode = val
- elif arg == "--only-get":
- which_functions = PrintGlxSizeStubs_common.do_get
- elif arg == "--only-set":
- which_functions = PrintGlxSizeStubs_common.do_set
- elif (arg == '-h') or (arg == "--header-tag"):
- header_tag = val
-
- if mode == "size_c":
- printer = PrintGlxSizeStubs_c( which_functions )
- elif mode == "size_h":
- printer = PrintGlxSizeStubs_h( which_functions )
- if header_tag:
- printer.header_tag = header_tag
- elif mode == "reqsize_c":
- printer = PrintGlxReqSize_c()
- elif mode == "reqsize_h":
- printer = PrintGlxReqSize_h()
- else:
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
-
-
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_API.dtd b/src/mesa/glapi/gl_API.dtd
deleted file mode 100644
index ded487bc922..00000000000
--- a/src/mesa/glapi/gl_API.dtd
+++ /dev/null
@@ -1,134 +0,0 @@
-<!ELEMENT OpenGLAPI (category?, xi:include?, OpenGLAPI?)+>
-<!ELEMENT category (type*, enum*, function*)*>
-<!ELEMENT type EMPTY>
-<!ELEMENT enum (size*)>
-<!ELEMENT size EMPTY>
-<!ELEMENT function (param*, return?, glx?)*>
-<!ELEMENT param EMPTY>
-<!ELEMENT return EMPTY>
-<!ELEMENT glx EMPTY>
-
-<!ELEMENT xi:include (xi:fallback)?>
-<!ATTLIST xi:include
- xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"
- href CDATA #REQUIRED
- parse (xml|text) "xml"
- encoding CDATA #IMPLIED>
-<!ELEMENT xi:fallback ANY>
-<!ATTLIST xi:fallback
- xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude">
-
-
-<!ATTLIST category name NMTOKEN #REQUIRED
- number NMTOKEN #IMPLIED
- window_system NMTOKEN #IMPLIED>
-<!ATTLIST type name NMTOKEN #REQUIRED
- size NMTOKEN #REQUIRED
- float (true | false) "false"
- unsigned (true | false) "false"
- glx_name NMTOKEN #IMPLIED>
-<!ATTLIST enum name NMTOKEN #REQUIRED
- count CDATA #IMPLIED
- value NMTOKEN #REQUIRED>
-<!ATTLIST function name NMTOKEN #REQUIRED
- alias NMTOKEN #IMPLIED
- offset CDATA #IMPLIED
- vectorequiv NMTOKEN #IMPLIED>
-<!ATTLIST size name NMTOKEN #REQUIRED
- count NMTOKEN #IMPLIED
- mode (get | set) "set">
-<!ATTLIST param name NMTOKEN #REQUIRED
- type CDATA #REQUIRED
- count NMTOKEN #IMPLIED
- counter (true | false) "false"
- count_scale NMTOKEN "1"
- output (true | false) "false"
- img_width NMTOKEN #IMPLIED
- img_height NMTOKEN #IMPLIED
- img_depth NMTOKEN #IMPLIED
- img_extent NMTOKEN #IMPLIED
- img_xoff NMTOKEN #IMPLIED
- img_yoff NMTOKEN #IMPLIED
- img_zoff NMTOKEN #IMPLIED
- img_woff NMTOKEN #IMPLIED
- img_format NMTOKEN #IMPLIED
- img_type NMTOKEN #IMPLIED
- img_target NMTOKEN #IMPLIED
- img_send_null (true | false) "false"
- img_null_flag (true | false) "false"
- img_pad_dimensions (true | false) "false"
- variable_param NMTOKENS #IMPLIED>
-<!ATTLIST return type CDATA "void">
-<!ATTLIST glx rop NMTOKEN #IMPLIED
- sop NMTOKEN #IMPLIED
- vendorpriv NMTOKEN #IMPLIED
- large (true | false) "false"
- doubles_in_order (true | false) "false"
- always_array (true | false) "false"
- handcode (true | false | client | server) "false"
- img_reset NMTOKEN #IMPLIED
- dimensions_in_reply (true | false) "false"
- ignore (true | false) "false">
-
-<!--
-The various attributes for param and glx have the meanings listed below.
-When adding new functions, please annote them correctly. In most cases this
-will just mean adding a '<glx ignore="true"/>' tag.
-
-param:
- name - name of the parameter
- type - fully qualified type (e.g., with "const", etc.)
- count - for counted arrays (e.g., the 'lists' parameter to glCallLists),
- the parameter or literal that represents the count. For functions
- like glVertex3fv it will be a litteral, for others it will be one of
- the parameters.
- counter - this parameter is a counter that will be referenced by the
- 'count' attribute in another parameter.
- count_scale - literal value scale factor for the 'count' attribute.
- See ProgramParameters4dvNV for an example.
- output - this parameter is used to store the output of the function.
- variable_param - name of parameter used to determine the number of
- elements referenced by this parameter. This should be the name of a
- single enum parameter. Most of the gl*Parameter[if]v functions use
- this. Additionally, the enums that can be passed should be properly
- annotated.
- img_width / img_height / img_depth / img_extent - name of parameters
- (or hardcoded integer) used for the dimensions of pixel data.
- img_xoff / img_yoff / img_zoff / img_woff - name of parameters used
- for x, y, z, and w offsets of pixel data.
- img_format - name of parameter used as the pixel data format.
- img_type - name of parameter used as the pixel data type.
- img_target - name of parameter used as a texture target. Non-texture
- pixel data should hardcode 0.
- img_send_null - boolean flag to determine if blank pixel data should
- be sent when a NULL pointer is passed. This is only used by
- TexImage1D and TexImage2D.
- img_null_flag - boolean flag to determine if an extra flag is used to
- determine if a NULL pixel pointer was passed. This is used by
- TexSubImage1D, TexSubImage2D, TexImage3D and others.
- img_pad_dimensions - boolean flag to determine if dimension data and
- offset data should be padded to the next even number of dimensions.
- For example, this will insert an empty "height" field after the
- "width" field in the protocol for TexImage1D.
-
-glx:
- rop - Opcode value for "render" commands
- sop - Opcode value for "single" commands
- vendorpriv - Opcode value for vendor private (or vendor private with
- reply) commands
- large - set to "true" of the render command can use RenderLarge protocol.
- doubles_in_order - older commands always put GLdouble data at the
- start of the render packet. Newer commands (e.g.,
- ProgramEnvParameter4dvARB) put the in the order that they appear
- in the parameter list.
- always_array - some single commands take reply data as an array or as
- return value data (e.g., glGetLightfv). Other single commands take
- reply data only as an array (e.g., glGetClipPlane).
- handcode - some functions are just too complicated to generate
- (e.g., glSeperableFilter2D) or operate only on client-side data
- (e.g., glVertexPointer) and must be handcoded.
- ignore - some functions have an entry in the dispatch table, but aren't
- suitable for protocol implementation (e.g., glLockArraysEXT). This
- also applies to functions that don't have any GLX protocol specified
- (e.g., glGetFogFuncSGIS).
--->
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
deleted file mode 100644
index 9fb99e381a4..00000000000
--- a/src/mesa/glapi/gl_API.xml
+++ /dev/null
@@ -1,11520 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-
-<!-- Core versions sorted by version number. -->
-
-<category name="1.0">
- <enum name="FALSE" value="0x0"/>
- <enum name="TRUE" value="0x1"/>
- <enum name="ZERO" value="0x0"/>
- <enum name="ONE" value="0x1"/>
- <enum name="NONE" value="0x0"/>
- <enum name="NO_ERROR" value="0x0"/>
- <enum name="POINTS" value="0x0000"/>
- <enum name="LINES" value="0x0001"/>
- <enum name="LINE_LOOP" value="0x0002"/>
- <enum name="LINE_STRIP" value="0x0003"/>
- <enum name="TRIANGLES" value="0x0004"/>
- <enum name="TRIANGLE_STRIP" value="0x0005"/>
- <enum name="TRIANGLE_FAN" value="0x0006"/>
- <enum name="QUADS" value="0x0007"/>
- <enum name="QUAD_STRIP" value="0x0008"/>
- <enum name="POLYGON" value="0x0009"/>
- <enum name="ACCUM" value="0x0100"/>
- <enum name="LOAD" value="0x0101"/>
- <enum name="RETURN" value="0x0102"/>
- <enum name="MULT" value="0x0103"/>
- <enum name="ADD" value="0x0104"/>
- <enum name="NEVER" value="0x0200"/>
- <enum name="LESS" value="0x0201"/>
- <enum name="EQUAL" value="0x0202"/>
- <enum name="LEQUAL" value="0x0203"/>
- <enum name="GREATER" value="0x0204"/>
- <enum name="NOTEQUAL" value="0x0205"/>
- <enum name="GEQUAL" value="0x0206"/>
- <enum name="ALWAYS" value="0x0207"/>
- <enum name="SRC_COLOR" value="0x0300"/>
- <enum name="ONE_MINUS_SRC_COLOR" value="0x0301"/>
- <enum name="SRC_ALPHA" value="0x0302"/>
- <enum name="ONE_MINUS_SRC_ALPHA" value="0x0303"/>
- <enum name="DST_ALPHA" value="0x0304"/>
- <enum name="ONE_MINUS_DST_ALPHA" value="0x0305"/>
- <enum name="DST_COLOR" value="0x0306"/>
- <enum name="ONE_MINUS_DST_COLOR" value="0x0307"/>
- <enum name="SRC_ALPHA_SATURATE" value="0x0308"/>
- <enum name="FRONT_LEFT" value="0x0400"/>
- <enum name="FRONT_RIGHT" value="0x0401"/>
- <enum name="BACK_LEFT" value="0x0402"/>
- <enum name="BACK_RIGHT" value="0x0403"/>
- <enum name="FRONT" value="0x0404"/>
- <enum name="BACK" value="0x0405"/>
- <enum name="LEFT" value="0x0406"/>
- <enum name="RIGHT" value="0x0407"/>
- <enum name="FRONT_AND_BACK" value="0x0408"/>
- <enum name="AUX0" value="0x0409"/>
- <enum name="AUX1" value="0x040A"/>
- <enum name="AUX2" value="0x040B"/>
- <enum name="AUX3" value="0x040C"/>
- <enum name="INVALID_VALUE" value="0x0501"/>
- <enum name="INVALID_ENUM" value="0x0500"/>
- <enum name="INVALID_OPERATION" value="0x0502"/>
- <enum name="STACK_OVERFLOW" value="0x0503"/>
- <enum name="STACK_UNDERFLOW" value="0x0504"/>
- <enum name="OUT_OF_MEMORY" value="0x0505"/>
- <enum name="2D" value="0x0600"/>
- <enum name="3D" value="0x0601"/>
- <enum name="3D_COLOR" value="0x0602"/>
- <enum name="3D_COLOR_TEXTURE" value="0x0603"/>
- <enum name="4D_COLOR_TEXTURE" value="0x0604"/>
- <enum name="PASS_THROUGH_TOKEN" value="0x0700"/>
- <enum name="POINT_TOKEN" value="0x0701"/>
- <enum name="LINE_TOKEN" value="0x0702"/>
- <enum name="POLYGON_TOKEN" value="0x0703"/>
- <enum name="BITMAP_TOKEN" value="0x0704"/>
- <enum name="DRAW_PIXEL_TOKEN" value="0x0705"/>
- <enum name="COPY_PIXEL_TOKEN" value="0x0706"/>
- <enum name="LINE_RESET_TOKEN" value="0x0707"/>
- <enum name="EXP" value="0x0800"/>
- <enum name="EXP2" value="0x0801"/>
- <enum name="CW" value="0x0900"/>
- <enum name="CCW" value="0x0901"/>
- <enum name="COEFF" value="0x0A00"/>
- <enum name="ORDER" value="0x0A01"/>
- <enum name="DOMAIN" value="0x0A02"/>
- <enum name="CURRENT_COLOR" count="4" value="0x0B00">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_INDEX" count="1" value="0x0B01">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_NORMAL" count="3" value="0x0B02">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_TEXTURE_COORDS" count="4" value="0x0B03">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_RASTER_COLOR" count="4" value="0x0B04">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_RASTER_INDEX" count="1" value="0x0B05">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_RASTER_TEXTURE_COORDS" count="4" value="0x0B06">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_RASTER_POSITION" count="4" value="0x0B07">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_RASTER_POSITION_VALID" count="1" value="0x0B08">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_RASTER_DISTANCE" count="1" value="0x0B09">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POINT_SMOOTH" count="1" value="0x0B10">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POINT_SIZE" count="1" value="0x0B11">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POINT_SIZE_RANGE" count="2" value="0x0B12">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POINT_SIZE_GRANULARITY" count="1" value="0x0B13">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_SMOOTH" count="1" value="0x0B20">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_WIDTH" count="1" value="0x0B21">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_WIDTH_RANGE" count="2" value="0x0B22">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_WIDTH_GRANULARITY" count="1" value="0x0B23">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_STIPPLE" count="1" value="0x0B24">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_STIPPLE_PATTERN" count="1" value="0x0B25">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_STIPPLE_REPEAT" count="1" value="0x0B26">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIST_MODE" count="1" value="0x0B30">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_LIST_NESTING" count="1" value="0x0B31">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIST_BASE" count="1" value="0x0B32">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIST_INDEX" count="1" value="0x0B33">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POLYGON_MODE" count="2" value="0x0B40">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POLYGON_SMOOTH" count="1" value="0x0B41">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POLYGON_STIPPLE" count="1" value="0x0B42">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="EDGE_FLAG" count="1" value="0x0B43">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CULL_FACE" count="1" value="0x0B44">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CULL_FACE_MODE" count="1" value="0x0B45">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FRONT_FACE" count="1" value="0x0B46">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHTING" count="1" value="0x0B50">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT_MODEL_LOCAL_VIEWER" count="1" value="0x0B51">
- <size name="LightModelfv"/>
- <size name="LightModeliv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT_MODEL_TWO_SIDE" count="1" value="0x0B52">
- <size name="LightModelfv"/>
- <size name="LightModeliv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT_MODEL_AMBIENT" count="4" value="0x0B53">
- <size name="LightModelfv"/>
- <size name="LightModeliv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SHADE_MODEL" count="1" value="0x0B54">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_MATERIAL_FACE" count="1" value="0x0B55">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_MATERIAL_PARAMETER" count="1" value="0x0B56">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_MATERIAL" count="1" value="0x0B57">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG" count="1" value="0x0B60">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_INDEX" count="1" value="0x0B61">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_DENSITY" count="1" value="0x0B62">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_START" count="1" value="0x0B63">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_END" count="1" value="0x0B64">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_MODE" count="1" value="0x0B65">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COLOR" count="4" value="0x0B66">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_RANGE" count="2" value="0x0B70">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_TEST" count="1" value="0x0B71">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_WRITEMASK" count="1" value="0x0B72">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_CLEAR_VALUE" count="1" value="0x0B73">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_FUNC" count="1" value="0x0B74">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACCUM_CLEAR_VALUE" count="4" value="0x0B80">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_TEST" count="1" value="0x0B90">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_CLEAR_VALUE" count="1" value="0x0B91">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_FUNC" count="1" value="0x0B92">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_VALUE_MASK" count="1" value="0x0B93">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_FAIL" count="1" value="0x0B94">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_PASS_DEPTH_FAIL" count="1" value="0x0B95">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_PASS_DEPTH_PASS" count="1" value="0x0B96">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_REF" count="1" value="0x0B97">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_WRITEMASK" count="1" value="0x0B98">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX_MODE" count="1" value="0x0BA0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="NORMALIZE" count="1" value="0x0BA1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VIEWPORT" count="4" value="0x0BA2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW_STACK_DEPTH" count="1" value="0x0BA3">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROJECTION_STACK_DEPTH" count="1" value="0x0BA4">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_STACK_DEPTH" count="1" value="0x0BA5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW_MATRIX" count="16" value="0x0BA6">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROJECTION_MATRIX" count="16" value="0x0BA7">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_MATRIX" count="16" value="0x0BA8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ATTRIB_STACK_DEPTH" count="1" value="0x0BB0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIENT_ATTRIB_STACK_DEPTH" value="0x0BB1"/>
- <enum name="ALPHA_TEST" count="1" value="0x0BC0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALPHA_TEST_FUNC" count="1" value="0x0BC1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALPHA_TEST_REF" count="1" value="0x0BC2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DITHER" count="1" value="0x0BD0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND_DST" count="1" value="0x0BE0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND_SRC" count="1" value="0x0BE1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND" count="1" value="0x0BE2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LOGIC_OP_MODE" count="1" value="0x0BF0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LOGIC_OP" count="1" value="0x0BF1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="AUX_BUFFERS" count="1" value="0x0C00">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER" count="1" value="0x0C01">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="READ_BUFFER" count="1" value="0x0C02">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SCISSOR_BOX" count="4" value="0x0C10">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SCISSOR_TEST" count="1" value="0x0C11">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_CLEAR_VALUE" count="1" value="0x0C20">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_WRITEMASK" count="1" value="0x0C21">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_CLEAR_VALUE" count="4" value="0x0C22">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_WRITEMASK" count="4" value="0x0C23">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_MODE" count="1" value="0x0C30">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="RGBA_MODE" count="1" value="0x0C31">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DOUBLEBUFFER" count="1" value="0x0C32">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STEREO" count="1" value="0x0C33">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="RENDER_MODE" count="1" value="0x0C40">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PERSPECTIVE_CORRECTION_HINT" count="1" value="0x0C50">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POINT_SMOOTH_HINT" count="1" value="0x0C51">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LINE_SMOOTH_HINT" count="1" value="0x0C52">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POLYGON_SMOOTH_HINT" count="1" value="0x0C53">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_HINT" count="1" value="0x0C54">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_GEN_S" count="1" value="0x0C60">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_GEN_T" count="1" value="0x0C61">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_GEN_R" count="1" value="0x0C62">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_GEN_Q" count="1" value="0x0C63">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_I_TO_I" count="1" value="0x0C70">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_S_TO_S" value="0x0C71"/>
- <enum name="PIXEL_MAP_I_TO_R" value="0x0C72"/>
- <enum name="PIXEL_MAP_I_TO_G" value="0x0C73"/>
- <enum name="PIXEL_MAP_I_TO_B" value="0x0C74"/>
- <enum name="PIXEL_MAP_I_TO_A" value="0x0C75"/>
- <enum name="PIXEL_MAP_R_TO_R" value="0x0C76"/>
- <enum name="PIXEL_MAP_G_TO_G" value="0x0C77"/>
- <enum name="PIXEL_MAP_B_TO_B" value="0x0C78"/>
- <enum name="PIXEL_MAP_A_TO_A" value="0x0C79"/>
- <enum name="PIXEL_MAP_I_TO_I_SIZE" count="1" value="0x0CB0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_S_TO_S_SIZE" count="1" value="0x0CB1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_I_TO_R_SIZE" count="1" value="0x0CB2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_I_TO_G_SIZE" count="1" value="0x0CB3">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_I_TO_B_SIZE" count="1" value="0x0CB4">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_I_TO_A_SIZE" count="1" value="0x0CB5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_R_TO_R_SIZE" count="1" value="0x0CB6">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_G_TO_G_SIZE" count="1" value="0x0CB7">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_B_TO_B_SIZE" count="1" value="0x0CB8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PIXEL_MAP_A_TO_A_SIZE" count="1" value="0x0CB9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_SWAP_BYTES" count="1" value="0x0CF0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_LSB_FIRST" count="1" value="0x0CF1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_ROW_LENGTH" count="1" value="0x0CF2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_SKIP_PIXELS" count="1" value="0x0CF4">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_SKIP_ROWS" count="1" value="0x0CF3">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_ALIGNMENT" count="1" value="0x0CF5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_SWAP_BYTES" count="1" value="0x0D00">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_LSB_FIRST" count="1" value="0x0D01">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_ROW_LENGTH" count="1" value="0x0D02">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_SKIP_ROWS" count="1" value="0x0D03">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_SKIP_PIXELS" count="1" value="0x0D04">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_ALIGNMENT" count="1" value="0x0D05">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAP_COLOR" count="1" value="0x0D10">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAP_STENCIL" count="1" value="0x0D11">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_SHIFT" count="1" value="0x0D12">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_OFFSET" count="1" value="0x0D13">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="RED_SCALE" count="1" value="0x0D14">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="RED_BIAS" count="1" value="0x0D15">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ZOOM_X" count="1" value="0x0D16">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ZOOM_Y" count="1" value="0x0D17">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="GREEN_SCALE" count="1" value="0x0D18">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="GREEN_BIAS" count="1" value="0x0D19">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLUE_SCALE" count="1" value="0x0D1A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLUE_BIAS" count="1" value="0x0D1B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALPHA_SCALE" count="1" value="0x0D1C">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALPHA_BIAS" count="1" value="0x0D1D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_SCALE" count="1" value="0x0D1E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_BIAS" count="1" value="0x0D1F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_EVAL_ORDER" count="1" value="0x0D30">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_LIGHTS" count="1" value="0x0D31">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_CLIP_PLANES" count="1" value="0x0D32">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_SIZE" count="1" value="0x0D33">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_PIXEL_MAP_TABLE" count="1" value="0x0D34">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_ATTRIB_STACK_DEPTH" count="1" value="0x0D35">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_MODELVIEW_STACK_DEPTH" count="1" value="0x0D36">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_NAME_STACK_DEPTH" count="1" value="0x0D37">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_PROJECTION_STACK_DEPTH" count="1" value="0x0D38">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_STACK_DEPTH" count="1" value="0x0D39">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_VIEWPORT_DIMS" count="2" value="0x0D3A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_CLIENT_ATTRIB_STACK_DEPTH" value="0x0D3B"/>
- <enum name="SUBPIXEL_BITS" count="1" value="0x0D50">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_BITS" count="1" value="0x0D51">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="RED_BITS" count="1" value="0x0D52">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="GREEN_BITS" count="1" value="0x0D53">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLUE_BITS" count="1" value="0x0D54">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALPHA_BITS" count="1" value="0x0D55">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_BITS" count="1" value="0x0D56">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="STENCIL_BITS" count="1" value="0x0D57">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACCUM_RED_BITS" count="1" value="0x0D58">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACCUM_GREEN_BITS" count="1" value="0x0D59">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACCUM_BLUE_BITS" count="1" value="0x0D5A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACCUM_ALPHA_BITS" count="1" value="0x0D5B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="NAME_STACK_DEPTH" count="1" value="0x0D70">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="AUTO_NORMAL" count="1" value="0x0D80">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAP1_COLOR_4" count="4" value="0x0D90">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_INDEX" count="1" value="0x0D91">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_NORMAL" count="3" value="0x0D92">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_TEXTURE_COORD_1" count="1" value="0x0D93">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_TEXTURE_COORD_2" count="2" value="0x0D94">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_TEXTURE_COORD_3" count="3" value="0x0D95">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_TEXTURE_COORD_4" count="4" value="0x0D96">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_VERTEX_3" count="3" value="0x0D97">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_VERTEX_4" count="4" value="0x0D98">
- <size name="Map1d"/>
- <size name="Map1f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_COLOR_4" count="4" value="0x0DB0">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_INDEX" count="1" value="0x0DB1">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_NORMAL" count="3" value="0x0DB2">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_TEXTURE_COORD_1" count="1" value="0x0DB3">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_TEXTURE_COORD_2" count="2" value="0x0DB4">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_TEXTURE_COORD_3" count="3" value="0x0DB5">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_TEXTURE_COORD_4" count="4" value="0x0DB6">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_VERTEX_3" count="3" value="0x0DB7">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP2_VERTEX_4" count="4" value="0x0DB8">
- <size name="Map2d"/>
- <size name="Map2f"/>
- <size name="Get" count="1" mode="get"/>
- </enum>
- <enum name="MAP1_GRID_DOMAIN" count="2" value="0x0DD0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAP1_GRID_SEGMENTS" count="1" value="0x0DD1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAP2_GRID_DOMAIN" count="4" value="0x0DD2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAP2_GRID_SEGMENTS" count="2" value="0x0DD3">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_1D" count="1" value="0x0DE0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_2D" count="1" value="0x0DE1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FEEDBACK_BUFFER_POINTER" value="0x0DF0"/>
- <enum name="FEEDBACK_BUFFER_SIZE" value="0x0DF1"/>
- <enum name="FEEDBACK_BUFFER_TYPE" value="0x0DF2"/>
- <enum name="SELECTION_BUFFER_POINTER" value="0x0DF3"/>
- <enum name="SELECTION_BUFFER_SIZE" value="0x0DF4"/>
- <enum name="TEXTURE_WIDTH" count="1" value="0x1000">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_HEIGHT" count="1" value="0x1001">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_BORDER" count="1" value="0x1005">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPONENTS" count="1" value="0x1003">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_BORDER_COLOR" count="4" value="0x1004">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="DONT_CARE" value="0x1100"/>
- <enum name="FASTEST" value="0x1101"/>
- <enum name="NICEST" value="0x1102"/>
- <enum name="AMBIENT" count="4" value="0x1200">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="DIFFUSE" count="4" value="0x1201">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="SPECULAR" count="4" value="0x1202">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="POSITION" count="4" value="0x1203">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="SPOT_DIRECTION" count="3" value="0x1204">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="SPOT_EXPONENT" count="1" value="0x1205">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="SPOT_CUTOFF" count="1" value="0x1206">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="CONSTANT_ATTENUATION" count="1" value="0x1207">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="LINEAR_ATTENUATION" count="1" value="0x1208">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="QUADRATIC_ATTENUATION" count="1" value="0x1209">
- <size name="Lightfv"/>
- <size name="Lightiv"/>
- <size name="GetLightfv" mode="get"/>
- <size name="GetLightiv" mode="get"/>
- </enum>
- <enum name="COMPILE" value="0x1300"/>
- <enum name="COMPILE_AND_EXECUTE" value="0x1301"/>
- <enum name="BYTE" count="1" value="0x1400">
- <size name="CallLists"/>
- </enum>
- <enum name="UNSIGNED_BYTE" count="1" value="0x1401">
- <size name="CallLists"/>
- </enum>
- <enum name="SHORT" count="2" value="0x1402">
- <size name="CallLists"/>
- </enum>
- <enum name="UNSIGNED_SHORT" count="2" value="0x1403">
- <size name="CallLists"/>
- </enum>
- <enum name="INT" count="4" value="0x1404">
- <size name="CallLists"/>
- </enum>
- <enum name="UNSIGNED_INT" count="4" value="0x1405">
- <size name="CallLists"/>
- </enum>
- <enum name="FLOAT" count="4" value="0x1406">
- <size name="CallLists"/>
- </enum>
- <enum name="2_BYTES" count="2" value="0x1407">
- <size name="CallLists"/>
- </enum>
- <enum name="3_BYTES" count="3" value="0x1408">
- <size name="CallLists"/>
- </enum>
- <enum name="4_BYTES" count="4" value="0x1409">
- <size name="CallLists"/>
- </enum>
- <enum name="CLEAR" value="0x1500"/>
- <enum name="AND" value="0x1501"/>
- <enum name="AND_REVERSE" value="0x1502"/>
- <enum name="COPY" value="0x1503"/>
- <enum name="AND_INVERTED" value="0x1504"/>
- <enum name="NOOP" value="0x1505"/>
- <enum name="XOR" value="0x1506"/>
- <enum name="OR" value="0x1507"/>
- <enum name="NOR" value="0x1508"/>
- <enum name="EQUIV" value="0x1509"/>
- <enum name="INVERT" value="0x150A"/>
- <enum name="OR_REVERSE" value="0x150B"/>
- <enum name="COPY_INVERTED" value="0x150C"/>
- <enum name="OR_INVERTED" value="0x150D"/>
- <enum name="NAND" value="0x150E"/>
- <enum name="SET" value="0x150F"/>
- <enum name="EMISSION" count="4" value="0x1600">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- </enum>
- <enum name="SHININESS" count="1" value="0x1601">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- </enum>
- <enum name="AMBIENT_AND_DIFFUSE" count="4" value="0x1602">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- </enum>
- <enum name="COLOR_INDEXES" count="3" value="0x1603">
- <size name="Materialfv"/>
- <size name="Materialiv"/>
- <size name="GetMaterialfv" mode="get"/>
- <size name="GetMaterialiv" mode="get"/>
- </enum>
- <enum name="MODELVIEW" value="0x1700"/>
- <enum name="PROJECTION" value="0x1701"/>
- <enum name="TEXTURE" value="0x1702"/>
- <enum name="COLOR" value="0x1800"/>
- <enum name="DEPTH" value="0x1801"/>
- <enum name="STENCIL" value="0x1802"/>
- <enum name="COLOR_INDEX" value="0x1900"/>
- <enum name="STENCIL_INDEX" value="0x1901"/>
- <enum name="DEPTH_COMPONENT" value="0x1902"/>
- <enum name="RED" value="0x1903"/>
- <enum name="GREEN" value="0x1904"/>
- <enum name="BLUE" value="0x1905"/>
- <enum name="ALPHA" value="0x1906"/>
- <enum name="RGBA" value="0x1908"/>
- <enum name="RGB" value="0x1907"/>
- <enum name="LUMINANCE" value="0x1909"/>
- <enum name="LUMINANCE_ALPHA" value="0x190A"/>
- <enum name="BITMAP" value="0x1A00"/>
- <enum name="POINT" value="0x1B00"/>
- <enum name="LINE" value="0x1B01"/>
- <enum name="FILL" value="0x1B02"/>
- <enum name="FEEDBACK" value="0x1C01"/>
- <enum name="RENDER" value="0x1C00"/>
- <enum name="SELECT" value="0x1C02"/>
- <enum name="FLAT" value="0x1D00"/>
- <enum name="SMOOTH" value="0x1D01"/>
- <enum name="KEEP" value="0x1E00"/>
- <enum name="REPLACE" value="0x1E01"/>
- <enum name="INCR" value="0x1E02"/>
- <enum name="DECR" value="0x1E03"/>
- <enum name="VENDOR" value="0x1F00"/>
- <enum name="RENDERER" value="0x1F01"/>
- <enum name="VERSION" value="0x1F02"/>
- <enum name="EXTENSIONS" value="0x1F03"/>
- <enum name="S" value="0x2000"/>
- <enum name="T" value="0x2001"/>
- <enum name="R" value="0x2002"/>
- <enum name="Q" value="0x2003"/>
- <enum name="MODULATE" value="0x2100"/>
- <enum name="DECAL" value="0x2101"/>
- <enum name="TEXTURE_ENV_MODE" count="1" value="0x2200">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="TEXTURE_ENV_COLOR" count="4" value="0x2201">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="TEXTURE_ENV" value="0x2300"/>
- <enum name="EYE_LINEAR" value="0x2400"/>
- <enum name="OBJECT_LINEAR" value="0x2401"/>
- <enum name="SPHERE_MAP" value="0x2402"/>
- <enum name="TEXTURE_GEN_MODE" count="1" value="0x2500">
- <size name="TexGendv"/>
- <size name="TexGenfv"/>
- <size name="TexGeniv"/>
- <size name="GetTexGendv" mode="get"/>
- <size name="GetTexGenfv" mode="get"/>
- <size name="GetTexGeniv" mode="get"/>
- </enum>
- <enum name="OBJECT_PLANE" count="4" value="0x2501">
- <size name="TexGendv"/>
- <size name="TexGenfv"/>
- <size name="TexGeniv"/>
- <size name="GetTexGendv" mode="get"/>
- <size name="GetTexGenfv" mode="get"/>
- <size name="GetTexGeniv" mode="get"/>
- </enum>
- <enum name="EYE_PLANE" count="4" value="0x2502">
- <size name="TexGendv"/>
- <size name="TexGenfv"/>
- <size name="TexGeniv"/>
- <size name="GetTexGendv" mode="get"/>
- <size name="GetTexGenfv" mode="get"/>
- <size name="GetTexGeniv" mode="get"/>
- </enum>
- <enum name="NEAREST" value="0x2600"/>
- <enum name="LINEAR" value="0x2601"/>
- <enum name="NEAREST_MIPMAP_NEAREST" value="0x2700"/>
- <enum name="LINEAR_MIPMAP_NEAREST" value="0x2701"/>
- <enum name="NEAREST_MIPMAP_LINEAR" value="0x2702"/>
- <enum name="LINEAR_MIPMAP_LINEAR" value="0x2703"/>
- <enum name="TEXTURE_MAG_FILTER" count="1" value="0x2800">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_MIN_FILTER" count="1" value="0x2801">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_WRAP_S" count="1" value="0x2802">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_WRAP_T" count="1" value="0x2803">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="CLAMP" value="0x2900"/>
- <enum name="REPEAT" value="0x2901"/>
- <enum name="CLIP_PLANE0" count="1" value="0x3000">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIP_PLANE1" count="1" value="0x3001">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIP_PLANE2" count="1" value="0x3002">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIP_PLANE3" count="1" value="0x3003">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIP_PLANE4" count="1" value="0x3004">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIP_PLANE5" count="1" value="0x3005">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT0" count="1" value="0x4000">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT1" count="1" value="0x4001">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT2" count="1" value="0x4002">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT3" count="1" value="0x4003">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT4" count="1" value="0x4004">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT5" count="1" value="0x4005">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT6" count="1" value="0x4006">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="LIGHT7" count="1" value="0x4007">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_BIT" value="0x00000001"/>
- <enum name="POINT_BIT" value="0x00000002"/>
- <enum name="LINE_BIT" value="0x00000004"/>
- <enum name="POLYGON_BIT" value="0x00000008"/>
- <enum name="POLYGON_STIPPLE_BIT" value="0x00000010"/>
- <enum name="PIXEL_MODE_BIT" value="0x00000020"/>
- <enum name="LIGHTING_BIT" value="0x00000040"/>
- <enum name="FOG_BIT" value="0x00000080"/>
- <enum name="DEPTH_BUFFER_BIT" value="0x00000100"/>
- <enum name="ACCUM_BUFFER_BIT" value="0x00000200"/>
- <enum name="STENCIL_BUFFER_BIT" value="0x00000400"/>
- <enum name="VIEWPORT_BIT" value="0x00000800"/>
- <enum name="TRANSFORM_BIT" value="0x00001000"/>
- <enum name="ENABLE_BIT" value="0x00002000"/>
- <enum name="COLOR_BUFFER_BIT" value="0x00004000"/>
- <enum name="HINT_BIT" value="0x00008000"/>
- <enum name="EVAL_BIT" value="0x00010000"/>
- <enum name="LIST_BIT" value="0x00020000"/>
- <enum name="TEXTURE_BIT" value="0x00040000"/>
- <enum name="SCISSOR_BIT" value="0x00080000"/>
- <enum name="ALL_ATTRIB_BITS" value="0x000FFFFF"/>
-
- <type name="double" size="8" float="true" glx_name="FLOAT64"/>
- <type name="clampd" size="8" float="true" glx_name="FLOAT64"/>
-
- <type name="float" size="4" float="true" glx_name="FLOAT32"/>
- <type name="clampf" size="4" float="true" glx_name="FLOAT32"/>
-
- <type name="int" size="4" glx_name="CARD32"/>
- <type name="uint" size="4" unsigned="true" glx_name="CARD32"/>
- <type name="sizei" size="4" unsigned="true" glx_name="CARD32"/>
- <type name="enum" size="4" unsigned="true" glx_name="ENUM"/>
- <type name="bitfield" size="4" unsigned="true" glx_name="CARD32"/>
-
- <type name="short" size="2" glx_name="CARD16"/>
- <type name="ushort" size="2" unsigned="true" glx_name="CARD16"/>
-
- <type name="byte" size="1" glx_name="CARD8"/>
- <type name="ubyte" size="1" unsigned="true" glx_name="CARD8"/>
- <type name="boolean" size="1" unsigned="true" glx_name="CARD8"/>
-
- <type name="void" size="1"/>
-
- <function name="NewList" offset="0">
- <param name="list" type="GLuint"/>
- <param name="mode" type="GLenum"/>
- <glx sop="101"/>
- </function>
-
- <function name="EndList" offset="1">
- <glx sop="102"/>
- </function>
-
- <function name="CallList" offset="2">
- <param name="list" type="GLuint"/>
- <glx rop="1"/>
- </function>
-
- <function name="CallLists" offset="3">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="type" type="GLenum"/>
- <param name="lists" type="const GLvoid *" variable_param="type" count="n"/>
- <glx rop="2" large="true"/>
- </function>
-
- <function name="DeleteLists" offset="4">
- <param name="list" type="GLuint"/>
- <param name="range" type="GLsizei"/>
- <glx sop="103"/>
- </function>
-
- <function name="GenLists" offset="5">
- <param name="range" type="GLsizei"/>
- <return type="GLuint"/>
- <glx sop="104"/>
- </function>
-
- <function name="ListBase" offset="6">
- <param name="base" type="GLuint"/>
- <glx rop="3"/>
- </function>
-
- <function name="Begin" offset="7">
- <param name="mode" type="GLenum"/>
- <glx rop="4"/>
- </function>
-
- <function name="Bitmap" offset="8">
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="xorig" type="GLfloat"/>
- <param name="yorig" type="GLfloat"/>
- <param name="xmove" type="GLfloat"/>
- <param name="ymove" type="GLfloat"/>
- <param name="bitmap" type="const GLubyte *" img_width="width" img_height="height" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP" img_target="0" img_pad_dimensions="false"/>
- <glx rop="5" large="true"/>
- </function>
-
- <function name="Color3b" offset="9" vectorequiv="Color3bv">
- <param name="red" type="GLbyte"/>
- <param name="green" type="GLbyte"/>
- <param name="blue" type="GLbyte"/>
- </function>
-
- <function name="Color3bv" offset="10">
- <param name="v" type="const GLbyte *" count="3"/>
- <glx rop="6"/>
- </function>
-
- <function name="Color3d" offset="11" vectorequiv="Color3dv">
- <param name="red" type="GLdouble"/>
- <param name="green" type="GLdouble"/>
- <param name="blue" type="GLdouble"/>
- </function>
-
- <function name="Color3dv" offset="12">
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="7"/>
- </function>
-
- <function name="Color3f" offset="13" vectorequiv="Color3fv">
- <param name="red" type="GLfloat"/>
- <param name="green" type="GLfloat"/>
- <param name="blue" type="GLfloat"/>
- </function>
-
- <function name="Color3fv" offset="14">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="8"/>
- </function>
-
- <function name="Color3i" offset="15" vectorequiv="Color3iv">
- <param name="red" type="GLint"/>
- <param name="green" type="GLint"/>
- <param name="blue" type="GLint"/>
- </function>
-
- <function name="Color3iv" offset="16">
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="9"/>
- </function>
-
- <function name="Color3s" offset="17" vectorequiv="Color3sv">
- <param name="red" type="GLshort"/>
- <param name="green" type="GLshort"/>
- <param name="blue" type="GLshort"/>
- </function>
-
- <function name="Color3sv" offset="18">
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="10"/>
- </function>
-
- <function name="Color3ub" offset="19" vectorequiv="Color3ubv">
- <param name="red" type="GLubyte"/>
- <param name="green" type="GLubyte"/>
- <param name="blue" type="GLubyte"/>
- </function>
-
- <function name="Color3ubv" offset="20">
- <param name="v" type="const GLubyte *" count="3"/>
- <glx rop="11"/>
- </function>
-
- <function name="Color3ui" offset="21" vectorequiv="Color3uiv">
- <param name="red" type="GLuint"/>
- <param name="green" type="GLuint"/>
- <param name="blue" type="GLuint"/>
- </function>
-
- <function name="Color3uiv" offset="22">
- <param name="v" type="const GLuint *" count="3"/>
- <glx rop="12"/>
- </function>
-
- <function name="Color3us" offset="23" vectorequiv="Color3usv">
- <param name="red" type="GLushort"/>
- <param name="green" type="GLushort"/>
- <param name="blue" type="GLushort"/>
- </function>
-
- <function name="Color3usv" offset="24">
- <param name="v" type="const GLushort *" count="3"/>
- <glx rop="13"/>
- </function>
-
- <function name="Color4b" offset="25" vectorequiv="Color4bv">
- <param name="red" type="GLbyte"/>
- <param name="green" type="GLbyte"/>
- <param name="blue" type="GLbyte"/>
- <param name="alpha" type="GLbyte"/>
- </function>
-
- <function name="Color4bv" offset="26">
- <param name="v" type="const GLbyte *" count="4"/>
- <glx rop="14"/>
- </function>
-
- <function name="Color4d" offset="27" vectorequiv="Color4dv">
- <param name="red" type="GLdouble"/>
- <param name="green" type="GLdouble"/>
- <param name="blue" type="GLdouble"/>
- <param name="alpha" type="GLdouble"/>
- </function>
-
- <function name="Color4dv" offset="28">
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="15"/>
- </function>
-
- <function name="Color4f" offset="29" vectorequiv="Color4fv">
- <param name="red" type="GLfloat"/>
- <param name="green" type="GLfloat"/>
- <param name="blue" type="GLfloat"/>
- <param name="alpha" type="GLfloat"/>
- </function>
-
- <function name="Color4fv" offset="30">
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="16"/>
- </function>
-
- <function name="Color4i" offset="31" vectorequiv="Color4iv">
- <param name="red" type="GLint"/>
- <param name="green" type="GLint"/>
- <param name="blue" type="GLint"/>
- <param name="alpha" type="GLint"/>
- </function>
-
- <function name="Color4iv" offset="32">
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="17"/>
- </function>
-
- <function name="Color4s" offset="33" vectorequiv="Color4sv">
- <param name="red" type="GLshort"/>
- <param name="green" type="GLshort"/>
- <param name="blue" type="GLshort"/>
- <param name="alpha" type="GLshort"/>
- </function>
-
- <function name="Color4sv" offset="34">
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="18"/>
- </function>
-
- <function name="Color4ub" offset="35" vectorequiv="Color4ubv">
- <param name="red" type="GLubyte"/>
- <param name="green" type="GLubyte"/>
- <param name="blue" type="GLubyte"/>
- <param name="alpha" type="GLubyte"/>
- </function>
-
- <function name="Color4ubv" offset="36">
- <param name="v" type="const GLubyte *" count="4"/>
- <glx rop="19"/>
- </function>
-
- <function name="Color4ui" offset="37" vectorequiv="Color4uiv">
- <param name="red" type="GLuint"/>
- <param name="green" type="GLuint"/>
- <param name="blue" type="GLuint"/>
- <param name="alpha" type="GLuint"/>
- </function>
-
- <function name="Color4uiv" offset="38">
- <param name="v" type="const GLuint *" count="4"/>
- <glx rop="20"/>
- </function>
-
- <function name="Color4us" offset="39" vectorequiv="Color4usv">
- <param name="red" type="GLushort"/>
- <param name="green" type="GLushort"/>
- <param name="blue" type="GLushort"/>
- <param name="alpha" type="GLushort"/>
- </function>
-
- <function name="Color4usv" offset="40">
- <param name="v" type="const GLushort *" count="4"/>
- <glx rop="21"/>
- </function>
-
- <function name="EdgeFlag" offset="41" vectorequiv="EdgeFlagv">
- <param name="flag" type="GLboolean"/>
- </function>
-
- <function name="EdgeFlagv" offset="42">
- <param name="flag" type="const GLboolean *" count="1"/>
- <glx rop="22"/>
- </function>
-
- <function name="End" offset="43">
- <glx rop="23"/>
- </function>
-
- <function name="Indexd" offset="44" vectorequiv="Indexdv">
- <param name="c" type="GLdouble"/>
- </function>
-
- <function name="Indexdv" offset="45">
- <param name="c" type="const GLdouble *" count="1"/>
- <glx rop="24"/>
- </function>
-
- <function name="Indexf" offset="46" vectorequiv="Indexfv">
- <param name="c" type="GLfloat"/>
- </function>
-
- <function name="Indexfv" offset="47">
- <param name="c" type="const GLfloat *" count="1"/>
- <glx rop="25"/>
- </function>
-
- <function name="Indexi" offset="48" vectorequiv="Indexiv">
- <param name="c" type="GLint"/>
- </function>
-
- <function name="Indexiv" offset="49">
- <param name="c" type="const GLint *" count="1"/>
- <glx rop="26"/>
- </function>
-
- <function name="Indexs" offset="50" vectorequiv="Indexsv">
- <param name="c" type="GLshort"/>
- </function>
-
- <function name="Indexsv" offset="51">
- <param name="c" type="const GLshort *" count="1"/>
- <glx rop="27"/>
- </function>
-
- <function name="Normal3b" offset="52" vectorequiv="Normal3bv">
- <param name="nx" type="GLbyte"/>
- <param name="ny" type="GLbyte"/>
- <param name="nz" type="GLbyte"/>
- </function>
-
- <function name="Normal3bv" offset="53">
- <param name="v" type="const GLbyte *" count="3"/>
- <glx rop="28"/>
- </function>
-
- <function name="Normal3d" offset="54" vectorequiv="Normal3dv">
- <param name="nx" type="GLdouble"/>
- <param name="ny" type="GLdouble"/>
- <param name="nz" type="GLdouble"/>
- </function>
-
- <function name="Normal3dv" offset="55">
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="29"/>
- </function>
-
- <function name="Normal3f" offset="56" vectorequiv="Normal3fv">
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- </function>
-
- <function name="Normal3fv" offset="57">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="30"/>
- </function>
-
- <function name="Normal3i" offset="58" vectorequiv="Normal3iv">
- <param name="nx" type="GLint"/>
- <param name="ny" type="GLint"/>
- <param name="nz" type="GLint"/>
- </function>
-
- <function name="Normal3iv" offset="59">
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="31"/>
- </function>
-
- <function name="Normal3s" offset="60" vectorequiv="Normal3sv">
- <param name="nx" type="GLshort"/>
- <param name="ny" type="GLshort"/>
- <param name="nz" type="GLshort"/>
- </function>
-
- <function name="Normal3sv" offset="61">
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="32"/>
- </function>
-
- <function name="RasterPos2d" offset="62" vectorequiv="RasterPos2dv">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- </function>
-
- <function name="RasterPos2dv" offset="63">
- <param name="v" type="const GLdouble *" count="2"/>
- <glx rop="33"/>
- </function>
-
- <function name="RasterPos2f" offset="64" vectorequiv="RasterPos2fv">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="RasterPos2fv" offset="65">
- <param name="v" type="const GLfloat *" count="2"/>
- <glx rop="34"/>
- </function>
-
- <function name="RasterPos2i" offset="66" vectorequiv="RasterPos2iv">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- </function>
-
- <function name="RasterPos2iv" offset="67">
- <param name="v" type="const GLint *" count="2"/>
- <glx rop="35"/>
- </function>
-
- <function name="RasterPos2s" offset="68" vectorequiv="RasterPos2sv">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- </function>
-
- <function name="RasterPos2sv" offset="69">
- <param name="v" type="const GLshort *" count="2"/>
- <glx rop="36"/>
- </function>
-
- <function name="RasterPos3d" offset="70" vectorequiv="RasterPos3dv">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- </function>
-
- <function name="RasterPos3dv" offset="71">
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="37"/>
- </function>
-
- <function name="RasterPos3f" offset="72" vectorequiv="RasterPos3fv">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="RasterPos3fv" offset="73">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="38"/>
- </function>
-
- <function name="RasterPos3i" offset="74" vectorequiv="RasterPos3iv">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- </function>
-
- <function name="RasterPos3iv" offset="75">
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="39"/>
- </function>
-
- <function name="RasterPos3s" offset="76" vectorequiv="RasterPos3sv">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- </function>
-
- <function name="RasterPos3sv" offset="77">
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="40"/>
- </function>
-
- <function name="RasterPos4d" offset="78" vectorequiv="RasterPos4dv">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="RasterPos4dv" offset="79">
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="41"/>
- </function>
-
- <function name="RasterPos4f" offset="80" vectorequiv="RasterPos4fv">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="RasterPos4fv" offset="81">
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="42"/>
- </function>
-
- <function name="RasterPos4i" offset="82" vectorequiv="RasterPos4iv">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- <param name="w" type="GLint"/>
- </function>
-
- <function name="RasterPos4iv" offset="83">
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="43"/>
- </function>
-
- <function name="RasterPos4s" offset="84" vectorequiv="RasterPos4sv">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- <param name="w" type="GLshort"/>
- </function>
-
- <function name="RasterPos4sv" offset="85">
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="44"/>
- </function>
-
- <function name="Rectd" offset="86" vectorequiv="Rectdv">
- <param name="x1" type="GLdouble"/>
- <param name="y1" type="GLdouble"/>
- <param name="x2" type="GLdouble"/>
- <param name="y2" type="GLdouble"/>
- </function>
-
- <function name="Rectdv" offset="87">
- <param name="v1" type="const GLdouble *" count="2"/>
- <param name="v2" type="const GLdouble *" count="2"/>
- <glx rop="45"/>
- </function>
-
- <function name="Rectf" offset="88" vectorequiv="Rectfv">
- <param name="x1" type="GLfloat"/>
- <param name="y1" type="GLfloat"/>
- <param name="x2" type="GLfloat"/>
- <param name="y2" type="GLfloat"/>
- </function>
-
- <function name="Rectfv" offset="89">
- <param name="v1" type="const GLfloat *" count="2"/>
- <param name="v2" type="const GLfloat *" count="2"/>
- <glx rop="46"/>
- </function>
-
- <function name="Recti" offset="90" vectorequiv="Rectiv">
- <param name="x1" type="GLint"/>
- <param name="y1" type="GLint"/>
- <param name="x2" type="GLint"/>
- <param name="y2" type="GLint"/>
- </function>
-
- <function name="Rectiv" offset="91">
- <param name="v1" type="const GLint *" count="2"/>
- <param name="v2" type="const GLint *" count="2"/>
- <glx rop="47"/>
- </function>
-
- <function name="Rects" offset="92" vectorequiv="Rectsv">
- <param name="x1" type="GLshort"/>
- <param name="y1" type="GLshort"/>
- <param name="x2" type="GLshort"/>
- <param name="y2" type="GLshort"/>
- </function>
-
- <function name="Rectsv" offset="93">
- <param name="v1" type="const GLshort *" count="2"/>
- <param name="v2" type="const GLshort *" count="2"/>
- <glx rop="48"/>
- </function>
-
- <function name="TexCoord1d" offset="94" vectorequiv="TexCoord1dv">
- <param name="s" type="GLdouble"/>
- </function>
-
- <function name="TexCoord1dv" offset="95">
- <param name="v" type="const GLdouble *" count="1"/>
- <glx rop="49"/>
- </function>
-
- <function name="TexCoord1f" offset="96" vectorequiv="TexCoord1fv">
- <param name="s" type="GLfloat"/>
- </function>
-
- <function name="TexCoord1fv" offset="97">
- <param name="v" type="const GLfloat *" count="1"/>
- <glx rop="50"/>
- </function>
-
- <function name="TexCoord1i" offset="98" vectorequiv="TexCoord1iv">
- <param name="s" type="GLint"/>
- </function>
-
- <function name="TexCoord1iv" offset="99">
- <param name="v" type="const GLint *" count="1"/>
- <glx rop="51"/>
- </function>
-
- <function name="TexCoord1s" offset="100" vectorequiv="TexCoord1sv">
- <param name="s" type="GLshort"/>
- </function>
-
- <function name="TexCoord1sv" offset="101">
- <param name="v" type="const GLshort *" count="1"/>
- <glx rop="52"/>
- </function>
-
- <function name="TexCoord2d" offset="102" vectorequiv="TexCoord2dv">
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- </function>
-
- <function name="TexCoord2dv" offset="103">
- <param name="v" type="const GLdouble *" count="2"/>
- <glx rop="53"/>
- </function>
-
- <function name="TexCoord2f" offset="104" vectorequiv="TexCoord2fv">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- </function>
-
- <function name="TexCoord2fv" offset="105">
- <param name="v" type="const GLfloat *" count="2"/>
- <glx rop="54"/>
- </function>
-
- <function name="TexCoord2i" offset="106" vectorequiv="TexCoord2iv">
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- </function>
-
- <function name="TexCoord2iv" offset="107">
- <param name="v" type="const GLint *" count="2"/>
- <glx rop="55"/>
- </function>
-
- <function name="TexCoord2s" offset="108" vectorequiv="TexCoord2sv">
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- </function>
-
- <function name="TexCoord2sv" offset="109">
- <param name="v" type="const GLshort *" count="2"/>
- <glx rop="56"/>
- </function>
-
- <function name="TexCoord3d" offset="110" vectorequiv="TexCoord3dv">
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- <param name="r" type="GLdouble"/>
- </function>
-
- <function name="TexCoord3dv" offset="111">
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="57"/>
- </function>
-
- <function name="TexCoord3f" offset="112" vectorequiv="TexCoord3fv">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- </function>
-
- <function name="TexCoord3fv" offset="113">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="58"/>
- </function>
-
- <function name="TexCoord3i" offset="114" vectorequiv="TexCoord3iv">
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- <param name="r" type="GLint"/>
- </function>
-
- <function name="TexCoord3iv" offset="115">
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="59"/>
- </function>
-
- <function name="TexCoord3s" offset="116" vectorequiv="TexCoord3sv">
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- <param name="r" type="GLshort"/>
- </function>
-
- <function name="TexCoord3sv" offset="117">
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="60"/>
- </function>
-
- <function name="TexCoord4d" offset="118" vectorequiv="TexCoord4dv">
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- <param name="r" type="GLdouble"/>
- <param name="q" type="GLdouble"/>
- </function>
-
- <function name="TexCoord4dv" offset="119">
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="61"/>
- </function>
-
- <function name="TexCoord4f" offset="120" vectorequiv="TexCoord4fv">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="q" type="GLfloat"/>
- </function>
-
- <function name="TexCoord4fv" offset="121">
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="62"/>
- </function>
-
- <function name="TexCoord4i" offset="122" vectorequiv="TexCoord4iv">
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- <param name="r" type="GLint"/>
- <param name="q" type="GLint"/>
- </function>
-
- <function name="TexCoord4iv" offset="123">
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="63"/>
- </function>
-
- <function name="TexCoord4s" offset="124" vectorequiv="TexCoord4sv">
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- <param name="r" type="GLshort"/>
- <param name="q" type="GLshort"/>
- </function>
-
- <function name="TexCoord4sv" offset="125">
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="64"/>
- </function>
-
- <function name="Vertex2d" offset="126" vectorequiv="Vertex2dv">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- </function>
-
- <function name="Vertex2dv" offset="127">
- <param name="v" type="const GLdouble *" count="2"/>
- <glx rop="65"/>
- </function>
-
- <function name="Vertex2f" offset="128" vectorequiv="Vertex2fv">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="Vertex2fv" offset="129">
- <param name="v" type="const GLfloat *" count="2"/>
- <glx rop="66"/>
- </function>
-
- <function name="Vertex2i" offset="130" vectorequiv="Vertex2iv">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- </function>
-
- <function name="Vertex2iv" offset="131">
- <param name="v" type="const GLint *" count="2"/>
- <glx rop="67"/>
- </function>
-
- <function name="Vertex2s" offset="132" vectorequiv="Vertex2sv">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- </function>
-
- <function name="Vertex2sv" offset="133">
- <param name="v" type="const GLshort *" count="2"/>
- <glx rop="68"/>
- </function>
-
- <function name="Vertex3d" offset="134" vectorequiv="Vertex3dv">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- </function>
-
- <function name="Vertex3dv" offset="135">
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="69"/>
- </function>
-
- <function name="Vertex3f" offset="136" vectorequiv="Vertex3fv">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="Vertex3fv" offset="137">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="70"/>
- </function>
-
- <function name="Vertex3i" offset="138" vectorequiv="Vertex3iv">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- </function>
-
- <function name="Vertex3iv" offset="139">
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="71"/>
- </function>
-
- <function name="Vertex3s" offset="140" vectorequiv="Vertex3sv">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- </function>
-
- <function name="Vertex3sv" offset="141">
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="72"/>
- </function>
-
- <function name="Vertex4d" offset="142" vectorequiv="Vertex4dv">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="Vertex4dv" offset="143">
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="73"/>
- </function>
-
- <function name="Vertex4f" offset="144" vectorequiv="Vertex4fv">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="Vertex4fv" offset="145">
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="74"/>
- </function>
-
- <function name="Vertex4i" offset="146" vectorequiv="Vertex4iv">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- <param name="w" type="GLint"/>
- </function>
-
- <function name="Vertex4iv" offset="147">
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="75"/>
- </function>
-
- <function name="Vertex4s" offset="148" vectorequiv="Vertex4sv">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- <param name="w" type="GLshort"/>
- </function>
-
- <function name="Vertex4sv" offset="149">
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="76"/>
- </function>
-
- <function name="ClipPlane" offset="150">
- <param name="plane" type="GLenum"/>
- <param name="equation" type="const GLdouble *" count="4"/>
- <glx rop="77"/>
- </function>
-
- <function name="ColorMaterial" offset="151">
- <param name="face" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- <glx rop="78"/>
- </function>
-
- <function name="CullFace" offset="152">
- <param name="mode" type="GLenum"/>
- <glx rop="79"/>
- </function>
-
- <function name="Fogf" offset="153">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="80"/>
- </function>
-
- <function name="Fogfv" offset="154">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="81"/>
- </function>
-
- <function name="Fogi" offset="155">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="82"/>
- </function>
-
- <function name="Fogiv" offset="156">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="83"/>
- </function>
-
- <function name="FrontFace" offset="157">
- <param name="mode" type="GLenum"/>
- <glx rop="84"/>
- </function>
-
- <function name="Hint" offset="158">
- <param name="target" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- <glx rop="85"/>
- </function>
-
- <function name="Lightf" offset="159">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="86"/>
- </function>
-
- <function name="Lightfv" offset="160">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="87"/>
- </function>
-
- <function name="Lighti" offset="161">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="88"/>
- </function>
-
- <function name="Lightiv" offset="162">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="89"/>
- </function>
-
- <function name="LightModelf" offset="163">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="90"/>
- </function>
-
- <function name="LightModelfv" offset="164">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="91"/>
- </function>
-
- <function name="LightModeli" offset="165">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="92"/>
- </function>
-
- <function name="LightModeliv" offset="166">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="93"/>
- </function>
-
- <function name="LineStipple" offset="167">
- <param name="factor" type="GLint"/>
- <param name="pattern" type="GLushort"/>
- <glx rop="94"/>
- </function>
-
- <function name="LineWidth" offset="168">
- <param name="width" type="GLfloat"/>
- <glx rop="95"/>
- </function>
-
- <function name="Materialf" offset="169">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="96"/>
- </function>
-
- <function name="Materialfv" offset="170">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="97"/>
- </function>
-
- <function name="Materiali" offset="171">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="98"/>
- </function>
-
- <function name="Materialiv" offset="172">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="99"/>
- </function>
-
- <function name="PointSize" offset="173">
- <param name="size" type="GLfloat"/>
- <glx rop="100"/>
- </function>
-
- <function name="PolygonMode" offset="174">
- <param name="face" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- <glx rop="101"/>
- </function>
-
- <function name="PolygonStipple" offset="175">
- <param name="mask" type="const GLubyte *" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP" img_target="0" img_pad_dimensions="false"/>
- <glx rop="102"/>
- </function>
-
- <function name="Scissor" offset="176">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <glx rop="103"/>
- </function>
-
- <function name="ShadeModel" offset="177">
- <param name="mode" type="GLenum"/>
- <glx rop="104"/>
- </function>
-
- <function name="TexParameterf" offset="178">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="105"/>
- </function>
-
- <function name="TexParameterfv" offset="179">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="106"/>
- </function>
-
- <function name="TexParameteri" offset="180">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="107"/>
- </function>
-
- <function name="TexParameteriv" offset="181">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="108"/>
- </function>
-
- <function name="TexImage1D" offset="182">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/>
- <glx rop="109" large="true"/>
- </function>
-
- <function name="TexImage2D" offset="183">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/>
- <glx rop="110" large="true"/>
- </function>
-
- <function name="TexEnvf" offset="184">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="111"/>
- </function>
-
- <function name="TexEnvfv" offset="185">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="112"/>
- </function>
-
- <function name="TexEnvi" offset="186">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="113"/>
- </function>
-
- <function name="TexEnviv" offset="187">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="114"/>
- </function>
-
- <function name="TexGend" offset="188">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLdouble"/>
- <glx rop="115"/>
- </function>
-
- <function name="TexGendv" offset="189">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLdouble *" variable_param="pname"/>
- <glx rop="116"/>
- </function>
-
- <function name="TexGenf" offset="190">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="117"/>
- </function>
-
- <function name="TexGenfv" offset="191">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="118"/>
- </function>
-
- <function name="TexGeni" offset="192">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="119"/>
- </function>
-
- <function name="TexGeniv" offset="193">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="120"/>
- </function>
-
- <function name="FeedbackBuffer" offset="194">
- <param name="size" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="buffer" type="GLfloat *" output="true"/>
- <glx sop="105" handcode="true"/>
- </function>
-
- <function name="SelectBuffer" offset="195">
- <param name="size" type="GLsizei"/>
- <param name="buffer" type="GLuint *" output="true"/>
- <glx sop="106" handcode="true"/>
- </function>
-
- <function name="RenderMode" offset="196">
- <param name="mode" type="GLenum"/>
- <return type="GLint"/>
- <glx sop="107" handcode="true"/>
- </function>
-
- <function name="InitNames" offset="197">
- <glx rop="121"/>
- </function>
-
- <function name="LoadName" offset="198">
- <param name="name" type="GLuint"/>
- <glx rop="122"/>
- </function>
-
- <function name="PassThrough" offset="199">
- <param name="token" type="GLfloat"/>
- <glx rop="123"/>
- </function>
-
- <function name="PopName" offset="200">
- <glx rop="124"/>
- </function>
-
- <function name="PushName" offset="201">
- <param name="name" type="GLuint"/>
- <glx rop="125"/>
- </function>
-
- <function name="DrawBuffer" offset="202">
- <param name="mode" type="GLenum"/>
- <glx rop="126"/>
- </function>
-
- <function name="Clear" offset="203">
- <param name="mask" type="GLbitfield"/>
- <glx rop="127"/>
- </function>
-
- <function name="ClearAccum" offset="204">
- <param name="red" type="GLfloat"/>
- <param name="green" type="GLfloat"/>
- <param name="blue" type="GLfloat"/>
- <param name="alpha" type="GLfloat"/>
- <glx rop="128"/>
- </function>
-
- <function name="ClearIndex" offset="205">
- <param name="c" type="GLfloat"/>
- <glx rop="129"/>
- </function>
-
- <function name="ClearColor" offset="206">
- <param name="red" type="GLclampf"/>
- <param name="green" type="GLclampf"/>
- <param name="blue" type="GLclampf"/>
- <param name="alpha" type="GLclampf"/>
- <glx rop="130"/>
- </function>
-
- <function name="ClearStencil" offset="207">
- <param name="s" type="GLint"/>
- <glx rop="131"/>
- </function>
-
- <function name="ClearDepth" offset="208">
- <param name="depth" type="GLclampd"/>
- <glx rop="132"/>
- </function>
-
- <function name="StencilMask" offset="209">
- <param name="mask" type="GLuint"/>
- <glx rop="133"/>
- </function>
-
- <function name="ColorMask" offset="210">
- <param name="red" type="GLboolean"/>
- <param name="green" type="GLboolean"/>
- <param name="blue" type="GLboolean"/>
- <param name="alpha" type="GLboolean"/>
- <glx rop="134"/>
- </function>
-
- <function name="DepthMask" offset="211">
- <param name="flag" type="GLboolean"/>
- <glx rop="135"/>
- </function>
-
- <function name="IndexMask" offset="212">
- <param name="mask" type="GLuint"/>
- <glx rop="136"/>
- </function>
-
- <function name="Accum" offset="213">
- <param name="op" type="GLenum"/>
- <param name="value" type="GLfloat"/>
- <glx rop="137"/>
- </function>
-
- <function name="Disable" offset="214">
- <param name="cap" type="GLenum"/>
- <glx rop="138" handcode="client"/>
- </function>
-
- <function name="Enable" offset="215">
- <param name="cap" type="GLenum"/>
- <glx rop="139" handcode="client"/>
- </function>
-
- <function name="Finish" offset="216">
- <glx sop="108" handcode="true"/>
- </function>
-
- <function name="Flush" offset="217">
- <glx sop="142" handcode="true"/>
- </function>
-
- <function name="PopAttrib" offset="218">
- <glx rop="141"/>
- </function>
-
- <function name="PushAttrib" offset="219">
- <param name="mask" type="GLbitfield"/>
- <glx rop="142"/>
- </function>
-
- <function name="Map1d" offset="220">
- <param name="target" type="GLenum"/>
- <param name="u1" type="GLdouble"/>
- <param name="u2" type="GLdouble"/>
- <param name="stride" type="GLint"/>
- <param name="order" type="GLint"/>
- <param name="points" type="const GLdouble *"/>
- <glx rop="143" handcode="true"/>
- </function>
-
- <function name="Map1f" offset="221">
- <param name="target" type="GLenum"/>
- <param name="u1" type="GLfloat"/>
- <param name="u2" type="GLfloat"/>
- <param name="stride" type="GLint"/>
- <param name="order" type="GLint"/>
- <param name="points" type="const GLfloat *"/>
- <glx rop="144" handcode="true"/>
- </function>
-
- <function name="Map2d" offset="222">
- <param name="target" type="GLenum"/>
- <param name="u1" type="GLdouble"/>
- <param name="u2" type="GLdouble"/>
- <param name="ustride" type="GLint"/>
- <param name="uorder" type="GLint"/>
- <param name="v1" type="GLdouble"/>
- <param name="v2" type="GLdouble"/>
- <param name="vstride" type="GLint"/>
- <param name="vorder" type="GLint"/>
- <param name="points" type="const GLdouble *"/>
- <glx rop="145" handcode="true"/>
- </function>
-
- <function name="Map2f" offset="223">
- <param name="target" type="GLenum"/>
- <param name="u1" type="GLfloat"/>
- <param name="u2" type="GLfloat"/>
- <param name="ustride" type="GLint"/>
- <param name="uorder" type="GLint"/>
- <param name="v1" type="GLfloat"/>
- <param name="v2" type="GLfloat"/>
- <param name="vstride" type="GLint"/>
- <param name="vorder" type="GLint"/>
- <param name="points" type="const GLfloat *"/>
- <glx rop="146" handcode="true"/>
- </function>
-
- <function name="MapGrid1d" offset="224">
- <param name="un" type="GLint"/>
- <param name="u1" type="GLdouble"/>
- <param name="u2" type="GLdouble"/>
- <glx rop="147"/>
- </function>
-
- <function name="MapGrid1f" offset="225">
- <param name="un" type="GLint"/>
- <param name="u1" type="GLfloat"/>
- <param name="u2" type="GLfloat"/>
- <glx rop="148"/>
- </function>
-
- <function name="MapGrid2d" offset="226">
- <param name="un" type="GLint"/>
- <param name="u1" type="GLdouble"/>
- <param name="u2" type="GLdouble"/>
- <param name="vn" type="GLint"/>
- <param name="v1" type="GLdouble"/>
- <param name="v2" type="GLdouble"/>
- <glx rop="149"/>
- </function>
-
- <function name="MapGrid2f" offset="227">
- <param name="un" type="GLint"/>
- <param name="u1" type="GLfloat"/>
- <param name="u2" type="GLfloat"/>
- <param name="vn" type="GLint"/>
- <param name="v1" type="GLfloat"/>
- <param name="v2" type="GLfloat"/>
- <glx rop="150"/>
- </function>
-
- <function name="EvalCoord1d" offset="228" vectorequiv="EvalCoord1dv">
- <param name="u" type="GLdouble"/>
- </function>
-
- <function name="EvalCoord1dv" offset="229">
- <param name="u" type="const GLdouble *" count="1"/>
- <glx rop="151"/>
- </function>
-
- <function name="EvalCoord1f" offset="230" vectorequiv="EvalCoord1fv">
- <param name="u" type="GLfloat"/>
- </function>
-
- <function name="EvalCoord1fv" offset="231">
- <param name="u" type="const GLfloat *" count="1"/>
- <glx rop="152"/>
- </function>
-
- <function name="EvalCoord2d" offset="232" vectorequiv="EvalCoord2dv">
- <param name="u" type="GLdouble"/>
- <param name="v" type="GLdouble"/>
- </function>
-
- <function name="EvalCoord2dv" offset="233">
- <param name="u" type="const GLdouble *" count="2"/>
- <glx rop="153"/>
- </function>
-
- <function name="EvalCoord2f" offset="234" vectorequiv="EvalCoord2fv">
- <param name="u" type="GLfloat"/>
- <param name="v" type="GLfloat"/>
- </function>
-
- <function name="EvalCoord2fv" offset="235">
- <param name="u" type="const GLfloat *" count="2"/>
- <glx rop="154"/>
- </function>
-
- <function name="EvalMesh1" offset="236">
- <param name="mode" type="GLenum"/>
- <param name="i1" type="GLint"/>
- <param name="i2" type="GLint"/>
- <glx rop="155"/>
- </function>
-
- <function name="EvalPoint1" offset="237">
- <param name="i" type="GLint"/>
- <glx rop="156"/>
- </function>
-
- <function name="EvalMesh2" offset="238">
- <param name="mode" type="GLenum"/>
- <param name="i1" type="GLint"/>
- <param name="i2" type="GLint"/>
- <param name="j1" type="GLint"/>
- <param name="j2" type="GLint"/>
- <glx rop="157"/>
- </function>
-
- <function name="EvalPoint2" offset="239">
- <param name="i" type="GLint"/>
- <param name="j" type="GLint"/>
- <glx rop="158"/>
- </function>
-
- <function name="AlphaFunc" offset="240">
- <param name="func" type="GLenum"/>
- <param name="ref" type="GLclampf"/>
- <glx rop="159"/>
- </function>
-
- <function name="BlendFunc" offset="241">
- <param name="sfactor" type="GLenum"/>
- <param name="dfactor" type="GLenum"/>
- <glx rop="160"/>
- </function>
-
- <function name="LogicOp" offset="242">
- <param name="opcode" type="GLenum"/>
- <glx rop="161"/>
- </function>
-
- <function name="StencilFunc" offset="243">
- <param name="func" type="GLenum"/>
- <param name="ref" type="GLint"/>
- <param name="mask" type="GLuint"/>
- <glx rop="162"/>
- </function>
-
- <function name="StencilOp" offset="244">
- <param name="fail" type="GLenum"/>
- <param name="zfail" type="GLenum"/>
- <param name="zpass" type="GLenum"/>
- <glx rop="163"/>
- </function>
-
- <function name="DepthFunc" offset="245">
- <param name="func" type="GLenum"/>
- <glx rop="164"/>
- </function>
-
- <function name="PixelZoom" offset="246">
- <param name="xfactor" type="GLfloat"/>
- <param name="yfactor" type="GLfloat"/>
- <glx rop="165"/>
- </function>
-
- <function name="PixelTransferf" offset="247">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="166"/>
- </function>
-
- <function name="PixelTransferi" offset="248">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="167"/>
- </function>
-
- <function name="PixelStoref" offset="249">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx sop="109" handcode="client"/>
- </function>
-
- <function name="PixelStorei" offset="250">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx sop="110" handcode="client"/>
- </function>
-
- <function name="PixelMapfv" offset="251">
- <param name="map" type="GLenum"/>
- <param name="mapsize" type="GLsizei" counter="true"/>
- <param name="values" type="const GLfloat *" count="mapsize"/>
- <glx rop="168" large="true"/>
- </function>
-
- <function name="PixelMapuiv" offset="252">
- <param name="map" type="GLenum"/>
- <param name="mapsize" type="GLsizei" counter="true"/>
- <param name="values" type="const GLuint *" count="mapsize"/>
- <glx rop="169" large="true"/>
- </function>
-
- <function name="PixelMapusv" offset="253">
- <param name="map" type="GLenum"/>
- <param name="mapsize" type="GLsizei" counter="true"/>
- <param name="values" type="const GLushort *" count="mapsize"/>
- <glx rop="170" large="true"/>
- </function>
-
- <function name="ReadBuffer" offset="254">
- <param name="mode" type="GLenum"/>
- <glx rop="171"/>
- </function>
-
- <function name="CopyPixels" offset="255">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <glx rop="172"/>
- </function>
-
- <function name="ReadPixels" offset="256">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0"/>
- <glx sop="111"/>
- </function>
-
- <function name="DrawPixels" offset="257">
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0" img_pad_dimensions="false"/>
- <glx rop="173" large="true"/>
- </function>
-
- <function name="GetBooleanv" offset="258">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLboolean *" output="true" variable_param="pname"/>
- <glx sop="112" handcode="client"/>
- </function>
-
- <function name="GetClipPlane" offset="259">
- <param name="plane" type="GLenum"/>
- <param name="equation" type="GLdouble *" output="true" count="4"/>
- <glx sop="113" always_array="true"/>
- </function>
-
- <function name="GetDoublev" offset="260">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLdouble *" output="true" variable_param="pname"/>
- <glx sop="114" handcode="client"/>
- </function>
-
- <function name="GetError" offset="261">
- <return type="GLenum"/>
- <glx sop="115" handcode="client"/>
- </function>
-
- <function name="GetFloatv" offset="262">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="116" handcode="client"/>
- </function>
-
- <function name="GetIntegerv" offset="263">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="117" handcode="client"/>
- </function>
-
- <function name="GetLightfv" offset="264">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="118"/>
- </function>
-
- <function name="GetLightiv" offset="265">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="119"/>
- </function>
-
- <function name="GetMapdv" offset="266">
- <param name="target" type="GLenum"/>
- <param name="query" type="GLenum"/>
- <param name="v" type="GLdouble *" output="true" variable_param="target query"/>
- <glx sop="120"/>
- </function>
-
- <function name="GetMapfv" offset="267">
- <param name="target" type="GLenum"/>
- <param name="query" type="GLenum"/>
- <param name="v" type="GLfloat *" output="true" variable_param="target query"/>
- <glx sop="121"/>
- </function>
-
- <function name="GetMapiv" offset="268">
- <param name="target" type="GLenum"/>
- <param name="query" type="GLenum"/>
- <param name="v" type="GLint *" output="true" variable_param="target query"/>
- <glx sop="122"/>
- </function>
-
- <function name="GetMaterialfv" offset="269">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="123"/>
- </function>
-
- <function name="GetMaterialiv" offset="270">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="124"/>
- </function>
-
- <function name="GetPixelMapfv" offset="271">
- <param name="map" type="GLenum"/>
- <param name="values" type="GLfloat *" output="true" variable_param="map"/>
- <glx sop="125"/>
- </function>
-
- <function name="GetPixelMapuiv" offset="272">
- <param name="map" type="GLenum"/>
- <param name="values" type="GLuint *" output="true" variable_param="map"/>
- <glx sop="126"/>
- </function>
-
- <function name="GetPixelMapusv" offset="273">
- <param name="map" type="GLenum"/>
- <param name="values" type="GLushort *" output="true" variable_param="map"/>
- <glx sop="127"/>
- </function>
-
- <function name="GetPolygonStipple" offset="274">
- <param name="mask" type="GLubyte *" output="true" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP"/>
- <glx sop="128"/>
- </function>
-
- <function name="GetString" offset="275">
- <param name="name" type="GLenum"/>
- <return type="const GLubyte *"/>
- <glx sop="129" handcode="true"/>
- </function>
-
- <function name="GetTexEnvfv" offset="276">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="130"/>
- </function>
-
- <function name="GetTexEnviv" offset="277">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="131"/>
- </function>
-
- <function name="GetTexGendv" offset="278">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLdouble *" output="true" variable_param="pname"/>
- <glx sop="132"/>
- </function>
-
- <function name="GetTexGenfv" offset="279">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="133"/>
- </function>
-
- <function name="GetTexGeniv" offset="280">
- <param name="coord" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="134"/>
- </function>
-
- <function name="GetTexImage" offset="281">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type"/>
- <glx sop="135" dimensions_in_reply="true"/>
- </function>
-
- <function name="GetTexParameterfv" offset="282">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="136"/>
- </function>
-
- <function name="GetTexParameteriv" offset="283">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="137"/>
- </function>
-
- <function name="GetTexLevelParameterfv" offset="284">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="138"/>
- </function>
-
- <function name="GetTexLevelParameteriv" offset="285">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="139"/>
- </function>
-
- <function name="IsEnabled" offset="286">
- <param name="cap" type="GLenum"/>
- <return type="GLboolean"/>
- <glx sop="140" handcode="client"/>
- </function>
-
- <function name="IsList" offset="287">
- <param name="list" type="GLuint"/>
- <return type="GLboolean"/>
- <glx sop="141"/>
- </function>
-
- <function name="DepthRange" offset="288">
- <param name="zNear" type="GLclampd"/>
- <param name="zFar" type="GLclampd"/>
- <glx rop="174"/>
- </function>
-
- <function name="Frustum" offset="289">
- <param name="left" type="GLdouble"/>
- <param name="right" type="GLdouble"/>
- <param name="bottom" type="GLdouble"/>
- <param name="top" type="GLdouble"/>
- <param name="zNear" type="GLdouble"/>
- <param name="zFar" type="GLdouble"/>
- <glx rop="175"/>
- </function>
-
- <function name="LoadIdentity" offset="290">
- <glx rop="176"/>
- </function>
-
- <function name="LoadMatrixf" offset="291">
- <param name="m" type="const GLfloat *" count="16"/>
- <glx rop="177"/>
- </function>
-
- <function name="LoadMatrixd" offset="292">
- <param name="m" type="const GLdouble *" count="16"/>
- <glx rop="178"/>
- </function>
-
- <function name="MatrixMode" offset="293">
- <param name="mode" type="GLenum"/>
- <glx rop="179"/>
- </function>
-
- <function name="MultMatrixf" offset="294">
- <param name="m" type="const GLfloat *" count="16"/>
- <glx rop="180"/>
- </function>
-
- <function name="MultMatrixd" offset="295">
- <param name="m" type="const GLdouble *" count="16"/>
- <glx rop="181"/>
- </function>
-
- <function name="Ortho" offset="296">
- <param name="left" type="GLdouble"/>
- <param name="right" type="GLdouble"/>
- <param name="bottom" type="GLdouble"/>
- <param name="top" type="GLdouble"/>
- <param name="zNear" type="GLdouble"/>
- <param name="zFar" type="GLdouble"/>
- <glx rop="182"/>
- </function>
-
- <function name="PopMatrix" offset="297">
- <glx rop="183"/>
- </function>
-
- <function name="PushMatrix" offset="298">
- <glx rop="184"/>
- </function>
-
- <function name="Rotated" offset="299">
- <param name="angle" type="GLdouble"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <glx rop="185"/>
- </function>
-
- <function name="Rotatef" offset="300">
- <param name="angle" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <glx rop="186"/>
- </function>
-
- <function name="Scaled" offset="301">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <glx rop="187"/>
- </function>
-
- <function name="Scalef" offset="302">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <glx rop="188"/>
- </function>
-
- <function name="Translated" offset="303">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <glx rop="189"/>
- </function>
-
- <function name="Translatef" offset="304">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <glx rop="190"/>
- </function>
-
- <function name="Viewport" offset="305">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <glx rop="191"/>
- </function>
-</category>
-
-<category name="1.1">
- <enum name="INDEX_LOGIC_OP" value="0x0BF1"/>
- <enum name="COLOR_LOGIC_OP" value="0x0BF2"/>
- <enum name="TEXTURE_INTERNAL_FORMAT" value="0x1003"/>
- <enum name="DOUBLE" value="0x140A"/>
- <enum name="POLYGON_OFFSET_UNITS" count="1" value="0x2A00">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POLYGON_OFFSET_POINT" value="0x2A01"/>
- <enum name="POLYGON_OFFSET_LINE" value="0x2A02"/>
- <enum name="R3_G3_B2" value="0x2A10"/>
- <enum name="V2F" value="0x2A20"/>
- <enum name="V3F" value="0x2A21"/>
- <enum name="C4UB_V2F" value="0x2A22"/>
- <enum name="C4UB_V3F" value="0x2A23"/>
- <enum name="C3F_V3F" value="0x2A24"/>
- <enum name="N3F_V3F" value="0x2A25"/>
- <enum name="C4F_N3F_V3F" value="0x2A26"/>
- <enum name="T2F_V3F" value="0x2A27"/>
- <enum name="T4F_V4F" value="0x2A28"/>
- <enum name="T2F_C4UB_V3F" value="0x2A29"/>
- <enum name="T2F_C3F_V3F" value="0x2A2A"/>
- <enum name="T2F_N3F_V3F" value="0x2A2B"/>
- <enum name="T2F_C4F_N3F_V3F" value="0x2A2C"/>
- <enum name="T4F_C4F_N3F_V4F" value="0x2A2D"/>
- <enum name="POLYGON_OFFSET_FILL" value="0x8037"/>
- <enum name="POLYGON_OFFSET_FACTOR" count="1" value="0x8038">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POLYGON_OFFSET_BIAS" value="0x8039"/>
- <enum name="ALPHA4" value="0x803B"/>
- <enum name="ALPHA8" value="0x803C"/>
- <enum name="ALPHA12" value="0x803D"/>
- <enum name="ALPHA16" value="0x803E"/>
- <enum name="LUMINANCE4" value="0x803F"/>
- <enum name="LUMINANCE8" value="0x8040"/>
- <enum name="LUMINANCE12" value="0x8041"/>
- <enum name="LUMINANCE16" value="0x8042"/>
- <enum name="LUMINANCE4_ALPHA4" value="0x8043"/>
- <enum name="LUMINANCE6_ALPHA2" value="0x8044"/>
- <enum name="LUMINANCE8_ALPHA8" value="0x8045"/>
- <enum name="LUMINANCE12_ALPHA4" value="0x8046"/>
- <enum name="LUMINANCE12_ALPHA12" value="0x8047"/>
- <enum name="LUMINANCE16_ALPHA16" value="0x8048"/>
- <enum name="INTENSITY" value="0x8049"/>
- <enum name="INTENSITY4" value="0x804A"/>
- <enum name="INTENSITY8" value="0x804B"/>
- <enum name="INTENSITY12" value="0x804C"/>
- <enum name="INTENSITY16" value="0x804D"/>
- <enum name="RGB4" value="0x804F"/>
- <enum name="RGB5" value="0x8050"/>
- <enum name="RGB8" value="0x8051"/>
- <enum name="RGB10" value="0x8052"/>
- <enum name="RGB12" value="0x8053"/>
- <enum name="RGB16" value="0x8054"/>
- <enum name="RGBA2" value="0x8055"/>
- <enum name="RGBA4" value="0x8056"/>
- <enum name="RGB5_A1" value="0x8057"/>
- <enum name="RGBA8" value="0x8058"/>
- <enum name="RGB10_A2" value="0x8059"/>
- <enum name="RGBA12" value="0x805A"/>
- <enum name="RGBA16" value="0x805B"/>
- <enum name="TEXTURE_RED_SIZE" count="1" value="0x805C">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_GREEN_SIZE" count="1" value="0x805D">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_BLUE_SIZE" count="1" value="0x805E">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_ALPHA_SIZE" count="1" value="0x805F">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_LUMINANCE_SIZE" count="1" value="0x8060">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_INTENSITY_SIZE" count="1" value="0x8061">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="PROXY_TEXTURE_1D" value="0x8063"/>
- <enum name="PROXY_TEXTURE_2D" value="0x8064"/>
- <enum name="TEXTURE_PRIORITY" count="1" value="0x8066">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_RESIDENT" count="1" value="0x8067">
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_1D" count="1" value="0x8068">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_2D" count="1" value="0x8069">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ARRAY" count="1" value="0x8074">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="NORMAL_ARRAY" count="1" value="0x8075">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_ARRAY" count="1" value="0x8076">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_ARRAY" count="1" value="0x8077">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COORD_ARRAY" count="1" value="0x8078">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="EDGE_FLAG_ARRAY" count="1" value="0x8079">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ARRAY_SIZE" count="1" value="0x807A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ARRAY_TYPE" count="1" value="0x807B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ARRAY_STRIDE" count="1" value="0x807C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="NORMAL_ARRAY_TYPE" count="1" value="0x807E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="NORMAL_ARRAY_STRIDE" count="1" value="0x807F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_ARRAY_SIZE" count="1" value="0x8081">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_ARRAY_TYPE" count="1" value="0x8082">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_ARRAY_STRIDE" count="1" value="0x8083">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_ARRAY_TYPE" count="1" value="0x8085">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="INDEX_ARRAY_STRIDE" count="1" value="0x8086">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COORD_ARRAY_SIZE" count="1" value="0x8088">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COORD_ARRAY_TYPE" count="1" value="0x8089">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COORD_ARRAY_STRIDE" count="1" value="0x808A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="EDGE_FLAG_ARRAY_STRIDE" count="1" value="0x808C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ARRAY_POINTER" value="0x808E"/>
- <enum name="NORMAL_ARRAY_POINTER" value="0x808F"/>
- <enum name="COLOR_ARRAY_POINTER" value="0x8090"/>
- <enum name="INDEX_ARRAY_POINTER" value="0x8091"/>
- <enum name="TEXTURE_COORD_ARRAY_POINTER" value="0x8092"/>
- <enum name="EDGE_FLAG_ARRAY_POINTER" value="0x8093"/>
- <enum name="CLIENT_PIXEL_STORE_BIT" value="0x00000001"/>
- <enum name="CLIENT_VERTEX_ARRAY_BIT" value="0x00000002"/>
- <enum name="ALL_CLIENT_ATTRIB_BITS" value="0xFFFFFFFF"/>
- <enum name="CLIENT_ALL_ATTRIB_BITS" value="0xFFFFFFFF"/>
-
- <function name="ArrayElement" offset="306">
- <param name="i" type="GLint"/>
- <glx handcode="true"/>
- </function>
-
- <function name="ColorPointer" offset="308">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="DisableClientState" offset="309">
- <param name="array" type="GLenum"/>
- <glx handcode="true"/>
- </function>
-
- <function name="DrawArrays" offset="310">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <glx rop="193" handcode="true"/>
- </function>
-
- <function name="DrawElements" offset="311">
- <param name="mode" type="GLenum"/>
- <param name="count" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="EdgeFlagPointer" offset="312">
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="EnableClientState" offset="313">
- <param name="array" type="GLenum"/>
- <glx handcode="true"/>
- </function>
-
- <function name="GetPointerv" offset="329">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLvoid **" output="true"/>
- <glx handcode="true"/>
- </function>
-
- <function name="IndexPointer" offset="314">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="InterleavedArrays" offset="317">
- <param name="format" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="NormalPointer" offset="318">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="TexCoordPointer" offset="320">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="VertexPointer" offset="321">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="PolygonOffset" offset="319">
- <param name="factor" type="GLfloat"/>
- <param name="units" type="GLfloat"/>
- <glx rop="192"/>
- </function>
-
- <function name="CopyTexImage1D" offset="323">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <glx rop="4119"/>
- </function>
-
- <function name="CopyTexImage2D" offset="324">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <glx rop="4120"/>
- </function>
-
- <function name="CopyTexSubImage1D" offset="325">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <glx rop="4121"/>
- </function>
-
- <function name="CopyTexSubImage2D" offset="326">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <glx rop="4122"/>
- </function>
-
- <function name="TexSubImage1D" offset="332">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
- <glx rop="4099" large="true"/>
- </function>
-
- <function name="TexSubImage2D" offset="333">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
- <glx rop="4100" large="true"/>
- </function>
-
- <function name="AreTexturesResident" offset="322">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="const GLuint *" count="n"/>
- <param name="residences" type="GLboolean *" output="true" count="n"/>
- <return type="GLboolean"/>
- <glx sop="143" always_array="true"/>
- </function>
-
- <function name="BindTexture" offset="307">
- <param name="target" type="GLenum"/>
- <param name="texture" type="GLuint"/>
- <glx rop="4117"/>
- </function>
-
- <function name="DeleteTextures" offset="327">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="const GLuint *" count="n"/>
- <glx sop="144"/>
- </function>
-
- <function name="GenTextures" offset="328">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="GLuint *" output="true" count="n"/>
- <glx sop="145" always_array="true"/>
- </function>
-
- <function name="IsTexture" offset="330">
- <param name="texture" type="GLuint"/>
- <return type="GLboolean"/>
- <glx sop="146"/>
- </function>
-
- <function name="PrioritizeTextures" offset="331">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="const GLuint *" count="n"/>
- <param name="priorities" type="const GLclampf *" count="n"/>
- <glx rop="4118"/>
- </function>
-
- <function name="Indexub" offset="315" vectorequiv="Indexubv">
- <param name="c" type="GLubyte"/>
- </function>
-
- <function name="Indexubv" offset="316">
- <param name="c" type="const GLubyte *" count="1"/>
- <glx rop="194"/>
- </function>
-
- <function name="PopClientAttrib" offset="334">
- <glx handcode="true"/>
- </function>
-
- <function name="PushClientAttrib" offset="335">
- <param name="mask" type="GLbitfield"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<category name="1.2">
- <enum name="UNSIGNED_BYTE_3_3_2" value="0x8032"/>
- <enum name="UNSIGNED_SHORT_4_4_4_4" value="0x8033"/>
- <enum name="UNSIGNED_SHORT_5_5_5_1" value="0x8034"/>
- <enum name="UNSIGNED_INT_8_8_8_8" value="0x8035"/>
- <enum name="UNSIGNED_INT_10_10_10_2" value="0x8036"/>
- <enum name="RESCALE_NORMAL" count="1" value="0x803A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_3D" count="1" value="0x806A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_SKIP_IMAGES" count="1" value="0x806B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PACK_IMAGE_HEIGHT" count="1" value="0x806C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_SKIP_IMAGES" count="1" value="0x806D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="UNPACK_IMAGE_HEIGHT" count="1" value="0x806E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_3D" count="1" value="0x806F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROXY_TEXTURE_3D" value="0x8070"/>
- <enum name="TEXTURE_DEPTH" count="1" value="0x8071">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_WRAP_R" count="1" value="0x8072">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="MAX_3D_TEXTURE_SIZE" value="0x8073"/>
- <enum name="UNSIGNED_BYTE_2_3_3_REV" value="0x8362"/>
- <enum name="UNSIGNED_SHORT_5_6_5" value="0x8363"/>
- <enum name="UNSIGNED_SHORT_5_6_5_REV" value="0x8364"/>
- <enum name="UNSIGNED_SHORT_4_4_4_4_REV" value="0x8365"/>
- <enum name="UNSIGNED_SHORT_1_5_5_5_REV" value="0x8366"/>
- <enum name="UNSIGNED_INT_8_8_8_8_REV" value="0x8367"/>
- <enum name="UNSIGNED_INT_2_10_10_10_REV" value="0x8368"/>
- <enum name="BGR" value="0x80E0"/>
- <enum name="BGRA" value="0x80E1"/>
- <enum name="MAX_ELEMENTS_VERTICES" count="1" value="0x80E8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_ELEMENTS_INDICES" count="1" value="0x80E9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLAMP_TO_EDGE" value="0x812F"/>
- <enum name="TEXTURE_MIN_LOD" count="1" value="0x813A">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_MAX_LOD" count="1" value="0x813B">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_BASE_LEVEL" count="1" value="0x813C">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_MAX_LEVEL" count="1" value="0x813D">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="LIGHT_MODEL_COLOR_CONTROL" count="1" value="0x81F8">
- <size name="LightModelfv"/>
- <size name="LightModeliv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SINGLE_COLOR" value="0x81F9"/>
- <enum name="SEPARATE_SPECULAR_COLOR" value="0x81FA"/>
- <enum name="SMOOTH_POINT_SIZE_RANGE" count="2" value="0x0B12">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SMOOTH_POINT_SIZE_GRANULARITY" count="1" value="0x0B13">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SMOOTH_LINE_WIDTH_RANGE" count="2" value="0x0B22">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SMOOTH_LINE_WIDTH_GRANULARITY" count="1" value="0x0B23">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALIASED_POINT_SIZE_RANGE" count="2" value="0x846D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ALIASED_LINE_WIDTH_RANGE" count="2" value="0x846E">
- <size name="Get" mode="get"/>
- </enum>
-
- <!-- These enums are actually part of the ARB_imaging subset. -->
-
- <enum name="CONSTANT_COLOR" value="0x8001"/>
- <enum name="ONE_MINUS_CONSTANT_COLOR" value="0x8002"/>
- <enum name="CONSTANT_ALPHA" value="0x8003"/>
- <enum name="ONE_MINUS_CONSTANT_ALPHA" value="0x8004"/>
- <enum name="BLEND_COLOR" count="4" value="0x8005">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FUNC_ADD" value="0x8006"/>
- <enum name="MIN" value="0x8007"/>
- <enum name="MAX" value="0x8008"/>
- <enum name="BLEND_EQUATION" count="1" value="0x8009">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FUNC_SUBTRACT" value="0x800A"/>
- <enum name="FUNC_REVERSE_SUBTRACT" value="0x800B"/>
- <enum name="CONVOLUTION_1D" count="1" value="0x8010">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_2D" count="1" value="0x8011">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SEPARABLE_2D" count="1" value="0x8012">
- <size name="Get" mode="get"/>
- </enum>
-
- <enum name="CONVOLUTION_BORDER_MODE" count="1" value="0x8013">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_BORDER_COLOR" count="4" value="0x8154">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_FILTER_SCALE" count="4" value="0x8014">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_FILTER_BIAS" count="4" value="0x8015">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="REDUCE" value="0x8016"/>
- <enum name="CONVOLUTION_FORMAT" count="1" value="0x8017">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_WIDTH" count="1" value="0x8018">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_HEIGHT" count="1" value="0x8019">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="MAX_CONVOLUTION_WIDTH" count="1" value="0x801A">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_CONVOLUTION_HEIGHT" count="1" value="0x801B">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_RED_SCALE" count="1" value="0x801C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_GREEN_SCALE" count="1" value="0x801D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_BLUE_SCALE" count="1" value="0x801E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_ALPHA_SCALE" count="1" value="0x801F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_RED_BIAS" count="1" value="0x8020">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_GREEN_BIAS" count="1" value="0x8021">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_BLUE_BIAS" count="1" value="0x8022">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_ALPHA_BIAS" count="1" value="0x8023">
- <size name="Get" mode="get"/>
- </enum>
-
- <enum name="HISTOGRAM" count="1" value="0x8024">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROXY_HISTOGRAM" value="0x8025"/>
- <enum name="HISTOGRAM_WIDTH" count="1" value="0x8026">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_FORMAT" count="1" value="0x8027">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_RED_SIZE" count="1" value="0x8028">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_GREEN_SIZE" count="1" value="0x8029">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_BLUE_SIZE" count="1" value="0x802A">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_ALPHA_SIZE" count="1" value="0x802B">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_LUMINANCE_SIZE" count="1" value="0x802C">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_SINK" count="1" value="0x802D">
- <size name="GetHistogramParameterfv" mode="get"/>
- <size name="GetHistogramParameteriv" mode="get"/>
- </enum>
- <enum name="MINMAX" count="1" value="0x802E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MINMAX_FORMAT" count="1" value="0x802F">
- <size name="GetMinmaxParameterfv" mode="get"/>
- <size name="GetMinmaxParameteriv" mode="get"/>
- </enum>
- <enum name="MINMAX_SINK" count="1" value="0x8030">
- <size name="GetMinmaxParameterfv" mode="get"/>
- <size name="GetMinmaxParameteriv" mode="get"/>
- </enum>
-
- <enum name="COLOR_MATRIX" count="16" value="0x80B1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_MATRIX_STACK_DEPTH" count="1" value="0x80B2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_COLOR_MATRIX_STACK_DEPTH" count="1" value="0x80B3">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_RED_SCALE" count="1" value="0x80B4">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_GREEN_SCALE" count="1" value="0x80B5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_BLUE_SCALE" count="1" value="0x80B6">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_ALPHA_SCALE" count="1" value="0x80B7">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_RED_BIAS" count="1" value="0x80B8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_GREEN_BIAS" count="1" value="0x80B9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_BLUE_BIAS" count="1" value="0x80BA">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_ALPHA_BIAS" count="1" value="0x80BB">
- <size name="Get" mode="get"/>
- </enum>
-
- <enum name="COLOR_TABLE" count="1" value="0x80D0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_COLOR_TABLE" count="1" value="0x80D1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_COLOR_MATRIX_COLOR_TABLE" count="1" value="0x80D2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROXY_COLOR_TABLE" value="0x80D3"/>
- <enum name="PROXY_POST_CONVOLUTION_COLOR_TABLE" value="0x80D4"/>
- <enum name="PROXY_POST_COLOR_MATRIX_COLOR_TABLE" value="0x80D5"/>
-
- <enum name="COLOR_TABLE_SCALE" count="4" value="0x80D6">
- <size name="ColorTableParameterfv"/>
- <size name="ColorTableParameteriv"/>
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_BIAS" count="4" value="0x80D7">
- <size name="ColorTableParameterfv"/>
- <size name="ColorTableParameteriv"/>
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_FORMAT" count="1" value="0x80D8">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_WIDTH" count="1" value="0x80D9">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_RED_SIZE" count="1" value="0x80DA">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_GREEN_SIZE" count="1" value="0x80DB">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_BLUE_SIZE" count="1" value="0x80DC">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_ALPHA_SIZE" count="1" value="0x80DD">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_LUMINANCE_SIZE" count="1" value="0x80DE">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_INTENSITY_SIZE" count="1" value="0x80DF">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
-
-
- <function name="BlendColor" offset="336">
- <param name="red" type="GLclampf"/>
- <param name="green" type="GLclampf"/>
- <param name="blue" type="GLclampf"/>
- <param name="alpha" type="GLclampf"/>
- <glx rop="4096"/>
- </function>
-
- <function name="BlendEquation" offset="337">
- <param name="mode" type="GLenum"/>
- <glx rop="4097"/>
- </function>
-
- <function name="DrawRangeElements" offset="338">
- <param name="mode" type="GLenum"/>
- <param name="start" type="GLuint"/>
- <param name="end" type="GLuint"/>
- <param name="count" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="ColorTable" offset="339">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="table" type="const GLvoid *" img_width="width" img_pad_dimensions="false" img_format="format" img_type="type" img_target="target"/>
- <glx rop="2053" large="true"/>
- </function>
-
- <function name="ColorTableParameterfv" offset="340">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="2054"/>
- </function>
-
- <function name="ColorTableParameteriv" offset="341">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="2055"/>
- </function>
-
- <function name="CopyColorTable" offset="342">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <glx rop="2056"/>
- </function>
-
- <function name="GetColorTable" offset="343">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="table" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/>
- <glx sop="147" dimensions_in_reply="true"/>
- </function>
-
- <function name="GetColorTableParameterfv" offset="344">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="148"/>
- </function>
-
- <function name="GetColorTableParameteriv" offset="345">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="149"/>
- </function>
-
- <function name="ColorSubTable" offset="346">
- <param name="target" type="GLenum"/>
- <param name="start" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="data" type="const GLvoid *" img_width="count" img_pad_dimensions="false" img_format="format" img_type="type" img_target="target"/>
- <glx rop="195" large="true"/>
- </function>
-
- <function name="CopyColorSubTable" offset="347">
- <param name="target" type="GLenum"/>
- <param name="start" type="GLsizei"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <glx rop="196"/>
- </function>
-
- <function name="ConvolutionFilter1D" offset="348">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="image" type="const GLvoid *" img_width="width" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
- <glx rop="4101" large="true"/>
- </function>
-
- <function name="ConvolutionFilter2D" offset="349">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="image" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
- <glx rop="4102" large="true"/>
- </function>
-
- <function name="ConvolutionParameterf" offset="350">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat"/>
- <glx rop="4103"/>
- </function>
-
- <function name="ConvolutionParameterfv" offset="351">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="4104"/>
- </function>
-
- <function name="ConvolutionParameteri" offset="352">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint"/>
- <glx rop="4105"/>
- </function>
-
- <function name="ConvolutionParameteriv" offset="353">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="4106"/>
- </function>
-
- <function name="CopyConvolutionFilter1D" offset="354">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <glx rop="4107"/>
- </function>
-
- <function name="CopyConvolutionFilter2D" offset="355">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <glx rop="4108"/>
- </function>
-
- <function name="GetConvolutionFilter" offset="356">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="image" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type"/>
- <glx sop="150" dimensions_in_reply="true"/>
- </function>
-
- <function name="GetConvolutionParameterfv" offset="357">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="151"/>
- </function>
-
- <function name="GetConvolutionParameteriv" offset="358">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="152"/>
- </function>
-
- <function name="GetSeparableFilter" offset="359">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="row" type="GLvoid *" output="true"/>
- <param name="column" type="GLvoid *" output="true"/>
- <param name="span" type="GLvoid *" output="true"/>
- <glx sop="153" handcode="true"/>
- </function>
-
- <function name="SeparableFilter2D" offset="360">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="row" type="const GLvoid *"/>
- <param name="column" type="const GLvoid *"/>
- <glx rop="4109" handcode="true"/>
- </function>
-
- <function name="GetHistogram" offset="361">
- <param name="target" type="GLenum"/>
- <param name="reset" type="GLboolean"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/>
- <glx sop="154" dimensions_in_reply="true" img_reset="reset"/>
- </function>
-
- <function name="GetHistogramParameterfv" offset="362">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="155"/>
- </function>
-
- <function name="GetHistogramParameteriv" offset="363">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="156"/>
- </function>
-
- <function name="GetMinmax" offset="364">
- <param name="target" type="GLenum"/>
- <param name="reset" type="GLboolean"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true" img_width="2" img_format="format" img_type="type"/>
- <glx sop="157" img_reset="reset"/>
- </function>
-
- <function name="GetMinmaxParameterfv" offset="365">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx sop="158"/>
- </function>
-
- <function name="GetMinmaxParameteriv" offset="366">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="159"/>
- </function>
-
- <function name="Histogram" offset="367">
- <param name="target" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="internalformat" type="GLenum"/>
- <param name="sink" type="GLboolean"/>
- <glx rop="4110"/>
- </function>
-
- <function name="Minmax" offset="368">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="sink" type="GLboolean"/>
- <glx rop="4111"/>
- </function>
-
- <function name="ResetHistogram" offset="369">
- <param name="target" type="GLenum"/>
- <glx rop="4112"/>
- </function>
-
- <function name="ResetMinmax" offset="370">
- <param name="target" type="GLenum"/>
- <glx rop="4113"/>
- </function>
-
- <function name="TexImage3D" offset="371">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
- <glx rop="4114" large="true"/>
- </function>
-
- <function name="TexSubImage3D" offset="372">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
- <glx rop="4115" large="true"/>
- </function>
-
- <function name="CopyTexSubImage3D" offset="373">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <glx rop="4123"/>
- </function>
-</category>
-
-<category name="1.3">
- <enum name="TEXTURE0" value="0x84C0"/>
- <enum name="TEXTURE1" value="0x84C1"/>
- <enum name="TEXTURE2" value="0x84C2"/>
- <enum name="TEXTURE3" value="0x84C3"/>
- <enum name="TEXTURE4" value="0x84C4"/>
- <enum name="TEXTURE5" value="0x84C5"/>
- <enum name="TEXTURE6" value="0x84C6"/>
- <enum name="TEXTURE7" value="0x84C7"/>
- <enum name="TEXTURE8" value="0x84C8"/>
- <enum name="TEXTURE9" value="0x84C9"/>
- <enum name="TEXTURE10" value="0x84CA"/>
- <enum name="TEXTURE11" value="0x84CB"/>
- <enum name="TEXTURE12" value="0x84CC"/>
- <enum name="TEXTURE13" value="0x84CD"/>
- <enum name="TEXTURE14" value="0x84CE"/>
- <enum name="TEXTURE15" value="0x84CF"/>
- <enum name="TEXTURE16" value="0x84D0"/>
- <enum name="TEXTURE17" value="0x84D1"/>
- <enum name="TEXTURE18" value="0x84D2"/>
- <enum name="TEXTURE19" value="0x84D3"/>
- <enum name="TEXTURE20" value="0x84D4"/>
- <enum name="TEXTURE21" value="0x84D5"/>
- <enum name="TEXTURE22" value="0x84D6"/>
- <enum name="TEXTURE23" value="0x84D7"/>
- <enum name="TEXTURE24" value="0x84D8"/>
- <enum name="TEXTURE25" value="0x84D9"/>
- <enum name="TEXTURE26" value="0x84DA"/>
- <enum name="TEXTURE27" value="0x84DB"/>
- <enum name="TEXTURE28" value="0x84DC"/>
- <enum name="TEXTURE29" value="0x84DD"/>
- <enum name="TEXTURE30" value="0x84DE"/>
- <enum name="TEXTURE31" value="0x84DF"/>
- <enum name="ACTIVE_TEXTURE" count="1" value="0x84E0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIENT_ACTIVE_TEXTURE" count="1" value="0x84E1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_UNITS" count="1" value="0x84E2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TRANSPOSE_MODELVIEW_MATRIX" value="0x84E3"/>
- <enum name="TRANSPOSE_PROJECTION_MATRIX" value="0x84E4"/>
- <enum name="TRANSPOSE_TEXTURE_MATRIX" value="0x84E5"/>
- <enum name="TRANSPOSE_COLOR_MATRIX" value="0x84E6"/>
- <enum name="MULTISAMPLE" count="1" value="0x809D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_ALPHA_TO_COVERAGE" count="1" value="0x809E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_ALPHA_TO_ONE" count="1" value="0x809F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_COVERAGE" count="1" value="0x80A0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_BUFFERS" count="1" value="0x80A8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLES" count="1" value="0x80A9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_COVERAGE_VALUE" count="1" value="0x80AA">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_COVERAGE_INVERT" count="1" value="0x80AB">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MULTISAMPLE_BIT" value="0x20000000"/>
- <enum name="NORMAL_MAP" value="0x8511"/>
- <enum name="REFLECTION_MAP" value="0x8512"/>
- <enum name="TEXTURE_CUBE_MAP" count="1" value="0x8513">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_CUBE_MAP" count="1" value="0x8514">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_CUBE_MAP_POSITIVE_X" value="0x8515"/>
- <enum name="TEXTURE_CUBE_MAP_NEGATIVE_X" value="0x8516"/>
- <enum name="TEXTURE_CUBE_MAP_POSITIVE_Y" value="0x8517"/>
- <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Y" value="0x8518"/>
- <enum name="TEXTURE_CUBE_MAP_POSITIVE_Z" value="0x8519"/>
- <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Z" value="0x851A"/>
- <enum name="PROXY_TEXTURE_CUBE_MAP" value="0x851B"/>
- <enum name="MAX_CUBE_MAP_TEXTURE_SIZE" count="1" value="0x851C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COMPRESSED_ALPHA" value="0x84E9"/>
- <enum name="COMPRESSED_LUMINANCE" value="0x84EA"/>
- <enum name="COMPRESSED_LUMINANCE_ALPHA" value="0x84EB"/>
- <enum name="COMPRESSED_INTENSITY" value="0x84EC"/>
- <enum name="COMPRESSED_RGB" value="0x84ED"/>
- <enum name="COMPRESSED_RGBA" value="0x84EE"/>
- <enum name="TEXTURE_COMPRESSION_HINT" count="1" value="0x84EF">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPRESSED_IMAGE_SIZE" count="1" value="0x86A0">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPRESSED" count="1" value="0x86A1">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="NUM_COMPRESSED_TEXTURE_FORMATS" count="1" value="0x86A2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COMPRESSED_TEXTURE_FORMATS" count="-1" value="0x86A3">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLAMP_TO_BORDER" value="0x812D"/>
- <enum name="COMBINE" value="0x8570"/>
- <enum name="COMBINE_RGB" count="1" value="0x8571">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="COMBINE_ALPHA" count="1" value="0x8572">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE0_RGB" count="1" value="0x8580">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE1_RGB" count="1" value="0x8581">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE2_RGB" count="1" value="0x8582">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE0_ALPHA" count="1" value="0x8588">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE1_ALPHA" count="1" value="0x8589">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE2_ALPHA" count="1" value="0x858A">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND0_RGB" count="1" value="0x8590">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND1_RGB" count="1" value="0x8591">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND2_RGB" count="1" value="0x8592">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND0_ALPHA" count="1" value="0x8598">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND1_ALPHA" count="1" value="0x8599">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND2_ALPHA" count="1" value="0x859A">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="RGB_SCALE" count="1" value="0x8573">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="ADD_SIGNED" value="0x8574"/>
- <enum name="INTERPOLATE" value="0x8575"/>
- <enum name="SUBTRACT" value="0x84E7"/>
- <enum name="CONSTANT" value="0x8576"/>
- <enum name="PRIMARY_COLOR" value="0x8577"/>
- <enum name="PREVIOUS" value="0x8578"/>
- <enum name="DOT3_RGB" value="0x86AE"/>
- <enum name="DOT3_RGBA" value="0x86AF"/>
-
- <function name="ActiveTexture" alias="ActiveTextureARB">
- <param name="texture" type="GLenum"/>
- </function>
-
- <function name="ClientActiveTexture" alias="ClientActiveTextureARB">
- <param name="texture" type="GLenum"/>
- </function>
-
- <function name="MultiTexCoord1d" alias="MultiTexCoord1dARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord1dv" alias="MultiTexCoord1dvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="MultiTexCoord1f" alias="MultiTexCoord1fARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord1fv" alias="MultiTexCoord1fvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="MultiTexCoord1i" alias="MultiTexCoord1iARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord1iv" alias="MultiTexCoord1ivARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="MultiTexCoord1s" alias="MultiTexCoord1sARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord1sv" alias="MultiTexCoord1svARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="MultiTexCoord2d" alias="MultiTexCoord2dARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord2dv" alias="MultiTexCoord2dvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="MultiTexCoord2f" alias="MultiTexCoord2fARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord2fv" alias="MultiTexCoord2fvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="MultiTexCoord2i" alias="MultiTexCoord2iARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord2iv" alias="MultiTexCoord2ivARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="MultiTexCoord2s" alias="MultiTexCoord2sARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord2sv" alias="MultiTexCoord2svARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="MultiTexCoord3d" alias="MultiTexCoord3dARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- <param name="r" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord3dv" alias="MultiTexCoord3dvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="MultiTexCoord3f" alias="MultiTexCoord3fARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord3fv" alias="MultiTexCoord3fvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="MultiTexCoord3i" alias="MultiTexCoord3iARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- <param name="r" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord3iv" alias="MultiTexCoord3ivARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="MultiTexCoord3s" alias="MultiTexCoord3sARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- <param name="r" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord3sv" alias="MultiTexCoord3svARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="MultiTexCoord4d" alias="MultiTexCoord4dARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- <param name="r" type="GLdouble"/>
- <param name="q" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord4dv" alias="MultiTexCoord4dvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="MultiTexCoord4f" alias="MultiTexCoord4fARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="q" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord4fv" alias="MultiTexCoord4fvARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="MultiTexCoord4i" alias="MultiTexCoord4iARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- <param name="r" type="GLint"/>
- <param name="q" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord4iv" alias="MultiTexCoord4ivARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="MultiTexCoord4s" alias="MultiTexCoord4sARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- <param name="r" type="GLshort"/>
- <param name="q" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord4sv" alias="MultiTexCoord4svARB">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="LoadTransposeMatrixf" alias="LoadTransposeMatrixfARB">
- <param name="m" type="const GLfloat *"/>
- </function>
-
- <function name="LoadTransposeMatrixd" alias="LoadTransposeMatrixdARB">
- <param name="m" type="const GLdouble *"/>
- </function>
-
- <function name="MultTransposeMatrixf" alias="MultTransposeMatrixfARB">
- <param name="m" type="const GLfloat *"/>
- </function>
-
- <function name="MultTransposeMatrixd" alias="MultTransposeMatrixdARB">
- <param name="m" type="const GLdouble *"/>
- </function>
-
- <function name="SampleCoverage" alias="SampleCoverageARB">
- <param name="value" type="GLclampf"/>
- <param name="invert" type="GLboolean"/>
- </function>
-
- <function name="CompressedTexImage3D" alias="CompressedTexImage3DARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="imageSize" type="GLsizei"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="CompressedTexImage2D" alias="CompressedTexImage2DARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="imageSize" type="GLsizei"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="CompressedTexImage1D" alias="CompressedTexImage1DARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="imageSize" type="GLsizei"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="CompressedTexSubImage3D" alias="CompressedTexSubImage3DARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="imageSize" type="GLsizei"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="CompressedTexSubImage2D" alias="CompressedTexSubImage2DARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="imageSize" type="GLsizei"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="CompressedTexSubImage1D" alias="CompressedTexSubImage1DARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="imageSize" type="GLsizei"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="GetCompressedTexImage" alias="GetCompressedTexImageARB">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="img" type="GLvoid *" output="true"/>
- </function>
-</category>
-
-<category name="1.4">
- <enum name="BLEND_DST_RGB" count="1" value="0x80C8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND_SRC_RGB" count="1" value="0x80C9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND_DST_ALPHA" count="1" value="0x80CA">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND_SRC_ALPHA" count="1" value="0x80CB">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POINT_SIZE_MIN" count="1" value="0x8126">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_SIZE_MAX" count="1" value="0x8127">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_FADE_THRESHOLD_SIZE" count="1" value="0x8128">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_DISTANCE_ATTENUATION" count="3" value="0x8129">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="GENERATE_MIPMAP" count="1" value="0x8191">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="GENERATE_MIPMAP_HINT" value="0x8192"/>
- <enum name="DEPTH_COMPONENT16" value="0x81A5"/>
- <enum name="DEPTH_COMPONENT24" value="0x81A6"/>
- <enum name="DEPTH_COMPONENT32" value="0x81A7"/>
- <enum name="MIRRORED_REPEAT" value="0x8370"/>
- <enum name="FOG_COORDINATE_SOURCE" count="1" value="0x8450">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORDINATE" value="0x8451"/>
- <enum name="FRAGMENT_DEPTH" value="0x8452"/>
- <enum name="CURRENT_FOG_COORDINATE" count="1" value="0x8453">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORDINATE_ARRAY_TYPE" count="1" value="0x8454">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORDINATE_ARRAY_STRIDE" count="1" value="0x8455">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORDINATE_ARRAY_POINTER" value="0x8456"/>
- <enum name="FOG_COORDINATE_ARRAY" count="1" value="0x8457">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COLOR_SUM" value="0x8458"/>
- <enum name="CURRENT_SECONDARY_COLOR" count="4" value="0x8459">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SECONDARY_COLOR_ARRAY_SIZE" count="1" value="0x845A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SECONDARY_COLOR_ARRAY_TYPE" count="1" value="0x845B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SECONDARY_COLOR_ARRAY_STRIDE" count="1" value="0x845C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SECONDARY_COLOR_ARRAY_POINTER" value="0x845D"/>
- <enum name="SECONDARY_COLOR_ARRAY" count="1" value="0x845E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_LOD_BIAS" count="1" value="0x84FD">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_FILTER_CONTROL" value="0x8500"/>
- <enum name="TEXTURE_LOD_BIAS" count="1" value="0x8501">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="INCR_WRAP" value="0x8507"/>
- <enum name="DECR_WRAP" value="0x8508"/>
- <enum name="TEXTURE_DEPTH_SIZE" count="1" value="0x884A">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="DEPTH_TEXTURE_MODE" count="1" value="0x884B">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPARE_MODE" count="1" value="0x884C">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPARE_FUNC" count="1" value="0x884D">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="COMPARE_R_TO_TEXTURE" value="0x884E"/>
-
- <function name="BlendFuncSeparate" alias="BlendFuncSeparateEXT">
- <param name="sfactorRGB" type="GLenum"/>
- <param name="dfactorRGB" type="GLenum"/>
- <param name="sfactorAlpha" type="GLenum"/>
- <param name="dfactorAlpha" type="GLenum"/>
- </function>
-
- <function name="FogCoordf" alias="FogCoordfEXT">
- <param name="coord" type="GLfloat"/>
- </function>
-
- <function name="FogCoordfv" alias="FogCoordfvEXT">
- <param name="coord" type="const GLfloat *"/>
- </function>
-
- <function name="FogCoordd" alias="FogCoorddEXT">
- <param name="coord" type="GLdouble"/>
- </function>
-
- <function name="FogCoorddv" alias="FogCoorddvEXT">
- <param name="coord" type="const GLdouble *"/>
- </function>
-
- <function name="FogCoordPointer" alias="FogCoordPointerEXT">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- </function>
-
- <function name="MultiDrawArrays" alias="MultiDrawArraysEXT">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. -->
- <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. -->
- <param name="primcount" type="GLsizei"/>
- </function>
-
- <function name="MultiDrawElements" alias="MultiDrawElementsEXT">
- <param name="mode" type="GLenum"/>
- <param name="count" type="const GLsizei *"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid **"/>
- <param name="primcount" type="GLsizei"/>
- </function>
-
- <function name="PointParameterf" alias="PointParameterfEXT">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- </function>
-
- <function name="PointParameterfv" alias="PointParameterfvEXT">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-
- <function name="PointParameteri" alias="PointParameteriNV">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- </function>
-
- <function name="PointParameteriv" alias="PointParameterivNV">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="SecondaryColor3b" alias="SecondaryColor3bEXT">
- <param name="red" type="GLbyte"/>
- <param name="green" type="GLbyte"/>
- <param name="blue" type="GLbyte"/>
- </function>
-
- <function name="SecondaryColor3bv" alias="SecondaryColor3bvEXT">
- <param name="v" type="const GLbyte *"/>
- </function>
-
- <function name="SecondaryColor3d" alias="SecondaryColor3dEXT">
- <param name="red" type="GLdouble"/>
- <param name="green" type="GLdouble"/>
- <param name="blue" type="GLdouble"/>
- </function>
-
- <function name="SecondaryColor3dv" alias="SecondaryColor3dvEXT">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="SecondaryColor3f" alias="SecondaryColor3fEXT">
- <param name="red" type="GLfloat"/>
- <param name="green" type="GLfloat"/>
- <param name="blue" type="GLfloat"/>
- </function>
-
- <function name="SecondaryColor3fv" alias="SecondaryColor3fvEXT">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="SecondaryColor3i" alias="SecondaryColor3iEXT">
- <param name="red" type="GLint"/>
- <param name="green" type="GLint"/>
- <param name="blue" type="GLint"/>
- </function>
-
- <function name="SecondaryColor3iv" alias="SecondaryColor3ivEXT">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="SecondaryColor3s" alias="SecondaryColor3sEXT">
- <param name="red" type="GLshort"/>
- <param name="green" type="GLshort"/>
- <param name="blue" type="GLshort"/>
- </function>
-
- <function name="SecondaryColor3sv" alias="SecondaryColor3svEXT">
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="SecondaryColor3ub" alias="SecondaryColor3ubEXT">
- <param name="red" type="GLubyte"/>
- <param name="green" type="GLubyte"/>
- <param name="blue" type="GLubyte"/>
- </function>
-
- <function name="SecondaryColor3ubv" alias="SecondaryColor3ubvEXT">
- <param name="v" type="const GLubyte *"/>
- </function>
-
- <function name="SecondaryColor3ui" alias="SecondaryColor3uiEXT">
- <param name="red" type="GLuint"/>
- <param name="green" type="GLuint"/>
- <param name="blue" type="GLuint"/>
- </function>
-
- <function name="SecondaryColor3uiv" alias="SecondaryColor3uivEXT">
- <param name="v" type="const GLuint *"/>
- </function>
-
- <function name="SecondaryColor3us" alias="SecondaryColor3usEXT">
- <param name="red" type="GLushort"/>
- <param name="green" type="GLushort"/>
- <param name="blue" type="GLushort"/>
- </function>
-
- <function name="SecondaryColor3usv" alias="SecondaryColor3usvEXT">
- <param name="v" type="const GLushort *"/>
- </function>
-
- <function name="SecondaryColorPointer" alias="SecondaryColorPointerEXT">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- </function>
-
- <function name="WindowPos2d" alias="WindowPos2dMESA">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- </function>
-
- <function name="WindowPos2dv" alias="WindowPos2dvMESA">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="WindowPos2f" alias="WindowPos2fMESA">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="WindowPos2fv" alias="WindowPos2fvMESA">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="WindowPos2i" alias="WindowPos2iMESA">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- </function>
-
- <function name="WindowPos2iv" alias="WindowPos2ivMESA">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="WindowPos2s" alias="WindowPos2sMESA">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- </function>
-
- <function name="WindowPos2sv" alias="WindowPos2svMESA">
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="WindowPos3d" alias="WindowPos3dMESA">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- </function>
-
- <function name="WindowPos3dv" alias="WindowPos3dvMESA">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="WindowPos3f" alias="WindowPos3fMESA">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="WindowPos3fv" alias="WindowPos3fvMESA">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="WindowPos3i" alias="WindowPos3iMESA">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- </function>
-
- <function name="WindowPos3iv" alias="WindowPos3ivMESA">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="WindowPos3s" alias="WindowPos3sMESA">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- </function>
-
- <function name="WindowPos3sv" alias="WindowPos3svMESA">
- <param name="v" type="const GLshort *"/>
- </function>
-</category>
-
-<category name="1.5">
- <enum name="BUFFER_SIZE" value="0x8764"/>
- <enum name="BUFFER_USAGE" value="0x8765"/>
- <enum name="QUERY_COUNTER_BITS" value="0x8864"/>
- <enum name="CURRENT_QUERY" value="0x8865"/>
- <enum name="QUERY_RESULT" value="0x8866"/>
- <enum name="QUERY_RESULT_AVAILABLE" value="0x8867"/>
- <enum name="ARRAY_BUFFER" value="0x8892"/>
- <enum name="ELEMENT_ARRAY_BUFFER" value="0x8893"/>
- <enum name="ARRAY_BUFFER_BINDING" value="0x8894"/>
- <enum name="ELEMENT_ARRAY_BUFFER_BINDING" value="0x8895"/>
- <enum name="VERTEX_ARRAY_BUFFER_BINDING" value="0x8896"/>
- <enum name="NORMAL_ARRAY_BUFFER_BINDING" value="0x8897"/>
- <enum name="COLOR_ARRAY_BUFFER_BINDING" value="0x8898"/>
- <enum name="INDEX_ARRAY_BUFFER_BINDING" value="0x8899"/>
- <enum name="TEXTURE_COORD_ARRAY_BUFFER_BINDING" value="0x889A"/>
- <enum name="EDGE_FLAG_ARRAY_BUFFER_BINDING" value="0x889B"/>
- <enum name="SECONDARY_COLOR_ARRAY_BUFFER_BINDING" value="0x889C"/>
- <enum name="FOG_COORDINATE_ARRAY_BUFFER_BINDING" value="0x889D"/>
- <enum name="WEIGHT_ARRAY_BUFFER_BINDING" value="0x889E"/>
- <enum name="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING" value="0x889F"/>
- <enum name="READ_ONLY" value="0x88B8"/>
- <enum name="WRITE_ONLY" value="0x88B9"/>
- <enum name="READ_WRITE" value="0x88BA"/>
- <enum name="BUFFER_ACCESS" value="0x88BB"/>
- <enum name="BUFFER_MAPPED" value="0x88BC"/>
- <enum name="BUFFER_MAP_POINTER" value="0x88BD"/>
- <enum name="STREAM_DRAW" value="0x88E0"/>
- <enum name="STREAM_READ" value="0x88E1"/>
- <enum name="STREAM_COPY" value="0x88E2"/>
- <enum name="STATIC_DRAW" value="0x88E4"/>
- <enum name="STATIC_READ" value="0x88E5"/>
- <enum name="STATIC_COPY" value="0x88E6"/>
- <enum name="DYNAMIC_DRAW" value="0x88E8"/>
- <enum name="DYNAMIC_READ" value="0x88E9"/>
- <enum name="DYNAMIC_COPY" value="0x88EA"/>
- <enum name="SAMPLES_PASSED" count="1" value="0x8914"/>
- <enum name="FOG_COORD_SRC" value="0x8450">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORD" value="0x8451"/>
- <enum name="CURRENT_FOG_COORD" count="1" value="0x8453">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORD_ARRAY_TYPE" count="1" value="0x8454">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORD_ARRAY_STRIDE" count="1" value="0x8455">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORD_ARRAY_POINTER" value="0x8456"/>
- <enum name="FOG_COORD_ARRAY" count="1" value="0x8457">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="FOG_COORD_ARRAY_BUFFER_BINDING" value="0x889D"/>
- <enum name="SRC0_RGB" value="0x8580"/>
- <enum name="SRC1_RGB" value="0x8581"/>
- <enum name="SRC2_RGB" value="0x8582"/>
- <enum name="SRC0_ALPHA" value="0x8588"/>
- <enum name="SRC1_ALPHA" value="0x8589"/>
- <enum name="SRC2_ALPHA" value="0x858A"/>
-
- <type name="intptr" size="4" glx_name="CARD32"/>
- <type name="sizeiptr" size="4" unsigned="true" glx_name="CARD32"/>
-
- <function name="BindBuffer" alias="BindBufferARB">
- <param name="target" type="GLenum"/>
- <param name="buffer" type="GLuint"/>
- </function>
-
- <function name="BufferData" alias="BufferDataARB">
- <param name="target" type="GLenum"/>
- <param name="size" type="GLsizeiptr"/>
- <param name="data" type="const GLvoid *"/>
- <param name="usage" type="GLenum"/>
- </function>
-
- <function name="BufferSubData" alias="BufferSubDataARB">
- <param name="target" type="GLenum"/>
- <param name="offset" type="GLintptr"/>
- <param name="size" type="GLsizeiptr"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="DeleteBuffers" alias="DeleteBuffersARB">
- <param name="n" type="GLsizei"/>
- <param name="buffer" type="const GLuint *"/>
- </function>
-
- <function name="GenBuffers" alias="GenBuffersARB">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="buffer" type="GLuint *" output="true" count="n"/>
- </function>
-
- <function name="GetBufferParameteriv" alias="GetBufferParameterivARB">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- </function>
-
- <function name="GetBufferPointerv" alias="GetBufferPointervARB">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLvoid **" output="true"/>
- </function>
-
- <function name="GetBufferSubData" alias="GetBufferSubDataARB">
- <param name="target" type="GLenum"/>
- <param name="offset" type="GLintptr"/>
- <param name="size" type="GLsizeiptr"/>
- <param name="data" type="GLvoid *" output="true"/>
- </function>
-
- <function name="IsBuffer" alias="IsBufferARB">
- <param name="buffer" type="GLuint"/>
- <return type="GLboolean"/>
- </function>
-
- <function name="MapBuffer" alias="MapBufferARB">
- <param name="target" type="GLenum"/>
- <param name="access" type="GLenum"/>
- <return type="GLvoid *"/>
- </function>
-
- <function name="UnmapBuffer" alias="UnmapBufferARB">
- <param name="target" type="GLenum"/>
- <return type="GLboolean"/>
- </function>
-
- <function name="GenQueries" alias="GenQueriesARB">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="ids" type="GLuint *" output="true" count="n"/>
- </function>
-
- <function name="DeleteQueries" alias="DeleteQueriesARB">
- <param name="n" type="GLsizei"/>
- <param name="ids" type="const GLuint *"/>
- </function>
-
- <function name="IsQuery" alias="IsQueryARB">
- <param name="id" type="GLuint"/>
- <return type="GLboolean"/>
- </function>
-
- <function name="BeginQuery" alias="BeginQueryARB">
- <param name="target" type="GLenum"/>
- <param name="id" type="GLuint"/>
- </function>
-
- <function name="EndQuery" alias="EndQueryARB">
- <param name="target" type="GLenum"/>
- </function>
-
- <function name="GetQueryiv" alias="GetQueryivARB">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- </function>
-
- <function name="GetQueryObjectiv" alias="GetQueryObjectivARB">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- </function>
-
- <function name="GetQueryObjectuiv" alias="GetQueryObjectuivARB">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLuint *" output="true" variable_param="pname"/>
- </function>
-</category>
-
-
-<category name="2.0">
- <!-- XXX this section is very much incomplete!!! -->
- <!-- These function offsets may change too!!! -->
-
- <enum name="POINT_SPRITE_COORD_ORIGIN" count="1" value="0x8CA0">
- <size name="PointParameterfvEXT"/>
- <size name="PointParameterivNV"/>
- </enum>
-
- <function name="StencilFuncSeparate" offset="813">
- <param name="face" type="GLenum"/>
- <param name="func" type="GLenum"/>
- <param name="ref" type="GLint"/>
- <param name="mask" type="GLuint"/>
- </function>
-
- <function name="StencilOpSeparate" offset="814">
- <param name="face" type="GLenum"/>
- <param name="fail" type="GLenum"/>
- <param name="zfail" type="GLenum"/>
- <param name="zpass" type="GLenum"/>
- </function>
-
- <function name="StencilMaskSeparate" offset="815">
- <param name="face" type="GLenum"/>
- <param name="mask" type="GLuint"/>
- </function>
-</category>
-
-
-<!-- ARB extensions sorted by extension number. -->
-
-<category name="GL_ARB_multitexture" number="1">
- <enum name="TEXTURE0_ARB" value="0x84C0"/>
- <enum name="TEXTURE1_ARB" value="0x84C1"/>
- <enum name="TEXTURE2_ARB" value="0x84C2"/>
- <enum name="TEXTURE3_ARB" value="0x84C3"/>
- <enum name="TEXTURE4_ARB" value="0x84C4"/>
- <enum name="TEXTURE5_ARB" value="0x84C5"/>
- <enum name="TEXTURE6_ARB" value="0x84C6"/>
- <enum name="TEXTURE7_ARB" value="0x84C7"/>
- <enum name="TEXTURE8_ARB" value="0x84C8"/>
- <enum name="TEXTURE9_ARB" value="0x84C9"/>
- <enum name="TEXTURE10_ARB" value="0x84CA"/>
- <enum name="TEXTURE11_ARB" value="0x84CB"/>
- <enum name="TEXTURE12_ARB" value="0x84CC"/>
- <enum name="TEXTURE13_ARB" value="0x84CD"/>
- <enum name="TEXTURE14_ARB" value="0x84CE"/>
- <enum name="TEXTURE15_ARB" value="0x84CF"/>
- <enum name="TEXTURE16_ARB" value="0x84D0"/>
- <enum name="TEXTURE17_ARB" value="0x84D1"/>
- <enum name="TEXTURE18_ARB" value="0x84D2"/>
- <enum name="TEXTURE19_ARB" value="0x84D3"/>
- <enum name="TEXTURE20_ARB" value="0x84D4"/>
- <enum name="TEXTURE21_ARB" value="0x84D5"/>
- <enum name="TEXTURE22_ARB" value="0x84D6"/>
- <enum name="TEXTURE23_ARB" value="0x84D7"/>
- <enum name="TEXTURE24_ARB" value="0x84D8"/>
- <enum name="TEXTURE25_ARB" value="0x84D9"/>
- <enum name="TEXTURE26_ARB" value="0x84DA"/>
- <enum name="TEXTURE27_ARB" value="0x84DB"/>
- <enum name="TEXTURE28_ARB" value="0x84DC"/>
- <enum name="TEXTURE29_ARB" value="0x84DD"/>
- <enum name="TEXTURE30_ARB" value="0x84DE"/>
- <enum name="TEXTURE31_ARB" value="0x84DF"/>
- <enum name="ACTIVE_TEXTURE_ARB" count="1" value="0x84E0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CLIENT_ACTIVE_TEXTURE_ARB" count="1" value="0x84E1">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_UNITS_ARB" count="1" value="0x84E2">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="ActiveTextureARB" offset="374">
- <param name="texture" type="GLenum"/>
- <glx rop="197"/>
- </function>
-
- <function name="ClientActiveTextureARB" offset="375">
- <param name="texture" type="GLenum"/>
- <glx handcode="true"/>
- </function>
-
- <function name="MultiTexCoord1dARB" offset="376" vectorequiv="MultiTexCoord1dvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord1dvARB" offset="377">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *" count="1"/>
- <glx rop="198"/>
- </function>
-
- <function name="MultiTexCoord1fARB" offset="378" vectorequiv="MultiTexCoord1fvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord1fvARB" offset="379">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *" count="1"/>
- <glx rop="199"/>
- </function>
-
- <function name="MultiTexCoord1iARB" offset="380" vectorequiv="MultiTexCoord1ivARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord1ivARB" offset="381">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *" count="1"/>
- <glx rop="200"/>
- </function>
-
- <function name="MultiTexCoord1sARB" offset="382" vectorequiv="MultiTexCoord1svARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord1svARB" offset="383">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *" count="1"/>
- <glx rop="201"/>
- </function>
-
- <function name="MultiTexCoord2dARB" offset="384" vectorequiv="MultiTexCoord2dvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord2dvARB" offset="385">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *" count="2"/>
- <glx rop="202"/>
- </function>
-
- <function name="MultiTexCoord2fARB" offset="386" vectorequiv="MultiTexCoord2fvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord2fvARB" offset="387">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *" count="2"/>
- <glx rop="203"/>
- </function>
-
- <function name="MultiTexCoord2iARB" offset="388" vectorequiv="MultiTexCoord2ivARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord2ivARB" offset="389">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *" count="2"/>
- <glx rop="204"/>
- </function>
-
- <function name="MultiTexCoord2sARB" offset="390" vectorequiv="MultiTexCoord2svARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord2svARB" offset="391">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *" count="2"/>
- <glx rop="205"/>
- </function>
-
- <function name="MultiTexCoord3dARB" offset="392" vectorequiv="MultiTexCoord3dvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- <param name="r" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord3dvARB" offset="393">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="206"/>
- </function>
-
- <function name="MultiTexCoord3fARB" offset="394" vectorequiv="MultiTexCoord3fvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord3fvARB" offset="395">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="207"/>
- </function>
-
- <function name="MultiTexCoord3iARB" offset="396" vectorequiv="MultiTexCoord3ivARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- <param name="r" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord3ivARB" offset="397">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="208"/>
- </function>
-
- <function name="MultiTexCoord3sARB" offset="398" vectorequiv="MultiTexCoord3svARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- <param name="r" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord3svARB" offset="399">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="209"/>
- </function>
-
- <function name="MultiTexCoord4dARB" offset="400" vectorequiv="MultiTexCoord4dvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLdouble"/>
- <param name="t" type="GLdouble"/>
- <param name="r" type="GLdouble"/>
- <param name="q" type="GLdouble"/>
- </function>
-
- <function name="MultiTexCoord4dvARB" offset="401">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="210"/>
- </function>
-
- <function name="MultiTexCoord4fARB" offset="402" vectorequiv="MultiTexCoord4fvARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="q" type="GLfloat"/>
- </function>
-
- <function name="MultiTexCoord4fvARB" offset="403">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="211"/>
- </function>
-
- <function name="MultiTexCoord4iARB" offset="404" vectorequiv="MultiTexCoord4ivARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLint"/>
- <param name="t" type="GLint"/>
- <param name="r" type="GLint"/>
- <param name="q" type="GLint"/>
- </function>
-
- <function name="MultiTexCoord4ivARB" offset="405">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="212"/>
- </function>
-
- <function name="MultiTexCoord4sARB" offset="406" vectorequiv="MultiTexCoord4svARB">
- <param name="target" type="GLenum"/>
- <param name="s" type="GLshort"/>
- <param name="t" type="GLshort"/>
- <param name="r" type="GLshort"/>
- <param name="q" type="GLshort"/>
- </function>
-
- <function name="MultiTexCoord4svARB" offset="407">
- <param name="target" type="GLenum"/>
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="213"/>
- </function>
-</category>
-
-<!-- ARB extension number 2 is a GLX extension. -->
-
-<category name="GL_ARB_transpose_matrix" number="3">
- <enum name="TRANSPOSE_MODELVIEW_MATRIX_ARB" value="0x84E3"/>
- <enum name="TRANSPOSE_PROJECTION_MATRIX_ARB" value="0x84E4"/>
- <enum name="TRANSPOSE_TEXTURE_MATRIX_ARB" value="0x84E5"/>
- <enum name="TRANSPOSE_COLOR_MATRIX_ARB" value="0x84E6"/>
-
- <function name="LoadTransposeMatrixfARB" offset="408">
- <param name="m" type="const GLfloat *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="LoadTransposeMatrixdARB" offset="409">
- <param name="m" type="const GLdouble *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="MultTransposeMatrixfARB" offset="410">
- <param name="m" type="const GLfloat *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="MultTransposeMatrixdARB" offset="411">
- <param name="m" type="const GLdouble *"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<!-- ARB extension number 4 is a WGL extension. -->
-
-<category name="GL_ARB_multisample" number="5">
- <enum name="MULTISAMPLE_ARB" count="1" value="0x809D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_ALPHA_TO_COVERAGE_ARB" count="1" value="0x809E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_ALPHA_TO_ONE_ARB" count="1" value="0x809F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_COVERAGE_ARB" count="1" value="0x80A0">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_BUFFERS_ARB" count="1" value="0x80A8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLES_ARB" count="1" value="0x80A9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_COVERAGE_VALUE_ARB" count="1" value="0x80AA">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="SAMPLE_COVERAGE_INVERT_ARB" count="1" value="0x80AB">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MULTISAMPLE_BIT_ARB" value="0x20000000"/>
-
- <function name="SampleCoverageARB" offset="412">
- <param name="value" type="GLclampf"/>
- <param name="invert" type="GLboolean"/>
- <glx rop="229"/>
- </function>
-</category>
-
-<category name="GL_ARB_texture_env_add" number="6">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_ARB_texture_cube_map" number="7">
- <enum name="NORMAL_MAP_ARB" value="0x8511"/>
- <enum name="REFLECTION_MAP_ARB" value="0x8512"/>
- <enum name="TEXTURE_CUBE_MAP_ARB" count="1" value="0x8513">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_CUBE_MAP_ARB" count="1" value="0x8514">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_CUBE_MAP_POSITIVE_X_ARB" value="0x8515"/>
- <enum name="TEXTURE_CUBE_MAP_NEGATIVE_X_ARB" value="0x8516"/>
- <enum name="TEXTURE_CUBE_MAP_POSITIVE_Y_ARB" value="0x8517"/>
- <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB" value="0x8518"/>
- <enum name="TEXTURE_CUBE_MAP_POSITIVE_Z_ARB" value="0x8519"/>
- <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB" value="0x851A"/>
- <enum name="PROXY_TEXTURE_CUBE_MAP_ARB" value="0x851B"/>
- <enum name="MAX_CUBE_MAP_TEXTURE_SIZE_ARB" count="1" value="0x851C">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<!-- ARB extension number 8 is a WGL extension. -->
-<!-- ARB extension number 9 is a WGL extension. -->
-<!-- ARB extension number 10 is a WGL extension. -->
-<!-- ARB extension number 11 is a WGL extension. -->
-
-<category name="GL_ARB_texture_compression" number="12">
- <enum name="COMPRESSED_ALPHA_ARB" value="0x84E9"/>
- <enum name="COMPRESSED_LUMINANCE_ARB" value="0x84EA"/>
- <enum name="COMPRESSED_LUMINANCE_ALPHA_ARB" value="0x84EB"/>
- <enum name="COMPRESSED_INTENSITY_ARB" value="0x84EC"/>
- <enum name="COMPRESSED_RGB_ARB" value="0x84ED"/>
- <enum name="COMPRESSED_RGBA_ARB" value="0x84EE"/>
- <enum name="TEXTURE_COMPRESSION_HINT_ARB" count="1" value="0x84EF">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPRESSED_IMAGE_SIZE_ARB" count="1" value="0x86A0">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPRESSED_ARB" count="1" value="0x86A1">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="NUM_TEXTURE_COMPRESSED_FORMATS_ARB" count="1" value="0x86A2">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPRESSED_FORMATS_ARB" value="0x86A3"/>
-
- <function name="CompressedTexImage3DARB" offset="554">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="imageSize" type="GLsizei" counter="true"/>
- <param name="data" type="const GLvoid *" count="imageSize"/>
- <glx rop="216" handcode="client"/>
- </function>
-
- <function name="CompressedTexImage2DARB" offset="555">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="imageSize" type="GLsizei" counter="true"/>
- <param name="data" type="const GLvoid *" count="imageSize"/>
- <glx rop="215" handcode="client"/>
- </function>
-
- <function name="CompressedTexImage1DARB" offset="556">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="imageSize" type="GLsizei" counter="true"/>
- <param name="data" type="const GLvoid *" count="imageSize"/>
- <glx rop="214" handcode="client"/>
- </function>
-
- <function name="CompressedTexSubImage3DARB" offset="557">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="imageSize" type="GLsizei" counter="true"/>
- <param name="data" type="const GLvoid *" count="imageSize"/>
- <glx rop="219" handcode="client"/>
- </function>
-
- <function name="CompressedTexSubImage2DARB" offset="558">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="imageSize" type="GLsizei" counter="true"/>
- <param name="data" type="const GLvoid *" count="imageSize"/>
- <glx rop="218" handcode="client"/>
- </function>
-
- <function name="CompressedTexSubImage1DARB" offset="559">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="imageSize" type="GLsizei" counter="true"/>
- <param name="data" type="const GLvoid *" count="imageSize"/>
- <glx rop="217" handcode="client"/>
- </function>
-
- <function name="GetCompressedTexImageARB" offset="560">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="img" type="GLvoid *" output="true"/>
-
- <!-- This has to be hand coded because the image size is in the
- "wrong" place. Technically, this should be a
- 'always_array="true"' case. The size field in the reply would
- be at offset 12. However, the size is actually at offset 16.
- This is where the 'width' is in a GetTexImage reply. -->
- <glx sop="160" handcode="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_texture_border_clamp" number="13">
- <enum name="CLAMP_TO_BORDER_ARB" value="0x812D"/>
-</category>
-
-<category name="GL_ARB_point_parameters" number="14">
- <enum name="POINT_SIZE_MIN_ARB" count="1" value="0x8126">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_SIZE_MAX_ARB" count="1" value="0x8127">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_FADE_THRESHOLD_SIZE_ARB" count="1" value="0x8128">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_DISTANCE_ATTENUATION_ARB" count="3" value="0x8129">
- <size name="PointParameterfvEXT"/>
- </enum>
-
- <function name="PointParameterfARB" alias="PointParameterfEXT">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="2065"/>
- </function>
-
- <function name="PointParameterfvARB" alias="PointParameterfvEXT">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="2066"/>
- </function>
-</category>
-
-<category name="GL_ARB_vertex_blend" number="15">
- <enum name="MAX_VERTEX_UNITS_ARB" count="1" value="0x86A4">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACTIVE_VERTEX_UNITS_ARB" count="1" value="0x86A5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="WEIGHT_SUM_UNITY_ARB" count="1" value="0x86A6">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_BLEND_ARB" count="1" value="0x86A7">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_WEIGHT_ARB" count="1" value="0x86A8">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="WEIGHT_ARRAY_TYPE_ARB" count="1" value="0x86A9">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="WEIGHT_ARRAY_STRIDE_ARB" count="1" value="0x86AA">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="WEIGHT_ARRAY_SIZE_ARB" count="1" value="0x86AB">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="WEIGHT_ARRAY_POINTER_ARB" value="0x86AC"/>
- <enum name="WEIGHT_ARRAY_ARB" count="1" value="0x86AD">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW0_ARB" count="16" value="0x1700">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW1_ARB" count="16" value="0x850A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW2_ARB" count="16" value="0x8722">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW3_ARB" count="16" value="0x8723">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW4_ARB" count="16" value="0x8724">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW5_ARB" count="16" value="0x8725">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW6_ARB" count="16" value="0x8726">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW7_ARB" count="16" value="0x8727">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW8_ARB" count="16" value="0x8728">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW9_ARB" count="16" value="0x8729">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW10_ARB" count="16" value="0x872A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW11_ARB" count="16" value="0x872B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW12_ARB" count="16" value="0x872C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW13_ARB" count="16" value="0x872D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW14_ARB" count="16" value="0x872E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW15_ARB" count="16" value="0x872F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW16_ARB" count="16" value="0x8730">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW17_ARB" count="16" value="0x8731">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW18_ARB" count="16" value="0x8732">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW19_ARB" count="16" value="0x8733">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW20_ARB" count="16" value="0x8734">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW21_ARB" count="16" value="0x8735">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW22_ARB" count="16" value="0x8736">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW23_ARB" count="16" value="0x8737">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW24_ARB" count="16" value="0x8738">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW25_ARB" count="16" value="0x8739">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW26_ARB" count="16" value="0x873A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW27_ARB" count="16" value="0x873B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW28_ARB" count="16" value="0x873C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW29_ARB" count="16" value="0x873D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW30_ARB" count="16" value="0x873E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MODELVIEW31_ARB" count="16" value="0x873F">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="WeightbvARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLbyte *"/>
- </function>
-
- <function name="WeightsvARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLshort *"/>
- </function>
-
- <function name="WeightivARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLint *"/>
- </function>
-
- <function name="WeightfvARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLfloat *"/>
- </function>
-
- <function name="WeightdvARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLdouble *"/>
- </function>
-
- <function name="WeightubvARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLubyte *"/>
- </function>
-
- <function name="WeightusvARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLushort *"/>
- </function>
-
- <function name="WeightuivARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="weights" type="const GLuint *"/>
- </function>
-
- <function name="WeightPointerARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="VertexBlendARB" offset="?">
- <param name="count" type="GLint"/>
- </function>
-</category>
-
-<category name="GL_ARB_matrix_palette" number="16">
- <enum name="MATRIX_PALETTE_ARB" count="1" value="0x8840">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_MATRIX_PALETTE_STACK_DEPTH_ARB" count="1" value="0x8841">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_PALETTE_MATRICES_ARB" count="1" value="0x8842">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_PALETTE_MATRIX_ARB" count="1" value="0x8843">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX_INDEX_ARRAY_ARB" count="1" value="0x8844">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_MATRIX_INDEX_ARB" count="1" value="0x8845">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX_INDEX_ARRAY_SIZE_ARB" count="1" value="0x8846">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX_INDEX_ARRAY_TYPE_ARB" count="1" value="0x8847">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX_INDEX_ARRAY_STRIDE_ARB" count="1" value="0x8848">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX_INDEX_ARRAY_POINTER_ARB" value="0x8849"/>
-
- <function name="CurrentPaletteMatrixARB" offset="?">
- <param name="index" type="GLint"/>
- <glx ignore="true" rop="4329"/>
- </function>
-
- <function name="MatrixIndexubvARB" offset="?">
- <param name="size" type="GLint" counter="true"/>
- <param name="indices" type="const GLubyte *" count="size"/>
- <glx ignore="true" rop="4326"/>
- </function>
-
- <function name="MatrixIndexusvARB" offset="?">
- <param name="size" type="GLint" counter="true"/>
- <param name="indices" type="const GLushort *" count="size"/>
- <glx ignore="true" rop="4327"/>
- </function>
-
- <function name="MatrixIndexuivARB" offset="?">
- <param name="size" type="GLint" counter="true"/>
- <param name="indices" type="const GLuint *" count="size"/>
- <glx ignore="true" rop="4328"/>
- </function>
-
- <function name="MatrixIndexPointerARB" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_texture_env_combine" number="17">
- <enum name="COMBINE_ARB" value="0x8570"/>
- <enum name="COMBINE_RGB_ARB" value="0x8571"/>
- <enum name="COMBINE_ALPHA_ARB" value="0x8572"/>
- <enum name="SOURCE0_RGB_ARB" value="0x8580"/>
- <enum name="SOURCE1_RGB_ARB" value="0x8581"/>
- <enum name="SOURCE2_RGB_ARB" value="0x8582"/>
- <enum name="SOURCE0_ALPHA_ARB" value="0x8588"/>
- <enum name="SOURCE1_ALPHA_ARB" value="0x8589"/>
- <enum name="SOURCE2_ALPHA_ARB" value="0x858A"/>
- <enum name="OPERAND0_RGB_ARB" value="0x8590"/>
- <enum name="OPERAND1_RGB_ARB" value="0x8591"/>
- <enum name="OPERAND2_RGB_ARB" value="0x8592"/>
- <enum name="OPERAND0_ALPHA_ARB" value="0x8598"/>
- <enum name="OPERAND1_ALPHA_ARB" value="0x8599"/>
- <enum name="OPERAND2_ALPHA_ARB" value="0x859A"/>
- <enum name="RGB_SCALE_ARB" value="0x8573"/>
- <enum name="ADD_SIGNED_ARB" value="0x8574"/>
- <enum name="INTERPOLATE_ARB" value="0x8575"/>
- <enum name="SUBTRACT_ARB" value="0x84E7"/>
- <enum name="CONSTANT_ARB" value="0x8576"/>
- <enum name="PRIMARY_COLOR_ARB" value="0x8577"/>
- <enum name="PREVIOUS_ARB" value="0x8578"/>
-</category>
-
-<category name="GL_ARB_texture_env_crossbar" number="18">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_ARB_texture_env_dot3" number="19">
- <enum name="DOT3_RGB_ARB" value="0x86AE"/>
- <enum name="DOT3_RGBA_ARB" value="0x86AF"/>
-</category>
-
-<!-- ARB extension number 20 is a WGL extension. -->
-
-<category name="GL_ARB_texture_mirrored_repeat" number="21">
- <enum name="MIRRORED_REPEAT_ARB" value="0x8370"/>
-</category>
-
-<category name="GL_ARB_depth_texture" number="22">
- <enum name="DEPTH_COMPONENT16_ARB" value="0x81A5"/>
- <enum name="DEPTH_COMPONENT24_ARB" value="0x81A6"/>
- <enum name="DEPTH_COMPONENT32_ARB" value="0x81A7"/>
- <enum name="TEXTURE_DEPTH_SIZE_ARB" count="1" value="0x884A">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="DEPTH_TEXTURE_MODE_ARB" count="1" value="0x884B">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_ARB_shadow" number="23">
- <enum name="TEXTURE_COMPARE_MODE_ARB" count="1" value="0x884C">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPARE_FUNC_ARB" count="1" value="0x884D">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="COMPARE_R_TO_TEXTURE_ARB" value="0x884E"/>
-</category>
-
-<category name="GL_ARB_shadow_ambient" number="24">
- <enum name="TEXTURE_COMPARE_FAIL_VALUE_ARB" count="1" value="0x80BF">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_ARB_window_pos" number="25">
- <function name="WindowPos2dARB" alias="WindowPos2dMESA">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- </function>
-
- <function name="WindowPos2fARB" alias="WindowPos2fMESA">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="WindowPos2iARB" alias="WindowPos2iMESA">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- </function>
-
- <function name="WindowPos2sARB" alias="WindowPos2sMESA">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- </function>
-
- <function name="WindowPos2dvARB" alias="WindowPos2dvMESA">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="WindowPos2fvARB" alias="WindowPos2fvMESA">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="WindowPos2ivARB" alias="WindowPos2ivMESA">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="WindowPos2svARB" alias="WindowPos2svMESA">
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="WindowPos3dARB" alias="WindowPos3dMESA">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- </function>
-
- <function name="WindowPos3fARB" alias="WindowPos3fMESA">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="WindowPos3iARB" alias="WindowPos3iMESA">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- </function>
-
- <function name="WindowPos3sARB" alias="WindowPos3sMESA">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- </function>
-
- <function name="WindowPos3dvARB" alias="WindowPos3dvMESA">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="WindowPos3fvARB" alias="WindowPos3fvMESA">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="WindowPos3ivARB" alias="WindowPos3ivMESA">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="WindowPos3svARB" alias="WindowPos3svMESA">
- <param name="v" type="const GLshort *"/>
- </function>
-</category>
-
-<category name="GL_ARB_vertex_program" number="26">
- <enum name="COLOR_SUM_ARB" count="1" value="0x8458">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_PROGRAM_ARB" count="1" value="0x8620">
- <size name="GetVertexAttribdvARB" mode="get"/>
- <size name="GetVertexAttribfvARB" mode="get"/>
- <size name="GetVertexAttribivARB" mode="get"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ATTRIB_ARRAY_ENABLED_ARB" count="1" value="0x8622">
- <size name="GetVertexAttribdvARB" mode="get"/>
- <size name="GetVertexAttribfvARB" mode="get"/>
- <size name="GetVertexAttribivARB" mode="get"/>
- </enum>
- <enum name="VERTEX_ATTRIB_ARRAY_SIZE_ARB" count="1" value="0x8623">
- <size name="GetVertexAttribdvARB" mode="get"/>
- <size name="GetVertexAttribfvARB" mode="get"/>
- <size name="GetVertexAttribivARB" mode="get"/>
- </enum>
- <enum name="VERTEX_ATTRIB_ARRAY_STRIDE_ARB" count="1" value="0x8624">
- <size name="GetVertexAttribdvARB" mode="get"/>
- <size name="GetVertexAttribfvARB" mode="get"/>
- <size name="GetVertexAttribivARB" mode="get"/>
- </enum>
- <enum name="VERTEX_ATTRIB_ARRAY_TYPE_ARB" count="1" value="0x8625">
- <size name="GetVertexAttribdvARB" mode="get"/>
- <size name="GetVertexAttribfvARB" mode="get"/>
- <size name="GetVertexAttribivARB" mode="get"/>
- </enum>
- <enum name="CURRENT_VERTEX_ATTRIB_ARB" count="1" value="0x8626">
- <size name="GetVertexAttribdvARB" mode="get"/>
- <size name="GetVertexAttribfvARB" mode="get"/>
- <size name="GetVertexAttribivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_LENGTH_ARB" count="1" value="0x8627">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_STRING_ARB" value="0x8628"/>
- <enum name="MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB" count="1" value="0x862E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_MATRICES_ARB" count="1" value="0x862F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_MATRIX_STACK_DEPTH_ARB" count="1" value="0x8640">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="CURRENT_MATRIX_ARB" count="16" value="0x8641">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_PROGRAM_POINT_SIZE_ARB" count="1" value="0x8642">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_PROGRAM_TWO_SIDE_ARB" count="1" value="0x8643">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ATTRIB_ARRAY_POINTER_ARB" value="0x8645"/>
- <enum name="PROGRAM_ERROR_POSITION_ARB" count="1" value="0x864B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROGRAM_BINDING_ARB" count="1" value="0x8677">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_VERTEX_ATTRIBS_ARB" count="1" value="0x8869">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB" value="0x886A"/>
- <enum name="PROGRAM_ERROR_STRING_ARB" value="0x8874"/>
- <enum name="PROGRAM_FORMAT_ASCII_ARB" value="0x8875"/>
- <enum name="PROGRAM_FORMAT_ARB" count="1" value="0x8876">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_INSTRUCTIONS_ARB" count="1" value="0x88A0">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_INSTRUCTIONS_ARB" count="1" value="0x88A1">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_INSTRUCTIONS_ARB" count="1" value="0x88A2">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB" count="1" value="0x88A3">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_TEMPORARIES_ARB" count="1" value="0x88A4">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_TEMPORARIES_ARB" count="1" value="0x88A5">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_TEMPORARIES_ARB" count="1" value="0x88A6">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_TEMPORARIES_ARB" count="1" value="0x88A7">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_PARAMETERS_ARB" count="1" value="0x88A8">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_PARAMETERS_ARB" count="1" value="0x88A9">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_PARAMETERS_ARB" count="1" value="0x88AA">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_PARAMETERS_ARB" count="1" value="0x88AB">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_ATTRIBS_ARB" count="1" value="0x88AC">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_ATTRIBS_ARB" count="1" value="0x88AD">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_ATTRIBS_ARB" count="1" value="0x88AE">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_ATTRIBS_ARB" count="1" value="0x88AF">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_ADDRESS_REGISTERS_ARB" count="1" value="0x88B0">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_ADDRESS_REGISTERS_ARB" count="1" value="0x88B1">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB" count="1" value="0x88B2">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB" count="1" value="0x88B3">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_LOCAL_PARAMETERS_ARB" count="1" value="0x88B4">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_ENV_PARAMETERS_ARB" count="1" value="0x88B5">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_UNDER_NATIVE_LIMITS_ARB" count="1" value="0x88B6">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="TRANSPOSE_CURRENT_MATRIX_ARB" count="16" value="0x88B7">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MATRIX0_ARB" value="0x88C0"/>
- <enum name="MATRIX1_ARB" value="0x88C1"/>
- <enum name="MATRIX2_ARB" value="0x88C2"/>
- <enum name="MATRIX3_ARB" value="0x88C3"/>
- <enum name="MATRIX4_ARB" value="0x88C4"/>
- <enum name="MATRIX5_ARB" value="0x88C5"/>
- <enum name="MATRIX6_ARB" value="0x88C6"/>
- <enum name="MATRIX7_ARB" value="0x88C7"/>
- <enum name="MATRIX8_ARB" value="0x88C8"/>
- <enum name="MATRIX9_ARB" value="0x88C9"/>
- <enum name="MATRIX10_ARB" value="0x88CA"/>
- <enum name="MATRIX11_ARB" value="0x88CB"/>
- <enum name="MATRIX12_ARB" value="0x88CC"/>
- <enum name="MATRIX13_ARB" value="0x88CD"/>
- <enum name="MATRIX14_ARB" value="0x88CE"/>
- <enum name="MATRIX15_ARB" value="0x88CF"/>
- <enum name="MATRIX16_ARB" value="0x88D0"/>
- <enum name="MATRIX17_ARB" value="0x88D1"/>
- <enum name="MATRIX18_ARB" value="0x88D2"/>
- <enum name="MATRIX19_ARB" value="0x88D3"/>
- <enum name="MATRIX20_ARB" value="0x88D4"/>
- <enum name="MATRIX21_ARB" value="0x88D5"/>
- <enum name="MATRIX22_ARB" value="0x88D6"/>
- <enum name="MATRIX23_ARB" value="0x88D7"/>
- <enum name="MATRIX24_ARB" value="0x88D8"/>
- <enum name="MATRIX25_ARB" value="0x88D9"/>
- <enum name="MATRIX26_ARB" value="0x88DA"/>
- <enum name="MATRIX27_ARB" value="0x88DB"/>
- <enum name="MATRIX28_ARB" value="0x88DC"/>
- <enum name="MATRIX29_ARB" value="0x88DD"/>
- <enum name="MATRIX30_ARB" value="0x88DE"/>
- <enum name="MATRIX31_ARB" value="0x88DF"/>
-
- <function name="GetVertexAttribdvARB" offset="588">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLdouble *" output="true" variable_param="pname"/>
- <glx handcode="client" vendorpriv="1301"/>
- </function>
-
- <function name="GetVertexAttribfvARB" offset="589">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx handcode="client" vendorpriv="1302"/>
- </function>
-
- <function name="GetVertexAttribivARB" offset="590">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx handcode="client" vendorpriv="1303"/>
- </function>
-
- <function name="VertexAttrib1dARB" offset="603" vectorequiv="VertexAttrib1dvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib1dvARB" offset="604">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="1"/>
- <glx rop="4197"/>
- </function>
-
- <function name="VertexAttrib1fARB" offset="605" vectorequiv="VertexAttrib1fvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib1fvARB" offset="606">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="1"/>
- <glx rop="4193"/>
- </function>
-
- <function name="VertexAttrib1sARB" offset="607" vectorequiv="VertexAttrib1svARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib1svARB" offset="608">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="1"/>
- <glx rop="4189"/>
- </function>
-
- <function name="VertexAttrib2dARB" offset="609" vectorequiv="VertexAttrib2dvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib2dvARB" offset="610">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="2"/>
- <glx rop="4198"/>
- </function>
-
- <function name="VertexAttrib2fARB" offset="611" vectorequiv="VertexAttrib2fvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib2fvARB" offset="612">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="2"/>
- <glx rop="4194"/>
- </function>
-
- <function name="VertexAttrib2sARB" offset="613" vectorequiv="VertexAttrib2svARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib2svARB" offset="614">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="2"/>
- <glx rop="4190"/>
- </function>
-
- <function name="VertexAttrib3dARB" offset="615" vectorequiv="VertexAttrib3dvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib3dvARB" offset="616">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="4199"/>
- </function>
-
- <function name="VertexAttrib3fARB" offset="617" vectorequiv="VertexAttrib3fvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib3fvARB" offset="618">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="4195"/>
- </function>
-
- <function name="VertexAttrib3sARB" offset="619" vectorequiv="VertexAttrib3svARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib3svARB" offset="620">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="4191"/>
- </function>
-
- <function name="VertexAttrib4dARB" offset="621" vectorequiv="VertexAttrib4dvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib4dvARB" offset="622">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="4200"/>
- </function>
-
- <function name="VertexAttrib4fARB" offset="623" vectorequiv="VertexAttrib4fvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib4fvARB" offset="624">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="4196"/>
- </function>
-
- <function name="VertexAttrib4sARB" offset="625" vectorequiv="VertexAttrib4svARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- <param name="w" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib4svARB" offset="626">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="4192"/>
- </function>
-
- <function name="VertexAttrib4NubARB" offset="627" vectorequiv="VertexAttrib4NubvARB">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLubyte"/>
- <param name="y" type="GLubyte"/>
- <param name="z" type="GLubyte"/>
- <param name="w" type="GLubyte"/>
- </function>
-
- <function name="VertexAttrib4NubvARB" offset="628">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLubyte *" count="4"/>
- <glx rop="4201"/>
- </function>
-
- <function name="VertexAttrib4bvARB" offset="654">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLbyte *" count="4"/>
- <glx rop="4230"/>
- </function>
-
- <function name="VertexAttrib4ivARB" offset="655">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="4231"/>
- </function>
-
- <function name="VertexAttrib4ubvARB" offset="656">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLubyte *" count="4"/>
- <glx rop="4232"/>
- </function>
-
- <function name="VertexAttrib4usvARB" offset="657">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLushort *" count="4"/>
- <glx rop="4233"/>
- </function>
-
- <function name="VertexAttrib4uivARB" offset="658">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLuint *" count="4"/>
- <glx rop="4234"/>
- </function>
-
- <function name="VertexAttrib4NbvARB" offset="659">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLbyte *" count="4"/>
- <glx rop="4235"/>
- </function>
-
- <function name="VertexAttrib4NsvARB" offset="660">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="4236"/>
- </function>
-
- <function name="VertexAttrib4NivARB" offset="661">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLint *" count="4"/>
- <glx rop="4237"/>
- </function>
-
- <function name="VertexAttrib4NusvARB" offset="662">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLushort *" count="4"/>
- <glx rop="4238"/>
- </function>
-
- <function name="VertexAttrib4NuivARB" offset="663">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLuint *" count="4"/>
- <glx rop="4239"/>
- </function>
-
- <function name="VertexAttribPointerARB" offset="664">
- <param name="index" type="GLuint"/>
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="normalized" type="GLboolean"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="EnableVertexAttribArrayARB" offset="665">
- <param name="index" type="GLuint"/>
- <glx handcode="true"/>
- </function>
-
- <function name="DisableVertexAttribArrayARB" offset="666">
- <param name="index" type="GLuint"/>
- <glx handcode="true"/>
- </function>
-
- <function name="ProgramStringARB" offset="667">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="string" type="const GLvoid *" count="len"/>
- <glx rop="4217" large="true"/>
- </function>
-
- <function name="BindProgramARB" alias="BindProgramNV">
- <param name="target" type="GLenum"/>
- <param name="program" type="GLuint"/>
- </function>
-
- <function name="DeleteProgramsARB" alias="DeleteProgramsNV">
- <param name="n" type="GLsizei"/>
- <param name="programs" type="const GLuint *"/>
- </function>
-
- <function name="GenProgramsARB" alias="GenProgramsNV">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="programs" type="GLuint *" output="true" count="n"/>
- </function>
-
- <function name="IsProgramARB" alias="IsProgramNV">
- <param name="program" type="GLuint"/>
- <return type="GLboolean"/>
- </function>
-
- <function name="ProgramEnvParameter4dARB" offset="668" vectorequiv="ProgramEnvParameter4dvARB">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="ProgramEnvParameter4dvARB" offset="669">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="const GLdouble *" count="4"/>
- <glx rop="4185" doubles_in_order="true"/>
- </function>
-
- <function name="ProgramEnvParameter4fARB" offset="670" vectorequiv="ProgramEnvParameter4fvARB">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="ProgramEnvParameter4fvARB" offset="671">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="const GLfloat *" count="4"/>
- <glx rop="4184"/>
- </function>
-
- <function name="ProgramLocalParameter4dARB" offset="672" vectorequiv="ProgramLocalParameter4dvARB">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="ProgramLocalParameter4dvARB" offset="673">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="const GLdouble *" count="4"/>
- <glx rop="4216" doubles_in_order="true"/>
- </function>
-
- <function name="ProgramLocalParameter4fARB" offset="674" vectorequiv="ProgramLocalParameter4fvARB">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="ProgramLocalParameter4fvARB" offset="675">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="const GLfloat *" count="4"/>
- <glx rop="4215"/>
- </function>
-
- <!-- The GetProgramEnvParameter[df]vARB are handcoded because there
- is an extra CARD32 of padding after the "index" field. Originally,
- GetProgranEnvParameter[df]vARB and GetProgramParameter[df]vNV
- shared the same GLX protocol. The pad field was where the pname
- parameter was in the NV functions. When this error was discovered
- and fixed, there was already at least one implementation of
- GLX protocol for ARB_vertex_program, but there were no
- implementations of NV_vertex_program. The sollution was to renumber
- the opcodes for NV_vertex_program and convert the unused field in
- the ARB_vertex_program protocol to unused padding.
- -->
-
- <function name="GetProgramEnvParameterdvARB" offset="676">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="GLdouble *" output="true" count="4"/>
- <glx vendorpriv="1297" handcode="client" doubles_in_order="true"/>
- </function>
-
- <function name="GetProgramEnvParameterfvARB" offset="677">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="GLfloat *" output="true" count="4"/>
- <glx vendorpriv="1296" handcode="client"/>
- </function>
-
- <function name="GetProgramLocalParameterdvARB" offset="678">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="GLdouble *" output="true" count="4"/>
- <glx vendorpriv="1306" handcode="client" doubles_in_order="true"/>
- </function>
-
- <function name="GetProgramLocalParameterfvARB" offset="679">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="GLfloat *" output="true" count="4"/>
- <glx vendorpriv="1305" handcode="client"/>
- </function>
-
-
- <function name="GetProgramivARB" offset="680">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="1307"/>
- </function>
-
- <function name="GetProgramStringARB" offset="681">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="string" type="GLvoid *" output="true"/>
- <glx vendorpriv="1308" handcode="server" always_array="true"/>
- </function>
-
- <function name="GetVertexAttribPointervARB" alias="GetVertexAttribPointervNV">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLvoid **" output="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_fragment_program" number="27">
- <enum name="FRAGMENT_PROGRAM_ARB" count="1" value="0x8804">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROGRAM_ALU_INSTRUCTIONS_ARB" count="1" value="0x8805">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_TEX_INSTRUCTIONS_ARB" count="1" value="0x8806">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_TEX_INDIRECTIONS_ARB" count="1" value="0x8807">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB" count="1" value="0x8808">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB" count="1" value="0x8809">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB" count="1" value="0x880A">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_ALU_INSTRUCTIONS_ARB" count="1" value="0x880B">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_TEX_INSTRUCTIONS_ARB" count="1" value="0x880C">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_TEX_INDIRECTIONS_ARB" count="1" value="0x880D">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB" count="1" value="0x880E">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB" count="1" value="0x880F">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB" count="1" value="0x8810">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_COORDS_ARB" count="1" value="0x8871">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_IMAGE_UNITS_ARB" count="1" value="0x8872">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_ARB_vertex_buffer_object" number="28">
- <enum name="BUFFER_SIZE_ARB" value="0x8764"/>
- <enum name="BUFFER_USAGE_ARB" value="0x8765"/>
- <enum name="ARRAY_BUFFER_ARB" value="0x8892"/>
- <enum name="ELEMENT_ARRAY_BUFFER_ARB" value="0x8893"/>
- <enum name="ARRAY_BUFFER_BINDING_ARB" value="0x8894"/>
- <enum name="ELEMENT_ARRAY_BUFFER_BINDING_ARB" value="0x8895"/>
- <enum name="VERTEX_ARRAY_BUFFER_BINDING_ARB" value="0x8896"/>
- <enum name="NORMAL_ARRAY_BUFFER_BINDING_ARB" value="0x8897"/>
- <enum name="COLOR_ARRAY_BUFFER_BINDING_ARB" value="0x8898"/>
- <enum name="INDEX_ARRAY_BUFFER_BINDING_ARB" value="0x8899"/>
- <enum name="TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB" value="0x889A"/>
- <enum name="EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB" value="0x889B"/>
- <enum name="SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB" value="0x889C"/>
- <enum name="FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB" value="0x889D"/>
- <enum name="WEIGHT_ARRAY_BUFFER_BINDING_ARB" value="0x889E"/>
- <enum name="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB" value="0x889F"/>
- <enum name="READ_ONLY_ARB" value="0x88B8"/>
- <enum name="WRITE_ONLY_ARB" value="0x88B9"/>
- <enum name="READ_WRITE_ARB" value="0x88BA"/>
- <enum name="BUFFER_ACCESS_ARB" value="0x88BB"/>
- <enum name="BUFFER_MAPPED_ARB" value="0x88BC"/>
- <enum name="BUFFER_MAP_POINTER_ARB" value="0x88BD"/>
- <enum name="STREAM_DRAW_ARB" value="0x88E0"/>
- <enum name="STREAM_READ_ARB" value="0x88E1"/>
- <enum name="STREAM_COPY_ARB" value="0x88E2"/>
- <enum name="STATIC_DRAW_ARB" value="0x88E4"/>
- <enum name="STATIC_READ_ARB" value="0x88E5"/>
- <enum name="STATIC_COPY_ARB" value="0x88E6"/>
- <enum name="DYNAMIC_DRAW_ARB" value="0x88E8"/>
- <enum name="DYNAMIC_READ_ARB" value="0x88E9"/>
- <enum name="DYNAMIC_COPY_ARB" value="0x88EA"/>
-
- <type name="intptrARB" size="4"/>
- <type name="sizeiptrARB" unsigned="true" size="4"/>
-
- <function name="BindBufferARB" offset="688">
- <param name="target" type="GLenum"/>
- <param name="buffer" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="BufferDataARB" offset="689">
- <param name="target" type="GLenum"/>
- <param name="size" type="GLsizeiptrARB"/>
- <param name="data" type="const GLvoid *"/>
- <param name="usage" type="GLenum"/>
- <glx ignore="true"/>
- </function>
-
- <function name="BufferSubDataARB" offset="690">
- <param name="target" type="GLenum"/>
- <param name="offset" type="GLintptrARB"/>
- <param name="size" type="GLsizeiptrARB"/>
- <param name="data" type="const GLvoid *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="DeleteBuffersARB" offset="691">
- <param name="n" type="GLsizei"/>
- <param name="buffer" type="const GLuint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GenBuffersARB" offset="692">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="buffer" type="GLuint *" output="true" count="n"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetBufferParameterivARB" offset="693">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetBufferPointervARB" offset="694">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLvoid **" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetBufferSubDataARB" offset="695">
- <param name="target" type="GLenum"/>
- <param name="offset" type="GLintptrARB"/>
- <param name="size" type="GLsizeiptrARB"/>
- <param name="data" type="GLvoid *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="IsBufferARB" offset="696">
- <param name="buffer" type="GLuint"/>
- <return type="GLboolean"/>
- <glx ignore="true"/>
- </function>
-
- <function name="MapBufferARB" offset="697">
- <param name="target" type="GLenum"/>
- <param name="access" type="GLenum"/>
- <return type="GLvoid *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="UnmapBufferARB" offset="698">
- <param name="target" type="GLenum"/>
- <return type="GLboolean"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_occlusion_query" number="29">
- <enum name="QUERY_COUNTER_BITS_ARB" count="1" value="0x8864">
- <size name="GetQueryivARB" mode="get"/>
- </enum>
- <enum name="CURRENT_QUERY_ARB" count="1" value="0x8865">
- <size name="GetQueryivARB" mode="get"/>
- </enum>
- <enum name="QUERY_RESULT_ARB" count="1" value="0x8866">
- <size name="GetQueryObjectivARB" mode="get"/>
- <size name="GetQueryObjectuivARB" mode="get"/>
- </enum>
- <enum name="QUERY_RESULT_AVAILABLE_ARB" count="1" value="0x8867">
- <size name="GetQueryObjectivARB" mode="get"/>
- <size name="GetQueryObjectuivARB" mode="get"/>
- </enum>
- <enum name="SAMPLES_PASSED_ARB" value="0x8914"/>
-
- <function name="GenQueriesARB" offset="700">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="ids" type="GLuint *" output="true" count="n"/>
- <glx sop="162" always_array="true"/>
- </function>
-
- <function name="DeleteQueriesARB" offset="701">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="ids" type="const GLuint *" count="n"/>
- <glx sop="161"/>
- </function>
-
- <function name="IsQueryARB" offset="702">
- <param name="id" type="GLuint"/>
- <return type="GLboolean"/>
- <glx sop="163"/>
- </function>
-
- <function name="BeginQueryARB" offset="703">
- <param name="target" type="GLenum"/>
- <param name="id" type="GLuint"/>
- <glx rop="231"/>
- </function>
-
- <function name="EndQueryARB" offset="704">
- <param name="target" type="GLenum"/>
- <glx rop="232"/>
- </function>
-
- <function name="GetQueryivARB" offset="705">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="164"/>
- </function>
-
- <function name="GetQueryObjectivARB" offset="706">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx sop="165"/>
- </function>
-
- <function name="GetQueryObjectuivARB" offset="707">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLuint *" output="true" variable_param="pname"/>
- <glx sop="166"/>
- </function>
-</category>
-
-<category name="GL_ARB_shader_objects" number="30">
- <enum name="PROGRAM_OBJECT_ARB" value="0x8B40"/>
- <enum name="SHADER_OBJECT_ARB" value="0x8B48"/>
- <enum name="OBJECT_TYPE_ARB" value="0x8B4E"/>
- <enum name="OBJECT_SUBTYPE_ARB" value="0x8B4F"/>
- <enum name="FLOAT_VEC2_ARB" value="0x8B50"/>
- <enum name="FLOAT_VEC3_ARB" value="0x8B51"/>
- <enum name="FLOAT_VEC4_ARB" value="0x8B52"/>
- <enum name="INT_VEC2_ARB" value="0x8B53"/>
- <enum name="INT_VEC3_ARB" value="0x8B54"/>
- <enum name="INT_VEC4_ARB" value="0x8B55"/>
- <enum name="BOOL_ARB" value="0x8B56"/>
- <enum name="BOOL_VEC2_ARB" value="0x8B57"/>
- <enum name="BOOL_VEC3_ARB" value="0x8B58"/>
- <enum name="BOOL_VEC4_ARB" value="0x8B59"/>
- <enum name="FLOAT_MAT2_ARB" value="0x8B5A"/>
- <enum name="FLOAT_MAT3_ARB" value="0x8B5B"/>
- <enum name="FLOAT_MAT4_ARB" value="0x8B5C"/>
- <enum name="OBJECT_DELETE_STATUS_ARB" value="0x8B80"/>
- <enum name="OBJECT_COMPILE_STATUS_ARB" value="0x8B81"/>
- <enum name="OBJECT_LINK_STATUS_ARB" value="0x8B82"/>
- <enum name="OBJECT_VALIDATE_STATUS_ARB" value="0x8B83"/>
- <enum name="OBJECT_INFO_LOG_LENGTH_ARB" value="0x8B84"/>
- <enum name="OBJECT_ATTACHED_OBJECTS_ARB" value="0x8B85"/>
- <enum name="OBJECT_ACTIVE_UNIFORMS_ARB" value="0x8B86"/>
- <enum name="OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB" value="0x8B87"/>
- <enum name="OBJECT_SHADER_SOURCE_LENGTH_ARB" value="0x8B88"/>
-
- <type name="charARB" size="1" glx_name="CARD8"/>
- <type name="handleARB" size="4" glx_name="CARD32"/>
-
- <function name="DeleteObjectARB" offset="711">
- <param name="obj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetHandleARB" offset="712">
- <param name="pname" type="GLenum"/>
- <return type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="DetachObjectARB" offset="713">
- <param name="containerObj" type="GLhandleARB"/>
- <param name="attachedObj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="CreateShaderObjectARB" offset="714">
- <param name="shaderType" type="GLenum"/>
- <return type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ShaderSourceARB" offset="715">
- <param name="shaderObj" type="GLhandleARB"/>
- <param name="count" type="GLsizei"/>
- <param name="string" type="const GLcharARB **"/>
- <param name="length" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="CompileShaderARB" offset="716">
- <param name="shaderObj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="CreateProgramObjectARB" offset="717">
- <return type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="AttachObjectARB" offset="718">
- <param name="containerObj" type="GLhandleARB"/>
- <param name="obj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="LinkProgramARB" offset="719">
- <param name="programObj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="UseProgramObjectARB" offset="720">
- <param name="programObj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ValidateProgramARB" offset="721">
- <param name="programObj" type="GLhandleARB"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform1fARB" offset="722">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform2fARB" offset="723">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLfloat"/>
- <param name="v1" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform3fARB" offset="724">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLfloat"/>
- <param name="v1" type="GLfloat"/>
- <param name="v2" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform4fARB" offset="725">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLfloat"/>
- <param name="v1" type="GLfloat"/>
- <param name="v2" type="GLfloat"/>
- <param name="v3" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform1iARB" offset="726">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform2iARB" offset="727">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLint"/>
- <param name="v1" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform3iARB" offset="728">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLint"/>
- <param name="v1" type="GLint"/>
- <param name="v2" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform4iARB" offset="729">
- <param name="location" type="GLint"/>
- <param name="v0" type="GLint"/>
- <param name="v1" type="GLint"/>
- <param name="v2" type="GLint"/>
- <param name="v3" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform1fvARB" offset="730">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform2fvARB" offset="731">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform3fvARB" offset="732">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform4fvARB" offset="733">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform1ivARB" offset="734">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform2ivARB" offset="735">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform3ivARB" offset="736">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="Uniform4ivARB" offset="737">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="value" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="UniformMatrix2fvARB" offset="738">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="transpose" type="GLboolean"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="UniformMatrix3fvARB" offset="739">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="transpose" type="GLboolean"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="UniformMatrix4fvARB" offset="740">
- <param name="location" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="transpose" type="GLboolean"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetObjectParameterfvARB" offset="741">
- <param name="obj" type="GLhandleARB"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetObjectParameterivARB" offset="742">
- <param name="obj" type="GLhandleARB"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetInfoLogARB" offset="743">
- <param name="obj" type="GLhandleARB"/>
- <param name="maxLength" type="GLsizei"/>
- <param name="length" type="GLsizei *" output="true"/>
- <param name="infoLog" type="GLcharARB *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetAttachedObjectsARB" offset="744">
- <param name="containerObj" type="GLhandleARB"/>
- <param name="maxLength" type="GLsizei"/>
- <param name="length" type="GLsizei *" output="true"/>
- <param name="infoLog" type="GLhandleARB *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetUniformLocationARB" offset="745">
- <param name="programObj" type="GLhandleARB"/>
- <param name="name" type="const GLcharARB *"/>
- <return type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetActiveUniformARB" offset="746">
- <param name="programObj" type="GLhandleARB"/>
- <param name="index" type="GLuint"/>
- <param name="maxLength" type="GLsizei"/>
- <param name="length" type="GLsizei *" output="true"/>
- <param name="size" type="GLint *" output="true"/>
- <param name="type" type="GLenum *" output="true"/>
- <param name="name" type="GLcharARB *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetUniformfvARB" offset="747">
- <param name="programObj" type="GLhandleARB"/>
- <param name="location" type="GLint"/>
- <param name="params" type="GLfloat *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetUniformivARB" offset="748">
- <param name="programObj" type="GLhandleARB"/>
- <param name="location" type="GLint"/>
- <param name="params" type="GLint *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetShaderSourceARB" offset="749">
- <param name="obj" type="GLhandleARB"/>
- <param name="maxLength" type="GLsizei"/>
- <param name="length" type="GLsizei *" output="true"/>
- <param name="source" type="GLcharARB *" output="true"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_vertex_shader" number="31">
- <enum name="VERTEX_SHADER_ARB" value="0x8B31"/>
- <enum name="MAX_VERTEX_UNIFORM_COMPONENTS_ARB" value="0x8B4A"/>
- <enum name="MAX_VARYING_FLOATS_ARB" value="0x8B4B"/>
- <enum name="MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB" value="0x8B4C"/>
- <enum name="MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB" value="0x8B4D"/>
- <enum name="OBJECT_ACTIVE_ATTRIBUTES_ARB" value="0x8B89"/>
- <enum name="OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB" value="0x8B8A"/>
-
- <function name="BindAttribLocationARB" offset="750">
- <param name="programObj" type="GLhandleARB"/>
- <param name="index" type="GLuint"/>
- <param name="name" type="const GLcharARB *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetActiveAttribARB" offset="751">
- <param name="programObj" type="GLhandleARB"/>
- <param name="index" type="GLuint"/>
- <param name="maxLength" type="GLsizei"/>
- <param name="length" type="GLsizei *" output="true"/>
- <param name="size" type="GLint *" output="true"/>
- <param name="type" type="GLenum *" output="true"/>
- <param name="name" type="GLcharARB *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetAttribLocationARB" offset="752">
- <param name="programObj" type="GLhandleARB"/>
- <param name="name" type="const GLcharARB *"/>
- <return type="GLint"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_fragment_shader" number="32">
- <enum name="FRAGMENT_SHADER_ARB" value="0x8B30"/>
- <enum name="MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB" value="0x8B49"/>
-</category>
-
-<category name="GL_ARB_shading_language_100" number="33">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_ARB_texture_non_power_of_two" number="34">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_ARB_point_sprite" number="35">
- <enum name="POINT_SPRITE_ARB" count="1" value="0x8861">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COORD_REPLACE_ARB" count="1" value="0x8862">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_ARB_fragment_program_shadow" number="36">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_ARB_draw_buffers" number="37">
- <enum name="MAX_DRAW_BUFFERS_ARB" count="1" value="0x8824">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER0_ARB" count="1" value="0x8825">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER1_ARB" count="1" value="0x8826">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER2_ARB" count="1" value="0x8827">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER3_ARB" count="1" value="0x8828">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER4_ARB" count="1" value="0x8829">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER5_ARB" count="1" value="0x882A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER6_ARB" count="1" value="0x882B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER7_ARB" count="1" value="0x882C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER8_ARB" count="1" value="0x882D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER9_ARB" count="1" value="0x882E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER10_ARB" count="1" value="0x882F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER11_ARB" count="1" value="0x8830">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER12_ARB" count="1" value="0x8831">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER13_ARB" count="1" value="0x8832">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER14_ARB" count="1" value="0x8833">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER15_ARB" count="1" value="0x8834">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="DrawBuffersARB" offset="413">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="bufs" type="const GLenum *" count="n"/>
- <glx rop="233" large="true"/>
- </function>
-</category>
-
-<category name="GL_ARB_texture_rectangle" number="38">
- <enum name="TEXTURE_RECTANGLE_ARB" count="1" value="0x84F5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_RECTANGLE_ARB" count="1" value="0x84F6">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROXY_TEXTURE_RECTANGLE_ARB" value="0x84F7"/>
- <enum name="MAX_RECTANGLE_TEXTURE_SIZE_ARB" count="1" value="0x84F8">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<!-- Non-ARB extensions sorted by extension number. -->
-
-<category name="GL_EXT_blend_color" number="2">
- <enum name="CONSTANT_COLOR_EXT" value="0x8001"/>
- <enum name="ONE_MINUS_CONSTANT_COLOR_EXT" value="0x8002"/>
- <enum name="CONSTANT_ALPHA_EXT" value="0x8003"/>
- <enum name="ONE_MINUS_CONSTANT_ALPHA_EXT" value="0x8004"/>
- <enum name="BLEND_COLOR_EXT" count="4" value="0x8005">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="BlendColorEXT" alias="BlendColor">
- <param name="red" type="GLclampf"/>
- <param name="green" type="GLclampf"/>
- <param name="blue" type="GLclampf"/>
- <param name="alpha" type="GLclampf"/>
- </function>
-</category>
-
-<category name="GL_EXT_polygon_offset" number="3">
- <function name="PolygonOffsetEXT" offset="414">
- <param name="factor" type="GLfloat"/>
- <param name="bias" type="GLfloat"/>
- <glx rop="4098" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_texture" number="4">
- <enum name="ALPHA4_EXT" value="0x803B"/>
- <enum name="ALPHA8_EXT" value="0x803C"/>
- <enum name="ALPHA12_EXT" value="0x803D"/>
- <enum name="ALPHA16_EXT" value="0x803E"/>
- <enum name="LUMINANCE4_EXT" value="0x803F"/>
- <enum name="LUMINANCE8_EXT" value="0x8040"/>
- <enum name="LUMINANCE12_EXT" value="0x8041"/>
- <enum name="LUMINANCE16_EXT" value="0x8042"/>
- <enum name="LUMINANCE4_ALPHA4_EXT" value="0x8043"/>
- <enum name="LUMINANCE6_ALPHA2_EXT" value="0x8044"/>
- <enum name="LUMINANCE8_ALPHA8_EXT" value="0x8045"/>
- <enum name="LUMINANCE12_ALPHA4_EXT" value="0x8046"/>
- <enum name="LUMINANCE12_ALPHA12_EXT" value="0x8047"/>
- <enum name="LUMINANCE16_ALPHA16_EXT" value="0x8048"/>
- <enum name="INTENSITY_EXT" value="0x8049"/>
- <enum name="INTENSITY4_EXT" value="0x804A"/>
- <enum name="INTENSITY8_EXT" value="0x804B"/>
- <enum name="INTENSITY12_EXT" value="0x804C"/>
- <enum name="INTENSITY16_EXT" value="0x804D"/>
- <enum name="RGB2_EXT" value="0x804E"/>
- <enum name="RGB4_EXT" value="0x804F"/>
- <enum name="RGB5_EXT" value="0x8050"/>
- <enum name="RGB8_EXT" value="0x8051"/>
- <enum name="RGB10_EXT" value="0x8052"/>
- <enum name="RGB12_EXT" value="0x8053"/>
- <enum name="RGB16_EXT" value="0x8054"/>
- <enum name="RGBA2_EXT" value="0x8055"/>
- <enum name="RGBA4_EXT" value="0x8056"/>
- <enum name="RGB5_A1_EXT" value="0x8057"/>
- <enum name="RGBA8_EXT" value="0x8058"/>
- <enum name="RGB10_A2_EXT" value="0x8059"/>
- <enum name="RGBA12_EXT" value="0x805A"/>
- <enum name="RGBA16_EXT" value="0x805B"/>
- <enum name="TEXTURE_RED_SIZE_EXT" count="1" value="0x805C">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_GREEN_SIZE_EXT" count="1" value="0x805D">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_BLUE_SIZE_EXT" count="1" value="0x805E">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_ALPHA_SIZE_EXT" count="1" value="0x805F">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_LUMINANCE_SIZE_EXT" count="1" value="0x8060">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_INTENSITY_SIZE_EXT" count="1" value="0x8061">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
- <enum name="REPLACE_EXT" value="0x8062"/>
- <enum name="PROXY_TEXTURE_1D_EXT" value="0x8063"/>
- <enum name="PROXY_TEXTURE_2D_EXT" value="0x8064"/>
- <enum name="TEXTURE_TOO_LARGE_EXT" value="0x8065"/>
-</category>
-
-<!-- Extension number 5 is not listed in the extension registry. -->
-
-<category name="GL_EXT_texture3D" number="6">
- <function name="TexImage3DEXT" alias="TexImage3D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *"/>
- </function>
-
- <function name="TexSubImage3DEXT" alias="TexSubImage3D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *"/>
- </function>
-</category>
-
-<category name="GL_SGIS_texture_filter4" number="7">
- <function name="GetTexFilterFuncSGIS" offset="415">
- <param name="target" type="GLenum"/>
- <param name="filter" type="GLenum"/>
- <param name="weights" type="GLfloat *" output="true"/>
- <glx vendorpriv="4101" ignore="true"/>
- </function>
-
- <function name="TexFilterFuncSGIS" offset="416">
- <param name="target" type="GLenum"/>
- <param name="filter" type="GLenum"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="weights" type="const GLfloat *" count="n"/>
- <glx rop="2064" ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 8 is not listed in the extension registry. -->
-
-<category name="GL_EXT_subtexture" number="9">
- <function name="TexSubImage1DEXT" alias="TexSubImage1D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *"/>
- </function>
-
- <function name="TexSubImage2DEXT" alias="TexSubImage2D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *"/>
- </function>
-</category>
-
-<category name="GL_EXT_copy_texture" number="10">
- <function name="CopyTexImage1DEXT" alias="CopyTexImage1D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="border" type="GLint"/>
- </function>
-
- <function name="CopyTexImage2DEXT" alias="CopyTexImage2D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="border" type="GLint"/>
- </function>
-
- <function name="CopyTexSubImage1DEXT" alias="CopyTexSubImage1D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- </function>
-
- <function name="CopyTexSubImage2DEXT" alias="CopyTexSubImage2D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- </function>
-
- <function name="CopyTexSubImage3DEXT" alias="CopyTexSubImage3D">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- </function>
-</category>
-
-<category name="GL_EXT_histogram" number="11">
- <enum name="HISTOGRAM_EXT" value="0x8024"/>
- <enum name="PROXY_HISTOGRAM_EXT" value="0x8025"/>
- <enum name="HISTOGRAM_WIDTH_EXT" count="1" value="0x8026">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_FORMAT_EXT" count="1" value="0x8027">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_RED_SIZE_EXT" count="1" value="0x8028">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_GREEN_SIZE_EXT" count="1" value="0x8029">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_BLUE_SIZE_EXT" count="1" value="0x802A">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_ALPHA_SIZE_EXT" count="1" value="0x802B">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_LUMINANCE_SIZE_EXT" count="1" value="0x802C">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="HISTOGRAM_SINK_EXT" count="1" value="0x802D">
- <size name="GetHistogramParameterfvEXT" mode="get"/>
- <size name="GetHistogramParameterivEXT" mode="get"/>
- </enum>
- <enum name="MINMAX_EXT" value="0x802E"/>
- <enum name="MINMAX_FORMAT_EXT" count="1" value="0x802F">
- <size name="GetMinmaxParameterfvEXT" mode="get"/>
- <size name="GetMinmaxParameterivEXT" mode="get"/>
- </enum>
- <enum name="MINMAX_SINK_EXT" count="1" value="0x8030">
- <size name="GetMinmaxParameterfvEXT" mode="get"/>
- <size name="GetMinmaxParameterivEXT" mode="get"/>
- </enum>
- <enum name="TABLE_TOO_LARGE_EXT" value="0x8031"/>
-
- <function name="GetHistogramEXT" offset="417">
- <param name="target" type="GLenum"/>
- <param name="reset" type="GLboolean"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true"/>
- <glx vendorpriv="5" handcode="true" ignore="true"/>
- </function>
-
- <function name="GetHistogramParameterfvEXT" offset="418">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx vendorpriv="6" ignore="true"/>
- </function>
-
- <function name="GetHistogramParameterivEXT" offset="419">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="7" ignore="true"/>
- </function>
-
- <function name="GetMinmaxEXT" offset="420">
- <param name="target" type="GLenum"/>
- <param name="reset" type="GLboolean"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true"/>
- <glx vendorpriv="8" handcode="true" ignore="true"/>
- </function>
-
- <function name="GetMinmaxParameterfvEXT" offset="421">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx vendorpriv="9" ignore="true"/>
- </function>
-
- <function name="GetMinmaxParameterivEXT" offset="422">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="10" ignore="true"/>
- </function>
-
- <function name="HistogramEXT" alias="Histogram">
- <param name="target" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="internalformat" type="GLenum"/>
- <param name="sink" type="GLboolean"/>
- </function>
-
- <function name="MinmaxEXT" alias="Minmax">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="sink" type="GLboolean"/>
- </function>
-
- <function name="ResetHistogramEXT" alias="ResetHistogram">
- <param name="target" type="GLenum"/>
- </function>
-
- <function name="ResetMinmaxEXT" alias="ResetMinmax">
- <param name="target" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_EXT_convolution" number="12">
- <enum name="CONVOLUTION_BORDER_MODE_EXT" count="1" value="0x8013">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_FILTER_SCALE_EXT" count="4" value="0x8014">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_FILTER_BIAS_EXT" count="4" value="0x8015">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="REDUCE_EXT" value="0x8016"/>
- <enum name="CONVOLUTION_FORMAT_EXT" count="1" value="0x8017">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_WIDTH_EXT" count="1" value="0x8018">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="CONVOLUTION_HEIGHT_EXT" count="1" value="0x8019">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
- <enum name="MAX_CONVOLUTION_WIDTH_EXT" count="1" value="0x801A">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_CONVOLUTION_HEIGHT_EXT" count="1" value="0x801B">
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_RED_SCALE_EXT" count="1" value="0x801C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_GREEN_SCALE_EXT" count="1" value="0x801D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_BLUE_SCALE_EXT" count="1" value="0x801E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_ALPHA_SCALE_EXT" count="1" value="0x801F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_RED_BIAS_EXT" count="1" value="0x8020">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_GREEN_BIAS_EXT" count="1" value="0x8021">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_BLUE_BIAS_EXT" count="1" value="0x8022">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="POST_CONVOLUTION_ALPHA_BIAS_EXT" count="1" value="0x8023">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="ConvolutionFilter1DEXT" alias="ConvolutionFilter1D">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="image" type="const GLvoid *"/>
- </function>
-
- <function name="ConvolutionFilter2DEXT" alias="ConvolutionFilter2D">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="image" type="const GLvoid *"/>
- </function>
-
- <function name="ConvolutionParameterfEXT" alias="ConvolutionParameterf">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat"/>
- </function>
-
- <function name="ConvolutionParameterfvEXT" alias="ConvolutionParameterfv">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-
- <function name="ConvolutionParameteriEXT" alias="ConvolutionParameteri">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint"/>
- </function>
-
- <function name="ConvolutionParameterivEXT" alias="ConvolutionParameteriv">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="CopyConvolutionFilter1DEXT" alias="CopyConvolutionFilter1D">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- </function>
-
- <function name="CopyConvolutionFilter2DEXT" alias="CopyConvolutionFilter2D">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- </function>
-
- <function name="GetConvolutionFilterEXT" offset="423">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="image" type="GLvoid *" output="true"/>
- <glx vendorpriv="1" handcode="true" ignore="true"/>
- </function>
-
- <function name="GetConvolutionParameterfvEXT" offset="424">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx vendorpriv="2" ignore="true"/>
- </function>
-
- <function name="GetConvolutionParameterivEXT" offset="425">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="3" ignore="true"/>
- </function>
-
- <function name="GetSeparableFilterEXT" offset="426">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="row" type="GLvoid *" output="true"/>
- <param name="column" type="GLvoid *" output="true"/>
- <param name="span" type="GLvoid *" output="true"/>
- <glx vendorpriv="4" handcode="true" ignore="true"/>
- </function>
-
- <function name="SeparableFilter2DEXT" alias="SeparableFilter2D">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="row" type="const GLvoid *"/>
- <param name="column" type="const GLvoid *"/>
- </function>
-</category>
-
-<category name="GL_SGI_color_matrix" number="13">
- <enum name="COLOR_MATRIX_SGI" value="0x80B1"/>
- <enum name="COLOR_MATRIX_STACK_DEPTH_SGI" value="0x80B2"/>
- <enum name="MAX_COLOR_MATRIX_STACK_DEPTH_SGI" value="0x80B3"/>
- <enum name="POST_COLOR_MATRIX_RED_SCALE_SGI" value="0x80B4"/>
- <enum name="POST_COLOR_MATRIX_GREEN_SCALE_SGI" value="0x80B5"/>
- <enum name="POST_COLOR_MATRIX_BLUE_SCALE_SGI" value="0x80B6"/>
- <enum name="POST_COLOR_MATRIX_ALPHA_SCALE_SGI" value="0x80B7"/>
- <enum name="POST_COLOR_MATRIX_RED_BIAS_SGI" value="0x80B8"/>
- <enum name="POST_COLOR_MATRIX_GREEN_BIAS_SGI" value="0x80B9"/>
- <enum name="POST_COLOR_MATRIX_BLUE_BIAS_SGI" value="0x80BA"/>
- <enum name="POST_COLOR_MATRIX_ALPHA_BIAS_SGI" value="0x80BB"/>
-</category>
-
-<category name="GL_SGI_color_table" number="14">
- <function name="ColorTableSGI" alias="ColorTable">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="table" type="const GLvoid *"/>
- </function>
-
- <function name="ColorTableParameterfvSGI" alias="ColorTableParameterfv">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-
- <function name="ColorTableParameterivSGI" alias="ColorTableParameteriv">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="CopyColorTableSGI" alias="CopyColorTable">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- </function>
-
- <function name="GetColorTableSGI" offset="427">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="table" type="GLvoid *" output="true"/>
- <glx vendorpriv="4098" handcode="true" ignore="true"/>
- </function>
-
- <function name="GetColorTableParameterfvSGI" offset="428">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx vendorpriv="4099" ignore="true"/>
- </function>
-
- <function name="GetColorTableParameterivSGI" offset="429">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="4100" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIS_pixel_texture" number="15">
- <function name="PixelTexGenParameteriSGIS" offset="431">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="PixelTexGenParameterivSGIS" offset="432">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="PixelTexGenParameterfSGIS" offset="433">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="PixelTexGenParameterfvSGIS" offset="434">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetPixelTexGenParameterivSGIS" offset="435">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetPixelTexGenParameterfvSGIS" offset="436">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIS_texture4D" number="16">
- <function name="TexImage4DSGIS" offset="437">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="size4d" type="GLsizei"/>
- <param name="border" type="GLint"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
- <glx rop="2057" ignore="true"/>
- </function>
-
- <function name="TexSubImage4DSGIS" offset="438">
- <param name="target" type="GLenum"/>
- <param name="level" type="GLint"/>
- <param name="xoffset" type="GLint"/>
- <param name="yoffset" type="GLint"/>
- <param name="zoffset" type="GLint"/>
- <param name="woffset" type="GLint"/>
- <param name="width" type="GLsizei"/>
- <param name="height" type="GLsizei"/>
- <param name="depth" type="GLsizei"/>
- <param name="size4d" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_woff="woffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
- <glx rop="2058" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGI_texture_color_table" number="17">
- <enum name="TEXTURE_COLOR_TABLE_SGI" value="0x80BC"/>
- <enum name="PROXY_TEXTURE_COLOR_TABLE_SGI" value="0x80BD"/>
-</category>
-
-<!-- Extension number 19 is not listed in the extension registry. -->
-
-<category name="GL_EXT_texture_object" number="20">
- <function name="AreTexturesResidentEXT" offset="439">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="const GLuint *" count="n"/>
- <param name="residences" type="GLboolean *" output="true" count="n"/>
- <return type="GLboolean"/>
- <glx vendorpriv="11" always_array="true"/>
- </function>
-
- <function name="BindTextureEXT" alias="BindTexture">
- <param name="target" type="GLenum"/>
- <param name="texture" type="GLuint"/>
- </function>
-
- <!-- For GLX, this is wrong. DeleteTexturesEXT and DeleteTextures
- do not have the same protocol!
- -->
- <function name="DeleteTexturesEXT" alias="DeleteTextures">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="const GLuint *" count="n"/>
- <glx vendorpriv="12"/>
- </function>
-
- <function name="GenTexturesEXT" offset="440">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="textures" type="GLuint *" output="true" count="n"/>
- <glx vendorpriv="13" always_array="true"/>
- </function>
-
- <function name="IsTextureEXT" offset="441">
- <param name="texture" type="GLuint"/>
- <return type="GLboolean"/>
- <glx vendorpriv="14"/>
- </function>
-
- <function name="PrioritizeTexturesEXT" alias="PrioritizeTextures">
- <param name="n" type="GLsizei"/>
- <param name="textures" type="const GLuint *"/>
- <param name="priorities" type="const GLclampf *"/>
- </function>
-</category>
-
-<category name="GL_SGIS_detail_texture" number="21">
- <function name="DetailTexFuncSGIS" offset="442">
- <param name="target" type="GLenum"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="points" type="const GLfloat *" count="n"/>
- <glx rop="2051" ignore="true"/>
- </function>
-
- <function name="GetDetailTexFuncSGIS" offset="443">
- <param name="target" type="GLenum"/>
- <param name="points" type="GLfloat *" output="true"/>
- <glx vendorpriv="4096" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIS_sharpen_texture" number="22">
- <function name="SharpenTexFuncSGIS" offset="444">
- <param name="target" type="GLenum"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="points" type="const GLfloat *" count="n" count_scale="2"/>
- <glx rop="2052" ignore="true"/>
- </function>
-
- <function name="GetSharpenTexFuncSGIS" offset="445">
- <param name="target" type="GLenum"/>
- <param name="points" type="GLfloat *" output="true"/>
- <glx vendorpriv="4097" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIS_multisample" number="25">
- <function name="SampleMaskSGIS" offset="446">
- <param name="value" type="GLclampf"/>
- <param name="invert" type="GLboolean"/>
- <glx rop="2048"/>
- </function>
-
- <function name="SamplePatternSGIS" offset="447">
- <param name="pattern" type="GLenum"/>
- <glx rop="2049"/>
- </function>
-</category>
-
-<!-- Extension number 26 is not listed in the extension registry. -->
-
-<category name="GL_EXT_rescale_normal" number="27">
- <enum name="RESCALE_NORMAL_EXT" count="1" value="0x803A">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<!-- Extension number 28 is a GLX extension. -->
-<!-- Extension number 29 is not listed in the extension registry. -->
-
-<category name="GL_EXT_vertex_array" number="30">
- <function name="ArrayElementEXT" alias="ArrayElement">
- <param name="i" type="GLint"/>
- </function>
-
- <function name="ColorPointerEXT" offset="448">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="DrawArraysEXT" alias="DrawArrays">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint"/>
- <param name="count" type="GLsizei"/>
- </function>
-
- <function name="EdgeFlagPointerEXT" offset="449">
- <param name="stride" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="pointer" type="const GLboolean *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="GetPointervEXT" alias="GetPointerv">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLvoid **" output="true"/>
- </function>
-
- <function name="IndexPointerEXT" offset="450">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="NormalPointerEXT" offset="451">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="TexCoordPointerEXT" offset="452">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="VertexPointerEXT" offset="453">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<category name="GL_SGIS_generate_mipmap" number="32">
- <enum name="GENERATE_MIPMAP_SGIS" count="1" value="0x8191">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="GENERATE_MIPMAP_HINT_SGIS" value="0x8192"/>
-</category>
-
-<category name="GL_SGIX_clipmap" number="33">
- <enum name="LINEAR_CLIPMAP_LINEAR_SGIX" value="0x8170"/>
- <enum name="TEXTURE_CLIPMAP_CENTER_SGIX" count="2" value="0x8171">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_CLIPMAP_FRAME_SGIX" count="1" value="0x8172">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_CLIPMAP_OFFSET_SGIX" count="2" value="0x8173">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX" count="3" value="0x8174">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_CLIPMAP_LOD_OFFSET_SGIX" value="0x8175"/>
- <enum name="TEXTURE_CLIPMAP_DEPTH_SGIX" value="0x8176"/>
- <enum name="MAX_CLIPMAP_DEPTH_SGIX" value="0x8177"/>
- <enum name="MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX" value="0x8178"/>
- <enum name="NEAREST_CLIPMAP_NEAREST_SGIX" value="0x844D"/>
- <enum name="NEAREST_CLIPMAP_LINEAR_SGIX" value="0x844E"/>
- <enum name="LINEAR_CLIPMAP_NEAREST_SGIX" value="0x844F"/>
-</category>
-
-<category name="GL_SGIX_shadow" number="34">
- <enum name="TEXTURE_COMPARE_SGIX" count="1" value="0x819A">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_COMPARE_OPERATOR_SGIX" count="1" value="0x819B">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_LEQUAL_R_SGIX" value="0x819C"/>
- <enum name="TEXTURE_GEQUAL_R_SGIX" value="0x819D"/>
-</category>
-
-<category name="GL_SGIS_texture_edge_clamp" number="35">
- <enum name="CLAMP_TO_EDGE_SGIS" value="0x812F"/>
-</category>
-
-<category name="GL_SGIS_texture_border_clamp" number="36">
- <enum name="CLAMP_TO_BORDER_SGIS" value="0x812D"/>
-</category>
-
-<category name="GL_EXT_blend_minmax" number="37">
- <enum name="FUNC_ADD_EXT" value="0x8006"/>
- <enum name="MIN_EXT" value="0x8007"/>
- <enum name="MAX_EXT" value="0x8008"/>
- <enum name="BLEND_EQUATION_EXT" count="1" value="0x8009">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="BlendEquationEXT" alias="BlendEquation">
- <param name="mode" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_EXT_blend_subtract" number="38">
- <enum name="FUNC_SUBTRACT_EXT" value="0x800A"/>
- <enum name="FUNC_REVERSE_SUBTRACT_EXT" value="0x800B"/>
-
- <!-- <function name="BlendEquationEXT" alias="BlendEquation">
- <param name="mode" type="GLenum"/>
- </function> -->
-</category>
-
-<!-- Extension number 40 is a GLX extension. -->
-<!-- Extension number 41 is a GLX extension. -->
-<!-- Extension number 42 is a GLX extension. -->
-<!-- Extension number 43 is a GLX extension. -->
-<!-- Extension number 44 is a GLX extension. -->
-<!-- Extension number 46 is not listed in the extension registry. -->
-<!-- Extension number 47 is a GLX extension. -->
-<!-- Extension number 48 is not listed in the extension registry. -->
-<!-- Extension number 49 is a GLX extension. -->
-<!-- Extension number 50 is a GLX extension. -->
-
-<category name="GL_SGIX_sprite" number="52">
- <function name="SpriteParameterfSGIX" offset="454">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="SpriteParameterfvSGIX" offset="455">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="SpriteParameteriSGIX" offset="456">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="SpriteParameterivSGIX" offset="457">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_point_parameters" number="54">
- <enum name="POINT_SIZE_MIN_EXT" count="1" value="0x8126">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_SIZE_MAX_EXT" count="1" value="0x8127">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_FADE_THRESHOLD_SIZE_EXT" count="1" value="0x8128">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_DISTANCE_ATTENUATION_EXT" count="3" value="0x8129">
- <size name="PointParameterfvEXT"/>
- </enum>
-
- <function name="PointParameterfEXT" offset="458">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="2065"/>
- </function>
-
- <function name="PointParameterfvEXT" offset="459">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="2066"/>
- </function>
-</category>
-
-<category name="GL_SGIX_instruments" number="55">
- <function name="GetInstrumentsSGIX" offset="460">
- <return type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="InstrumentsBufferSGIX" offset="461">
- <param name="size" type="GLsizei"/>
- <param name="buffer" type="GLint *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="PollInstrumentsSGIX" offset="462">
- <param name="marker_p" type="GLint *" output="true"/>
- <return type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ReadInstrumentsSGIX" offset="463">
- <param name="marker" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="StartInstrumentsSGIX" offset="464">
- <glx ignore="true"/>
- </function>
-
- <function name="StopInstrumentsSGIX" offset="465">
- <param name="marker" type="GLint"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIX_texture_scale_bias" number="56">
- <enum name="POST_TEXTURE_FILTER_BIAS_SGIX" count="4" value="0x8179">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="POST_TEXTURE_FILTER_SCALE_SGIX" count="4" value="0x817A">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="POST_TEXTURE_FILTER_BIAS_RANGE_SGIX" value="0x817B"/>
- <enum name="POST_TEXTURE_FILTER_SCALE_RANGE_SGIX" value="0x817C"/>
-</category>
-
-<category name="GL_SGIX_framezoom" number="57">
- <function name="FrameZoomSGIX" offset="466">
- <param name="factor" type="GLint"/>
- <glx rop="2072" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIX_tag_sample_buffer" number="58">
- <function name="TagSampleBufferSGIX" offset="467">
- <glx rop="2050" ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 59 is not listed in the extension registry. -->
-
-<category name="GL_SGIX_reference_plane" number="60">
- <function name="ReferencePlaneSGIX" offset="468">
- <param name="equation" type="const GLdouble *" count="4"/>
- <glx rop="2071" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_SGIX_flush_raster" number="61">
- <function name="FlushRasterSGIX" offset="469">
- <glx vendorpriv="4105" ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 62 is a GLX extension. -->
-
-<category name="GL_SGIX_depth_texture" number="63">
- <enum name="DEPTH_COMPONENT16_SGIX" value="0x81A5"/>
- <enum name="DEPTH_COMPONENT24_SGIX" value="0x81A6"/>
- <enum name="DEPTH_COMPONENT32_SGIX" value="0x81A7"/>
-</category>
-
-<category name="GL_SGIS_fog_function" number="64">
- <function name="FogFuncSGIS" offset="?">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="points" type="const GLfloat *" count="n" count_scale="2"/>
- <glx rop="2067" ignore="true"/>
- </function>
-
- <function name="GetFogFuncSGIS" offset="?">
- <param name="points" type="GLfloat *" output="true"/>
- <!-- GLX protocol for this function is unknown. -->
- </function>
-</category>
-
-<category name="GL_SGIX_fog_offset" number="65">
- <enum name="FOG_OFFSET_SGIX" value="0x8198"/>
- <enum name="FOG_OFFSET_VALUE_SGIX" count="1" value="0x8199">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- </enum>
-</category>
-
-<category name="GL_HP_image_transform" number="66">
- <function name="ImageTransformParameteriHP" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- </function>
-
- <function name="ImageTransformParameterfHP" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- </function>
-
- <function name="ImageTransformParameterivHP" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="ImageTransformParameterfvHP" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-
- <function name="GetImageTransformParameterivHP" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- </function>
-
- <function name="GetImageTransformParameterfvHP" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- </function>
-</category>
-
-<category name="GL_HP_convolution_border_modes" number="67">
- <enum name="IGNORE_BORDER_HP" value="0x8150"/>
- <enum name="CONSTANT_BORDER_HP" value="0x8151"/>
- <enum name="REPLICATE_BORDER_HP" value="0x8153"/>
- <enum name="CONVOLUTION_BORDER_COLOR_HP" count="4" value="0x8154">
- <size name="ConvolutionParameterfv"/>
- <size name="ConvolutionParameteriv"/>
- <size name="GetConvolutionParameterfv" mode="get"/>
- <size name="GetConvolutionParameteriv" mode="get"/>
- </enum>
-</category>
-
-<!-- Extension number 68 is not listed in the extension registry. -->
-<!-- Extension number 70 is not listed in the extension registry. -->
-<!-- Extension number 71 is not listed in the extension registry. -->
-<!-- Extension number 72 is not listed in the extension registry. -->
-<!-- Extension number 73 is not listed in the extension registry. -->
-
-<category name="GL_EXT_color_subtable" number="74">
- <function name="ColorSubTableEXT" alias="ColorSubTable">
- <param name="target" type="GLenum"/>
- <param name="start" type="GLsizei"/>
- <param name="count" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="data" type="const GLvoid *"/>
- </function>
-
- <function name="CopyColorSubTableEXT" alias="CopyColorSubTable">
- <param name="target" type="GLenum"/>
- <param name="start" type="GLsizei"/>
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="width" type="GLsizei"/>
- </function>
-</category>
-
-<!-- Extension number 75 is a GLU extension. -->
-
-<category name="GL_PGI_misc_hints" number="77">
- <function name="HintPGI" offset="544">
- <param name="target" type="GLenum"/>
- <param name="mode" type="GLint"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_paletted_texture" number="78">
- <enum name="COLOR_TABLE_FORMAT_EXT" count="1" value="0x80D8">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_WIDTH_EXT" count="1" value="0x80D9">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_RED_SIZE_EXT" count="1" value="0x80DA">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_GREEN_SIZE_EXT" count="1" value="0x80DB">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_BLUE_SIZE_EXT" count="1" value="0x80DC">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_ALPHA_SIZE_EXT" count="1" value="0x80DD">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_LUMINANCE_SIZE_EXT" count="1" value="0x80DE">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="COLOR_TABLE_INTENSITY_SIZE_EXT" count="1" value="0x80DF">
- <size name="GetColorTableParameterfv" mode="get"/>
- <size name="GetColorTableParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_INDEX_SIZE_EXT" count="1" value="0x80ED">
- <size name="GetTexLevelParameterfv" mode="get"/>
- <size name="GetTexLevelParameteriv" mode="get"/>
- </enum>
-
- <function name="ColorTableEXT" alias="ColorTable">
- <param name="target" type="GLenum"/>
- <param name="internalformat" type="GLenum"/>
- <param name="width" type="GLsizei"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="table" type="const GLvoid *"/>
- </function>
-
- <function name="GetColorTableEXT" offset="550">
- <param name="target" type="GLenum"/>
- <param name="format" type="GLenum"/>
- <param name="type" type="GLenum"/>
- <param name="data" type="GLvoid *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetColorTableParameterivEXT" offset="551">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetColorTableParameterfvEXT" offset="552">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_clip_volume_hint" number="79">
- <enum name="CLIP_VOLUME_CLIPPING_HINT_EXT" count="1" value="0x80F0">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_SGIX_list_priority" number="80">
- <function name="GetListParameterfvSGIX" offset="470">
- <param name="list" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetListParameterivSGIX" offset="471">
- <param name="list" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ListParameterfSGIX" offset="472">
- <param name="list" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ListParameterfvSGIX" offset="473">
- <param name="list" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ListParameteriSGIX" offset="474">
- <param name="list" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ListParameterivSGIX" offset="475">
- <param name="list" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 82 is not listed in the extension registry. -->
-<!-- Extension number 83 is a GLX extension. -->
-
-<category name="GL_SGIX_texture_lod_bias" number="84">
- <enum name="TEXTURE_LOD_BIAS_S_SGIX" count="1" value="0x818E">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_LOD_BIAS_T_SGIX" count="1" value="0x818F">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_LOD_BIAS_R_SGIX" count="1" value="0x8190">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<!-- Extension number 85 is a GLU extension. -->
-<!-- Extension number 86 is a GLX extension. -->
-<!-- Extension number 87 is not listed in the extension registry. -->
-<!-- Extension number 88 is not listed in the extension registry. -->
-<!-- Extension number 89 is not listed in the extension registry. -->
-
-
-<category name="GL_SGIX_shadow_ambient" number="90">
- <enum name="SHADOW_AMBIENT_SGIX" count="1" value="0x80BF">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<!-- Extension number 91 is a GLX extension. -->
-<!-- Extension number 92 is a GLX extension. -->
-
-<category name="GL_EXT_index_material" number="94">
- <function name="IndexMaterialEXT" offset="538">
- <param name="face" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_index_func" number="95">
- <function name="IndexFuncEXT" offset="539">
- <param name="func" type="GLenum"/>
- <param name="ref" type="GLclampf"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_compiled_vertex_array" number="97">
- <function name="LockArraysEXT" offset="540">
- <param name="first" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <glx handcode="true" ignore="true"/>
- </function>
-
- <function name="UnlockArraysEXT" offset="541">
- <glx handcode="true" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_cull_vertex" number="98">
- <enum name="CULL_VERTEX_EXT" value="0x81AA"/>
- <enum name="CULL_VERTEX_OBJECT_POSITION_EXT" count="4" value="0x81AB">
- <size name="CullParameterfv"/>
- <size name="CullParameterdv"/>
- </enum>
- <enum name="CULL_VERTEX_EYE_POSITION_EXT" count="4" value="0x81AC">
- <size name="CullParameterfv"/>
- <size name="CullParameterdv"/>
- </enum>
-
- <function name="CullParameterdvEXT" offset="542">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLdouble *"/> <!-- Spec bug. Should be const. -->
- <glx ignore="true"/>
- </function>
-
- <function name="CullParameterfvEXT" offset="543">
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *"/> <!-- Spec bug. Should be const. -->
- <glx ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 99 is not listed in the extension registry. -->
-<!-- Extension number 100 is a GLU extension. -->
-
-<!-- Shouldn't this be EXT_fragment_lighting? -->
-<category name="GL_SGIX_fragment_lighting" number="102">
- <function name="FragmentColorMaterialSGIX" offset="476">
- <param name="face" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightfSGIX" offset="477">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightfvSGIX" offset="478">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightiSGIX" offset="479">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightivSGIX" offset="480">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightModelfSGIX" offset="481">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightModelfvSGIX" offset="482">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightModeliSGIX" offset="483">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentLightModelivSGIX" offset="484">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentMaterialfSGIX" offset="485">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentMaterialfvSGIX" offset="486">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentMaterialiSGIX" offset="487">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FragmentMaterialivSGIX" offset="488">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetFragmentLightfvSGIX" offset="489">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetFragmentLightivSGIX" offset="490">
- <param name="light" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetFragmentMaterialfvSGIX" offset="491">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetFragmentMaterialivSGIX" offset="492">
- <param name="face" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx ignore="true"/>
- </function>
-
- <function name="LightEnviSGIX" offset="493">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 103 is not listed in the extension registry. -->
-<!-- Extension number 104 is not listed in the extension registry. -->
-<!-- Extension number 105 is not listed in the extension registry. -->
-<!-- Extension number 106 is not listed in the extension registry. -->
-<!-- Extension number 107 is not listed in the extension registry. -->
-<!-- Extension number 108 is not listed in the extension registry. -->
-<!-- Extension number 109 is not listed in the extension registry. -->
-
-<category name="GL_IBM_rasterpos_clip" number="110">
- <enum name="RASTER_POSITION_UNCLIPPED_IBM" count="1" value="0x19262">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_EXT_draw_range_elements" number="112">
- <function name="DrawRangeElementsEXT" alias="DrawRangeElements">
- <param name="mode" type="GLenum"/>
- <param name="start" type="GLuint"/>
- <param name="end" type="GLuint"/>
- <param name="count" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<!-- Extension number 115 is a GLX extension. -->
-<!-- Extension number 116 is not listed in the extension registry. -->
-
-<category name="GL_EXT_light_texture" number="117">
- <function name="ApplyTextureEXT" offset="?">
- <param name="mode" type="GLenum"/>
- </function>
-
- <function name="TextureLightEXT" offset="?">
- <param name="pname" type="GLenum"/>
- </function>
-
- <function name="TextureMaterialEXT" offset="?">
- <param name="face" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- </function>
-</category>
-
-<!-- Extension number 118 is not listed in the extension registry. -->
-<!-- Extension number 121 is not listed in the extension registry. -->
-<!-- Extension number 122 is not listed in the extension registry. -->
-<!-- Extension number 123 is not listed in the extension registry. -->
-<!-- Extension number 124 is not listed in the extension registry. -->
-<!-- Extension number 125 is not listed in the extension registry. -->
-<!-- Extension number 126 is not listed in the extension registry. -->
-<!-- Extension number 128 is not listed in the extension registry. -->
-<!-- Extension number 130 is not listed in the extension registry. -->
-<!-- Extension number 131 is not listed in the extension registry. -->
-
-<category name="GL_SGIX_async" number="132">
- <function name="AsyncMarkerSGIX" offset="?">
- <param name="marker" type="GLuint"/>
- </function>
-
- <function name="FinishAsyncSGIX" offset="?">
- <param name="markerp" type="GLuint *"/> <!-- Spec bug. Should be const. -->
- <return type="GLint"/>
- </function>
-
- <function name="PollAsyncSGIX" offset="?">
- <param name="markerp" type="GLuint *"/> <!-- Spec bug. Should be const. -->
- <return type="GLint"/>
- </function>
-
- <function name="GenAsyncMarkersSGIX" offset="?">
- <param name="range" type="GLsizei"/>
- <return type="GLuint"/>
- </function>
-
- <function name="DeleteAsyncMarkersSGIX" offset="?">
- <param name="marker" type="GLuint"/>
- <param name="range" type="GLsizei"/>
- </function>
-
- <function name="IsAsyncMarkerSGIX" offset="?">
- <param name="marker" type="GLuint"/>
- <return type="GLboolean"/>
- </function>
-</category>
-
-<category name="GL_INTEL_parallel_arrays" number="136">
- <function name="VertexPointervINTEL" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="pointer" type="const GLvoid **"/>
- </function>
-
- <function name="NormalPointervINTEL" offset="?">
- <param name="type" type="GLenum"/>
- <param name="pointer" type="const GLvoid **"/>
- </function>
-
- <function name="ColorPointervINTEL" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="pointer" type="const GLvoid **"/>
- </function>
-
- <function name="TexCoordPointervINTEL" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="pointer" type="const GLvoid **"/>
- </function>
-</category>
-
-<category name="GL_HP_occlusion_test" number="137">
- <enum name="OCCLUSION_TEST_HP" count="1" value="0x8165">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="OCCLUSION_TEST_RESULT_HP" count="1" value="0x8166">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_EXT_pixel_transform" number="138">
- <function name="PixelTransformParameteriEXT" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- </function>
-
- <function name="PixelTransformParameterfEXT" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- </function>
-
- <function name="PixelTransformParameterivEXT" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="PixelTransformParameterfvEXT" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-</category>
-
-<!-- Extension number 140 is not listed in the extension registry. -->
-
-<category name="GL_EXT_shared_texture_palette" number="141">
- <enum name="SHARED_TEXTURE_PALETTE_EXT" count="1" value="0x81FB"/>
-</category>
-
-<!-- Extension number 142 is a GLX extension. -->
-<!-- Extension number 143 is not listed in the extension registry. -->
-
-<category name="GL_EXT_separate_specular_color" number="144">
- <enum name="LIGHT_MODEL_COLOR_CONTROL_EXT" count="1" value="0x81F8">
- <size name="LightModelfv"/>
- <size name="LightModeliv"/>
- </enum>
- <enum name="SINGLE_COLOR_EXT" value="0x81F9"/>
- <enum name="SEPARATE_SPECULAR_COLOR_EXT" value="0x81FA"/>
-</category>
-
-<category name="GL_EXT_secondary_color" number="145">
- <function name="SecondaryColor3bEXT" offset="561" vectorequiv="SecondaryColor3bvEXT">
- <param name="red" type="GLbyte"/>
- <param name="green" type="GLbyte"/>
- <param name="blue" type="GLbyte"/>
- </function>
-
- <function name="SecondaryColor3bvEXT" offset="562">
- <param name="v" type="const GLbyte *" count="3"/>
- <glx rop="4126"/>
- </function>
-
- <function name="SecondaryColor3dEXT" offset="563" vectorequiv="SecondaryColor3dvEXT">
- <param name="red" type="GLdouble"/>
- <param name="green" type="GLdouble"/>
- <param name="blue" type="GLdouble"/>
- </function>
-
- <function name="SecondaryColor3dvEXT" offset="564">
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="4130"/>
- </function>
-
- <function name="SecondaryColor3fEXT" offset="565" vectorequiv="SecondaryColor3fvEXT">
- <param name="red" type="GLfloat"/>
- <param name="green" type="GLfloat"/>
- <param name="blue" type="GLfloat"/>
- </function>
-
- <function name="SecondaryColor3fvEXT" offset="566">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="4129"/>
- </function>
-
- <function name="SecondaryColor3iEXT" offset="567" vectorequiv="SecondaryColor3ivEXT">
- <param name="red" type="GLint"/>
- <param name="green" type="GLint"/>
- <param name="blue" type="GLint"/>
- </function>
-
- <function name="SecondaryColor3ivEXT" offset="568">
- <param name="v" type="const GLint *" count="3"/>
- <glx rop="4128"/>
- </function>
-
- <function name="SecondaryColor3sEXT" offset="569" vectorequiv="SecondaryColor3svEXT">
- <param name="red" type="GLshort"/>
- <param name="green" type="GLshort"/>
- <param name="blue" type="GLshort"/>
- </function>
-
- <function name="SecondaryColor3svEXT" offset="570">
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="4127"/>
- </function>
-
- <function name="SecondaryColor3ubEXT" offset="571" vectorequiv="SecondaryColor3ubvEXT">
- <param name="red" type="GLubyte"/>
- <param name="green" type="GLubyte"/>
- <param name="blue" type="GLubyte"/>
- </function>
-
- <function name="SecondaryColor3ubvEXT" offset="572">
- <param name="v" type="const GLubyte *" count="3"/>
- <glx rop="4131"/>
- </function>
-
- <function name="SecondaryColor3uiEXT" offset="573" vectorequiv="SecondaryColor3uivEXT">
- <param name="red" type="GLuint"/>
- <param name="green" type="GLuint"/>
- <param name="blue" type="GLuint"/>
- </function>
-
- <function name="SecondaryColor3uivEXT" offset="574">
- <param name="v" type="const GLuint *" count="3"/>
- <glx rop="4133"/>
- </function>
-
- <function name="SecondaryColor3usEXT" offset="575" vectorequiv="SecondaryColor3usvEXT">
- <param name="red" type="GLushort"/>
- <param name="green" type="GLushort"/>
- <param name="blue" type="GLushort"/>
- </function>
-
- <function name="SecondaryColor3usvEXT" offset="576">
- <param name="v" type="const GLushort *" count="3"/>
- <glx rop="4132"/>
- </function>
-
- <function name="SecondaryColorPointerEXT" offset="577">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_texture_perturb_normal" number="147">
- <function name="TextureNormalEXT" offset="?">
- <param name="mode" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_EXT_multi_draw_arrays" number="148">
- <function name="MultiDrawArraysEXT" offset="644">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. -->
- <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. -->
- <param name="primcount" type="GLsizei"/>
- <glx handcode="true"/>
- </function>
-
- <function name="MultiDrawElementsEXT" offset="645">
- <param name="mode" type="GLenum"/>
- <param name="count" type="const GLsizei *"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid **"/>
- <param name="primcount" type="GLsizei"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_fog_coord" number="149">
- <function name="FogCoordfEXT" offset="545" vectorequiv="FogCoordfvEXT">
- <param name="coord" type="GLfloat"/>
- </function>
-
- <function name="FogCoordfvEXT" offset="546">
- <param name="coord" type="const GLfloat *" count="1"/>
- <glx rop="4124"/>
- </function>
-
- <function name="FogCoorddEXT" offset="547" vectorequiv="FogCoorddvEXT">
- <param name="coord" type="GLdouble"/>
- </function>
-
- <function name="FogCoorddvEXT" offset="548">
- <param name="coord" type="const GLdouble *" count="1"/>
- <glx rop="4125"/>
- </function>
-
- <function name="FogCoordPointerEXT" offset="549">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-</category>
-
-<!-- Extension number 150 is not listed in the extension registry. -->
-<!-- Extension number 151 is not listed in the extension registry. -->
-<!-- Extension number 152 is not listed in the extension registry. -->
-<!-- Extension number 153 is not listed in the extension registry. -->
-<!-- Extension number 154 is not listed in the extension registry. -->
-
-<category name="GL_EXT_coordinate_frame" number="156">
- <function name="Tangent3bEXT" offset="?">
- <param name="tx" type="GLbyte"/>
- <param name="ty" type="GLbyte"/>
- <param name="tz" type="GLbyte"/>
- </function>
-
- <function name="Tangent3bvEXT" offset="?">
- <param name="v" type="const GLbyte *"/>
- </function>
-
- <function name="Tangent3dEXT" offset="?">
- <param name="tx" type="GLdouble"/>
- <param name="ty" type="GLdouble"/>
- <param name="tz" type="GLdouble"/>
- </function>
-
- <function name="Tangent3dvEXT" offset="?">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="Tangent3fEXT" offset="?">
- <param name="tx" type="GLfloat"/>
- <param name="ty" type="GLfloat"/>
- <param name="tz" type="GLfloat"/>
- </function>
-
- <function name="Tangent3fvEXT" offset="?">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="Tangent3iEXT" offset="?">
- <param name="tx" type="GLint"/>
- <param name="ty" type="GLint"/>
- <param name="tz" type="GLint"/>
- </function>
-
- <function name="Tangent3ivEXT" offset="?">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="Tangent3sEXT" offset="?">
- <param name="tx" type="GLshort"/>
- <param name="ty" type="GLshort"/>
- <param name="tz" type="GLshort"/>
- </function>
-
- <function name="Tangent3svEXT" offset="?">
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="Binormal3bEXT" offset="?">
- <param name="bx" type="GLbyte"/>
- <param name="by" type="GLbyte"/>
- <param name="bz" type="GLbyte"/>
- </function>
-
- <function name="Binormal3bvEXT" offset="?">
- <param name="v" type="const GLbyte *"/>
- </function>
-
- <function name="Binormal3dEXT" offset="?">
- <param name="bx" type="GLdouble"/>
- <param name="by" type="GLdouble"/>
- <param name="bz" type="GLdouble"/>
- </function>
-
- <function name="Binormal3dvEXT" offset="?">
- <param name="v" type="const GLdouble *"/>
- </function>
-
- <function name="Binormal3fEXT" offset="?">
- <param name="bx" type="GLfloat"/>
- <param name="by" type="GLfloat"/>
- <param name="bz" type="GLfloat"/>
- </function>
-
- <function name="Binormal3fvEXT" offset="?">
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="Binormal3iEXT" offset="?">
- <param name="bx" type="GLint"/>
- <param name="by" type="GLint"/>
- <param name="bz" type="GLint"/>
- </function>
-
- <function name="Binormal3ivEXT" offset="?">
- <param name="v" type="const GLint *"/>
- </function>
-
- <function name="Binormal3sEXT" offset="?">
- <param name="bx" type="GLshort"/>
- <param name="by" type="GLshort"/>
- <param name="bz" type="GLshort"/>
- </function>
-
- <function name="Binormal3svEXT" offset="?">
- <param name="v" type="const GLshort *"/>
- </function>
-
- <function name="TangentPointerEXT" offset="?">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- </function>
-
- <function name="BinormalPointerEXT" offset="?">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- </function>
-</category>
-
-<!-- Extension number 157 is not listed in the extension registry. -->
-
-<category name="GL_EXT_texture_env_combine" number="158">
- <enum name="COMBINE_EXT" value="0x8570"/>
- <enum name="COMBINE_RGB_EXT" count="1" value="0x8571"/>
- <enum name="COMBINE_ALPHA_EXT" count="1" value="0x8572"/>
- <enum name="RGB_SCALE_EXT" count="1" value="0x8573"/>
- <enum name="ADD_SIGNED_EXT" value="0x8574"/>
- <enum name="INTERPOLATE_EXT" value="0x8575"/>
- <enum name="CONSTANT_EXT" value="0x8576"/>
- <enum name="PRIMARY_COLOR_EXT" value="0x8577"/>
- <enum name="PREVIOUS_EXT" value="0x8578"/>
- <enum name="SOURCE0_RGB_EXT" count="1" value="0x8580"/>
- <enum name="SOURCE1_RGB_EXT" count="1" value="0x8581"/>
- <enum name="SOURCE2_RGB_EXT" count="1" value="0x8582"/>
- <enum name="SOURCE0_ALPHA_EXT" count="1" value="0x8588"/>
- <enum name="SOURCE1_ALPHA_EXT" count="1" value="0x8589"/>
- <enum name="SOURCE2_ALPHA_EXT" count="1" value="0x858A"/>
- <enum name="OPERAND0_RGB_EXT" count="1" value="0x8590"/>
- <enum name="OPERAND1_RGB_EXT" count="1" value="0x8591"/>
- <enum name="OPERAND2_RGB_EXT" count="1" value="0x8592"/>
- <enum name="OPERAND0_ALPHA_EXT" count="1" value="0x8598"/>
- <enum name="OPERAND1_ALPHA_EXT" count="1" value="0x8599"/>
- <enum name="OPERAND2_ALPHA_EXT" count="1" value="0x859A"/>
-</category>
-
-<category name="GL_SGIX_pixel_texture" number="160">
- <function name="PixelTexGenSGIX" offset="430">
- <param name="mode" type="GLenum"/>
- <glx rop="2059" ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 161 is not listed in the extension registry. -->
-<!-- Extension number 162 is not listed in the extension registry. -->
-
-<category name="GL_SUNX_constant_data" number="163">
- <function name="FinishTextureSUNX" offset="?">
- </function>
-</category>
-
-<category name="GL_SUN_global_alpha" number="164">
- <function name="GlobalAlphaFactorbSUN" offset="?">
- <param name="factor" type="GLbyte"/>
- </function>
-
- <function name="GlobalAlphaFactorsSUN" offset="?">
- <param name="factor" type="GLshort"/>
- </function>
-
- <function name="GlobalAlphaFactoriSUN" offset="?">
- <param name="factor" type="GLint"/>
- </function>
-
- <function name="GlobalAlphaFactorfSUN" offset="?">
- <param name="factor" type="GLfloat"/>
- </function>
-
- <function name="GlobalAlphaFactordSUN" offset="?">
- <param name="factor" type="GLdouble"/>
- </function>
-
- <function name="GlobalAlphaFactorubSUN" offset="?">
- <param name="factor" type="GLubyte"/>
- </function>
-
- <function name="GlobalAlphaFactorusSUN" offset="?">
- <param name="factor" type="GLushort"/>
- </function>
-
- <function name="GlobalAlphaFactoruiSUN" offset="?">
- <param name="factor" type="GLuint"/>
- </function>
-</category>
-
-<category name="GL_SUN_triangle_list" number="165">
- <function name="ReplacementCodeuiSUN" offset="?">
- <param name="code" type="GLuint"/>
- </function>
-
- <function name="ReplacementCodeusSUN" offset="?">
- <param name="code" type="GLushort"/>
- </function>
-
- <function name="ReplacementCodeubSUN" offset="?">
- <param name="code" type="GLubyte"/>
- </function>
-
- <function name="ReplacementCodeuivSUN" offset="?">
- <param name="code" type="const GLuint *"/>
- </function>
-
- <function name="ReplacementCodeusvSUN" offset="?">
- <param name="code" type="const GLushort *"/>
- </function>
-
- <function name="ReplacementCodeubvSUN" offset="?">
- <param name="code" type="const GLubyte *"/>
- </function>
-
- <function name="ReplacementCodePointerSUN" offset="?">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- </function>
-</category>
-
-<category name="GL_SUN_vertex" number="166">
- <function name="Color4ubVertex2fSUN" offset="?">
- <param name="r" type="GLubyte"/>
- <param name="g" type="GLubyte"/>
- <param name="b" type="GLubyte"/>
- <param name="a" type="GLubyte"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="Color4ubVertex2fvSUN" offset="?">
- <param name="c" type="const GLubyte *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="Color4ubVertex3fSUN" offset="?">
- <param name="r" type="GLubyte"/>
- <param name="g" type="GLubyte"/>
- <param name="b" type="GLubyte"/>
- <param name="a" type="GLubyte"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="Color4ubVertex3fvSUN" offset="?">
- <param name="c" type="const GLubyte *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="Color3fVertex3fSUN" offset="?">
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="Color3fVertex3fvSUN" offset="?">
- <param name="c" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="Normal3fVertex3fSUN" offset="?">
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="Normal3fVertex3fvSUN" offset="?">
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="Color4fNormal3fVertex3fSUN" offset="?">
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="a" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="Color4fNormal3fVertex3fvSUN" offset="?">
- <param name="c" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord2fVertex3fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="TexCoord2fVertex3fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord4fVertex4fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="p" type="GLfloat"/>
- <param name="q" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="TexCoord4fVertex4fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord2fColor4ubVertex3fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLubyte"/>
- <param name="g" type="GLubyte"/>
- <param name="b" type="GLubyte"/>
- <param name="a" type="GLubyte"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="TexCoord2fColor4ubVertex3fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="c" type="const GLubyte *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord2fColor3fVertex3fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="TexCoord2fColor3fVertex3fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="c" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord2fNormal3fVertex3fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="TexCoord2fNormal3fVertex3fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord2fColor4fNormal3fVertex3fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="a" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="TexCoord2fColor4fNormal3fVertex3fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="c" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="TexCoord4fColor4fNormal3fVertex4fSUN" offset="?">
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="p" type="GLfloat"/>
- <param name="q" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="a" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="TexCoord4fColor4fNormal3fVertex4fvSUN" offset="?">
- <param name="tc" type="const GLfloat *"/>
- <param name="c" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiColor4ubVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="r" type="GLubyte"/>
- <param name="g" type="GLubyte"/>
- <param name="b" type="GLubyte"/>
- <param name="a" type="GLubyte"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiColor4ubVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="c" type="const GLubyte *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiColor3fVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiColor3fVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="c" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiNormal3fVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiNormal3fVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiColor4fNormal3fVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="a" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiColor4fNormal3fVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="c" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiTexCoord2fVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiTexCoord2fVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="tc" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="tc" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-
- <function name="ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN" offset="?">
- <param name="rc" type="GLuint"/>
- <param name="s" type="GLfloat"/>
- <param name="t" type="GLfloat"/>
- <param name="r" type="GLfloat"/>
- <param name="g" type="GLfloat"/>
- <param name="b" type="GLfloat"/>
- <param name="a" type="GLfloat"/>
- <param name="nx" type="GLfloat"/>
- <param name="ny" type="GLfloat"/>
- <param name="nz" type="GLfloat"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN" offset="?">
- <param name="rc" type="const GLuint *"/>
- <param name="tc" type="const GLfloat *"/>
- <param name="c" type="const GLfloat *"/>
- <param name="n" type="const GLfloat *"/>
- <param name="v" type="const GLfloat *"/>
- </function>
-</category>
-
-<!-- Extension number 167 is a WGL extension. -->
-<!-- Extension number 168 is a WGL extension. -->
-<!-- Extension number 169 is a WGL extension. -->
-<!-- Extension number 170 is a WGL extension. -->
-<!-- Extension number 171 is a WGL extension. -->
-<!-- Extension number 172 is a WGL extension. -->
-
-<category name="GL_EXT_blend_func_separate" number="173">
- <function name="BlendFuncSeparateEXT" offset="537">
- <param name="sfactorRGB" type="GLenum"/>
- <param name="dfactorRGB" type="GLenum"/>
- <param name="sfactorAlpha" type="GLenum"/>
- <param name="dfactorAlpha" type="GLenum"/>
- <glx rop="4134"/>
- </function>
-</category>
-
-<category name="GL_EXT_stencil_wrap" number="176">
- <enum name="INCR_WRAP_EXT" value="0x8507"/>
- <enum name="DECR_WRAP_EXT" value="0x8508"/>
-</category>
-
-<!-- Extension number 177 is a WGL extension. -->
-
-<category name="GL_NV_texgen_reflection" number="179">
- <enum name="NORMAL_MAP_NV" value="0x8511"/>
- <enum name="REFLECTION_MAP_NV" value="0x8512"/>
-</category>
-
-<!-- Extension number 180 is not listed in the extension registry. -->
-
-<category name="GL_SUN_convolution_border_modes" number="182">
- <enum name="WRAP_BORDER_SUN" value="0x81D4"/>
-</category>
-
-<!-- Extension number 183 is a GLX extension. -->
-<!-- Extension number 184 is not listed in the extension registry. -->
-
-<category name="GL_EXT_texture_env_add" number="185">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_EXT_texture_lod_bias" number="186">
- <enum name="TEXTURE_LOD_BIAS_EXT" count="1" value="0x8501">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_EXT_texture_filter_anisotropic" number="187">
- <enum name="TEXTURE_MAX_ANISOTROPY_EXT" count="1" value="0x84FE">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="MAX_TEXTURE_MAX_ANISOTROPY_EXT" value="0x84FF"/>
-</category>
-
-<category name="GL_EXT_vertex_weighting" number="188">
- <function name="VertexWeightfEXT" offset="494" vectorequiv="VertexWeightfvEXT">
- <param name="weight" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="VertexWeightfvEXT" offset="495">
- <param name="weight" type="const GLfloat *" count="1"/>
- <glx rop="4135" ignore="true"/>
- </function>
-
- <function name="VertexWeightPointerEXT" offset="496">
- <param name="size" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_NV_light_max_exponent" number="189">
- <enum name="MAX_SHININESS_NV" count="1" value="0x8504">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="MAX_SPOT_EXPONENT_NV" count="1" value="0x8505">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_NV_vertex_array_range" number="190">
- <function name="FlushVertexArrayRangeNV" offset="497">
- <glx ignore="true"/>
- </function>
-
- <function name="VertexArrayRangeNV" offset="498">
- <param name="length" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_NV_register_combiners" number="191">
- <function name="CombinerParameterfvNV" offset="499">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *" variable_param="pname"/>
- <glx rop="4137" ignore="true"/>
- </function>
-
- <function name="CombinerParameterfNV" offset="500">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- <glx rop="4136" ignore="true"/>
- </function>
-
- <function name="CombinerParameterivNV" offset="501">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="4139" ignore="true"/>
- </function>
-
- <function name="CombinerParameteriNV" offset="502">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="4138" ignore="true"/>
- </function>
-
- <function name="CombinerInputNV" offset="503">
- <param name="stage" type="GLenum"/>
- <param name="portion" type="GLenum"/>
- <param name="variable" type="GLenum"/>
- <param name="input" type="GLenum"/>
- <param name="mapping" type="GLenum"/>
- <param name="componentUsage" type="GLenum"/>
- <glx rop="4140" ignore="true"/>
- </function>
-
- <function name="CombinerOutputNV" offset="504">
- <param name="stage" type="GLenum"/>
- <param name="portion" type="GLenum"/>
- <param name="abOutput" type="GLenum"/>
- <param name="cdOutput" type="GLenum"/>
- <param name="sumOutput" type="GLenum"/>
- <param name="scale" type="GLenum"/>
- <param name="bias" type="GLenum"/>
- <param name="abDotProduct" type="GLboolean"/>
- <param name="cdDotProduct" type="GLboolean"/>
- <param name="muxSum" type="GLboolean"/>
- <glx rop="4141" ignore="true"/>
- </function>
-
- <function name="FinalCombinerInputNV" offset="505">
- <param name="variable" type="GLenum"/>
- <param name="input" type="GLenum"/>
- <param name="mapping" type="GLenum"/>
- <param name="componentUsage" type="GLenum"/>
- <glx rop="4142" ignore="true"/>
- </function>
-
- <function name="GetCombinerInputParameterfvNV" offset="506">
- <param name="stage" type="GLenum"/>
- <param name="portion" type="GLenum"/>
- <param name="variable" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- <glx vendorpriv="1270" ignore="true"/>
- </function>
-
- <function name="GetCombinerInputParameterivNV" offset="507">
- <param name="stage" type="GLenum"/>
- <param name="portion" type="GLenum"/>
- <param name="variable" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx vendorpriv="1271" ignore="true"/>
- </function>
-
- <function name="GetCombinerOutputParameterfvNV" offset="508">
- <param name="stage" type="GLenum"/>
- <param name="portion" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- <glx vendorpriv="1272" ignore="true"/>
- </function>
-
- <function name="GetCombinerOutputParameterivNV" offset="509">
- <param name="stage" type="GLenum"/>
- <param name="portion" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx vendorpriv="1273" ignore="true"/>
- </function>
-
- <function name="GetFinalCombinerInputParameterfvNV" offset="510">
- <param name="variable" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- <glx vendorpriv="1274" ignore="true"/>
- </function>
-
- <function name="GetFinalCombinerInputParameterivNV" offset="511">
- <param name="variable" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx vendorpriv="1275" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_NV_fog_distance" number="192">
- <enum name="FOG_DISTANCE_MODE_NV" count="1" value="0x855A">
- <size name="Fogfv"/>
- <size name="Fogiv"/>
- <size name="Get" mode="get"/>
- </enum>
- <enum name="EYE_RADIAL_NV" value="0x855B"/>
- <enum name="EYE_PLANE_ABSOLUTE_NV" value="0x855C"/>
-</category>
-
-<category name="GL_NV_blend_square" number="194">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_NV_texture_env_combine4" number="195">
- <enum name="COMBINE4" value="0x8503"/>
- <enum name="SOURCE3_RGB_NV" count="1" value="0x8583">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="SOURCE3_ALPHA_NV" count="1" value="0x858B">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND3_RGB_NV" count="1" value="0x8593">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="OPERAND3_ALPHA_NV" count="1" value="0x859B">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_MESA_resize_buffers" number="196">
- <function name="ResizeBuffersMESA" offset="512">
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_MESA_window_pos" number="197">
- <function name="WindowPos2dMESA" offset="513">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2dvMESA" offset="514">
- <param name="v" type="const GLdouble *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2fMESA" offset="515">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2fvMESA" offset="516">
- <param name="v" type="const GLfloat *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2iMESA" offset="517">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2ivMESA" offset="518">
- <param name="v" type="const GLint *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2sMESA" offset="519">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos2svMESA" offset="520">
- <param name="v" type="const GLshort *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos3dMESA" offset="521">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos3dvMESA" offset="522">
- <param name="v" type="const GLdouble *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos3fMESA" offset="523" vectorequiv="WindowPos3fvMESA">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="WindowPos3fvMESA" offset="524">
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="230"/>
- </function>
-
- <function name="WindowPos3iMESA" offset="525">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos3ivMESA" offset="526">
- <param name="v" type="const GLint *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos3sMESA" offset="527">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos3svMESA" offset="528">
- <param name="v" type="const GLshort *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="WindowPos4dMESA" offset="529">
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4dvMESA" offset="530">
- <param name="v" type="const GLdouble *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4fMESA" offset="531">
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4fvMESA" offset="532">
- <param name="v" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4iMESA" offset="533">
- <param name="x" type="GLint"/>
- <param name="y" type="GLint"/>
- <param name="z" type="GLint"/>
- <param name="w" type="GLint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4ivMESA" offset="534">
- <param name="v" type="const GLint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4sMESA" offset="535">
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- <param name="w" type="GLshort"/>
- <glx ignore="true"/>
- </function>
-
- <function name="WindowPos4svMESA" offset="536">
- <param name="v" type="const GLshort *"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_texture_compression_s3tc" number="198">
- <enum name="COMPRESSED_RGB_S3TC_DXT1_EXT" value="0x83F0"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT1_EXT" value="0x83F1"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT3_EXT" value="0x83F2"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT5_EXT" value="0x83F3"/>
-</category>
-
-<category name="GL_IBM_multimode_draw_arrays" number="200">
- <function name="MultiModeDrawArraysIBM" offset="708">
- <param name="mode" type="const GLenum *"/>
- <param name="first" type="const GLint *"/>
- <param name="count" type="const GLsizei *"/>
- <param name="primcount" type="GLsizei"/>
- <param name="modestride" type="GLint"/>
- <glx handcode="true" ignore="true"/>
- </function>
-
- <function name="MultiModeDrawElementsIBM" offset="709">
- <param name="mode" type="const GLenum *"/>
- <param name="count" type="const GLsizei *"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid * const *"/>
- <param name="primcount" type="GLsizei"/>
- <param name="modestride" type="GLint"/>
- <glx handcode="true" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_IBM_vertex_array_lists" number="201">
- <function name="ColorPointerListIBM" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="SecondaryColorPointerListIBM" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="EdgeFlagPointerListIBM" offset="?">
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLboolean **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="FogCoordPointerListIBM" offset="?">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="IndexPointerListIBM" offset="?">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="NormalPointerListIBM" offset="?">
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="TexCoordPointerListIBM" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-
- <function name="VertexPointerListIBM" offset="?">
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLint"/>
- <param name="pointer" type="const GLvoid **"/>
- <param name="ptrstride" type="GLint"/>
- </function>
-</category>
-
-<!-- Extension number 202 is not listed in the extension registry. -->
-<!-- Extension number 203 is not listed in the extension registry. -->
-<!-- Extension number 204 is not listed in the extension registry. -->
-<!-- Extension number 205 is not listed in the extension registry. -->
-
-<category name="GL_3DFX_texture_compression_FXT1" number="206">
- <enum name="COMPRESSED_RGB_FXT1_3DFX" value="0x86B0"/>
- <enum name="COMPRESSED_RGBA_FXT1_3DFX" value="0x86B1"/>
-</category>
-
-<category name="GL_3DFX_multisample" number="207">
- <enum name="MULTISAMPLE_3DFX" value="0x86B2"/>
- <enum name="SAMPLE_BUFFERS_3DFX" value="0x86B3"/>
- <enum name="SAMPLES_3DFX" value="0x86B4"/>
- <enum name="MULTISAMPLE_BIT_3DFX" value="0x20000000"/>
-</category>
-
-<category name="GL_3DFX_tbuffer" number="208">
- <function name="TbufferMask3DFX" offset="553">
- <param name="mask" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_multisample" number="209">
- <function name="SampleMaskEXT" alias="SampleMaskSGIS">
- <param name="value" type="GLclampf"/>
- <param name="invert" type="GLboolean"/>
- </function>
-
- <function name="SamplePatternEXT" alias="SamplePatternSGIS">
- <param name="pattern" type="GLenum"/>
- </function>
-</category>
-
-<!-- Extension number 211 is not listed in the extension registry. -->
-<!-- Extension number 213 is not listed in the extension registry. -->
-
-<category name="GL_SGIS_texture_color_mask" number="214">
- <enum name="TEXTURE_COLOR_WRITEMASK_SGIS" value="0x81EF"/>
-
- <function name="TextureColorMaskSGIS" offset="?">
- <param name="red" type="GLboolean"/>
- <param name="green" type="GLboolean"/>
- <param name="blue" type="GLboolean"/>
- <param name="alpha" type="GLboolean"/>
- <glx rop="2082" ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 215 is a GLX extension. -->
-<!-- Extension number 216 is a GLX extension. -->
-<!-- Extension number 217 is a GLX extension. -->
-<!-- Extension number 218 is a GLX extension. -->
-<!-- Extension number 219 is not listed in the extension registry. -->
-
-<category name="GL_EXT_texture_env_dot3" number="220">
- <enum name="DOT3_RGB_EXT" value="0x8740"/>
- <enum name="DOT3_RGBA_EXT" value="0x8741"/>
-</category>
-
-<category name="GL_ATI_texture_mirror_once" number="221">
- <enum name="MIRROR_CLAMP_ATI" value="0x8742"/>
- <enum name="MIRROR_CLAMP_TO_EDGE_ATI" value="0x8743"/>
-</category>
-
-<category name="GL_NV_fence" number="222">
- <function name="DeleteFencesNV" offset="647">
- <param name="n" type="GLsizei"/>
- <param name="fences" type="const GLuint *"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GenFencesNV" offset="648">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="fences" type="GLuint *" output="true" count="n"/>
- <glx ignore="true"/>
- </function>
-
- <function name="IsFenceNV" offset="649">
- <param name="fence" type="GLuint"/>
- <return type="GLboolean"/>
- <glx ignore="true"/>
- </function>
-
- <function name="TestFenceNV" offset="650">
- <param name="fence" type="GLuint"/>
- <return type="GLboolean"/>
- <glx ignore="true"/>
- </function>
-
- <function name="GetFenceivNV" offset="651">
- <param name="fence" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- <glx ignore="true"/>
- </function>
-
- <function name="FinishFenceNV" offset="652">
- <param name="fence" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="SetFenceNV" offset="653">
- <param name="fence" type="GLuint"/>
- <param name="condition" type="GLenum"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<category name="GL_IBM_texture_mirrored_repeat" number="224">
- <enum name="MIRRORED_REPEAT_IBM" value="0x8370"/>
-</category>
-
-<category name="GL_NV_evaluators" number="225">
- <function name="MapControlPointsNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="type" type="GLenum"/>
- <param name="ustride" type="GLsizei"/>
- <param name="vstride" type="GLsizei"/>
- <param name="uorder" type="GLint"/>
- <param name="vorder" type="GLint"/>
- <param name="packed" type="GLboolean"/>
- <param name="points" type="const GLvoid *"/>
- </function>
-
- <function name="MapParameterivNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="MapParameterfvNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-
- <function name="GetMapControlPointsNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="type" type="GLenum"/>
- <param name="ustride" type="GLsizei"/>
- <param name="vstride" type="GLsizei"/>
- <param name="packed" type="GLboolean"/>
- <param name="points" type="GLvoid *" output="true"/>
- </function>
-
- <function name="GetMapParameterivNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- </function>
-
- <function name="GetMapParameterfvNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- </function>
-
- <function name="GetMapAttribParameterivNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true"/>
- </function>
-
- <function name="GetMapAttribParameterfvNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- </function>
-
- <function name="EvalMapsNV" offset="?">
- <param name="target" type="GLenum"/>
- <param name="mode" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_NV_packed_depth_stencil" number="226">
- <enum name="DEPTH_STENCIL_NV" value="0x84F9"/>
- <enum name="UNSIGNED_INT_24_8_NV" value="0x84FA"/>
-</category>
-
-<category name="GL_NV_register_combiners2" number="227">
- <function name="CombinerStageParameterfvNV" offset="?">
- <param name="stage" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-
- <function name="GetCombinerStageParameterfvNV" offset="?">
- <param name="stage" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true"/>
- </function>
-</category>
-
-<category name="GL_NV_texture_compression_vtc" number="228">
- <enum name="COMPRESSED_RGB_S3TC_DXT1_EXT" value="0x83F0"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT1_EXT" value="0x83F1"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT3_EXT" value="0x83F2"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT5_EXT" value="0x83F3"/>
-</category>
-
-<category name="GL_NV_texture_rectangle" number="229">
- <enum name="TEXTURE_RECTANGLE_NV" count="1" value="0x84F5">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="TEXTURE_BINDING_RECTANGLE_NV" count="1" value="0x84F6">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="PROXY_TEXTURE_RECTANGLE_NV" value="0x84F7"/>
- <enum name="MAX_RECTANGLE_TEXTURE_SIZE_NV" count="1" value="0x84F8">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_NV_vertex_program" number="233">
- <enum name="VERTEX_PROGRAM_NV" value="0x8620"/>
- <enum name="VERTEX_STATE_PROGRAM_NV" value="0x8621"/>
- <enum name="ATTRIB_ARRAY_SIZE_NV" count="1" value="0x8623">
- <size name="GetVertexAttribdvNV" mode="get"/>
- <size name="GetVertexAttribfvNV" mode="get"/>
- <size name="GetVertexAttribivNV" mode="get"/>
- </enum>
- <enum name="ATTRIB_ARRAY_STRIDE_NV" count="1" value="0x8624">
- <size name="GetVertexAttribdvNV" mode="get"/>
- <size name="GetVertexAttribfvNV" mode="get"/>
- <size name="GetVertexAttribivNV" mode="get"/>
- </enum>
- <enum name="ATTRIB_ARRAY_TYPE_NV" count="1" value="0x8625">
- <size name="GetVertexAttribdvNV" mode="get"/>
- <size name="GetVertexAttribfvNV" mode="get"/>
- <size name="GetVertexAttribivNV" mode="get"/>
- </enum>
- <enum name="CURRENT_ATTRIB_NV" count="1" value="0x8626">
- <size name="GetVertexAttribdvNV" mode="get"/>
- <size name="GetVertexAttribfvNV" mode="get"/>
- <size name="GetVertexAttribivNV" mode="get"/>
- </enum>
- <enum name="PROGRAM_LENGTH_NV" count="1" value="0x8627">
- <size name="GetProgramivNV" mode="get"/>
- </enum>
- <enum name="PROGRAM_STRING_NV" value="0x8628"/>
- <enum name="MODELVIEW_PROJECTION_NV" value="0x8629"/>
- <enum name="IDENTITY_NV" value="0x862A"/>
- <enum name="INVERSE_NV" value="0x862B"/>
- <enum name="TRANSPOSE_NV" value="0x862C"/>
- <enum name="INVERSE_TRANSPOSE_NV" value="0x862D"/>
- <enum name="MAX_TRACK_MATRIX_STACK_DEPTH_NV" value="0x862E"/>
- <enum name="MAX_TRACK_MATRICES_NV" value="0x862F"/>
- <enum name="MATRIX0_NV" value="0x8630"/>
- <enum name="MATRIX1_NV" value="0x8631"/>
- <enum name="MATRIX2_NV" value="0x8632"/>
- <enum name="MATRIX3_NV" value="0x8633"/>
- <enum name="MATRIX4_NV" value="0x8634"/>
- <enum name="MATRIX5_NV" value="0x8635"/>
- <enum name="MATRIX6_NV" value="0x8636"/>
- <enum name="MATRIX7_NV" value="0x8637"/>
- <enum name="CURRENT_MATRIX_STACK_DEPTH_NV" value="0x8640"/>
- <enum name="CURRENT_MATRIX_NV" value="0x8641"/>
- <enum name="VERTEX_PROGRAM_POINT_SIZE_NV" value="0x8642"/>
- <enum name="VERTEX_PROGRAM_TWO_SIDE_NV" value="0x8643"/>
- <enum name="PROGRAM_PARAMETER_NV" value="0x8644"/>
- <enum name="ATTRIB_ARRAY_POINTER_NV" value="0x8645"/>
- <enum name="PROGRAM_TARGET_NV" count="1" value="0x8646">
- <size name="GetProgramivNV" mode="get"/>
- </enum>
- <enum name="PROGRAM_RESIDENT_NV" count="1" value="0x8647">
- <size name="GetProgramivNV" mode="get"/>
- </enum>
- <enum name="TRACK_MATRIX_NV" value="0x8648"/>
- <enum name="TRACK_MATRIX_TRANSFORM_NV" value="0x8649"/>
- <enum name="VERTEX_PROGRAM_BINDING_NV" value="0x864A"/>
- <enum name="PROGRAM_ERROR_POSITION_NV" value="0x864B"/>
- <enum name="VERTEX_ATTRIB_ARRAY0_NV" value="0x8650"/>
- <enum name="VERTEX_ATTRIB_ARRAY1_NV" value="0x8651"/>
- <enum name="VERTEX_ATTRIB_ARRAY2_NV" value="0x8652"/>
- <enum name="VERTEX_ATTRIB_ARRAY3_NV" value="0x8653"/>
- <enum name="VERTEX_ATTRIB_ARRAY4_NV" value="0x8654"/>
- <enum name="VERTEX_ATTRIB_ARRAY5_NV" value="0x8655"/>
- <enum name="VERTEX_ATTRIB_ARRAY6_NV" value="0x8656"/>
- <enum name="VERTEX_ATTRIB_ARRAY7_NV" value="0x8657"/>
- <enum name="VERTEX_ATTRIB_ARRAY8_NV" value="0x8658"/>
- <enum name="VERTEX_ATTRIB_ARRAY9_NV" value="0x8659"/>
- <enum name="VERTEX_ATTRIB_ARRAY10_NV" value="0x865A"/>
- <enum name="VERTEX_ATTRIB_ARRAY11_NV" value="0x865B"/>
- <enum name="VERTEX_ATTRIB_ARRAY12_NV" value="0x865C"/>
- <enum name="VERTEX_ATTRIB_ARRAY13_NV" value="0x865D"/>
- <enum name="VERTEX_ATTRIB_ARRAY14_NV" value="0x865E"/>
- <enum name="VERTEX_ATTRIB_ARRAY15_NV" value="0x865F"/>
- <enum name="MAP1_VERTEX_ATTRIB0_4_NV" value="0x8660"/>
- <enum name="MAP1_VERTEX_ATTRIB1_4_NV" value="0x8661"/>
- <enum name="MAP1_VERTEX_ATTRIB2_4_NV" value="0x8662"/>
- <enum name="MAP1_VERTEX_ATTRIB3_4_NV" value="0x8663"/>
- <enum name="MAP1_VERTEX_ATTRIB4_4_NV" value="0x8664"/>
- <enum name="MAP1_VERTEX_ATTRIB5_4_NV" value="0x8665"/>
- <enum name="MAP1_VERTEX_ATTRIB6_4_NV" value="0x8666"/>
- <enum name="MAP1_VERTEX_ATTRIB7_4_NV" value="0x8667"/>
- <enum name="MAP1_VERTEX_ATTRIB8_4_NV" value="0x8668"/>
- <enum name="MAP1_VERTEX_ATTRIB9_4_NV" value="0x8669"/>
- <enum name="MAP1_VERTEX_ATTRIB10_4_NV" value="0x866A"/>
- <enum name="MAP1_VERTEX_ATTRIB11_4_NV" value="0x866B"/>
- <enum name="MAP1_VERTEX_ATTRIB12_4_NV" value="0x866C"/>
- <enum name="MAP1_VERTEX_ATTRIB13_4_NV" value="0x866D"/>
- <enum name="MAP1_VERTEX_ATTRIB14_4_NV" value="0x866E"/>
- <enum name="MAP1_VERTEX_ATTRIB15_4_NV" value="0x866F"/>
- <enum name="MAP2_VERTEX_ATTRIB0_4_NV" value="0x8670"/>
- <enum name="MAP2_VERTEX_ATTRIB1_4_NV" value="0x8671"/>
- <enum name="MAP2_VERTEX_ATTRIB2_4_NV" value="0x8672"/>
- <enum name="MAP2_VERTEX_ATTRIB3_4_NV" value="0x8673"/>
- <enum name="MAP2_VERTEX_ATTRIB4_4_NV" value="0x8674"/>
- <enum name="MAP2_VERTEX_ATTRIB5_4_NV" value="0x8675"/>
- <enum name="MAP2_VERTEX_ATTRIB6_4_NV" value="0x8676"/>
- <enum name="MAP2_VERTEX_ATTRIB7_4_NV" value="0x8677"/>
- <enum name="MAP2_VERTEX_ATTRIB8_4_NV" value="0x8678"/>
- <enum name="MAP2_VERTEX_ATTRIB9_4_NV" value="0x8679"/>
- <enum name="MAP2_VERTEX_ATTRIB10_4_NV" value="0x867A"/>
- <enum name="MAP2_VERTEX_ATTRIB11_4_NV" value="0x867B"/>
- <enum name="MAP2_VERTEX_ATTRIB12_4_NV" value="0x867C"/>
- <enum name="MAP2_VERTEX_ATTRIB13_4_NV" value="0x867D"/>
- <enum name="MAP2_VERTEX_ATTRIB14_4_NV" value="0x867E"/>
- <enum name="MAP2_VERTEX_ATTRIB15_4_NV" value="0x867F"/>
-
- <function name="AreProgramsResidentNV" offset="578">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="ids" type="const GLuint *" count="n"/>
- <param name="residences" type="GLboolean *" output="true" count="n"/>
- <return type="GLboolean"/>
- <glx vendorpriv="1293"/>
- </function>
-
- <function name="BindProgramNV" offset="579">
- <param name="target" type="GLenum"/>
- <param name="program" type="GLuint"/>
- <glx rop="4180"/>
- </function>
-
- <function name="DeleteProgramsNV" offset="580">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="programs" type="const GLuint *" count="n"/>
- <glx vendorpriv="1294"/>
- </function>
-
- <function name="ExecuteProgramNV" offset="581">
- <param name="target" type="GLenum"/>
- <param name="id" type="GLuint"/>
- <param name="params" type="const GLfloat *" count="4"/>
- <glx rop="4181"/>
- </function>
-
- <function name="GenProgramsNV" offset="582">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="programs" type="GLuint *" output="true" count="n"/>
- <glx vendorpriv="1295" always_array="true"/>
- </function>
-
- <!-- This isn't 100% correct. Currently, the only valid value of pname
- is GL_PROGRAM_PARAMETER_NV, and the count for that pname is always
- 4. This is why the pname parameter was removed in the ARB version
- of these functions.
- -->
-
- <function name="GetProgramParameterdvNV" offset="583">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLdouble *" output="true" count="4"/>
- <glx vendorpriv="1297"/>
- </function>
-
- <function name="GetProgramParameterfvNV" offset="584">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" count="4"/>
- <glx vendorpriv="1296"/>
- </function>
-
- <function name="GetProgramivNV" offset="585">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="1298"/>
- </function>
-
- <function name="GetProgramStringNV" offset="586">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="program" type="GLubyte *" output="true"/>
- <glx vendorpriv="1299" handcode="server" always_array="true"/>
- </function>
-
- <function name="GetTrackMatrixivNV" offset="587">
- <param name="target" type="GLenum"/>
- <param name="address" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" count="1"/>
- <glx vendorpriv="1300"/>
- </function>
-
- <function name="GetVertexAttribdvNV" offset="753">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLdouble *" output="true" variable_param="pname"/>
- <glx vendorpriv="1301"/>
- </function>
-
- <function name="GetVertexAttribfvNV" offset="754">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLfloat *" output="true" variable_param="pname"/>
- <glx vendorpriv="1302"/>
- </function>
-
- <function name="GetVertexAttribivNV" offset="755">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *" output="true" variable_param="pname"/>
- <glx vendorpriv="1303"/>
- </function>
-
- <function name="GetVertexAttribPointervNV" offset="591">
- <param name="index" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLvoid **" output="true"/>
- <glx handcode="true"/>
- </function>
-
- <function name="IsProgramNV" offset="592">
- <param name="program" type="GLuint"/>
- <return type="GLboolean"/>
- <glx vendorpriv="1304"/>
- </function>
-
- <function name="LoadProgramNV" offset="593">
- <param name="target" type="GLenum"/>
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="program" type="const GLubyte *" count="len"/>
- <glx rop="4183"/>
- </function>
-
- <function name="ProgramParameter4dNV" offset="594" vectorequiv="ProgramParameter4dvNV">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="ProgramParameter4dvNV" offset="595">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="const GLdouble *" count="4"/>
- <glx rop="4185" doubles_in_order="true"/>
- </function>
-
- <function name="ProgramParameter4fNV" offset="596" vectorequiv="ProgramParameter4fvNV">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="ProgramParameter4fvNV" offset="597">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="params" type="const GLfloat *" count="4"/>
- <glx rop="4184"/>
- </function>
-
- <function name="ProgramParameters4dvNV" offset="598">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="num" type="GLuint" counter="true"/>
- <param name="params" type="const GLdouble *" count="num" count_scale="4"/>
- <glx rop="4187"/>
- </function>
-
- <function name="ProgramParameters4fvNV" offset="599">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="num" type="GLuint" counter="true"/>
- <param name="params" type="const GLfloat *" count="num" count_scale="4"/>
- <glx rop="4186"/>
- </function>
-
- <function name="RequestResidentProgramsNV" offset="600">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="ids" type="const GLuint *" count="n"/>
- <glx rop="4182"/>
- </function>
-
- <function name="TrackMatrixNV" offset="601">
- <param name="target" type="GLenum"/>
- <param name="address" type="GLuint"/>
- <param name="matrix" type="GLenum"/>
- <param name="transform" type="GLenum"/>
- <glx rop="4188"/>
- </function>
-
- <function name="VertexAttribPointerNV" offset="602">
- <param name="index" type="GLuint"/>
- <param name="size" type="GLint"/>
- <param name="type" type="GLenum"/>
- <param name="stride" type="GLsizei"/>
- <param name="pointer" type="const GLvoid *"/>
- <glx handcode="true"/>
- </function>
-
- <function name="VertexAttrib1sNV" offset="760" vectorequiv="VertexAttrib1svNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib1svNV" offset="761">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="1"/>
- <glx rop="4189"/>
- </function>
-
- <function name="VertexAttrib2sNV" offset="766" vectorequiv="VertexAttrib2svNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib2svNV" offset="767">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="2"/>
- <glx rop="4190"/>
- </function>
-
- <function name="VertexAttrib3sNV" offset="772" vectorequiv="VertexAttrib3svNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib3svNV" offset="773">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="3"/>
- <glx rop="4191"/>
- </function>
-
- <function name="VertexAttrib4sNV" offset="778" vectorequiv="VertexAttrib4svNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLshort"/>
- <param name="y" type="GLshort"/>
- <param name="z" type="GLshort"/>
- <param name="w" type="GLshort"/>
- </function>
-
- <function name="VertexAttrib4svNV" offset="779">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLshort *" count="4"/>
- <glx rop="4192"/>
- </function>
-
- <function name="VertexAttrib1fNV" offset="758" vectorequiv="VertexAttrib1fvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib1fvNV" offset="759">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="1"/>
- <glx rop="4193"/>
- </function>
-
- <function name="VertexAttrib2fNV" offset="764" vectorequiv="VertexAttrib2fvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib2fvNV" offset="765">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="2"/>
- <glx rop="4194"/>
- </function>
-
- <function name="VertexAttrib3fNV" offset="770" vectorequiv="VertexAttrib3fvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib3fvNV" offset="771">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="3"/>
- <glx rop="4195"/>
- </function>
-
- <function name="VertexAttrib4fNV" offset="776" vectorequiv="VertexAttrib4fvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="VertexAttrib4fvNV" offset="777">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="4196"/>
- </function>
-
- <function name="VertexAttrib1dNV" offset="756" vectorequiv="VertexAttrib1dvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib1dvNV" offset="757">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="1"/>
- <glx rop="4197" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttrib2dNV" offset="762" vectorequiv="VertexAttrib2dvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib2dvNV" offset="763">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="2"/>
- <glx rop="4198" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttrib3dNV" offset="768" vectorequiv="VertexAttrib3dvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib3dvNV" offset="769">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="3"/>
- <glx rop="4199" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttrib4dNV" offset="774" vectorequiv="VertexAttrib4dvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="VertexAttrib4dvNV" offset="775">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="4200" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttrib4ubNV" offset="780" vectorequiv="VertexAttrib4ubvNV">
- <param name="index" type="GLuint"/>
- <param name="x" type="GLubyte"/>
- <param name="y" type="GLubyte"/>
- <param name="z" type="GLubyte"/>
- <param name="w" type="GLubyte"/>
- </function>
-
- <function name="VertexAttrib4ubvNV" offset="781">
- <param name="index" type="GLuint"/>
- <param name="v" type="const GLubyte *" count="4"/>
- <glx rop="4201"/>
- </function>
-
- <function name="VertexAttribs1svNV" offset="631">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLshort *" count="n"/>
- <glx rop="4202"/>
- </function>
-
- <function name="VertexAttribs2svNV" offset="634">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLshort *" count="n" count_scale="2"/>
- <glx rop="4203"/>
- </function>
-
- <function name="VertexAttribs3svNV" offset="637">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLshort *" count="n" count_scale="3"/>
- <glx rop="4204"/>
- </function>
-
- <function name="VertexAttribs4svNV" offset="640">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLshort *" count="n" count_scale="4"/>
- <glx rop="4205"/>
- </function>
-
- <function name="VertexAttribs1fvNV" offset="630">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLfloat *" count="n"/>
- <glx rop="4206"/>
- </function>
-
- <function name="VertexAttribs2fvNV" offset="633">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLfloat *" count="n" count_scale="2"/>
- <glx rop="4207"/>
- </function>
-
- <function name="VertexAttribs3fvNV" offset="636">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLfloat *" count="n" count_scale="3"/>
- <glx rop="4208"/>
- </function>
-
- <function name="VertexAttribs4fvNV" offset="639">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLfloat *" count="n" count_scale="4"/>
- <glx rop="4209"/>
- </function>
-
- <function name="VertexAttribs1dvNV" offset="629">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLdouble *" count="n"/>
- <glx rop="4210" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttribs2dvNV" offset="632">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLdouble *" count="n" count_scale="2"/>
- <glx rop="4211" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttribs3dvNV" offset="635">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLdouble *" count="n" count_scale="3"/>
- <glx rop="4212" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttribs4dvNV" offset="638">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLdouble *" count="n" count_scale="4"/>
- <glx rop="4213" doubles_in_order="true"/>
- </function>
-
- <function name="VertexAttribs4ubvNV" offset="641">
- <param name="index" type="GLuint"/>
- <param name="n" type="GLsizei" counter="true"/>
- <param name="v" type="const GLubyte *" count="n" count_scale="4"/>
- <glx rop="4214"/>
- </function>
-</category>
-
-<!-- Extension number 234 is a GLX extension. -->
-
-<category name="GL_SGIX_texture_coordinate_clamp" number="235">
- <enum name="TEXTURE_MAX_CLAMP_S_SGIX" count="1" value="0x8369">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_MAX_CLAMP_T_SGIX" count="1" value="0x836A">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
- <enum name="TEXTURE_MAX_CLAMP_R_SGIX" count="1" value="0x836B">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<!-- Extension number 236 is not listed in the extension registry. -->
-<!-- Extension number 237 is a GLX extension. -->
-<!-- Extension number 238 is a GLX extension. -->
-<!-- Extension number 242 is a WGL extension. -->
-
-<category name="GL_NV_copy_depth_to_color" number="243">
- <enum name="DEPTH_STENCIL_TO_RGBA_NV" value="0x886E"/>
- <enum name="DEPTH_STENCIL_TO_BGRA_NV" value="0x886F"/>
-</category>
-
-<category name="GL_ATI_fragment_shader" number="245">
- <function name="GenFragmentShadersATI" offset="782">
- <return type="GLuint"/>
- <param name="range" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="BindFragmentShaderATI" offset="783">
- <param name="id" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="DeleteFragmentShaderATI" offset="784">
- <param name="id" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="BeginFragmentShaderATI" offset="785">
- <glx ignore="true"/>
- </function>
-
- <function name="EndFragmentShaderATI" offset="786">
- <glx ignore="true"/>
- </function>
-
- <function name="PassTexCoordATI" offset="787">
- <param name="dst" type="GLuint"/>
- <param name="coord" type="GLuint"/>
- <param name="swizzle" type="GLenum"/>
- <glx ignore="true"/>
- </function>
-
- <function name="SampleMapATI" offset="788">
- <param name="dst" type="GLuint"/>
- <param name="interp" type="GLuint"/>
- <param name="swizzle" type="GLenum"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ColorFragmentOp1ATI" offset="789">
- <param name="op" type="GLenum"/>
- <param name="dst" type="GLuint"/>
- <param name="dstMask" type="GLuint"/>
- <param name="dstMod" type="GLuint"/>
- <param name="arg1" type="GLuint"/>
- <param name="arg1Rep" type="GLuint"/>
- <param name="arg1Mod" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ColorFragmentOp2ATI" offset="790">
- <param name="op" type="GLenum"/>
- <param name="dst" type="GLuint"/>
- <param name="dstMask" type="GLuint"/>
- <param name="dstMod" type="GLuint"/>
- <param name="arg1" type="GLuint"/>
- <param name="arg1Rep" type="GLuint"/>
- <param name="arg1Mod" type="GLuint"/>
- <param name="arg2" type="GLuint"/>
- <param name="arg2Rep" type="GLuint"/>
- <param name="arg2Mod" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="ColorFragmentOp3ATI" offset="791">
- <param name="op" type="GLenum"/>
- <param name="dst" type="GLuint"/>
- <param name="dstMask" type="GLuint"/>
- <param name="dstMod" type="GLuint"/>
- <param name="arg1" type="GLuint"/>
- <param name="arg1Rep" type="GLuint"/>
- <param name="arg1Mod" type="GLuint"/>
- <param name="arg2" type="GLuint"/>
- <param name="arg2Rep" type="GLuint"/>
- <param name="arg2Mod" type="GLuint"/>
- <param name="arg3" type="GLuint"/>
- <param name="arg3Rep" type="GLuint"/>
- <param name="arg3Mod" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="AlphaFragmentOp1ATI" offset="792">
- <param name="op" type="GLenum"/>
- <param name="dst" type="GLuint"/>
- <param name="dstMod" type="GLuint"/>
- <param name="arg1" type="GLuint"/>
- <param name="arg1Rep" type="GLuint"/>
- <param name="arg1Mod" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="AlphaFragmentOp2ATI" offset="793">
- <param name="op" type="GLenum"/>
- <param name="dst" type="GLuint"/>
- <param name="dstMod" type="GLuint"/>
- <param name="arg1" type="GLuint"/>
- <param name="arg1Rep" type="GLuint"/>
- <param name="arg1Mod" type="GLuint"/>
- <param name="arg2" type="GLuint"/>
- <param name="arg2Rep" type="GLuint"/>
- <param name="arg2Mod" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="AlphaFragmentOp3ATI" offset="794">
- <param name="op" type="GLenum"/>
- <param name="dst" type="GLuint"/>
- <param name="dstMod" type="GLuint"/>
- <param name="arg1" type="GLuint"/>
- <param name="arg1Rep" type="GLuint"/>
- <param name="arg1Mod" type="GLuint"/>
- <param name="arg2" type="GLuint"/>
- <param name="arg2Rep" type="GLuint"/>
- <param name="arg2Mod" type="GLuint"/>
- <param name="arg3" type="GLuint"/>
- <param name="arg3Rep" type="GLuint"/>
- <param name="arg3Mod" type="GLuint"/>
- <glx ignore="true"/>
- </function>
-
- <function name="SetFragmentShaderConstantATI" offset="795">
- <param name="dst" type="GLuint"/>
- <param name="value" type="const GLfloat *"/>
- <glx ignore="true"/>
- </function>
-</category>
-
-<!-- Extension number 250 is a WGL extension. -->
-<!-- Extension number 251 is a WGL extension. -->
-<!-- Extension number 252 is a WGL extension. -->
-<!-- Extension number 253 is a WGL extension. -->
-<!-- Extension number 254 is a WGL extension. -->
-<!-- Extension number 255 is a WGL extension. -->
-
-<category name="GL_SUN_mesh_array" number="257">
- <enum name="QUAD_MESH_SUN" value="0x8614"/>
- <enum name="TRIANGLE_MESH_SUN" value="0x8615"/>
-
- <function name="DrawMeshArraysSUN" offset="?">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="width" type="GLsizei"/>
- </function>
-</category>
-
-<category name="GL_SUN_slice_accum" number="258">
- <enum name="SLICE_ACCUM_SUN" value="0x85CC"/>
-</category>
-
-<category name="GL_NV_multisample_filter_hint" number="259">
- <enum name="MULTISAMPLE_FILTER_HINT_NV" count="1" value="0x8534">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_NV_depth_clamp" number="260">
- <enum name="DEPTH_CLAMP_NV" count="1" value="0x864F">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_NV_point_sprite" number="262">
- <!-- These existing enums can be passed as a parameter to the function
- added for this extension. -->
-
- <enum name="POINT_SIZE_MIN_EXT" count="1" value="0x8126">
- <size name="PointParameterivNV"/>
- </enum>
- <enum name="POINT_SIZE_MAX_EXT" count="1" value="0x8127">
- <size name="PointParameterivNV"/>
- </enum>
- <enum name="POINT_FADE_THRESHOLD_SIZE_EXT" count="1" value="0x8128">
- <size name="PointParameterivNV"/>
- </enum>
- <enum name="POINT_DISTANCE_ATTENUATION_EXT" count="3" value="0x8129">
- <size name="PointParameterivNV"/>
- </enum>
-
- <enum name="POINT_SPRITE_NV" count="1" value="0x8861">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="COORD_REPLACE_NV" count="1" value="0x8862">
- <size name="TexEnvfv"/>
- <size name="TexEnviv"/>
- <size name="GetTexEnvfv" mode="get"/>
- <size name="GetTexEnviv" mode="get"/>
- </enum>
- <enum name="POINT_SPRITE_R_MODE_NV" count="1" value="0x8863">
- <size name="PointParameterfvEXT"/>
- <size name="PointParameterivNV"/>
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="PointParameteriNV" offset="642">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLint"/>
- <glx rop="4221"/>
- </function>
-
- <function name="PointParameterivNV" offset="643">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *" variable_param="pname"/>
- <glx rop="4222"/>
- </function>
-</category>
-
-<!-- Extension number 263 is a WGL extension. -->
-<!-- Extension number 264 is a WGL extension. -->
-
-<category name="GL_EXT_shadow_funcs" number="267">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_EXT_stencil_two_side" number="268">
- <enum name="STENCIL_TEST_TWO_SIDE_EXT" count="1" value="0x8910">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="ACTIVE_STENCIL_FACE_EXT" count="1" value="0x8911">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="ActiveStencilFaceEXT" offset="646">
- <param name="face" type="GLenum"/>
- <glx rop="4220"/>
- </function>
-</category>
-
-<category name="GL_APPLE_ycbcr_422" number="275">
- <enum name="YCBCR_422_APPLE" value="0x85B9"/>
- <enum name="UNSIGNED_SHORT_8_8_APPLE" value="0x85BA"/>
- <enum name="UNSIGNED_SHORT_8_8_REV_APPLE" value="0x85BB"/>
-</category>
-
-<category name="GL_S3_s3tc" number="276">
- <enum name="RGB_S3TC" value="0x83A0"/>
- <enum name="RGB4_S3TC" value="0x83A1"/>
- <enum name="RGBA_S3TC" value="0x83A2"/>
- <enum name="RGBA4_S3TC" value="0x83A3"/>
- <enum name="RGBA_DXT5_S3TC" value="0x83A4"/>
- <enum name="RGBA4_DXT5_S3TC" value="0x83A5"/>
-</category>
-
-<category name="GL_ATI_draw_buffers" number="277">
- <enum name="MAX_DRAW_BUFFERS_ATI" count="1" value="0x8824">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER0_ATI" count="1" value="0x8825">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER1_ATI" count="1" value="0x8826">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER2_ATI" count="1" value="0x8827">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER3_ATI" count="1" value="0x8828">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER4_ATI" count="1" value="0x8829">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER5_ATI" count="1" value="0x882A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER6_ATI" count="1" value="0x882B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER7_ATI" count="1" value="0x882C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER8_ATI" count="1" value="0x882D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER9_ATI" count="1" value="0x882E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER10_ATI" count="1" value="0x882F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER11_ATI" count="1" value="0x8830">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER12_ATI" count="1" value="0x8831">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER13_ATI" count="1" value="0x8832">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER14_ATI" count="1" value="0x8833">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER15_ATI" count="1" value="0x8834">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="DrawBuffersATI" alias="DrawBuffersARB">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="bufs" type="const GLenum *" count="n"/>
- <!-- GLX protocol is not fully defined for this extension. -->
- </function>
-</category>
-
-<!-- Extension number 278 is a WGL extension. -->
-
-<category name="GL_ATI_texture_env_combine3" number="279">
- <enum name="MODULATE_ADD_ATI" value="0x8744"/>
- <enum name="MODULATE_SIGNED_ADD_ATI" value="0x8745"/>
- <enum name="MODULATE_SUBTRACT_ATI" value="0x8746"/>
-</category>
-
-<category name="GL_NV_fragment_program" number="282">
- <function name="ProgramNamedParameter4fNV" offset="682" vectorequiv="ProgramNamedParameter4fvNV">
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="name" type="const GLubyte *" count="len"/>
- <param name="x" type="GLfloat"/>
- <param name="y" type="GLfloat"/>
- <param name="z" type="GLfloat"/>
- <param name="w" type="GLfloat"/>
- </function>
-
- <function name="ProgramNamedParameter4dNV" offset="683" vectorequiv="ProgramNamedParameter4dvNV">
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="name" type="const GLubyte *" count="len"/>
- <param name="x" type="GLdouble"/>
- <param name="y" type="GLdouble"/>
- <param name="z" type="GLdouble"/>
- <param name="w" type="GLdouble"/>
- </function>
-
- <function name="ProgramNamedParameter4fvNV" offset="684">
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="name" type="const GLubyte *" count="len"/>
- <param name="v" type="const GLfloat *" count="4"/>
- <glx rop="4218"/>
- </function>
-
- <function name="ProgramNamedParameter4dvNV" offset="685">
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="name" type="const GLubyte *" count="len"/>
- <param name="v" type="const GLdouble *" count="4"/>
- <glx rop="4219"/>
- </function>
-
- <function name="GetProgramNamedParameterfvNV" offset="686">
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="name" type="const GLubyte *" count="len"/>
- <param name="params" type="GLfloat *" output="true" count="4"/>
- <glx vendorpriv="1310" always_array="true"/>
- </function>
-
- <function name="GetProgramNamedParameterdvNV" offset="687">
- <param name="id" type="GLuint"/>
- <param name="len" type="GLsizei" counter="true"/>
- <param name="name" type="const GLubyte *" count="len"/>
- <param name="params" type="GLdouble *" output="true" count="4"/>
- <glx vendorpriv="1311" always_array="true"/>
- </function>
-</category>
-
-<category name="GL_NV_expand_normal" number="286">
- <enum name="TEXTURE_UNSIGNED_REMAP_MODE_NV" count="1" value="0x888F">
- <size name="TexParameterfv"/>
- <size name="TexParameteriv"/>
- <size name="GetTexParameterfv" mode="get"/>
- <size name="GetTexParameteriv" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_OES_compressed_paletted_texture" number="294">
- <enum name="PALETTE4_RGB8_OES" value="0x8B90"/>
- <enum name="PALETTE4_RGBA8_OES" value="0x8B91"/>
- <enum name="PALETTE4_R5_G6_B5_OES" value="0x8B92"/>
- <enum name="PALETTE4_RGBA4_OES" value="0x8B93"/>
- <enum name="PALETTE4_RGB5_A1_OES" value="0x8B94"/>
- <enum name="PALETTE8_RGB8_OES" value="0x8B95"/>
- <enum name="PALETTE8_RGBA8_OES" value="0x8B96"/>
- <enum name="PALETTE8_R5_G6_B5_OES" value="0x8B97"/>
- <enum name="PALETTE8_RGBA4_OES" value="0x8B98"/>
- <enum name="PALETTE8_RGB5_A1_OES" value="0x8B99"/>
-</category>
-
-<category name="GL_OES_read_format" number="295">
- <enum name="IMPLEMENTATION_COLOR_READ_TYPE_OES" value="0x8B9A"/>
- <enum name="IMPLEMENTATION_COLOR_READ_FORMAT_OES" value="0x8B9B"/>
-</category>
-
-<category name="GL_EXT_depth_bounds_test" number="297">
- <enum name="DEPTH_BOUNDS_TEST_EXT" count="1" value="0x8890">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DEPTH_BOUNDS_EXT" count="2" value="0x8891">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="DepthBoundsEXT" offset="699">
- <param name="zmin" type="GLclampd"/>
- <param name="zmax" type="GLclampd"/>
- <glx rop="4229" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_EXT_texture_mirror_clamp" number="298">
- <enum name="MIRROR_CLAMP_EXT" value="0x8742"/>
- <enum name="MIRROR_CLAMP_TO_EDGE_EXT" value="0x8743"/>
- <enum name="MIRROR_CLAMP_TO_BORDER_EXT" value="0x8912"/>
-</category>
-
-<category name="GL_EXT_blend_equation_separate" number="299">
- <enum name="BLEND_EQUATION_RGB_EXT" count="1" value="0x8009">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="BLEND_EQUATION_ALPHA_EXT" count="1" value="0x883D">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="BlendEquationSeparateEXT" offset="710">
- <param name="modeRGB" type="GLenum"/>
- <param name="modeA" type="GLenum"/>
- <glx rop="4228" ignore="true"/>
- </function>
-</category>
-
-<category name="GL_MESA_pack_invert" number="300">
- <enum name="PACK_INVERT_MESA" count="1" value="0x8758">
- <size name="Get" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_MESA_ycbcr_texture" number="301">
- <enum name="YCBCR_MESA" value="0x8757"/>
- <enum name="UNSIGNED_SHORT_8_8_MESA" value="0x85BA"/>
- <enum name="UNSIGNED_SHORT_8_8_REV_MESA" value="0x85BB"/>
-</category>
-
-<category name="GL_EXT_pixel_buffer_object" number="302">
- <enum name="PIXEL_PACK_BUFFER_EXT" value="0x88EB"/>
- <enum name="PIXEL_UNPACK_BUFFER_EXT" value="0x88EC"/>
- <enum name="PIXEL_PACK_BUFFER_BINDING_EXT" value="0x88ED"/>
- <enum name="PIXEL_UNPACK_BUFFER_BINDING_EXT" value="0x88EF"/>
-</category>
-
-<category name="GL_NV_fragment_program_option" number="303">
- <!-- No new functions, types, enums. -->
-</category>
-
-<category name="GL_NV_fragment_program2" number="304">
- <enum name="MAX_PROGRAM_EXEC_INSTRUCTIONS_NV" count="1" value="0x88F4">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_CALL_DEPTH_NV" count="1" value="0x88F5">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_IF_DEPTH_NV" count="1" value="0x88F6">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_LOOP_DEPTH_NV" count="1" value="0x88F7">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_LOOP_COUNT_NV" count="1" value="0x88F8">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_NV_vertex_program2_option" number="305">
- <enum name="MAX_PROGRAM_EXEC_INSTRUCTIONS_NV" count="1" value="0x88F4">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
- <enum name="MAX_PROGRAM_CALL_DEPTH_NV" count="1" value="0x88F5">
- <size name="GetProgramivARB" mode="get"/>
- </enum>
-</category>
-
-<category name="GL_NV_vertex_program3" number="306">
- <enum name="MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB" count="1" value="0x8B4C"/>
-</category>
-
-<xi:include href="EXT_framebuffer_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
-
-<!-- Extension number 307 is a GLX extension. -->
-<!-- Extension number 308 is a GLX extension. -->
-
-<category name="GL_EXT_texture_compression_dxt1" number="309">
- <enum name="COMPRESSED_RGB_S3TC_DXT1_EXT" value="0x83F0"/>
- <enum name="COMPRESSED_RGBA_S3TC_DXT1_EXT" value="0x83F1"/>
-</category>
-
-<!-- Unnumbered extensions sorted by name. -->
-
-<category name="GL_ATI_blend_equation_separate">
- <function name="BlendEquationSeparateATI" alias="BlendEquationSeparateEXT">
- <param name="modeRGB" type="GLenum"/>
- <param name="modeA" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_INGR_blend_func_separate">
- <function name="BlendFuncSeparateINGR" alias="BlendFuncSeparateEXT">
- <param name="sfactorRGB" type="GLenum"/>
- <param name="dfactorRGB" type="GLenum"/>
- <param name="sfactorAlpha" type="GLenum"/>
- <param name="dfactorAlpha" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_SGIS_point_parameters">
- <enum name="POINT_SIZE_MIN_SGIS" count="1" value="0x8126">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_SIZE_MAX_SGIS" count="1" value="0x8127">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_FADE_THRESHOLD_SIZE_SGIS" count="1" value="0x8128">
- <size name="PointParameterfvEXT"/>
- </enum>
- <enum name="POINT_DISTANCE_ATTENUATION_SGIS" count="3" value="0x8129">
- <size name="PointParameterfvEXT"/>
- </enum>
-
- <function name="PointParameterfSGIS" alias="PointParameterfEXT">
- <param name="pname" type="GLenum"/>
- <param name="param" type="GLfloat"/>
- </function>
-
- <function name="PointParameterfvSGIS" alias="PointParameterfvEXT">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLfloat *"/>
- </function>
-</category>
-
-<category name="GL_SGIX_igloo_interface">
- <function name="IglooInterfaceSGIX" offset="?">
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLvoid *"/>
- </function>
-</category>
-
-<category name="GL_SGIX_polynomial_ffd">
- <function name="DeformationMap3dSGIX" offset="?">
- <param name="target" type="GLenum"/>
- <param name="u1" type="GLdouble"/>
- <param name="u2" type="GLdouble"/>
- <param name="ustride" type="GLint"/>
- <param name="uorder" type="GLint"/>
- <param name="v1" type="GLdouble"/>
- <param name="v2" type="GLdouble"/>
- <param name="vstride" type="GLint"/>
- <param name="vorder" type="GLint"/>
- <param name="w1" type="GLdouble"/>
- <param name="w2" type="GLdouble"/>
- <param name="wstride" type="GLint"/>
- <param name="worder" type="GLint"/>
- <param name="points" type="const GLdouble *"/>
- </function>
-
- <function name="DeformationMap3fSGIX" offset="?">
- <param name="target" type="GLenum"/>
- <param name="u1" type="GLfloat"/>
- <param name="u2" type="GLfloat"/>
- <param name="ustride" type="GLint"/>
- <param name="uorder" type="GLint"/>
- <param name="v1" type="GLfloat"/>
- <param name="v2" type="GLfloat"/>
- <param name="vstride" type="GLint"/>
- <param name="vorder" type="GLint"/>
- <param name="w1" type="GLfloat"/>
- <param name="w2" type="GLfloat"/>
- <param name="wstride" type="GLint"/>
- <param name="worder" type="GLint"/>
- <param name="points" type="const GLfloat *"/>
- </function>
-
- <function name="DeformSGIX" offset="?">
- <param name="mask" type="GLenum"/>
- </function>
-
- <function name="LoadIdentityDeformationMapSGIX" offset="?">
- <param name="mask" type="GLenum"/>
- </function>
-</category>
-
-<category name="GL_EXT_timer_query" number="310">
- <enum name="GL_TIME_ELAPSED_EXT" value="0x88BF"/>
- <type name="int64EXT" size="8"/>
- <type name="uint64EXT" unsigned="true" size="8"/>
- <function name="GetQueryObjecti64vEXT" offset="816">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint64EXT *"/>
- </function>
- <function name="GetQueryObjectui64vEXT" offset="817">
- <param name="id" type="GLuint"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLuint64EXT *"/>
- </function>
-</category>
-
-<category name="GL_EXT_framebuffer_blit" number="316">
- <enum name="GL_READ_FRAMEBUFFER_EXT" value="0x8CA8"/>
- <enum name="GL_DRAW_FRAMEBUFFER_EXT" value="0x8CA9"/>
- <enum name="GL_DRAW_FRAMEBUFFER_BINDING_EXT" value="0x8CA6"/>
- <enum name="GL_READ_FRAMEBUFFER_BINDING_EXT" value="0x8CAA"/>
- <function name="BlitFramebufferEXT" offset="818">
- <param name="srcX0" type="GLint"/>
- <param name="srcY0" type="GLint"/>
- <param name="srcX1" type="GLint"/>
- <param name="srcY1" type="GLint"/>
- <param name="dstX0" type="GLint"/>
- <param name="dstY0" type="GLint"/>
- <param name="dstX1" type="GLint"/>
- <param name="dstY1" type="GLint"/>
- <param name="mask" type="GLbitfield"/>
- <param name="filter" type="GLenum"/>
- </function>
-</category>
-
-</OpenGLAPI>
diff --git a/src/mesa/glapi/gl_SPARC_asm.py b/src/mesa/glapi/gl_SPARC_asm.py
deleted file mode 100644
index 1a8823cc405..00000000000
--- a/src/mesa/glapi/gl_SPARC_asm.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, license
-import sys, getopt
-
-class PrintGenericStubs(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
- self.name = "gl_SPARC_asm.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
-
-
- def printRealHeader(self):
- print '#include "glapioffsets.h"'
- print ''
- print '#ifdef __arch64__'
- print '# define GL_STUB(fn,off)\t\t\t\t\\'
- print 'fn:\t\t\t\t\t\\'
- print '\tsethi\t%hi(0xDEADBEEF), %g4 ;\t\t\t\\'
- print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
- print '\tor\t%g4, %lo(0xDEADBEEF), %g4 ;\t\t\\'
- print '\tor\t%g1, %lo(0xDEADBEEF), %g1 ;\t\t\\'
- print '\tsllx\t%g4, 32, %g4 ;\t\t\t\t\\'
- print '\tldx\t[%g1 + %g4], %g1 ;\t\t\t\\'
- print '\tsethi\t%hi(8 * off), %g4 ;\t\t\t\\'
- print '\tor\t%g4, %lo(8 * off), %g4 ;\t\t\\'
- print '\tldx\t[%g1 + %g4], %g5 ;\t\t\t\\'
- print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
- print '\tnop'
- print '#else'
- print '# define GL_STUB(fn,off)\t\t\t\t\\'
- print 'fn:\t\t\t\t\t\\'
- print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
- print '\tld\t[%g1 + %lo(0xDEADBEEF)], %g1 ;\t\t\\'
- print '\tld\t[%g1 + (4 * off)], %g5 ;\t\t\\'
- print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
- print '\tnop'
- print '#endif'
- print ''
- print '#define GL_STUB_ALIAS(fn,alias) fn = alias'
- print ''
- print '.text'
- print '.align 32'
- print '\t\t.globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function'
- print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
- print '\tflush\t%o0'
- print '\tretl'
- print '\tnop'
- print ''
- print '.data'
- print '.align 64'
- print ''
- return
-
-
- def printBody(self, api):
- for f in api.functionIterateByOffset():
- print '\t\t.globl gl%s ; .type gl%s,#function' % (f.name, f.name)
-
- print '\t\t.globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function'
- print '_mesa_sparc_glapi_begin:'
- print ''
-
- for f in api.functionIterateByOffset():
- print '\tGL_STUB(gl%s, _gloffset_%s)' % (f.name, f.name)
-
- print ''
- print '\t\t.globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function'
- print '_mesa_sparc_glapi_end:'
- print ''
-
-
- for f in api.functionIterateByOffset():
- for n in f.entry_points:
- if n != f.name:
- print '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
-
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
- mode = "generic"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == '-m':
- mode = val
- elif arg == "-f":
- file_name = val
-
- if mode == "generic":
- printer = PrintGenericStubs()
- else:
- print "ERROR: Invalid mode \"%s\" specified." % mode
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py
deleted file mode 100644
index 11b23b7a867..00000000000
--- a/src/mesa/glapi/gl_XML.py
+++ /dev/null
@@ -1,813 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import libxml2
-import re, sys, string
-import typeexpr
-
-
-def parse_GL_API( file_name, factory = None ):
- doc = libxml2.readFile( file_name, None, libxml2.XML_PARSE_XINCLUDE + libxml2.XML_PARSE_NOBLANKS + libxml2.XML_PARSE_DTDVALID + libxml2.XML_PARSE_DTDATTR + libxml2.XML_PARSE_DTDLOAD + libxml2.XML_PARSE_NOENT )
- ret = doc.xincludeProcess()
-
- if not factory:
- factory = gl_item_factory()
-
- api = factory.create_item( "api", None, None )
- api.process_element( doc )
-
- doc.freeDoc()
-
- return api
-
-
-def is_attr_true( element, name ):
- """Read a name value from an element's attributes.
-
- The value read from the attribute list must be either 'true' or
- 'false'. If the value is 'false', zero will be returned. If the
- value is 'true', non-zero will be returned. An exception will be
- raised for any other value."""
-
- value = element.nsProp( name, None )
- if value == "true":
- return 1
- elif value == "false":
- return 0
- else:
- raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name))
-
-
-class gl_print_base:
- """Base class of all API pretty-printers.
-
- In the model-view-controller pattern, this is the view. Any derived
- class will want to over-ride the printBody, printRealHader, and
- printRealFooter methods. Some derived classes may want to over-ride
- printHeader and printFooter, or even Print (though this is unlikely).
- """
-
- def __init__(self):
- # Name of the script that is generating the output file.
- # Every derived class should set this to the name of its
- # source file.
-
- self.name = "a"
-
-
- # License on the *generated* source file. This may differ
- # from the license on the script that is generating the file.
- # Every derived class should set this to some reasonable
- # value.
- #
- # See license.py for an example of a reasonable value.
-
- self.license = "The license for this file is unspecified."
-
-
- # The header_tag is the name of the C preprocessor define
- # used to prevent multiple inclusion. Typically only
- # generated C header files need this to be set. Setting it
- # causes code to be generated automatically in printHeader
- # and printFooter.
-
- self.header_tag = None
-
-
- # List of file-private defines that must be undefined at the
- # end of the file. This can be used in header files to define
- # names for use in the file, then undefine them at the end of
- # the header file.
-
- self.undef_list = []
- return
-
-
- def Print(self, api):
- self.printHeader()
- self.printBody(api)
- self.printFooter()
- return
-
-
- def printHeader(self):
- """Print the header associated with all files and call the printRealHeader method."""
-
- print '/* DO NOT EDIT - This file generated automatically by %s script */' \
- % (self.name)
- print ''
- print '/*'
- print ' * ' + self.license.replace('\n', '\n * ')
- print ' */'
- print ''
- if self.header_tag:
- print '#if !defined( %s )' % (self.header_tag)
- print '# define %s' % (self.header_tag)
- print ''
- self.printRealHeader();
- return
-
-
- def printFooter(self):
- """Print the header associated with all files and call the printRealFooter method."""
-
- self.printRealFooter()
-
- if self.undef_list:
- print ''
- for u in self.undef_list:
- print "# undef %s" % (u)
-
- if self.header_tag:
- print ''
- print '#endif /* !defined( %s ) */' % (self.header_tag)
-
-
- def printRealHeader(self):
- """Print the "real" header for the created file.
-
- In the base class, this function is empty. All derived
- classes should over-ride this function."""
- return
-
-
- def printRealFooter(self):
- """Print the "real" footer for the created file.
-
- In the base class, this function is empty. All derived
- classes should over-ride this function."""
- return
-
-
- def printPure(self):
- """Conditionally define `PURE' function attribute.
-
- Conditionally defines a preprocessor macro `PURE' that wraps
- GCC's `pure' function attribute. The conditional code can be
- easilly adapted to other compilers that support a similar
- feature.
-
- The name is also added to the file's undef_list.
- """
- self.undef_list.append("PURE")
- print """# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
-# define PURE __attribute__((pure))
-# else
-# define PURE
-# endif"""
- return
-
-
- def printFastcall(self):
- """Conditionally define `FASTCALL' function attribute.
-
- Conditionally defines a preprocessor macro `FASTCALL' that
- wraps GCC's `fastcall' function attribute. The conditional
- code can be easilly adapted to other compilers that support a
- similar feature.
-
- The name is also added to the file's undef_list.
- """
-
- self.undef_list.append("FASTCALL")
- print """# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-# define FASTCALL __attribute__((fastcall))
-# else
-# define FASTCALL
-# endif"""
- return
-
-
- def printVisibility(self, S, s):
- """Conditionally define visibility function attribute.
-
- Conditionally defines a preprocessor macro name S that wraps
- GCC's visibility function attribute. The visibility used is
- the parameter s. The conditional code can be easilly adapted
- to other compilers that support a similar feature.
-
- The name is also added to the file's undef_list.
- """
-
- self.undef_list.append(S)
- print """# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
-# define %s __attribute__((visibility("%s")))
-# else
-# define %s
-# endif""" % (S, s, S)
- return
-
-
- def printNoinline(self):
- """Conditionally define `NOINLINE' function attribute.
-
- Conditionally defines a preprocessor macro `NOINLINE' that
- wraps GCC's `noinline' function attribute. The conditional
- code can be easilly adapted to other compilers that support a
- similar feature.
-
- The name is also added to the file's undef_list.
- """
-
- self.undef_list.append("NOINLINE")
- print """# if defined(__GNUC__)
-# define NOINLINE __attribute__((noinline))
-# else
-# define NOINLINE
-# endif"""
- return
-
-
-def real_function_name(element):
- name = element.nsProp( "name", None )
- alias = element.nsProp( "alias", None )
-
- if alias:
- return alias
- else:
- return name
-
-
-def real_category_name(c):
- if re.compile("[1-9][0-9]*[.][0-9]+").match(c):
- return "GL_VERSION_" + c.replace(".", "_")
- else:
- return c
-
-
-def create_parameter_string(parameters, include_names):
- """Create a parameter string from a list of gl_parameters."""
-
- list = []
- for p in parameters:
- if include_names:
- list.append( p.string() )
- else:
- list.append( p.type_string() )
-
- if len(list) == 0: list = ["void"]
-
- return string.join(list, ", ")
-
-
-class gl_item:
- def __init__(self, element, context):
- self.context = context
- self.name = element.nsProp( "name", None )
- self.category = real_category_name( element.parent.nsProp( "name", None ) )
- return
-
-
-class gl_type( gl_item ):
- def __init__(self, element, context):
- gl_item.__init__(self, element, context)
- self.size = int( element.nsProp( "size", None ), 0 )
-
- te = typeexpr.type_expression( None )
- tn = typeexpr.type_node()
- tn.size = int( element.nsProp( "size", None ), 0 )
- tn.integer = not is_attr_true( element, "float" )
- tn.unsigned = is_attr_true( element, "unsigned" )
- tn.name = "GL" + self.name
- te.set_base_type_node( tn )
-
- self.type_expr = te
- return
-
-
- def get_type_expression(self):
- return self.type_expr
-
-
-class gl_enum( gl_item ):
- def __init__(self, element, context):
- gl_item.__init__(self, element, context)
- self.value = int( element.nsProp( "value", None ), 0 )
-
- temp = element.nsProp( "count", None )
- if not temp or temp == "?":
- self.default_count = -1
- else:
- try:
- c = int(temp)
- except Exception,e:
- raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n))
-
- self.default_count = c
-
- return
-
-
- def priority(self):
- """Calculate a 'priority' for this enum name.
-
- When an enum is looked up by number, there may be many
- possible names, but only one is the 'prefered' name. The
- priority is used to select which name is the 'best'.
-
- Highest precedence is given to core GL name. ARB extension
- names have the next highest, followed by EXT extension names.
- Vendor extension names are the lowest.
- """
-
- if self.name.endswith( "_BIT" ):
- bias = 1
- else:
- bias = 0
-
- if self.category.startswith( "GL_VERSION_" ):
- priority = 0
- elif self.category.startswith( "GL_ARB_" ):
- priority = 2
- elif self.category.startswith( "GL_EXT_" ):
- priority = 4
- else:
- priority = 6
-
- return priority + bias
-
-
-
-class gl_parameter:
- def __init__(self, element, context):
- self.name = element.nsProp( "name", None )
-
- ts = element.nsProp( "type", None )
- self.type_expr = typeexpr.type_expression( ts, context )
-
- temp = element.nsProp( "variable_param", None )
- if temp:
- self.count_parameter_list = temp.split( ' ' )
- else:
- self.count_parameter_list = []
-
- # The count tag can be either a numeric string or the name of
- # a variable. If it is the name of a variable, the int(c)
- # statement will throw an exception, and the except block will
- # take over.
-
- c = element.nsProp( "count", None )
- try:
- count = int(c)
- self.count = count
- self.counter = None
- except Exception,e:
- count = 1
- self.count = 0
- self.counter = c
-
- self.count_scale = int(element.nsProp( "count_scale", None ))
-
- elements = (count * self.count_scale)
- if elements == 1:
- elements = 0
-
- #if ts == "GLdouble":
- # print '/* stack size -> %s = %u (before)*/' % (self.name, self.type_expr.get_stack_size())
- # print '/* # elements = %u */' % (elements)
- self.type_expr.set_elements( elements )
- #if ts == "GLdouble":
- # print '/* stack size -> %s = %u (after) */' % (self.name, self.type_expr.get_stack_size())
-
- self.is_counter = is_attr_true( element, 'counter' )
- self.is_output = is_attr_true( element, 'output' )
-
-
- # Pixel data has special parameters.
-
- self.width = element.nsProp('img_width', None)
- self.height = element.nsProp('img_height', None)
- self.depth = element.nsProp('img_depth', None)
- self.extent = element.nsProp('img_extent', None)
-
- self.img_xoff = element.nsProp('img_xoff', None)
- self.img_yoff = element.nsProp('img_yoff', None)
- self.img_zoff = element.nsProp('img_zoff', None)
- self.img_woff = element.nsProp('img_woff', None)
-
- self.img_format = element.nsProp('img_format', None)
- self.img_type = element.nsProp('img_type', None)
- self.img_target = element.nsProp('img_target', None)
-
- self.img_pad_dimensions = is_attr_true( element, 'img_pad_dimensions' )
- self.img_null_flag = is_attr_true( element, 'img_null_flag' )
- self.img_send_null = is_attr_true( element, 'img_send_null' )
-
- return
-
-
- def compatible(self, other):
- return 1
-
-
- def is_array(self):
- return self.is_pointer()
-
-
- def is_pointer(self):
- return self.type_expr.is_pointer()
-
-
- def is_image(self):
- if self.width:
- return 1
- else:
- return 0
-
-
- def is_variable_length(self):
- return len(self.count_parameter_list) or self.counter
-
-
- def is_64_bit(self):
- count = self.type_expr.get_element_count()
- if count:
- if (self.size() / count) == 8:
- return 1
- else:
- if self.size() == 8:
- return 1
-
- return 0
-
-
- def string(self):
- return self.type_expr.original_string + " " + self.name
-
-
- def type_string(self):
- return self.type_expr.original_string
-
-
- def get_base_type_string(self):
- return self.type_expr.get_base_name()
-
-
- def get_dimensions(self):
- if not self.width:
- return [ 0, "0", "0", "0", "0" ]
-
- dim = 1
- w = self.width
- h = "1"
- d = "1"
- e = "1"
-
- if self.height:
- dim = 2
- h = self.height
-
- if self.depth:
- dim = 3
- d = self.depth
-
- if self.extent:
- dim = 4
- e = self.extent
-
- return [ dim, w, h, d, e ]
-
-
- def get_stack_size(self):
- return self.type_expr.get_stack_size()
-
-
- def size(self):
- if self.is_image():
- return 0
- else:
- return self.type_expr.get_element_size()
-
-
- def get_element_count(self):
- c = self.type_expr.get_element_count()
- if c == 0:
- return 1
-
- return c
-
-
- def size_string(self, use_parens = 1):
- s = self.size()
- if self.counter or self.count_parameter_list:
- list = [ "compsize" ]
-
- if self.counter and self.count_parameter_list:
- list.append( self.counter )
- elif self.counter:
- list = [ self.counter ]
-
- if s > 1:
- list.append( str(s) )
-
- if len(list) > 1 and use_parens :
- return "(%s)" % (string.join(list, " * "))
- else:
- return string.join(list, " * ")
-
- elif self.is_image():
- return "compsize"
- else:
- return str(s)
-
-
- def format_string(self):
- if self.type_expr.original_string == "GLenum":
- return "0x%x"
- else:
- return self.type_expr.format_string()
-
-
-
-class gl_function( gl_item ):
- def __init__(self, element, context):
- self.context = context
- self.name = None
-
- self.entry_points = []
- self.return_type = "void"
- self.parameters = []
- self.offset = -1
- self.initialized = 0
- self.images = []
-
- # Track the parameter string (for the function prototype)
- # for each entry-point. This is done because some functions
- # change their prototype slightly when promoted from extension
- # to ARB extension to core. glTexImage3DEXT and glTexImage3D
- # are good examples of this. Scripts that need to generate
- # code for these differing aliases need to real prototype
- # for each entry-point. Otherwise, they may generate code
- # that won't compile.
-
- self.parameter_strings = {}
-
- self.process_element( element )
-
- return
-
-
- def process_element(self, element):
- name = element.nsProp( "name", None )
- alias = element.nsProp( "alias", None )
-
- self.entry_points.append( name )
- if alias:
- true_name = alias
- else:
- true_name = name
-
- # Only try to set the offset when a non-alias
- # entry-point is being processes.
-
- offset = element.nsProp( "offset", None )
- if offset:
- try:
- o = int( offset )
- self.offset = o
- except Exception, e:
- self.offset = -1
-
-
- if not self.name:
- self.name = true_name
- elif self.name != true_name:
- raise RuntimeError("Function true name redefined. Was %s, now %s." % (self.name, true_name))
-
-
- # There are two possible cases. The first time an entry-point
- # with data is seen, self.initialized will be 0. On that
- # pass, we just fill in the data. The next time an
- # entry-point with data is seen, self.initialized will be 1.
- # On that pass we have to make that the new values match the
- # valuse from the previous entry-point.
-
- parameters = []
- return_type = "void"
- child = element.children
- while child:
- if child.type == "element":
- if child.name == "return":
- return_type = child.nsProp( "type", None )
- elif child.name == "param":
- param = self.context.factory.create_item( "parameter", child, self.context)
- parameters.append( param )
-
- child = child.next
-
-
- if self.initialized:
- if self.return_type != return_type:
- raise RuntimeError( "Return type changed in %s. Was %s, now %s." % (name, self.return_type, return_type))
-
- if len(parameters) != len(self.parameters):
- raise RuntimeError( "Parameter count mismatch in %s. Was %d, now %d." % (name, len(self.parameters), len(parameters)))
-
- for j in range(0, len(parameters)):
- p1 = parameters[j]
- p2 = self.parameters[j]
- if not p1.compatible( p2 ):
- raise RuntimeError( 'Parameter type mismatch in %s. "%s" was "%s", now "%s".' % (name, p2.name, p2.type_expr.original_string, p1.type_expr.original_string))
-
-
- if true_name == name or not self.initialized:
- self.return_type = return_type
- self.parameters = parameters
-
- for param in self.parameters:
- if param.is_image():
- self.images.append( param )
-
- if element.children:
- self.initialized = 1
- self.parameter_strings[name] = create_parameter_string(parameters, 1)
- else:
- self.parameter_strings[name] = None
-
- return
-
-
- def get_images(self):
- """Return potentially empty list of input images."""
- return self.images
-
-
- def parameterIterator(self):
- return self.parameters.__iter__();
-
-
- def get_parameter_string(self, entrypoint = None):
- if entrypoint:
- s = self.parameter_strings[ entrypoint ]
- if s:
- return s
-
- return create_parameter_string( self.parameters, 1 )
-
-
-class gl_item_factory:
- """Factory to create objects derived from gl_item."""
-
- def create_item(self, item_name, element, context):
- if item_name == "function":
- return gl_function(element, context)
- if item_name == "type":
- return gl_type(element, context)
- elif item_name == "enum":
- return gl_enum(element, context)
- elif item_name == "parameter":
- return gl_parameter(element, context)
- elif item_name == "api":
- return gl_api(self)
- else:
- return None
-
-
-class gl_api:
- def __init__(self, factory):
- self.functions_by_name = {}
- self.enums_by_name = {}
- self.types_by_name = {}
- self.category_dict = {}
-
- self.factory = factory
-
- typeexpr.create_initial_types()
- return
-
-
- def process_element(self, doc):
- element = doc.children
- while element.type != "element" or element.name != "OpenGLAPI":
- element = element.next
-
- if element:
- self.process_OpenGLAPI(element)
- return
-
-
- def process_OpenGLAPI(self, element):
- child = element.children
- while child:
- if child.type == "element":
- if child.name == "category":
- self.process_category( child )
- elif child.name == "OpenGLAPI":
- self.process_OpenGLAPI( child )
-
- child = child.next
-
- return
-
-
- def process_category(self, cat):
- cat_name = cat.nsProp( "name", None )
- cat_number = cat.nsProp( "number", None )
-
- child = cat.children
- while child:
- if child.type == "element":
- if child.name == "function":
- func_name = real_function_name( child )
-
- temp_name = child.nsProp( "name", None )
- self.category_dict[ temp_name ] = [cat_name, cat_number]
-
- if self.functions_by_name.has_key( func_name ):
- func = self.functions_by_name[ func_name ]
- func.process_element( child )
- else:
- func = self.factory.create_item( "function", child, self )
- self.functions_by_name[ func_name ] = func
-
-
- elif child.name == "enum":
- enum = self.factory.create_item( "enum", child, self )
- self.enums_by_name[ enum.name ] = enum
- elif child.name == "type":
- t = self.factory.create_item( "type", child, self )
- self.types_by_name[ "GL" + t.name ] = t
-
-
- child = child.next
-
- return
-
-
- def functionIterateByOffset(self):
- max_offset = -1
- for func in self.functions_by_name.itervalues():
- if func.offset > max_offset:
- max_offset = func.offset
-
-
- temp = [None for i in range(0, max_offset + 1)]
- for func in self.functions_by_name.itervalues():
- if func.offset != -1:
- temp[ func.offset ] = func
-
-
- list = []
- for i in range(0, max_offset + 1):
- if temp[i]:
- list.append(temp[i])
-
- return list.__iter__();
-
-
- def functionIterateAll(self):
- return self.functions_by_name.itervalues()
-
-
- def enumIterateByName(self):
- keys = self.enums_by_name.keys()
- keys.sort()
-
- list = []
- for enum in keys:
- list.append( self.enums_by_name[ enum ] )
-
- return list.__iter__()
-
-
- def get_category_for_name( self, name ):
- if self.category_dict.has_key(name):
- return self.category_dict[name]
- else:
- return ["<unknown category>", None]
-
-
- def typeIterate(self):
- return self.types_by_name.itervalues()
-
-
- def find_type( self, type_name ):
- if type_name in self.types_by_name:
- return self.types_by_name[ type_name ].type_expr
- else:
- print "Unable to find base type matching \"%s\"." % (type_name)
- return None
diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py
deleted file mode 100644
index 7cc434fa89b..00000000000
--- a/src/mesa/glapi/gl_apitemp.py
+++ /dev/null
@@ -1,216 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML
-import license
-import sys, getopt
-
-class PrintGlOffsets(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "gl_apitemp.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
-
- self.undef_list.append( "KEYWORD1" )
- self.undef_list.append( "KEYWORD2" )
- self.undef_list.append( "NAME" )
- self.undef_list.append( "DISPATCH" )
- self.undef_list.append( "RETURN_DISPATCH" )
- self.undef_list.append( "DISPATCH_TABLE_NAME" )
- self.undef_list.append( "UNUSED_TABLE_NAME" )
- self.undef_list.append( "TABLE_ENTRY" )
-
-
- def printFunction(self, f, name):
- p_string = ""
- o_string = ""
- t_string = ""
- comma = ""
-
- for p in f.parameterIterator():
- if p.is_pointer():
- cast = "(const void *) "
- else:
- cast = ""
-
- t_string = t_string + comma + p.format_string()
- p_string = p_string + comma + p.name
- o_string = o_string + comma + cast + p.name
- comma = ", "
-
-
- if f.return_type != 'void':
- dispatch = "RETURN_DISPATCH"
- else:
- dispatch = "DISPATCH"
-
- print 'KEYWORD1 %s KEYWORD2 NAME(%s)(%s)' \
- % (f.return_type, name, f.get_parameter_string(name))
- print '{'
- if p_string == "":
- print ' %s(%s, (), (F, "gl%s();\\n"));' \
- % (dispatch, f.name, name)
- else:
- print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \
- % (dispatch, f.name, p_string, name, t_string, o_string)
- print '}'
- print ''
- return
-
- def printRealHeader(self):
- print """
-/*
- * This file is a template which generates the OpenGL API entry point
- * functions. It should be included by a .c file which first defines
- * the following macros:
- * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32
- * KEYWORD2 - usually nothing, but might be __stdcall on Win32
- * NAME(n) - builds the final function name (usually add "gl" prefix)
- * DISPATCH(func, args, msg) - code to do dispatch of named function.
- * msg is a printf-style debug message.
- * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value
- *
- * Here is an example which generates the usual OpenGL functions:
- * #define KEYWORD1
- * #define KEYWORD2
- * #define NAME(func) gl##func
- * #define DISPATCH(func, args, msg) \\
- * struct _glapi_table *dispatch = CurrentDispatch; \\
- * (*dispatch->func) args
- * #define RETURN DISPATCH(func, args, msg) \\
- * struct _glapi_table *dispatch = CurrentDispatch; \\
- * return (*dispatch->func) args
- *
- */
-
-
-#if defined( NAME )
-#ifndef KEYWORD1
-#define KEYWORD1
-#endif
-
-#ifndef KEYWORD2
-#define KEYWORD2
-#endif
-
-#ifndef DISPATCH
-#error DISPATCH must be defined
-#endif
-
-#ifndef RETURN_DISPATCH
-#error RETURN_DISPATCH must be defined
-#endif
-
-"""
- return
-
-
-
- def printInitDispatch(self, api):
- print """
-#endif /* defined( NAME ) */
-
-/*
- * This is how a dispatch table can be initialized with all the functions
- * we generated above.
- */
-#ifdef DISPATCH_TABLE_NAME
-
-#ifndef TABLE_ENTRY
-#error TABLE_ENTRY must be defined
-#endif
-
-static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
- for f in api.functionIterateByOffset():
- print ' TABLE_ENTRY(%s),' % (f.name)
-
- print ' /* A whole bunch of no-op functions. These might be called'
- print ' * when someone tries to call a dynamically-registered'
- print ' * extension function without a current rendering context.'
- print ' */'
- for i in range(1, 100):
- print ' TABLE_ENTRY(Unused),'
-
- print '};'
- print '#endif /* DISPATCH_TABLE_NAME */'
- print ''
- return
-
-
- def printAliasedTable(self, api):
- print """
-/*
- * This is just used to silence compiler warnings.
- * We list the functions which are not otherwise used.
- */
-#ifdef UNUSED_TABLE_NAME
-static _glapi_proc UNUSED_TABLE_NAME[] = {"""
-
- for f in api.functionIterateByOffset():
- for n in f.entry_points:
- if n != f.name:
- print ' TABLE_ENTRY(%s),' % (n)
-
- print '};'
- print '#endif /*UNUSED_TABLE_NAME*/'
- print ''
- return
-
-
- def printBody(self, api):
- for func in api.functionIterateByOffset():
- for n in func.entry_points:
- self.printFunction( func, n )
-
- self.printInitDispatch(api)
- self.printAliasedTable(api)
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer = PrintGlOffsets()
- printer.Print(api)
diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py
deleted file mode 100644
index e8c0576fd9b..00000000000
--- a/src/mesa/glapi/gl_enums.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/python2
-# -*- Mode: Python; py-indent-offset: 8 -*-
-
-# (C) Copyright Zack Rusin 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Zack Rusin <zack@kde.org>
-
-import license
-import gl_XML
-import sys, getopt
-
-class PrintGlEnums(gl_XML.gl_print_base):
-
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "gl_enums.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2005 Brian Paul All Rights Reserved.""", "BRIAN PAUL")
- self.enum_table = {}
-
-
- def printRealHeader(self):
- print '#include "glheader.h"'
- print '#include "enums.h"'
- print '#include "imports.h"'
- print ''
- print 'typedef struct {'
- print ' size_t offset;'
- print ' int n;'
- print '} enum_elt;'
- print ''
- return
-
- def print_code(self):
- print """
-#define Elements(x) sizeof(x)/sizeof(*x)
-
-typedef int (*cfunc)(const void *, const void *);
-
-/**
- * Compare a key name to an element in the \c all_enums array.
- *
- * \c bsearch always passes the key as the first parameter and the pointer
- * to the array element as the second parameter. We can elimiate some
- * extra work by taking advantage of that fact.
- *
- * \param a Pointer to the desired enum name.
- * \param b Pointer to an element of the \c all_enums array.
- */
-static int compar_name( const char *a, const enum_elt *b )
-{
- return _mesa_strcmp( a, & enum_string_table[ b->offset ] );
-}
-
-/**
- * Compare a key enum value to an element in the \c all_enums array.
- *
- * \c bsearch always passes the key as the first parameter and the pointer
- * to the array element as the second parameter. We can elimiate some
- * extra work by taking advantage of that fact.
- *
- * \param a Pointer to the desired enum name.
- * \param b Pointer to an index into the \c all_enums array.
- */
-static int compar_nr( const int *a, const unsigned *b )
-{
- return a[0] - all_enums[*b].n;
-}
-
-
-static char token_tmp[20];
-
-const char *_mesa_lookup_enum_by_nr( int nr )
-{
- unsigned * i;
-
- i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums),
- sizeof(reduced_enums[0]), (cfunc) compar_nr );
-
- if ( i != NULL ) {
- return & enum_string_table[ all_enums[ *i ].offset ];
- }
- else {
- /* this is not re-entrant safe, no big deal here */
- _mesa_sprintf(token_tmp, "0x%x", nr);
- return token_tmp;
- }
-}
-
-int _mesa_lookup_enum_by_name( const char *symbol )
-{
- enum_elt * f = NULL;
-
- if ( symbol != NULL ) {
- f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums),
- sizeof( enum_elt ), (cfunc) compar_name );
- }
-
- return (f != NULL) ? f->n : -1;
-}
-
-"""
- return
-
-
- def printBody(self, api):
- self.process_enums( api )
-
- keys = self.enum_table.keys()
- keys.sort()
-
- name_table = []
- enum_table = {}
-
- for enum in keys:
- low_pri = 9
- for [name, pri] in self.enum_table[ enum ]:
- name_table.append( [name, enum] )
-
- if pri < low_pri:
- low_pri = pri
- enum_table[enum] = name
-
-
- name_table.sort()
-
- string_offsets = {}
- i = 0;
- print 'static const char enum_string_table[] = '
- for [name, enum] in name_table:
- print ' "%s\\0"' % (name)
- string_offsets[ name ] = i
- i += len(name) + 1
-
- print ' ;'
- print ''
-
-
- print 'static const enum_elt all_enums[%u] =' % (len(name_table))
- print '{'
- for [name, enum] in name_table:
- print ' { %5u, 0x%08X }, /* %s */' % (string_offsets[name], enum, name)
- print '};'
- print ''
-
- print 'static const unsigned reduced_enums[%u] =' % (len(keys))
- print '{'
- for enum in keys:
- name = enum_table[ enum ]
- if [name, enum] not in name_table:
- print ' /* Error! %s, 0x%04x */ 0,' % (name, enum)
- else:
- i = name_table.index( [name, enum] )
-
- print ' %4u, /* %s */' % (i, name)
- print '};'
-
-
- self.print_code()
- return
-
-
- def process_enums(self, api):
- self.enum_table = {}
-
- for obj in api.enumIterateByName():
- if obj.value not in self.enum_table:
- self.enum_table[ obj.value ] = []
-
-
- name = "GL_" + obj.name
- priority = obj.priority()
- self.enum_table[ obj.value ].append( [name, priority] )
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer = PrintGlEnums()
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py
deleted file mode 100644
index 2966e3b624b..00000000000
--- a/src/mesa/glapi/gl_offsets.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML
-import license
-import sys, getopt
-
-class PrintGlOffsets(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "gl_offsets.py (from Mesa)"
- self.header_tag = '_GLAPI_OFFSETS_H_'
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
- return
-
- def printBody(self, api):
- abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
-
- functions = []
- abi_functions = []
- count = 0
- for f in api.functionIterateByOffset():
- [category, num] = api.get_category_for_name( f.name )
- if category not in abi:
- functions.append( [f, count] )
- count += 1
- else:
- abi_functions.append( f )
-
-
- for f in abi_functions:
- print '#define _gloffset_%s %d' % (f.name, f.offset)
- last_static = f.offset
-
- print ''
- print '#if !defined(IN_DRI_DRIVER)'
- print ''
-
- for [f, index] in functions:
- print '#define _gloffset_%s %d' % (f.name, f.offset)
- if f.offset > last_static:
- last_static = f.offset
-
- print '#define _gloffset_FIRST_DYNAMIC %d' % (last_static + 1)
-
- print ''
- print '#else'
- print ''
-
- for [f, index] in functions:
- print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name)
-
- print ''
- print '#endif /* !defined(IN_DRI_DRIVER) */'
-
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer = PrintGlOffsets()
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py
deleted file mode 100644
index 76131b83a0b..00000000000
--- a/src/mesa/glapi/gl_procs.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import license
-import gl_XML
-import sys, getopt
-
-class PrintGlProcs(gl_XML.gl_print_base):
- def __init__(self, long_strings):
- gl_XML.gl_print_base.__init__(self)
-
- self.long_strings = long_strings
- self.name = "gl_procs.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
-
-
- def printRealHeader(self):
- print '/* This file is only included by glapi.c and is used for'
- print ' * the GetProcAddress() function'
- print ' */'
- print ''
- print 'typedef struct {'
- print ' GLint Name_offset;'
- print '#ifdef NEED_FUNCTION_POINTER'
- print ' _glapi_proc Address;'
- print '#endif'
- print ' GLuint Offset;'
- print '} glprocs_table_t;'
- print ''
- print '#ifdef NEED_FUNCTION_POINTER'
- print '# define NAME_FUNC_OFFSET(n,f,o) { n , (_glapi_proc) f , o }'
- print '#else'
- print '# define NAME_FUNC_OFFSET(n,f,o) { n , o }'
- print '#endif'
- print ''
- return
-
- def printRealFooter(self):
- print ''
- print '#undef NAME_FUNC_OFFSET'
- return
-
- def printFunctionString(self, name):
- if self.long_strings:
- print ' "gl%s\\0"' % (name)
- else:
- print " 'g','l',",
- for c in name:
- print "'%s'," % (c),
-
- print "'\\0',"
-
-
- def printBody(self, api):
- print ''
- if self.long_strings:
- print 'static const char gl_string_table[] ='
- else:
- print 'static const char gl_string_table[] = {'
-
- base_offset = 0
- table = []
- for func in api.functionIterateByOffset():
- self.printFunctionString( func.name )
- table.append((base_offset, func.name, func.name))
-
- # The length of the function's name, plus 2 for "gl",
- # plus 1 for the NUL.
-
- base_offset += len(func.name) + 3
-
-
- for func in api.functionIterateByOffset():
- for n in func.entry_points:
- if n != func.name:
- self.printFunctionString( n )
- table.append((base_offset, n, func.name))
- base_offset += len(n) + 3
-
-
- if self.long_strings:
- print ' ;'
- else:
- print '};'
-
- print ''
- print 'static const glprocs_table_t static_functions[] = {'
-
- for (offset, disp_name, real_name) in table:
- print ' NAME_FUNC_OFFSET( %5u, gl%s, _gloffset_%s ),' % (offset, disp_name, real_name)
-
- print ' NAME_FUNC_OFFSET( -1, NULL, 0 )'
- print '};'
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
- print "mode can be one of:"
- print " long - Create code for compilers that can handle very "
- print " long string constants. (default)"
- print " short - Create code for compilers that can only handle "
- print " ANSI C89 string constants."
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
- except Exception,e:
- show_usage()
-
- long_string = 1
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- if val == "short":
- long_string = 0
- elif val == "long":
- long_string = 1
- else:
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer = PrintGlProcs( long_string )
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py
deleted file mode 100644
index 52b4be1d2b5..00000000000
--- a/src/mesa/glapi/gl_table.py
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/usr/bin/python2
-
-# (C) Copyright IBM Corporation 2004
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML
-import license
-import sys, getopt
-
-class PrintGlTable(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.header_tag = '_GLAPI_TABLE_H_'
- self.name = "gl_table.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
- return
-
-
- def printBody(self, api):
- for f in api.functionIterateByOffset():
- arg_string = f.get_parameter_string()
- print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (f.return_type, f.name, arg_string, f.offset)
-
-
- def printRealHeader(self):
- print '#ifndef GLAPIENTRYP'
- print '#define GLAPIENTRYP'
- print '#endif'
- print ''
- print 'typedef void (*_glapi_proc)(void); /* generic function pointer */'
- print ''
- print 'struct _glapi_table'
- print '{'
- return
-
-
- def printRealFooter(self):
- print '};'
- return
-
-
-class PrintRemapTable(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.header_tag = '_DISPATCH_H_'
- self.name = "gl_table.py (from Mesa)"
- self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
- return
-
-
- def printRealHeader(self):
- print """/**
- * \\file dispatch.h
- * Macros for handling GL dispatch tables.
- *
- * For each known GL function, there are 3 macros in this file. The first
- * macro is named CALL_FuncName and is used to call that GL function using
- * the specified dispatch table. The other 2 macros, called GET_FuncName
- * can SET_FuncName, are used to get and set the dispatch pointer for the
- * named function in the specified dispatch table.
- */
-"""
-
- return
-
- def printBody(self, api):
- print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
- print ' (*(cast (GET_by_offset(disp, offset)))) parameters'
- print '#define GET_by_offset(disp, offset) \\'
- print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL'
- print '#define SET_by_offset(disp, offset, fn) \\'
- print ' do { \\'
- print ' if ( (offset) < 0 ) { \\'
- print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\'
- print ' /* __func__, __LINE__, disp, offset, # fn); */ \\'
- print ' /* abort(); */ \\'
- print ' } \\'
- print ' else { \\'
- print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\'
- print ' } \\'
- print ' } while(0)'
- print ''
-
- abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
-
- functions = []
- abi_functions = []
- count = 0
- for f in api.functionIterateByOffset():
- [category, num] = api.get_category_for_name( f.name )
- if category not in abi:
- functions.append( [f, count] )
- count += 1
- else:
- abi_functions.append( f )
-
-
- for f in abi_functions:
- print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
- print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
- print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
-
-
- print ''
- print '#if !defined(IN_DRI_DRIVER)'
- print ''
-
- for [f, index] in functions:
- print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
- print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
- print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
-
- print ''
- print '#else'
- print ''
- print '#define driDispatchRemapTable_size %u' % (count)
- print 'extern int driDispatchRemapTable[ driDispatchRemapTable_size ];'
- print ''
-
- for [f, index] in functions:
- print '#define %s_remap_index %u' % (f.name, index)
-
- print ''
-
- for [f, index] in functions:
- arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
- cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string)
-
- print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name)
- print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name)
- print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name)
-
-
- print ''
- print '#endif /* !defined(IN_DRI_DRIVER) */'
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
- print " -m mode Mode can be 'table' or 'remap_table'."
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
- except Exception,e:
- show_usage()
-
- mode = "table"
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- mode = val
-
- if mode == "table":
- printer = PrintGlTable()
- elif mode == "remap_table":
- printer = PrintRemapTable()
- else:
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_x86-64_asm.py b/src/mesa/glapi/gl_x86-64_asm.py
deleted file mode 100644
index ea13d2ac522..00000000000
--- a/src/mesa/glapi/gl_x86-64_asm.py
+++ /dev/null
@@ -1,320 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, license
-import sys, getopt, copy
-
-def should_use_push(registers):
- for [reg, offset] in registers:
- if reg[1:4] == "xmm":
- return 0
-
- N = len(registers)
- return (N & 1) != 0
-
-
-def local_size(registers):
- # The x86-64 ABI says "the value (%rsp - 8) is always a multiple of
- # 16 when control is transfered to the function entry point." This
- # means that the local stack usage must be (16*N)+8 for some value
- # of N. (16*N)+8 = (8*(2N))+8 = 8*(2N+1). As long as N is odd, we
- # meet this requirement.
-
- N = (len(registers) | 1)
- return 8*N
-
-
-def save_all_regs(registers):
- adjust_stack = 0
- if not should_use_push(registers):
- adjust_stack = local_size(registers)
- print '\tsubq\t$%u, %%rsp' % (adjust_stack)
-
- for [reg, stack_offset] in registers:
- save_reg( reg, stack_offset, adjust_stack )
- return
-
-
-def restore_all_regs(registers):
- adjust_stack = 0
- if not should_use_push(registers):
- adjust_stack = local_size(registers)
-
- temp = copy.deepcopy(registers)
- while len(temp):
- [reg, stack_offset] = temp.pop()
- restore_reg(reg, stack_offset, adjust_stack)
-
- if adjust_stack:
- print '\taddq\t$%u, %%rsp' % (adjust_stack)
- return
-
-
-def save_reg(reg, offset, use_move):
- if use_move:
- if offset == 0:
- print '\tmovq\t%s, (%%rsp)' % (reg)
- else:
- print '\tmovq\t%s, %u(%%rsp)' % (reg, offset)
- else:
- print '\tpushq\t%s' % (reg)
-
- return
-
-
-def restore_reg(reg, offset, use_move):
- if use_move:
- if offset == 0:
- print '\tmovq\t(%%rsp), %s' % (reg)
- else:
- print '\tmovq\t%u(%%rsp), %s' % (offset, reg)
- else:
- print '\tpopq\t%s' % (reg)
-
- return
-
-
-class PrintGenericStubs(gl_XML.gl_print_base):
-
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "gl_x86-64_asm.py (from Mesa)"
- self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
- return
-
-
- def get_stack_size(self, f):
- size = 0
- for p in f.parameterIterator():
- size += p.get_stack_size()
-
- return size
-
-
- def printRealHeader(self):
- print "/* If we build with gcc's -fvisibility=hidden flag, we'll need to change"
- print " * the symbol visibility mode to 'default'."
- print ' */'
- print ''
- print '#include "../x86/assyntax.h"'
- print ''
- print '#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303'
- print '# pragma GCC visibility push(default)'
- print '# define HIDDEN(x) .hidden x'
- print '#else'
- print '# define HIDDEN(x)'
- print '#endif'
- print ''
- print '# if defined(USE_MGL_NAMESPACE)'
- print '# define GL_PREFIX(n) GLNAME(CONCAT(mgl,n))'
- print '# else'
- print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
- print '# endif'
- print ''
- print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
- print '# define THREADS'
- print '#endif'
- print ''
- print '\t.text'
- print ''
- print '#ifdef GLX_USE_TLS'
- print ''
- print '\t.globl _x86_64_get_get_dispatch; HIDDEN(_x86_64_get_get_dispatch)'
- print '_x86_64_get_get_dispatch:'
- print '\tlea\t_x86_64_get_dispatch(%rip), %rax'
- print '\tret'
- print ''
- print '\t.p2align\t4,,15'
- print '_x86_64_get_dispatch:'
- print '\tmovq\t_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax'
- print '\tmovq\t%fs:(%rax), %rax'
- print '\tret'
- print '\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch'
- print ''
- print '#elif defined(PTHREADS)'
- print ''
- print '\t.extern\t_glapi_Dispatch'
- print '\t.extern\t_gl_DispatchTSD'
- print '\t.extern\tpthread_getspecific'
- print ''
- print '\t.p2align\t4,,15'
- print '_x86_64_get_dispatch:'
- print '\tmovq\t_gl_DispatchTSD(%rip), %rdi'
- print '\tjmp\tpthread_getspecific@PLT'
- print ''
- print '#elif defined(THREADS)'
- print ''
- print '\t.extern\t_glapi_get_dispatch'
- print ''
- print '#endif'
- print ''
- return
-
-
- def printRealFooter(self):
- print ''
- print '#if defined(GLX_USE_TLS) && defined(__linux__)'
- print ' .section ".note.ABI-tag", "a"'
- print ' .p2align 2'
- print ' .long 1f - 0f /* name length */'
- print ' .long 3f - 2f /* data length */'
- print ' .long 1 /* note length */'
- print '0: .asciz "GNU" /* vendor name */'
- print '1: .p2align 2'
- print '2: .long 0 /* note data: the ABI tag */'
- print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
- print '3: .p2align 2 /* pad out section */'
- print '#endif /* GLX_USE_TLS */'
- print ''
- print '#if defined (__ELF__) && defined (__linux__)'
- print ' .section .note.GNU-stack,"",%progbits'
- print '#endif'
- return
-
-
- def printFunction(self, f):
-
- # The x86-64 ABI divides function parameters into a couple
- # classes. For the OpenGL interface, the only ones that are
- # relevent are INTEGER and SSE. Basically, the first 8
- # GLfloat or GLdouble parameters are placed in %xmm0 - %xmm7,
- # the first 6 non-GLfloat / non-GLdouble parameters are placed
- # in registers listed in int_parameters.
- #
- # If more parameters than that are required, they are passed
- # on the stack. Therefore, we just have to make sure that
- # %esp hasn't changed when we jump to the actual function.
- # Since we're jumping to the function (and not calling it), we
- # have to make sure of that anyway!
-
- int_parameters = ["%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9"]
-
- int_class = 0
- sse_class = 0
- stack_offset = 0
- registers = []
- for p in f.parameterIterator():
- type_name = p.get_base_type_string()
-
- if p.is_pointer() or (type_name != "GLfloat" and type_name != "GLdouble"):
- if int_class < 6:
- registers.append( [int_parameters[int_class], stack_offset] )
- int_class += 1
- stack_offset += 8
- else:
- if sse_class < 8:
- registers.append( ["%%xmm%u" % (sse_class), stack_offset] )
- sse_class += 1
- stack_offset += 8
-
- if ((int_class & 1) == 0) and (sse_class == 0):
- registers.append( ["%rbp", 0] )
-
-
- print '\t.p2align\t4,,15'
- print '\t.globl\tGL_PREFIX(%s)' % (f.name)
- print '\t.type\tGL_PREFIX(%s), @function' % (f.name)
- print 'GL_PREFIX(%s):' % (f.name)
- print '#if defined(GLX_USE_TLS)'
- print '\tcall\t_x86_64_get_dispatch@PLT'
- print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
- print '\tjmp\t*%r11'
- print '#elif defined(PTHREADS)'
-
- save_all_regs(registers)
- print '\tcall\t_x86_64_get_dispatch@PLT'
- restore_all_regs(registers)
-
- if f.offset == 0:
- print '\tmovq\t(%rax), %r11'
- else:
- print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
-
- print '\tjmp\t*%r11'
-
- print '#else'
- print '\tmovq\t_glapi_Dispatch(%rip), %rax'
- print '\ttestq\t%rax, %rax'
- print '\tje\t1f'
- print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
- print '\tjmp\t*%r11'
- print '1:'
-
- save_all_regs(registers)
- print '\tcall\t_glapi_get_dispatch'
- restore_all_regs(registers)
-
- print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
- print '\tjmp\t*%r11'
- print '#endif /* defined(GLX_USE_TLS) */'
-
- print '\t.size\tGL_PREFIX(%s), .-GL_PREFIX(%s)' % (f.name, f.name)
- print ''
- return
-
-
- def printBody(self, api):
- for f in api.functionIterateByOffset():
- self.printFunction(f)
-
-
- for f in api.functionIterateByOffset():
- for n in f.entry_points:
- if n != f.name:
- print '\t.globl GL_PREFIX(%s) ; .set GL_PREFIX(%s), GL_PREFIX(%s)' % (n, n, f.name)
-
- return
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
- mode = "generic"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == '-m':
- mode = val
- elif arg == "-f":
- file_name = val
-
- if mode == "generic":
- printer = PrintGenericStubs()
- else:
- print "ERROR: Invalid mode \"%s\" specified." % mode
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer.Print( api )
diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py
deleted file mode 100644
index 899cce64b99..00000000000
--- a/src/mesa/glapi/gl_x86_asm.py
+++ /dev/null
@@ -1,244 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import gl_XML, license
-import sys, getopt
-
-class PrintGenericStubs(gl_XML.gl_print_base):
-
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
-
- self.name = "gl_x86_asm.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004, 2005""", "BRIAN PAUL, IBM")
- return
-
-
- def get_stack_size(self, f):
- size = 0
- for p in f.parameterIterator():
- size += p.get_stack_size()
-
- return size
-
-
- def printRealHeader(self):
- print '#include "assyntax.h"'
- print '#include "glapioffsets.h"'
- print ''
- print '#if defined(STDCALL_API)'
- print '# if defined(USE_MGL_NAMESPACE)'
- print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n2))'
- print '# else'
- print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))'
- print '# endif'
- print '#else'
- print '# if defined(USE_MGL_NAMESPACE)'
- print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))'
- print '# else'
- print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))'
- print '# endif'
- print '#endif'
- print ''
- print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))'
- print ''
- print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)'
- print '#define GLOBL_FN(x) GLOBL x ; .type x, function'
- print '#else'
- print '#define GLOBL_FN(x) GLOBL x'
- print '#endif'
- print ''
- print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
- print '# define THREADS'
- print '#endif'
- print ''
- print '#ifdef GLX_USE_TLS'
- print ''
- print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
- print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
- print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
- print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
- print '\tCALL(_x86_get_dispatch) ;\t\t\t\\'
- print '\tNOP ;\t\t\t\t\t\t\\'
- print '\tJMP(GL_OFFSET(off))'
- print ''
- print '#elif defined(PTHREADS)'
- print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
- print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
- print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
- print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
- print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
- print '\tTEST_L(EAX, EAX) ;\t\t\t\t\\'
- print '\tJE(1f) ;\t\t\t\t\t\\'
- print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
- print '1:\tCALL(_x86_get_dispatch) ;\t\t\t\\'
- print '\tJMP(GL_OFFSET(off))'
- print '#elif defined(THREADS)'
- print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
- print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
- print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
- print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
- print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
- print '\tTEST_L(EAX, EAX) ;\t\t\t\t\\'
- print '\tJE(1f) ;\t\t\t\t\t\\'
- print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
- print '1:\tCALL(_glapi_get_dispatch) ;\t\t\t\\'
- print '\tJMP(GL_OFFSET(off))'
- print '#else /* Non-threaded version. */'
- print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
- print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
- print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
- print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
- print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
- print '\tJMP(GL_OFFSET(off))'
- print '#endif'
- print ''
- print '#ifdef HAVE_ALIAS'
- print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
- print '\t.globl\tGL_PREFIX(fn, fn_alt) ;\t\t\t\\'
- print '\t.set\tGL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt)'
- print '#else'
- print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
- print ' GL_STUB(fn, off, fn_alt)'
- print '#endif'
- print ''
- print 'SEG_TEXT'
- print ''
- print '#ifdef GLX_USE_TLS'
- print ''
- print '\tGLOBL\tGLNAME(_x86_get_dispatch)'
- print '\tHIDDEN(GLNAME(_x86_get_dispatch))'
- print 'ALIGNTEXT16'
- print 'GLNAME(_x86_get_dispatch):'
- print '\tmovl\t%gs:_glapi_tls_Dispatch@NTPOFF, %eax'
- print '\tret'
- print ''
- print '#elif defined(PTHREADS)'
- print 'EXTERN GLNAME(_glapi_Dispatch)'
- print 'EXTERN GLNAME(_gl_DispatchTSD)'
- print 'EXTERN GLNAME(pthread_getspecific)'
- print ''
- print 'ALIGNTEXT16'
- print 'GLNAME(_x86_get_dispatch):'
- print '\tSUB_L(CONST(24), ESP)'
- print '\tPUSH_L(GLNAME(_gl_DispatchTSD))'
- print '\tCALL(GLNAME(pthread_getspecific))'
- print '\tADD_L(CONST(28), ESP)'
- print '\tRET'
- print '#elif defined(THREADS)'
- print 'EXTERN GLNAME(_glapi_get_dispatch)'
- print '#endif'
- print ''
-
- print '#if defined( GLX_USE_TLS )'
- print '\t\t.section\twtext, "awx", @progbits'
- print '#endif /* defined( GLX_USE_TLS ) */'
-
- print ''
- print '\t\tALIGNTEXT16'
- print '\t\tGLOBL GLNAME(gl_dispatch_functions_start)'
- print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_start))'
- print 'GLNAME(gl_dispatch_functions_start):'
- print ''
- return
-
-
- def printRealFooter(self):
- print ''
- print '\t\tGLOBL\tGLNAME(gl_dispatch_functions_end)'
- print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_end))'
- print '\t\tALIGNTEXT16'
- print 'GLNAME(gl_dispatch_functions_end):'
- print ''
- print '#if defined(GLX_USE_TLS) && defined(__linux__)'
- print ' .section ".note.ABI-tag", "a"'
- print ' .p2align 2'
- print ' .long 1f - 0f /* name length */'
- print ' .long 3f - 2f /* data length */'
- print ' .long 1 /* note length */'
- print '0: .asciz "GNU" /* vendor name */'
- print '1: .p2align 2'
- print '2: .long 0 /* note data: the ABI tag */'
- print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
- print '3: .p2align 2 /* pad out section */'
- print '#endif /* GLX_USE_TLS */'
- print ''
- print '#if defined (__ELF__) && defined (__linux__)'
- print ' .section .note.GNU-stack,"",%progbits'
- print '#endif'
- return
-
-
- def printBody(self, api):
- for f in api.functionIterateByOffset():
- stack = self.get_stack_size(f)
-
- alt = "%s@%u" % (f.name, stack)
- print '\tGL_STUB(%s, _gloffset_%s, %s)' % (f.name, f.name, alt)
-
- for f in api.functionIterateByOffset():
- stack = self.get_stack_size(f)
-
- alt = "%s@%u" % (f.name, stack)
-
- for n in f.entry_points:
- if n != f.name:
- alt2 = "%s@%u" % (n, stack)
- print '\tGL_STUB_ALIAS(%s, _gloffset_%s, %s, %s, %s)' % (n, f.name, alt2, f.name, alt)
-
- return
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
- mode = "generic"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == '-m':
- mode = val
- elif arg == "-f":
- file_name = val
-
- if mode == "generic":
- printer = PrintGenericStubs()
- else:
- print "ERROR: Invalid mode \"%s\" specified." % mode
- show_usage()
-
- api = gl_XML.parse_GL_API( file_name )
-
- printer.Print( api )
diff --git a/src/mesa/glapi/license.py b/src/mesa/glapi/license.py
deleted file mode 100644
index 02181648e4b..00000000000
--- a/src/mesa/glapi/license.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# (C) Copyright IBM Corporation 2004
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-bsd_license_template = """%s
-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
-%s,
-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."""
diff --git a/src/mesa/glapi/mesadef.py b/src/mesa/glapi/mesadef.py
deleted file mode 100644
index 63c2a6de109..00000000000
--- a/src/mesa/glapi/mesadef.py
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/usr/bin/env python
-
-# $Id: mesadef.py,v 1.4 2006-01-25 15:05:36 brianp Exp $
-
-# Mesa 3-D graphics library
-# Version: 4.1
-#
-# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# Generate the mesa.def file for Windows.
-#
-# Usage:
-# mesadef.py >mesa.def
-# Then copy to src/mesa/drivers/windows/gdi
-#
-# Dependencies:
-# The apispec file must be in the current directory.
-
-
-
-import apiparser
-import string
-
-
-def PrintHead():
- print '; DO NOT EDIT - This file generated automatically by mesadef.py script'
- print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\''
- print 'VERSION 6.0'
- print ';'
- print '; Module definition file for Mesa (OPENGL32.DLL)'
- print ';'
- print '; Note: The OpenGL functions use the STDCALL'
- print '; function calling convention. Microsoft\'s'
- print '; OPENGL32 uses this convention and so must the'
- print '; Mesa OPENGL32 so that the Mesa DLL can be used'
- print '; as a drop-in replacement.'
- print ';'
- print '; The linker exports STDCALL entry points with'
- print '; \'decorated\' names; e.g., _glBegin@0, where the'
- print '; trailing number is the number of bytes of '
- print '; parameter data pushed onto the stack. The'
- print '; callee is responsible for popping this data'
- print '; off the stack, usually via a RETF n instruction.'
- print ';'
- print '; However, the Microsoft OPENGL32.DLL does not export'
- print '; the decorated names, even though the calling convention'
- print '; is STDCALL. So, this module definition file is'
- print '; needed to force the Mesa OPENGL32.DLL to export the'
- print '; symbols in the same manner as the Microsoft DLL.'
- print '; Were it not for this problem, this file would not'
- print '; be needed (for the gl* functions) since the entry'
- print '; points are compiled with dllexport declspec.'
- print ';'
- print '; However, this file is still needed to export "internal"'
- print '; Mesa symbols for the benefit of the OSMESA32.DLL.'
- print ';'
- print 'EXPORTS'
- return
-#enddef
-
-
-def PrintTail():
- print ';'
- print '; WGL API'
- print '\twglChoosePixelFormat'
- print '\twglCopyContext'
- print '\twglCreateContext'
- print '\twglCreateLayerContext'
- print '\twglDeleteContext'
- print '\twglDescribeLayerPlane'
- print '\twglDescribePixelFormat'
- print '\twglGetCurrentContext'
- print '\twglGetCurrentDC'
- print '\twglGetExtensionsStringARB'
- print '\twglGetLayerPaletteEntries'
- print '\twglGetPixelFormat'
- print '\twglGetProcAddress'
- print '\twglMakeCurrent'
- print '\twglRealizeLayerPalette'
- print '\twglSetLayerPaletteEntries'
- print '\twglSetPixelFormat'
- print '\twglShareLists'
- print '\twglSwapBuffers'
- print '\twglSwapLayerBuffers'
- print '\twglUseFontBitmapsA'
- print '\twglUseFontBitmapsW'
- print '\twglUseFontOutlinesA'
- print '\twglUseFontOutlinesW'
- print ';'
- print '; Mesa internals - mostly for OSMESA'
- print '\t_ac_CreateContext'
- print '\t_ac_DestroyContext'
- print '\t_ac_InvalidateState'
- print '\t_glapi_get_context'
- print '\t_glapi_get_proc_address'
- print '\t_mesa_buffer_data'
- print '\t_mesa_buffer_map'
- print '\t_mesa_buffer_subdata'
- print '\t_mesa_bzero'
- print '\t_mesa_calloc'
- print '\t_mesa_choose_tex_format'
- print '\t_mesa_compressed_texture_size'
- print '\t_mesa_create_framebuffer'
- print '\t_mesa_create_visual'
- print '\t_mesa_delete_buffer_object'
- print '\t_mesa_delete_texture_object'
- print '\t_mesa_destroy_framebuffer'
- print '\t_mesa_destroy_visual'
- print '\t_mesa_enable_1_3_extensions'
- print '\t_mesa_enable_1_4_extensions'
- print '\t_mesa_enable_1_5_extensions'
- print '\t_mesa_enable_sw_extensions'
- print '\t_mesa_error'
- print '\t_mesa_free'
- print '\t_mesa_free_context_data'
- print '\t_mesa_get_current_context'
- print '\t_mesa_init_default_imports'
- print '\t_mesa_initialize_context'
- print '\t_mesa_make_current'
- print '\t_mesa_memcpy'
- print '\t_mesa_memset'
- print '\t_mesa_new_buffer_object'
- print '\t_mesa_new_texture_object'
- print '\t_mesa_problem'
- print '\t_mesa_ResizeBuffersMESA'
- print '\t_mesa_store_compressed_teximage1d'
- print '\t_mesa_store_compressed_teximage2d'
- print '\t_mesa_store_compressed_teximage3d'
- print '\t_mesa_store_compressed_texsubimage1d'
- print '\t_mesa_store_compressed_texsubimage2d'
- print '\t_mesa_store_compressed_texsubimage3d'
- print '\t_mesa_store_teximage1d'
- print '\t_mesa_store_teximage2d'
- print '\t_mesa_store_teximage3d'
- print '\t_mesa_store_texsubimage1d'
- print '\t_mesa_store_texsubimage2d'
- print '\t_mesa_store_texsubimage3d'
- print '\t_mesa_strcmp'
- print '\t_mesa_test_proxy_teximage'
- print '\t_mesa_Viewport'
- print '\t_swrast_Accum'
- print '\t_swrast_alloc_buffers'
- print '\t_swrast_Bitmap'
- print '\t_swrast_CopyPixels'
- print '\t_swrast_DrawPixels'
- print '\t_swrast_GetDeviceDriverReference'
- print '\t_swrast_Clear'
- print '\t_swrast_choose_line'
- print '\t_swrast_choose_triangle'
- print '\t_swrast_CopyColorSubTable'
- print '\t_swrast_CopyColorTable'
- print '\t_swrast_CopyConvolutionFilter1D'
- print '\t_swrast_CopyConvolutionFilter2D'
- print '\t_swrast_copy_teximage1d'
- print '\t_swrast_copy_teximage2d'
- print '\t_swrast_copy_texsubimage1d'
- print '\t_swrast_copy_texsubimage2d'
- print '\t_swrast_copy_texsubimage3d'
- print '\t_swrast_CreateContext'
- print '\t_swrast_DestroyContext'
- print '\t_swrast_InvalidateState'
- print '\t_swrast_ReadPixels'
- print '\t_swrast_zbuffer_address'
- print '\t_swsetup_Wakeup'
- print '\t_swsetup_CreateContext'
- print '\t_swsetup_DestroyContext'
- print '\t_swsetup_InvalidateState'
- print '\t_tnl_CreateContext'
- print '\t_tnl_DestroyContext'
- print '\t_tnl_InvalidateState'
- print '\t_tnl_MakeCurrent'
- print '\t_tnl_run_pipeline'
-#enddef
-
-
-records = []
-
-def FindOffset(funcName):
- for (name, alias, offset) in records:
- if name == funcName:
- return offset
- #endif
- #endfor
- return -1
-#enddef
-
-
-def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
- if alias == '':
- dispatchName = name
- else:
- dispatchName = alias
- if offset < 0:
- offset = FindOffset(dispatchName)
- if offset >= 0 and string.find(name, "unused") == -1:
- print '\tgl%s' % (name)
- # save this info in case we need to look up an alias later
- records.append((name, dispatchName, offset))
-
-#enddef
-
-
-PrintHead()
-apiparser.ProcessSpecFile("APIspec", EmitEntry)
-PrintTail()
diff --git a/src/mesa/glapi/next_available_offset.sh b/src/mesa/glapi/next_available_offset.sh
deleted file mode 100755
index e7d6c2f4afa..00000000000
--- a/src/mesa/glapi/next_available_offset.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-#
-# (C) Copyright IBM Corporation 2004
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-# Trivial shell script to search the API definition file and print out the
-# next numerically available API entry-point offset. This could probably
-# be made smarter, but it would be better to use the existin Python
-# framework to do that. This is just a quick-and-dirty hack.
-
-num=$(grep 'offset="' gl_API.xml |\
- sed 's/.\+ offset="//g;s/".*$//g' |\
- grep -v '?' |\
- sort -rn |\
- head -1)
-
-echo $((num + 1))
diff --git a/src/mesa/glapi/typeexpr.py b/src/mesa/glapi/typeexpr.py
deleted file mode 100644
index 8ba7de48627..00000000000
--- a/src/mesa/glapi/typeexpr.py
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2005
-# 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
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import string, copy
-
-class type_node:
- def __init__(self):
- self.pointer = 0 # bool
- self.const = 0 # bool
- self.signed = 1 # bool
- self.integer = 1 # bool
-
- # If elements is set to non-zero, then field is an array.
- self.elements = 0
-
- self.name = None
- self.size = 0 # type's size in bytes
- return
-
-
- def string(self):
- """Return string representation of this type_node."""
- s = ""
-
- if self.pointer:
- s = "* "
-
- if self.const:
- s += "const "
-
- if not self.pointer:
- if self.integer:
- if self.signed:
- s += "signed "
- else:
- s += "unsigned "
-
- if self.name:
- s += "%s " % (self.name)
-
- return s
-
-
-class type_table:
- def __init__(self):
- self.types_by_name = {}
- return
-
-
- def add_type(self, type_expr):
- self.types_by_name[ type_expr.get_base_name() ] = type_expr
- return
-
-
- def find_type(self, name):
- if name in self.types_by_name:
- return self.types_by_name[ name ]
- else:
- return None
-
-
-def create_initial_types():
- tt = type_table()
-
- basic_types = [
- ("char", 1, 1),
- ("short", 2, 1),
- ("int", 4, 1),
- ("long", 4, 1),
- ("float", 4, 0),
- ("double", 8, 0),
- ("enum", 4, 1)
- ]
-
- for (type_name, type_size, integer) in basic_types:
- te = type_expression(None)
- tn = type_node()
- tn.name = type_name
- tn.size = type_size
- tn.integer = integer
- te.expr.append(tn)
- tt.add_type( te )
-
- type_expression.built_in_types = tt
- return
-
-
-class type_expression:
- built_in_types = None
-
- def __init__(self, type_string, extra_types = None):
- self.expr = []
-
- if not type_string:
- return
-
- self.original_string = type_string
-
- if not type_expression.built_in_types:
- raise RuntimeError("create_initial_types must be called before creating type_expression objects.")
-
- # Replace '*' with ' * ' in type_string. Then, split the string
- # into tokens, separated by spaces.
- tokens = string.split( string.replace( type_string, "*", " * " ) )
-
- const = 0
- t = None
- signed = 0
- unsigned = 0
-
- for i in tokens:
- if i == "const":
- if t and t.pointer:
- t.const = 1
- else:
- const = 1
- elif i == "signed":
- signed = 1
- elif i == "unsigned":
- unsigned = 1
- elif i == "*":
- # This is a quirky special-case because of the
- # way the C works for types. If 'unsigned' is
- # specified all by itself, it is treated the
- # same as "unsigned int".
-
- if unsigned:
- self.set_base_type( "int", signed, unsigned, const, extra_types )
- const = 0
- signed = 0
- unsigned = 0
-
- if not self.expr:
- raise RuntimeError("Invalid type expression (dangling pointer)")
-
- if signed:
- raise RuntimeError("Invalid type expression (signed / unsigned applied to pointer)")
-
- t = type_node()
- t.pointer = 1
- self.expr.append( t )
- else:
- if self.expr:
- raise RuntimeError('Invalid type expression (garbage after pointer qualifier -> "%s")' % (self.original_string))
-
- self.set_base_type( i, signed, unsigned, const, extra_types )
- const = 0
- signed = 0
- unsigned = 0
-
- if signed and unsigned:
- raise RuntimeError("Invalid type expression (both signed and unsigned specified)")
-
-
- if const:
- raise RuntimeError("Invalid type expression (dangling const)")
-
- if unsigned:
- raise RuntimeError("Invalid type expression (dangling signed)")
-
- if signed:
- raise RuntimeError("Invalid type expression (dangling unsigned)")
-
- return
-
-
- def set_base_type(self, type_name, signed, unsigned, const, extra_types):
- te = type_expression.built_in_types.find_type( type_name )
- if not te:
- te = extra_types.find_type( type_name )
-
- if not te:
- raise RuntimeError('Unknown base type "%s".' % (type_name))
-
- self.expr = copy.deepcopy(te.expr)
-
- t = self.expr[ len(self.expr) - 1 ]
- t.const = const
- if signed:
- t.signed = 1
- elif unsigned:
- t.signed = 0
-
-
- def set_base_type_node(self, tn):
- self.expr = [tn]
- return
-
-
- def set_elements(self, count):
- tn = self.expr[0]
-
- tn.elements = count
- return
-
-
- def string(self):
- s = ""
- for t in self.expr:
- s += t.string()
-
- return s
-
-
- def get_base_type_node(self):
- return self.expr[0]
-
-
- def get_base_name(self):
- if len(self.expr):
- return self.expr[0].name
- else:
- return None
-
-
- def get_element_size(self):
- tn = self.expr[0]
-
- if tn.elements:
- return tn.elements * tn.size
- else:
- return tn.size
-
-
- def get_element_count(self):
- tn = self.expr[0]
- return tn.elements
-
-
- def get_stack_size(self):
- tn = self.expr[ len(self.expr) - 1 ]
-
- if tn.elements or tn.pointer:
- return 4
- elif not tn.integer:
- return tn.size
- else:
- return 4
-
-
- def is_pointer(self):
- tn = self.expr[ len(self.expr) - 1 ]
- return tn.pointer
-
-
- def format_string(self):
- tn = self.expr[ len(self.expr) - 1 ]
- if tn.pointer:
- return "%p"
- elif not tn.integer:
- return "%f"
- else:
- return "%d"
-
-
-
-if __name__ == '__main__':
-
- types_to_try = [ "int", "int *", "const int *", "int * const", "const int * const", \
- "unsigned * const *", \
- "float", "const double", "double * const"]
-
- create_initial_types()
-
- for t in types_to_try:
- print 'Trying "%s"...' % (t)
- te = type_expression( t )
- print 'Got "%s" (%u, %u).' % (te.string(), te.get_stack_size(), te.get_element_size())
diff --git a/src/mesa/main/Imakefile b/src/mesa/main/Imakefile
deleted file mode 100644
index fe0658c6c76..00000000000
--- a/src/mesa/main/Imakefile
+++ /dev/null
@@ -1,129 +0,0 @@
-#define DoNormalLib NO
-#define DoSharedLib YES
-#define DoDebugLib NO
-#define DoProfileLib NO
-#define LibName MESAGL
-#define SoRev SOX11REV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-REQUIREDLIBS = $(X11ROOT)\\XFree86\\lib\\ Xext X11
-BUILDLIBDIR = $(TOP)\\lib
-
-INCLUDES = -I$(TOP)\\include
-
-SRCS = \
-accum.c \
-alpha.c \
-alphabuf.c \
-api1.c \
-api2.c \
-attrib.c \
-bitmap.c \
-blend.c \
-bresenhm.c \
-clip.c \
-context.c \
-copypix.c \
-dd.c \
-depth.c \
-draw.c \
-drawpix.c \
-enable.c \
-eval2.c \
-feedback.c \
-fog.c \
-fortran.c \
-get.c \
-hash.c \
-glx.c \
-interp.c \
-light.c \
-lines.c \
-list.c \
-logic.c \
-masking.c \
-misc.c \
-osmesa.c \
-pb.c \
-pixel.c \
-points.c \
-polygons.c \
-readpix.c \
-scissor.c \
-span.c \
-stencil.c \
-svgamesa.c \
-texture.c \
-varray.c \
-vb.c \
-vertex.c \
-xfonts.c \
-xform.c \
-xm_api.c \
-xm_dd.c \
-xm_line.c \
-xm_span.c \
-xm_tri.c
-
-OBJS = \
-accum.o \
-alpha.o \
-alphabuf.o \
-api1.o \
-api2.o \
-attrib.o \
-bitmap.o \
-blend.o \
-bresenhm.o \
-clip.o \
-context.o \
-copypix.o \
-dd.o \
-depth.o \
-draw.o \
-drawpix.o \
-enable.o \
-eval2.o \
-feedback.o \
-fog.o \
-fortran.o \
-get.o \
-hash.o \
-glx.o \
-interp.o \
-light.o \
-lines.o \
-list.o \
-logic.o \
-masking.o \
-misc.o \
-osmesa.o \
-pb.o \
-pixel.o \
-points.o \
-polygons.o \
-readpix.o \
-scissor.o \
-span.o \
-stencil.o \
-svgamesa.o \
-texture.o \
-varray.o \
-vb.o \
-vertex.o \
-xfonts.o \
-xform.o \
-xm_api.o \
-xm_dd.o \
-xm_line.o \
-xm_span.o \
-xm_tri.o
-
-LINTLIBS =
-
-#include <Library.tmpl>
-
-DependTarget()
-
diff --git a/src/mesa/main/KNOWN_BUGS b/src/mesa/main/KNOWN_BUGS
deleted file mode 100644
index efbb0ca40fc..00000000000
--- a/src/mesa/main/KNOWN_BUGS
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-Performance issues with EXT_point_parameters & quake2
-
-
-
-Using glPolygonMode() where the front and back modes aren't the
-same causes poor performance on 3Dfx.
-
-
-
-Broken drivers: some of the Mesa device drivers (such as BeOS, D3D,
-etc) haven't been updated for Mesa 3.3's device driver changes.
-
-
-
-glDrawRangeElements() should use vertex array locking to improve performance
-but trying to do so causes a rendering error. Reported by Scott McMillan.
-Fixed by disabling locking in glDrawRangeElements (varray.c) but that's
-really just hiding a bug in array locking.
-
diff --git a/src/mesa/main/Makefile.ugl b/src/mesa/main/Makefile.ugl
deleted file mode 100644
index b440e136436..00000000000
--- a/src/mesa/main/Makefile.ugl
+++ /dev/null
@@ -1,364 +0,0 @@
-# Mesa 3-D graphics library
-# Version: 4.1
-#
-# Copyright (C) 2001 Wind River Systems, Inc
-
-# The MIT License
-# 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
-# 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.
-
-# Makefile for core library
-
-# This makefile can moved all objects files in MESA_OBJ for use with
-# ld in windShell or create a library from objects files in their
-# associated .c folder.
-#
-# For an easy inclusion of lib$(CPU)$(TOOL)GL.a in vxworks image, this
-# makefile collects together all .o in an only file
-# (obj$(CPU)$(TOOL)GL.o). This operation is unnecessary for
-# lib$(CPU)$(TOOL)OSMesa.a and lib$(CPU)$(TOOL)UglMesa.a because they
-# already contain only one file.
-#
-##### MACROS #####
-MESA_MAJOR=4
-MESA_MINOR=1
-MESA_TINY=0
-VERSION=$(MESA_MAJOR).$(MESA_MINOR)
-
-GL_MAJOR = 1
-GL_MINOR = 2
-GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
-
-##### RULES #####
-
-include ..\rules.windml
-
-#### GL #####
-
-GL_SOURCES = \
- api_arrayelt.c \
- api_loopback.c \
- api_noop.c \
- api_validate.c \
- accum.c \
- arbprogram.c \
- attrib.c \
- blend.c \
- bufferobj.c \
- buffers.c \
- clip.c \
- colortab.c \
- context.c \
- convolve.c \
- debug.c \
- depth.c \
- dispatch.c \
- dlist.c \
- drawpix.c \
- enable.c \
- enums.c \
- eval.c \
- extensions.c \
- feedback.c \
- fog.c \
- get.c \
- glapi.c \
- glthread.c \
- hash.c \
- hint.c \
- histogram.c \
- image.c \
- imports.c \
- light.c \
- lines.c \
- matrix.c \
- pixel.c \
- points.c \
- polygon.c \
- rastpos.c \
- state.c \
- stencil.c \
- texcompress.c \
- texformat.c \
- teximage.c \
- texobj.c \
- texstate.c \
- texstore.c \
- texutil.c \
- varray.c \
- vtxfmt.c \
- X86/x86.c \
- X86/common_x86.c \
- X86/3dnow.c \
- X86/sse.c \
- math/m_debug_clip.c \
- math/m_debug_norm.c \
- math/m_debug_vertex.c \
- math/m_debug_xform.c \
- math/m_eval.c \
- math/m_matrix.c \
- math/m_translate.c \
- math/m_vector.c \
- math/m_vertices.c \
- math/m_xform.c \
- array_cache/ac_context.c \
- array_cache/ac_import.c \
- swrast/s_aaline.c \
- swrast/s_aatriangle.c \
- swrast/s_accum.c \
- swrast/s_alpha.c \
- swrast/s_alphabuf.c \
- swrast/s_bitmap.c \
- swrast/s_blend.c \
- swrast/s_buffers.c \
- swrast/s_copypix.c \
- swrast/s_context.c \
- swrast/s_depth.c \
- swrast/s_drawpix.c \
- swrast/s_feedback.c \
- swrast/s_fog.c \
- swrast/s_imaging.c \
- swrast/s_lines.c \
- swrast/s_logic.c \
- swrast/s_masking.c \
- swrast/s_pixeltex.c \
- swrast/s_points.c \
- swrast/s_readpix.c \
- swrast/s_span.c \
- swrast/s_stencil.c \
- swrast/s_texture.c \
- swrast/s_texstore.c \
- swrast/s_triangle.c \
- swrast/s_zoom.c \
- swrast_setup/ss_context.c \
- swrast_setup/ss_triangle.c \
- swrast_setup/ss_vb.c \
- tnl/t_array_api.c \
- tnl/t_array_import.c \
- tnl/t_context.c \
- tnl/t_eval_api.c \
- tnl/t_imm_alloc.c \
- tnl/t_imm_api.c \
- tnl/t_imm_debug.c \
- tnl/t_imm_dlist.c \
- tnl/t_imm_elt.c \
- tnl/t_imm_eval.c \
- tnl/t_imm_exec.c \
- tnl/t_imm_fixup.c \
- tnl/t_pipeline.c \
- tnl/t_vb_fog.c \
- tnl/t_vb_light.c \
- tnl/t_vb_normals.c \
- tnl/t_vb_points.c \
- tnl/t_vb_render.c \
- tnl/t_vb_texgen.c \
- tnl/t_vb_texmat.c \
- tnl/t_vb_vertex.c
-
-GL_OBJECTS = $(GL_SOURCES:.c=.o)
-GL_OBJNAME = $(MESA_LIBDIR)/objMesaGL.o
-
-#### X86 #####
-
-x86_files = \
- X86/common_x86_asm.S \
- X86/glapi_x86.S \
- X86/x86_cliptest.S \
- X86/x86_vertex.S \
- X86/x86_xform2.S \
- X86/x86_xform3.S \
- X86/x86_xform4.S \
-
-x3dnow_files = \
- X86/3dnow_normal.S \
- X86/3dnow_vertex.S \
- X86/3dnow_xform1.S \
- X86/3dnow_xform2.S \
- X86/3dnow_xform3.S \
- X86/3dnow_xform4.S
-
-sse_files = \
- X86/sse_normal.S \
- X86/sse_vertex.S \
- X86/sse_xform1.S \
- X86/sse_xform2.S \
- X86/sse_xform3.S \
- X86/sse_xform4.S
-
-mmx_files = X86/mmx_blend.S
-
-X86_OBJNAME = $(MESA_LIBDIR)/objMesaX86.o
-
-##### UGL #####
-
-UGL_SOURCES = \
- windml/ugl_api.c \
- windml/ugl_dd.c \
- windml/ugl_span.c \
- windml/ugl_line.c \
- windml/ugl_tri.c \
- windml/tornado/torMesaUGLInit.c
-
-UGL_OBJECTS = $(UGL_SOURCES:.c=.o)
-UGL_OBJNAME = $(MESA_LIBDIR)/objMesaUGL.o
-
-##### OS #####
-
-OS_SOURCES = OSmesa/osmesa.c windml/tornado/torMesaOSInit.c
-OS_OBJECTS = $(OS_SOURCES:.c=.o)
-OS_OBJNAME = $(MESA_LIBDIR)/objMesaOS.o
-
-##### GLUTSHAPES #####
-
-GLUTSHAPES_SOURCES = \
- windml/ugl_glutshapes.c \
- windml/tornado/torGLUTShapesInit.c
-
-GLUTSHAPES_OBJECTS = $(GLUTSHAPES_SOURCES:.c=.o)
-GLUTSHAPES_OBJNAME = $(MESA_LIBDIR)/objGLUTShapes.o
-
-SOURCES = $(GL_SOURCES) $(UGL_SOURCES) $(OS_SOURCES) \
- $(GLUTSHAPES_SOURCES)
-
-##### TARGETS #####
-
-all: depend.$(CPU)$(TOOL) cfgX86 $(X86_OBJNAME) $(GL_OBJNAME)\
-$(UGL_OBJNAME) $(OS_OBJNAME) $(GLUTSHAPES_OBJNAME)
-
-#histogram.o:
-# $(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $<
-
-#image.o:
-# $(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $<
-
-cfgX86:
-ifdef HAVE_3DNOW
-x3dnow_sources = $(x3dnow_files)
-CFLAGS_3DNOW = -DUSE_3DNOW_ASM
-HAVE_X86 = 1
-endif
-ifdef HAVE_SSE
-sse_sources = $(sse_files)
-CFLAGS_SSE = -DUSE_SSE_ASM
-HAVE_X86 = 1
-endif
-ifdef HAVE_MMX
-mmx_sources = $(mmx_files)
-CFLAGS_MMX = -DUSE_MMX_ASM
-HAVE_X86 = 1
-endif
-ifdef HAVE_X86
-x86_sources = $(x86_files)
-CFLAGS_X86 = -DUSE_X86_ASM
-endif
-X86_SOURCES = $(x86_sources) $(mmx_sources) \
- $(x3dnow_sources) $(sse_sources)
-X86_OBJECTS = $(X86_SOURCES:.S=.o)
-CFLAGS_USE_X86 = $(CFLAGS_3DNOW) $(CFLAGS_SSE) $(CFLAGS_MMX) $(CFLAGS_X86)
-
-#X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c
-# $(CC) -I ./ X86/gen_matypes.c -o X86/gen_matypes
-# ./X86/gen_matypes > X86/matypes.h
-# $(RM) X86/gen_matypes
-# $(RM) X86/gen_matypes.o
-
-# Make the Mesax86 library
-$(X86_OBJNAME): $(X86_OBJECTS)
-ifdef HAVE_X86
-# $(LD) -r $(X86_OBJECTS) -o $(MESA_OBJNAME)
- $(LD) -r $(X86_OBJECTS) -o $(X86_OBJNAME)
-# $(AR) rus $(MESA_LIBNAME) $(X86_OBJNAME)
-# $(RM) $(X86_OBJNAME)
-endif
-
-# Make the GL library
-$(GL_OBJNAME): $(GL_OBJECTS)
-# $(LD) -r $(GL_OBJECTS) -o $(MESA_OBJNAME)
- $(LD) -r $(GL_OBJECTS) -o $(GL_OBJNAME)
-# $(AR) rus $(MESA_LIBNAME) $(GL_OBJNAME)
-# $(AR) rus $(VX_LIBNAME) $(GL_OBJNAME)
-# $(RM) $(GL_OBJNAME)
-
-# Make the UGLMesa library
-$(UGL_OBJNAME): $(UGL_OBJECTS)
-# $(LD) -r $(UGL_OBJECTS) -o $(MESA_OBJNAME)
- $(LD) -r $(UGL_OBJECTS) -o $(UGL_OBJNAME)
-# $(AR) rus $(MESA_LIBNAME) $(UGL_OBJNAME)
-# $(AR) rus $(VX_LIBNAME) $(UGL_OBJNAME)
-# $(RM) $(UGL_OBJNAME)
-
-# Make the OSMesa library
-$(OS_OBJNAME): $(OS_OBJECTS)
-# $(LD) -r $(OS_OBJECTS) -o $(MESA_OBJNAME)
- $(LD) -r $(OS_OBJECTS) -o $(OS_OBJNAME)
-# $(AR) rus $(MESA_LIBNAME) $(OS_OBJNAME)
-# $(AR) rus $(VX_LIBNAME) $(OS_OBJNAME)
-# $(RM) $(OS_OBJNAME)
-
-# Make the GLUT Shapes library
-$(GLUTSHAPES_OBJNAME): $(GLUTSHAPES_OBJECTS)
-# $(LD) -r $(GLUTSHAPES_OBJECTS) -o $(MESA_OBJNAME)
- $(LD) -r $(GLUTSHAPES_OBJECTS) -o $(GLUTSHAPES_OBJNAME)
-# $(AR) rus $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME)
-# $(AR) rus $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME)
-# $(RM) $(GLUTSHAPES_OBJNAME)
-
-depend.$(CPU)$(TOOL):
-ifeq ($(WIND_HOST_TYPE),x86-win32)
- @ $(RM) $@
- @ $(ECHO) Creating depend.$(CPU)$(TOOL)
-ifneq ($(SOURCES),)
- @ for %f in ($(SOURCES)) do \
- $(CC) -MM $(CFLAGS) %f >>$@
-endif
-else
-Makefile
- @ $(RM) $@
- @ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
-ifneq ($(SOURCES),)
- @ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
- do \
- $(CC) -MM $(CFLAGS) $$FILE \
- | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
- done
-endif
-endif
-
-.PHONY = clean
-
-clean:
-# $(AR) d $(MESA_LIBNAME) $(GL_OBJNAME)
-# $(AR) d $(MESA_LIBNAME) $(UGL_OBJNAME)
-# $(AR) d $(MESA_LIBNAME) $(OS_OBJNAME)
-# $(AR) d $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME)
-# $(AR) d $(VX_LIBNAME) $(GL_OBJNAME)
-# $(AR) d $(VX_LIBNAME) $(UGL_OBJNAME)
-# $(AR) d $(VX_LIBNAME) $(OS_OBJNAME)
-# $(AR) d $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME)
- $(RM) $(GL_OBJECTS)
- $(RM) $(UGL_OBJECTS)
- $(RM) $(OS_OBJECTS)
- $(RM) $(GLUTSHAPES_OBJECTS)
- $(RM) $(GL_OBJNAME)
- $(RM) $(UGL_OBJNAME)
- $(RM) $(OS_OBJNAME)
- $(RM) $(GLUTSHAPES_OBJNAME)
- $(RM) depend.$(CPU)$(TOOL)
-
-include depend.$(CPU)$(TOOL)
-
diff --git a/src/mesa/main/Makefile.win b/src/mesa/main/Makefile.win
deleted file mode 100644
index a27f44c112e..00000000000
--- a/src/mesa/main/Makefile.win
+++ /dev/null
@@ -1,208 +0,0 @@
-# Makefile for Win32
-#
-# NOTE: the install target may overwrite important files in the system dirs
-# Check first, before making the install target.
-#
-# This builds both the osmesa and Windows drivers.
-#
-
-!include <win32.mak>
-
-TOP = ..
-SUBDIRS = osmesa.dir
-
-CORE_SRCS = \
- api_loopback.c \
- api_noop.c \
- api_validate.c \
- accum.c \
- arbprogram.c \
- attrib.c \
- blend.c \
- bufferobj.c \
- buffers.c \
- clip.c \
- colortab.c \
- context.c \
- convolve.c \
- debug.c \
- depth.c \
- dispatch.c \
- dlist.c \
- drawpix.c \
- enable.c \
- enums.c \
- eval.c \
- extensions.c \
- feedback.c \
- fog.c \
- get.c \
- glapi.c \
- glthread.c \
- hash.c \
- hint.c \
- histogram.c \
- image.c \
- imports.c \
- light.c \
- lines.c \
- matrix.c \
- nvprogram.c \
- nvfragparse.c \
- nvvertexec.c \
- nvvertparse.c \
- pixel.c \
- points.c \
- polygon.c \
- rastpos.c \
- state.c \
- stencil.c \
- texcompress.c \
- texcompress_fxt1.c \
- texcompress_s3tc.c \
- teximage.c \
- texformat.c \
- texobj.c \
- texstate.c \
- texstore.c \
- varray.c \
- vtxfmt.c \
-# X86\x86.c \
-# X86\common_x86.c \
-# X86\3dnow.c \
-# X86\sse.c \
- math\m_debug_norm.c \
- math\m_debug_xform.c \
- math\m_eval.c \
- math\m_matrix.c \
- math\m_translate.c \
- math\m_vector.c \
- math\m_xform.c \
- array_cache\ac_context.c \
- array_cache\ac_import.c \
- swrast\s_aaline.c \
- swrast\s_aatriangle.c \
- swrast\s_accum.c \
- swrast\s_alpha.c \
- swrast\s_alphabuf.c \
- swrast\s_bitmap.c \
- swrast\s_blend.c \
- swrast\s_buffers.c \
- swrast\s_copypix.c \
- swrast\s_context.c \
- swrast\s_depth.c \
- swrast\s_drawpix.c \
- swrast\s_feedback.c \
- swrast\s_fog.c \
- swrast\s_imaging.c \
- swrast\s_lines.c \
- swrast\s_logic.c \
- swrast\s_masking.c \
- swrast\s_nvfragprog.c \
- swrast\s_pixeltex.c \
- swrast\s_points.c \
- swrast\s_readpix.c \
- swrast\s_span.c \
- swrast\s_stencil.c \
- swrast\s_texstore.c \
- swrast\s_texture.c \
- swrast\s_triangle.c \
- swrast\s_zoom.c \
- swrast_setup\ss_context.c \
- swrast_setup\ss_triangle.c \
- swrast_setup\ss_vb.c \
- tnl\t_array_api.c \
- tnl\t_array_import.c \
- tnl\t_context.c \
- tnl\t_eval_api.c \
- tnl\t_imm_alloc.c \
- tnl\t_imm_api.c \
- tnl\t_imm_debug.c \
- tnl\t_imm_dlist.c \
- tnl\t_imm_elt.c \
- tnl\t_imm_eval.c \
- tnl\t_imm_exec.c \
- tnl\t_imm_fixup.c \
- tnl\t_pipeline.c \
- tnl\t_vb_fog.c \
- tnl\t_vb_light.c \
- tnl\t_vb_normals.c \
- tnl\t_vb_points.c \
- tnl\t_vb_program.c \
- tnl\t_vb_render.c \
- tnl\t_vb_texgen.c \
- tnl\t_vb_texmat.c \
- tnl\t_vb_vertex.c
-
-DRIVER_SRCS = \
- Trace\tr_context.c \
- Trace\tr_control.c \
- Trace\tr_error.c \
- Trace\tr_support.c \
- Trace\tr_wrapper.c \
- Trace\tr_write.c \
- Windows\wgl.c \
- Windows\wmesa.c
-
-ASM_SRCS =
-
-SRCS = $(CORE_SRCS) $(DRIVER_SRCS)
-
-all : mesadll $(SUBDIRS)
-
-!include "$(TOP)/mesawin32.mak"
-
-mesadll : $(MESADLL)
-
-CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -DBUILD_GL32 -DNO_PARALLEL -DNO_STEREO
-!IFNDEF NODEBUG
-CFLAGS = $(CFLAGS) -DMESA_DEBUG
-!ENDIF
-LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
-
-OBJS = $(ASM_SRCS:.S=.obj) $(CORE_SRCS:.c=.obj) $(DRIVER_SRCS:.c=.obj)
-LIBS = winmm.lib $(guilibsdll)
-
-$(MESADLL) : $(OBJS) mesa.def
- $(link) $(LFLAGS) -out:$(MESADLL) -def:mesa.def $(OBJS) $(LIBS)
- @echo "copying Mesa dynamic link library to lib directory..."
- -copy $(MESADLL) ..\lib
- @echo "copying Mesa import library to lib directory..."
- -copy $(MESALIB) ..\lib
-
-$(SUBDIRS) :
- @echo.
- @echo Making in $* directory
- @cd $*
- @nmake -f Makefile.win -nologo
- @cd ..
-
-install : $(MESADLL)
- @echo.
- @echo "copying Mesa dynamic link library to system directory..."
- -copy $(MESADLL) $(DLLINSTALL)
- @echo "copying Mesa header files to include directory..."
- -copy ..\..\include\GL\gl.h $(INCLUDEINSTALL)
- -copy ..\..\include\GL\glext.h $(INCLUDEINSTALL)
- @echo "copying Mesa import library to library directory..."
- -copy $(MESALIB) $(LIBINSTALL)
-
-clean ::
- @del /f tnl\*.obj
- @del /f swrast_setup\*.obj
- @del /f math\*.obj
- @del /f array_cache\*.obj
- @del /f swrast\*.obj
- @del /f Trace\*.obj
- @del /f osmesa\*.obj
- @del /f Windows\*.obj
-
-clobber ::
- @del /f OSmesa\*.lib
- @del /f OSmesa\*.exp
- @del /f OSmesa\*.dll
-
-# override default inference rule with one that writes the object to
-# the same subdir that the c file is in.
-.c.obj :
- $(cc) $(CFLAGS) -I. $< /Fo$*.obj
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
deleted file mode 100644
index 78d50663550..00000000000
--- a/src/mesa/main/get_gen.py
+++ /dev/null
@@ -1,1194 +0,0 @@
-#!/usr/bin/env python
-
-# Mesa 3-D graphics library
-#
-# Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-# This script is used to generate the get.c file:
-# python get_gen.py > get.c
-
-
-import string
-
-
-GLint = 1
-GLenum = 2
-GLfloat = 3
-GLdouble = 4
-GLboolean = 5
-GLfloatN = 6 # A normalized value, such as a color or depth range
-
-
-TypeStrings = {
- GLint : "GLint",
- GLenum : "GLenum",
- GLfloat : "GLfloat",
- GLdouble : "GLdouble",
- GLboolean : "GLboolean"
-}
-
-
-# Each entry is a tuple of:
-# - the GL state name, such as GL_CURRENT_COLOR
-# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
-# - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
-# - optional extra code or empty string
-# - optional extensions to check, or None
-#
-StateVars = [
- ( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"],
- "", None ),
- ( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"],
- "", None ),
- ( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"],
- "", None ),
- ( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"],
- "", None ),
- ( "GL_ACCUM_CLEAR_VALUE", GLfloatN,
- [ "ctx->Accum.ClearColor[0]",
- "ctx->Accum.ClearColor[1]",
- "ctx->Accum.ClearColor[2]",
- "ctx->Accum.ClearColor[3]" ],
- "", None ),
- ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", None ),
- ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"],
- "", None ),
- ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", None ),
- ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ),
- ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ),
- ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ),
- ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", None ),
- ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ),
- ( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"],
- "", None ),
- ( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ),
- ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
- ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
- ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
- ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
- ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None ),
- ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None ),
- ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None),
- ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "],
- "", None ),
- ( "GL_BLEND_COLOR_EXT", GLfloatN,
- [ "ctx->Color.BlendColor[0]",
- "ctx->Color.BlendColor[1]",
- "ctx->Color.BlendColor[2]",
- "ctx->Color.BlendColor[3]"], "", None ),
- ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", None ),
- ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ),
- ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", None ),
- ( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint,
- ["ctx->ClientAttribStackDepth"], "", None ),
- ( "GL_CLIP_PLANE0", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ),
- ( "GL_CLIP_PLANE1", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ),
- ( "GL_CLIP_PLANE2", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ),
- ( "GL_CLIP_PLANE3", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ),
- ( "GL_CLIP_PLANE4", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ),
- ( "GL_CLIP_PLANE5", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ),
- ( "GL_COLOR_CLEAR_VALUE", GLfloatN,
- [ "ctx->Color.ClearColor[0]",
- "ctx->Color.ClearColor[1]",
- "ctx->Color.ClearColor[2]",
- "ctx->Color.ClearColor[3]" ], "", None ),
- ( "GL_COLOR_MATERIAL", GLboolean,
- ["ctx->Light.ColorMaterialEnabled"], "", None ),
- ( "GL_COLOR_MATERIAL_FACE", GLenum,
- ["ctx->Light.ColorMaterialFace"], "", None ),
- ( "GL_COLOR_MATERIAL_PARAMETER", GLenum,
- ["ctx->Light.ColorMaterialMode"], "", None ),
- ( "GL_COLOR_WRITEMASK", GLint,
- [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0",
- "ctx->Color.ColorMask[GCOMP] ? 1 : 0",
- "ctx->Color.ColorMask[BCOMP] ? 1 : 0",
- "ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ),
- ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ),
- ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ),
- ( "GL_CURRENT_COLOR", GLfloatN,
- [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]",
- "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]",
- "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
- "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
- "FLUSH_CURRENT(ctx, 0);", None ),
- ( "GL_CURRENT_INDEX", GLfloat,
- [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ],
- "FLUSH_CURRENT(ctx, 0);", None ),
- ( "GL_CURRENT_NORMAL", GLfloatN,
- [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
- "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]",
- "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"],
- "FLUSH_CURRENT(ctx, 0);", None ),
- ( "GL_CURRENT_RASTER_COLOR", GLfloatN,
- ["ctx->Current.RasterColor[0]",
- "ctx->Current.RasterColor[1]",
- "ctx->Current.RasterColor[2]",
- "ctx->Current.RasterColor[3]"], "", None ),
- ( "GL_CURRENT_RASTER_DISTANCE", GLfloat,
- ["ctx->Current.RasterDistance"], "", None ),
- ( "GL_CURRENT_RASTER_INDEX", GLfloat,
- ["ctx->Current.RasterIndex"], "", None ),
- ( "GL_CURRENT_RASTER_POSITION", GLfloat,
- ["ctx->Current.RasterPos[0]",
- "ctx->Current.RasterPos[1]",
- "ctx->Current.RasterPos[2]",
- "ctx->Current.RasterPos[3]"], "", None ),
- ( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat,
- ["ctx->Current.RasterTexCoords[texUnit][0]",
- "ctx->Current.RasterTexCoords[texUnit][1]",
- "ctx->Current.RasterTexCoords[texUnit][2]",
- "ctx->Current.RasterTexCoords[texUnit][3]"],
- "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ),
- ( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean,
- ["ctx->Current.RasterPosValid"], "", None ),
- ( "GL_CURRENT_TEXTURE_COORDS", GLfloat,
- ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]",
- "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]",
- "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]",
- "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]"],
- "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ),
- ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
- ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
- "", None ),
- ( "GL_DEPTH_CLEAR_VALUE", GLfloat, ["ctx->Depth.Clear"], "", None ),
- ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
- ( "GL_DEPTH_RANGE", GLfloatN,
- [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
- ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", None ),
- ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ),
- ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ),
- ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ),
- ( "GL_DOUBLEBUFFER", GLboolean,
- ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
- ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
- ( "GL_EDGE_FLAG", GLboolean, ["ctx->Current.EdgeFlag"],
- "FLUSH_CURRENT(ctx, 0);", None ),
- ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
- ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
- ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ),
- ( "GL_FOG_COLOR", GLfloatN,
- [ "ctx->Fog.Color[0]",
- "ctx->Fog.Color[1]",
- "ctx->Fog.Color[2]",
- "ctx->Fog.Color[3]" ], "", None ),
- ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ),
- ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ),
- ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ),
- ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", None ),
- ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ),
- ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ),
- ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ),
- ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", None ),
- ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"],
- "", None ),
- ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", None ),
- ( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"],
- "", None ),
- ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", None ),
- ( "GL_INDEX_MODE", GLboolean, ["!ctx->DrawBuffer->Visual.rgbMode"],
- "", None ),
- ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", None ),
- ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", None ),
- ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", None ),
- ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ),
- ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ),
- ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ),
- ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ),
- ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ),
- ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ),
- ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ),
- ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ),
- ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ),
- ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN,
- ["ctx->Light.Model.Ambient[0]",
- "ctx->Light.Model.Ambient[1]",
- "ctx->Light.Model.Ambient[2]",
- "ctx->Light.Model.Ambient[3]"], "", None ),
- ( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum,
- ["ctx->Light.Model.ColorControl"], "", None ),
- ( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean,
- ["ctx->Light.Model.LocalViewer"], "", None ),
- ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ),
- ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ),
- ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ),
- ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", None ),
- ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", None ),
- ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", None ),
- ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ),
- ( "GL_LINE_WIDTH_GRANULARITY", GLfloat,
- ["ctx->Const.LineWidthGranularity"], "", None ),
- ( "GL_LINE_WIDTH_RANGE", GLfloat,
- ["ctx->Const.MinLineWidthAA",
- "ctx->Const.MaxLineWidthAA"], "", None ),
- ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat,
- ["ctx->Const.MinLineWidth",
- "ctx->Const.MaxLineWidth"], "", None ),
- ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", None ),
- ( "GL_LIST_INDEX", GLint, ["ctx->ListState.CurrentListNum"], "", None ),
- ( "GL_LIST_MODE", GLenum, ["mode"],
- """GLenum mode;
- if (!ctx->CompileFlag)
- mode = 0;
- else if (ctx->ExecuteFlag)
- mode = GL_COMPILE_AND_EXECUTE;
- else
- mode = GL_COMPILE;""", None ),
- ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", None ),
- ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ),
- ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ),
- ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", None ),
- ( "GL_MAP1_GRID_DOMAIN", GLfloat,
- ["ctx->Eval.MapGrid1u1",
- "ctx->Eval.MapGrid1u2"], "", None ),
- ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", None ),
- ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", None ),
- ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", None ),
- ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", None ),
- ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", None ),
- ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", None ),
- ( "GL_MAP2_GRID_DOMAIN", GLfloat,
- ["ctx->Eval.MapGrid2u1",
- "ctx->Eval.MapGrid2u2",
- "ctx->Eval.MapGrid2v1",
- "ctx->Eval.MapGrid2v2"], "", None ),
- ( "GL_MAP2_GRID_SEGMENTS", GLint,
- ["ctx->Eval.MapGrid2un",
- "ctx->Eval.MapGrid2vn"], "", None ),
- ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", None ),
- ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", None ),
- ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", None ),
- ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", None ),
- ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", None ),
- ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", None ),
- ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ),
-
- ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", None ),
- ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", None ),
- ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
- ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
- ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
- ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", None ),
- ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
- ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", None ),
- ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ),
- ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", None ),
- ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", None ),
- ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ),
- ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ),
- ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None ),
- ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ),
- ( "GL_MAX_VIEWPORT_DIMS", GLint,
- ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"],
- "", None ),
- ( "GL_MODELVIEW_MATRIX", GLfloat,
- [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
- "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
- "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
- "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
- ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ),
- ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", None ),
- ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ),
- ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ),
- ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", None ),
- ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", None ),
- ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", None ),
- ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", None ),
- ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", None ),
- ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ),
- ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", None ),
- ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
- ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
- ["ctx->Hint.PerspectiveCorrection"], "", None ),
- ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->Pixel.MapAtoAsize"], "", None ),
- ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->Pixel.MapBtoBsize"], "", None ),
- ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->Pixel.MapGtoGsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->Pixel.MapItoAsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->Pixel.MapItoBsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->Pixel.MapItoGsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->Pixel.MapItoIsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->Pixel.MapItoRsize"], "", None ),
- ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->Pixel.MapRtoRsize"], "", None ),
- ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->Pixel.MapStoSsize"], "", None ),
- ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
- ( "GL_POINT_SIZE_GRANULARITY", GLfloat,
- ["ctx->Const.PointSizeGranularity"], "", None ),
- ( "GL_POINT_SIZE_RANGE", GLfloat,
- ["ctx->Const.MinPointSizeAA",
- "ctx->Const.MaxPointSizeAA"], "", None ),
- ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat,
- ["ctx->Const.MinPointSize",
- "ctx->Const.MaxPointSize"], "", None ),
- ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ),
- ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ),
- ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ),
- ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ),
- ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat,
- ["ctx->Point.Threshold"], "", None ),
- ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat,
- ["ctx->Point.Params[0]",
- "ctx->Point.Params[1]",
- "ctx->Point.Params[2]"], "", None ),
- ( "GL_POLYGON_MODE", GLenum,
- ["ctx->Polygon.FrontMode",
- "ctx->Polygon.BackMode"], "", None ),
- ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ),
- ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
- ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
- ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ),
- ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ),
- ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ),
- ( "GL_PROJECTION_MATRIX", GLfloat,
- [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
- "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
- "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
- "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
- ( "GL_PROJECTION_STACK_DEPTH", GLint,
- ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ),
- ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", None ),
- ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", None ),
- ( "GL_RED_BITS", GLint, [" ctx->DrawBuffer->Visual.redBits "], "", None ),
- ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", None ),
- ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", None ),
- ( "GL_RESCALE_NORMAL", GLboolean,
- ["ctx->Transform.RescaleNormals"], "", None ),
- ( "GL_RGBA_MODE", GLboolean, ["ctx->DrawBuffer->Visual.rgbMode"],
- "", None ),
- ( "GL_SCISSOR_BOX", GLint,
- ["ctx->Scissor.X",
- "ctx->Scissor.Y",
- "ctx->Scissor.Width",
- "ctx->Scissor.Height"], "", None ),
- ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ),
- ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", None ),
- ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ),
- ( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean,
- ["ctx->Texture.SharedPalette"], "", None ),
- ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ),
- ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ),
- ( "GL_STENCIL_FAIL", GLenum,
- ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_FUNC", GLenum,
- ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum,
- ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum,
- ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_REF", GLint,
- ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ),
- ( "GL_STENCIL_VALUE_MASK", GLint,
- ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_WRITEMASK", GLint,
- ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"],
- "", None ),
- ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ),
- ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", None ),
- ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ),
- ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", None ),
- ( "GL_TEXTURE_BINDING_1D", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name"], "", None ),
- ( "GL_TEXTURE_BINDING_2D", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name"], "", None ),
- ( "GL_TEXTURE_BINDING_3D", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name"], "", None ),
- ( "GL_TEXTURE_ENV_COLOR", GLfloatN,
- ["color[0]", "color[1]", "color[2]", "color[3]"],
- "const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;",
- None ),
- ( "GL_TEXTURE_ENV_MODE", GLenum,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode"], "", None ),
- ( "GL_TEXTURE_GEN_S", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
- ( "GL_TEXTURE_GEN_T", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None ),
- ( "GL_TEXTURE_GEN_R", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None ),
- ( "GL_TEXTURE_GEN_Q", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", None ),
- ( "GL_TEXTURE_MATRIX", GLfloat,
- ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
- "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
- "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
- "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
- ( "GL_TEXTURE_STACK_DEPTH", GLint,
- ["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ),
- ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),
- ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", None ),
- ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", None ),
- ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", None ),
- ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", None ),
- ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", None ),
- ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", None ),
- ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", None ),
- ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", None ),
- ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y",
- "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ),
- ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", None ),
- ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", None ),
-
- # Vertex arrays
- ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.Vertex.Enabled"], "", None ),
- ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.Vertex.Size"], "", None ),
- ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.Vertex.Type"], "", None ),
- ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.Vertex.Stride"], "", None ),
- ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.Normal.Enabled"], "", None ),
- ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.Normal.Type"], "", None ),
- ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.Normal.Stride"], "", None ),
- ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.Color.Enabled"], "", None ),
- ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.Color.Size"], "", None ),
- ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.Color.Type"], "", None ),
- ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.Color.Stride"], "", None ),
- ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.Index.Enabled"], "", None ),
- ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.Index.Type"], "", None ),
- ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.Index.Stride"], "", None ),
- ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_TEXTURE_COORD_ARRAY", GLboolean,
- ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
- ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
- ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
- ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
- ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
- ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
- ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
- ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.EdgeFlag.Enabled"], "", None ),
- ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.EdgeFlag.Stride"], "", None ),
- ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
-
- # GL_ARB_multitexture
- ( "GL_MAX_TEXTURE_UNITS_ARB", GLint,
- ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ),
- ( "GL_ACTIVE_TEXTURE_ARB", GLint,
- [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ),
- ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint,
- ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ),
-
- # GL_ARB_texture_cube_map
- ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
- ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ),
- ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name"],
- "", ["ARB_texture_cube_map"] ),
- ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
- ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
- "", ["ARB_texture_cube_map"]),
-
- # GL_ARB_texture_compression */
- ( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint,
- ["ctx->Hint.TextureCompression"], "", ["ARB_texture_compression"] ),
- ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
- ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
- "", ["ARB_texture_compression"] ),
- ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum,
- [],
- """GLint formats[100];
- GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
- ASSERT(n <= 100);
- for (i = 0; i < n; i++)
- params[i] = ENUM_TO_INT(formats[i]);""",
- ["ARB_texture_compression"] ),
-
- # GL_EXT_compiled_vertex_array
- ( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"],
- "", ["EXT_compiled_vertex_array"] ),
- ( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"],
- "", ["EXT_compiled_vertex_array"] ),
-
- # GL_ARB_transpose_matrix
- ( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat,
- ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
- "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
- "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
- "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
- ( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat,
- ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
- "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
- "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
- "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
- ( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat,
- ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
- "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
- "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
- "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
- ( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat,
- ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
- "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
- "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
- "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
-
- # GL_SGI_color_matrix (also in 1.2 imaging)
- ( "GL_COLOR_MATRIX_SGI", GLfloat,
- ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
- "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
- "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
- "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
- ( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
- ["ctx->ColorMatrixStack.Depth + 1"], "", None ),
- ( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
- ["MAX_COLOR_STACK_DEPTH"], "", None ),
- ( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[0]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[1]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[2]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[3]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[0]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[1]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[2]"], "", None ),
- ( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[3]"], "", None ),
-
- # GL_EXT_convolution (also in 1.2 imaging)
- ( "GL_CONVOLUTION_1D_EXT", GLboolean,
- ["ctx->Pixel.Convolution1DEnabled"], "", ["EXT_convolution"] ),
- ( "GL_CONVOLUTION_2D_EXT", GLboolean,
- ["ctx->Pixel.Convolution2DEnabled"], "", ["EXT_convolution"] ),
- ( "GL_SEPARABLE_2D_EXT", GLboolean,
- ["ctx->Pixel.Separable2DEnabled"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[0]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[1]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[2]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[3]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[0]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[1]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[2]"], "", ["EXT_convolution"] ),
- ( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[3]"], "", ["EXT_convolution"] ),
-
- # GL_EXT_histogram / GL_ARB_imaging
- ( "GL_HISTOGRAM", GLboolean,
- [ "ctx->Pixel.HistogramEnabled" ], "", ["EXT_histogram"] ),
- ( "GL_MINMAX", GLboolean,
- [ "ctx->Pixel.MinMaxEnabled" ], "", ["EXT_histogram"] ),
-
- # GL_SGI_color_table / GL_ARB_imaging
- ( "GL_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.ColorTableEnabled"], "", ["SGI_color_table"] ),
- ( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.PostConvolutionColorTableEnabled"], "", ["SGI_color_table"] ),
- ( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.PostColorMatrixColorTableEnabled"], "", ["SGI_color_table"] ),
-
- # GL_SGI_texture_color_table
- ( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"],
- "", ["SGI_texture_color_table"] ),
-
- # GL_EXT_secondary_color
- ( "GL_COLOR_SUM_EXT", GLboolean,
- ["ctx->Fog.ColorSumEnabled"], "",
- ["EXT_secondary_color", "ARB_vertex_program"] ),
- ( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN,
- ["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]",
- "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]",
- "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]",
- "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"],
- "FLUSH_CURRENT(ctx, 0);", ["EXT_secondary_color"] ),
- ( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean,
- ["ctx->Array.SecondaryColor.Enabled"], "", ["EXT_secondary_color"] ),
- ( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum,
- ["ctx->Array.SecondaryColor.Type"], "", ["EXT_secondary_color"] ),
- ( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint,
- ["ctx->Array.SecondaryColor.Stride"], "", ["EXT_secondary_color"] ),
- ( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint,
- ["ctx->Array.SecondaryColor.Size"], "", ["EXT_secondary_color"] ),
-
- # GL_EXT_fog_coord
- ( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat,
- ["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"],
- "FLUSH_CURRENT(ctx, 0);", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, ["ctx->Array.FogCoord.Enabled"],
- "", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.FogCoord.Type"],
- "", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.FogCoord.Stride"],
- "", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, ["ctx->Fog.FogCoordinateSource"],
- "", ["EXT_fog_coord"] ),
-
- # GL_EXT_texture_lod_bias
- ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat,
- ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]),
-
- # GL_EXT_texture_filter_anisotropic
- ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat,
- ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]),
-
- # GL_ARB_multisample
- ( "GL_MULTISAMPLE_ARB", GLboolean,
- ["ctx->Multisample.Enabled"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
- ["ctx->Multisample.SampleAlphaToCoverage"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
- ["ctx->Multisample.SampleAlphaToOne"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
- ["ctx->Multisample.SampleCoverage"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
- ["ctx->Multisample.SampleCoverageValue"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
- ["ctx->Multisample.SampleCoverageInvert"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLE_BUFFERS_ARB", GLint,
- ["ctx->DrawBuffer->Visual.sampleBuffers"], "", ["ARB_multisample"] ),
- ( "GL_SAMPLES_ARB", GLint,
- ["ctx->DrawBuffer->Visual.samples"], "", ["ARB_multisample"] ),
-
- # GL_IBM_rasterpos_clip
- ( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean,
- ["ctx->Transform.RasterPositionUnclipped"], "", ["IBM_rasterpos_clip"] ),
-
- # GL_NV_point_sprite
- ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
- "", ["NV_point_sprite", "ARB_point_sprite"] ),
- ( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"],
- "", ["NV_point_sprite"] ),
- ( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"],
- "", ["NV_point_sprite", "ARB_point_sprite"] ),
-
- # GL_SGIS_generate_mipmap
- ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
- "", ["SGIS_generate_mipmap"] ),
-
- # GL_NV_vertex_program
- ( "GL_VERTEX_PROGRAM_BINDING_NV", GLint,
- ["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"],
- "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean,
- ["ctx->Array.VertexAttrib[0].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean,
- ["ctx->Array.VertexAttrib[1].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean,
- ["ctx->Array.VertexAttrib[2].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean,
- ["ctx->Array.VertexAttrib[3].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean,
- ["ctx->Array.VertexAttrib[4].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean,
- ["ctx->Array.VertexAttrib[5].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean,
- ["ctx->Array.VertexAttrib[6].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean,
- ["ctx->Array.VertexAttrib[7].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean,
- ["ctx->Array.VertexAttrib[8].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean,
- ["ctx->Array.VertexAttrib[9].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean,
- ["ctx->Array.VertexAttrib[10].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean,
- ["ctx->Array.VertexAttrib[11].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean,
- ["ctx->Array.VertexAttrib[12].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean,
- ["ctx->Array.VertexAttrib[13].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean,
- ["ctx->Array.VertexAttrib[14].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean,
- ["ctx->Array.VertexAttrib[15].Enabled"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[0]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[1]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[2]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[3]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[4]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[5]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[6]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[7]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[8]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[9]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[10]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[11]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[12]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[13]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[14]"], "", ["NV_vertex_program"] ),
- ( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[15]"], "", ["NV_vertex_program"] ),
-
- # GL_NV_fragment_program
- ( "GL_FRAGMENT_PROGRAM_NV", GLboolean,
- ["ctx->FragmentProgram.Enabled"], "", ["NV_fragment_program"] ),
- ( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint,
- ["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"],
- "", ["NV_fragment_program"] ),
- ( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint,
- ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", ["NV_fragment_program"] ),
-
- # GL_NV_texture_rectangle
- ( "GL_TEXTURE_RECTANGLE_NV", GLboolean,
- ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ),
- ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name"],
- "", ["NV_texture_rectangle"] ),
- ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint,
- ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ),
-
- # GL_EXT_stencil_two_side
- ( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean,
- ["ctx->Stencil.TestTwoSide"], "", ["EXT_stencil_two_side"] ),
- ( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum,
- ["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"],
- "", ["EXT_stencil_two_side"] ),
-
- # GL_NV_light_max_exponent
- ( "GL_MAX_SHININESS_NV", GLfloat,
- ["ctx->Const.MaxShininess"], "", ["NV_light_max_exponent"] ),
- ( "GL_MAX_SPOT_EXPONENT_NV", GLfloat,
- ["ctx->Const.MaxSpotExponent"], "", ["NV_light_max_exponent"] ),
-
- # GL_ARB_vertex_buffer_object
- ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayBufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
- ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.Vertex.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
- ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.Normal.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
- ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.Color.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
- ( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.Index.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
- ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
- "", ["ARB_vertex_buffer_object"] ),
- ( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.EdgeFlag.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
- ( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.SecondaryColor.BufferObj->Name"],
- "", ["ARB_vertex_buffer_object"] ),
- ( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.FogCoord.BufferObj->Name"],
- "", ["ARB_vertex_buffer_object"] ),
- # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
- ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ElementArrayBufferObj->Name"],
- "", ["ARB_vertex_buffer_object"] ),
-
- # GL_EXT_pixel_buffer_object
- ( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint,
- ["ctx->Pack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
- ( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint,
- ["ctx->Unpack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
-
- # GL_ARB_vertex_program
- ( "GL_VERTEX_PROGRAM_ARB", GLboolean, # == GL_VERTEX_PROGRAM_NV
- ["ctx->VertexProgram.Enabled"], "",
- ["ARB_vertex_program", "NV_vertex_program"] ),
- ( "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_POINT_SIZE_NV
- ["ctx->VertexProgram.PointSizeEnabled"], "",
- ["ARB_vertex_program", "NV_vertex_program"] ),
- ( "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_TWO_SIDE_NV
- ["ctx->VertexProgram.TwoSideEnabled"], "",
- ["ARB_vertex_program", "NV_vertex_program"] ),
- ( "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", GLint, # == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV
- ["ctx->Const.MaxProgramMatrixStackDepth"], "",
- ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
- ( "GL_MAX_PROGRAM_MATRICES_ARB", GLint, # == GL_MAX_TRACK_MATRICES_NV
- ["ctx->Const.MaxProgramMatrices"], "",
- ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
- ( "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", GLboolean, # == GL_CURRENT_MATRIX_STACK_DEPTH_NV
- ["ctx->CurrentStack->Depth + 1"], "",
- ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
- ( "GL_CURRENT_MATRIX_ARB", GLfloat, # == GL_CURRENT_MATRIX_NV
- ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
- "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
- "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
- "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
- ["ARB_vertex_program", "ARB_fragment_program", "NV_fragment_program"] ),
- ( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat,
- ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
- "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
- "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
- "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
- ["ARB_vertex_program", "ARB_fragment_program"] ),
- ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
- ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
- ( "GL_PROGRAM_ERROR_POSITION_ARB", GLint, # == GL_PROGRAM_ERROR_POSITION_NV
- ["ctx->Program.ErrorPos"], "", ["NV_vertex_program",
- "ARB_vertex_program", "NV_fragment_program", "ARB_fragment_program"] ),
-
- # GL_ARB_fragment_program
- ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
- ["ctx->FragmentProgram.Enabled"], "", ["ARB_fragment_program"] ),
- ( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV
- ["ctx->Const.MaxTextureCoordUnits"], "",
- ["ARB_fragment_program", "NV_fragment_program"] ),
- ( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNITS_NV
- ["ctx->Const.MaxTextureImageUnits"], "",
- ["ARB_fragment_program", "NV_fragment_program"] ),
-
- # GL_EXT_depth_bounds_test
- ( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean,
- ["ctx->Depth.BoundsTest"], "", ["EXT_depth_bounds_test"] ),
- ( "GL_DEPTH_BOUNDS_EXT", GLfloat,
- ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
- "", ["EXT_depth_bounds_test"] ),
-
- # GL_MESA_program_debug
- ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean,
- ["ctx->FragmentProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
- ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean,
- ["ctx->VertexProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
- ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint,
- ["ctx->FragmentProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
- ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint,
- ["ctx->VertexProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
-
- # GL_ARB_draw_buffers
- ( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
- ["ctx->Const.MaxDrawBuffers"], "", ["ARB_draw_buffers"] ),
- ( "GL_DRAW_BUFFER0_ARB", GLenum,
- ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", ["ARB_draw_buffers"] ),
- ( "GL_DRAW_BUFFER1_ARB", GLenum,
- ["buffer"],
- """GLenum buffer;
- if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
- return;
- }
- buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", ["ARB_draw_buffers"] ),
- ( "GL_DRAW_BUFFER2_ARB", GLenum,
- ["buffer"],
- """GLenum buffer;
- if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
- return;
- }
- buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", ["ARB_draw_buffers"] ),
- ( "GL_DRAW_BUFFER3_ARB", GLenum,
- ["buffer"],
- """GLenum buffer;
- if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
- return;
- }
- buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", ["ARB_draw_buffers"] ),
- # XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future
-
- # GL_OES_read_format
- ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
- ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ),
- ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
- ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ),
-
- # GL_ATI_fragment_shader
- ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_PASSES_ATI", GLint, ["2"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], "", ["ATI_fragment_shader"] ),
- ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
-
- # OpenGL 2.0
- ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ),
- ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ),
- ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ),
- ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ),
- ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ),
- ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ),
-
- # GL_EXT_framebuffer_object
- ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "",
- ["EXT_framebuffer_object"] ),
- ( "GL_RENDERBUFFER_BINDING_EXT", GLint,
- ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "",
- ["EXT_framebuffer_object"] ),
- ( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint,
- ["ctx->Const.MaxColorAttachments"], "",
- ["EXT_framebuffer_object"] ),
- ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint,
- ["ctx->Const.MaxRenderbufferSize"], "",
- ["EXT_framebuffer_object"] ),
-
- # GL_ARB_fragment_shader
- ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
- ["MAX_FRAGMENT_UNIFORM_COMPONENTS"], "", ["ARB_fragment_shader"] ),
- ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
- ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
-
- # GL_ARB_vertex_shader
- ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
- ["MAX_VERTEX_UNIFORM_COMPONENTS"], "", ["ARB_vertex_shader"] ),
- ( "GL_MAX_VARYING_FLOATS_ARB", GLint,
- ["MAX_VARYING_FLOATS"], "", ["ARB_vertex_shader"] ),
- ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
- ["MAX_VERTEX_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
- ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
- ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] )
-]
-
-
-def ConversionFunc(fromType, toType):
- """Return the name of the macro to convert between two data types."""
- if fromType == toType:
- return ""
- elif fromType == GLfloat and toType == GLint:
- return "IROUND"
- elif fromType == GLfloatN and toType == GLfloat:
- return ""
- elif fromType == GLint and toType == GLfloat: # but not GLfloatN!
- return "(GLfloat)"
- else:
- if fromType == GLfloatN:
- fromType = GLfloat
- fromStr = TypeStrings[fromType]
- fromStr = string.upper(fromStr[2:])
- toStr = TypeStrings[toType]
- toStr = string.upper(toStr[2:])
- return fromStr + "_TO_" + toStr
-
-
-def EmitGetFunction(stateVars, returnType):
- """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
- assert (returnType == GLboolean or
- returnType == GLint or
- returnType == GLfloat)
-
- strType = TypeStrings[returnType]
- # Capitalize first letter of return type
- if returnType == GLint:
- function = "GetIntegerv"
- elif returnType == GLboolean:
- function = "GetBooleanv"
- elif returnType == GLfloat:
- function = "GetFloatv"
- else:
- abort()
-
- print "void GLAPIENTRY"
- print "_mesa_%s( GLenum pname, %s *params )" % (function, strType)
- print "{"
- print " GET_CURRENT_CONTEXT(ctx);"
- print " ASSERT_OUTSIDE_BEGIN_END(ctx);"
- print ""
- print " if (!params)"
- print " return;"
- print ""
- print " if (ctx->NewState)"
- print " _mesa_update_state(ctx);"
- print ""
- print " if (ctx->Driver.%s &&" % function
- print " ctx->Driver.%s(ctx, pname, params))" % function
- print " return;"
- print ""
- print " switch (pname) {"
-
- for (name, varType, state, optionalCode, extensions) in stateVars:
- print " case " + name + ":"
- if extensions:
- if len(extensions) == 1:
- print (' CHECK_EXT1(%s, "%s");' %
- (extensions[0], function))
- elif len(extensions) == 2:
- print (' CHECK_EXT2(%s, %s, "%s");' %
- (extensions[0], extensions[1], function))
- elif len(extensions) == 3:
- print (' CHECK_EXT3(%s, %s, %s, "%s");' %
- (extensions[0], extensions[1], extensions[2], function))
- else:
- assert len(extensions) == 4
- print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
- (extensions[0], extensions[1], extensions[2], extensions[3], function))
- if optionalCode:
- print " {"
- print " " + optionalCode
- conversion = ConversionFunc(varType, returnType)
- n = len(state)
- for i in range(n):
- if conversion:
- print " params[%d] = %s(%s);" % (i, conversion, state[i])
- else:
- print " params[%d] = %s;" % (i, state[i])
- if optionalCode:
- print " }"
- print " break;"
-
- print " default:"
- print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function
- print " }"
- print "}"
- print ""
- return
-
-
-
-def EmitHeader():
- """Print the get.c file header."""
- print """
-/***
- *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py
- ***/
-
-#include "glheader.h"
-#include "context.h"
-#include "enable.h"
-#include "extensions.h"
-#include "fbobject.h"
-#include "get.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "state.h"
-#include "texcompress.h"
-
-
-#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
-
-#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
-
-#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE )
-#define ENUM_TO_INT(E) ( (GLint) (E) )
-#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) )
-
-#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
-#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
-
-
-/*
- * Check if named extension is enabled, if not generate error and return.
- */
-#define CHECK_EXT1(EXT1, FUNC) \\
- if (!ctx->Extensions.EXT1) { \\
- _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
- return; \\
- }
-
-/*
- * Check if either of two extensions is enabled.
- */
-#define CHECK_EXT2(EXT1, EXT2, FUNC) \\
- if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \\
- _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
- return; \\
- }
-
-/*
- * Check if either of three extensions is enabled.
- */
-#define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC) \\
- if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\
- !ctx->Extensions.EXT3) { \\
- _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
- return; \\
- }
-
-/*
- * Check if either of four extensions is enabled.
- */
-#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC) \\
- if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\
- !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \\
- _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
- return; \\
- }
-
-"""
- return
-
-
-
-def EmitGetDoublev():
- print """
-void GLAPIENTRY
-_mesa_GetDoublev( GLenum pname, GLdouble *params )
-{
- const GLfloat magic = -1234.5F;
- GLfloat values[16];
- GLuint i;
-
- if (!params)
- return;
-
- /* Init temp array to magic numbers so we can figure out how many values
- * are returned by the GetFloatv() call.
- */
- for (i = 0; i < 16; i++)
- values[i] = magic;
-
- _mesa_GetFloatv(pname, values);
-
- for (i = 0; i < 16 && values[i] != magic; i++)
- params[i] = (GLdouble) values[i];
-}
-"""
-
-
-
-
-EmitHeader()
-# XXX Maybe sort the StateVars list
-EmitGetFunction(StateVars, GLboolean)
-EmitGetFunction(StateVars, GLfloat)
-EmitGetFunction(StateVars, GLint)
-EmitGetDoublev()
-
diff --git a/src/mesa/shader/arbprogram.syn b/src/mesa/shader/arbprogram.syn
deleted file mode 100644
index 6ab0f269380..00000000000
--- a/src/mesa/shader/arbprogram.syn
+++ /dev/null
@@ -1,2786 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.2
- *
- * Copyright (C) 1999-2004 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 arbprogram.syn
- * ARB_fragment/vertex_program syntax
- * \author Michal Krol
- */
-
-.syntax program;
-
-/*
- This value must be incremented every time emit code values or structure of the production
- array changes. This value is placed at the beginning of the production array. The loader
- compares the value with its REVISION value. If they do not match, the loader is not up
- to date.
-*/
-.emtcode REVISION 0x09
-
-/* program type */
-.emtcode FRAGMENT_PROGRAM 0x01
-.emtcode VERTEX_PROGRAM 0x02
-
-/* program section */
-.emtcode OPTION 0x01
-.emtcode INSTRUCTION 0x02
-.emtcode DECLARATION 0x03
-.emtcode END 0x04
-
-/* GL_ARB_fragment_program option */
-.emtcode ARB_PRECISION_HINT_FASTEST 0x00
-.emtcode ARB_PRECISION_HINT_NICEST 0x01
-.emtcode ARB_FOG_EXP 0x02
-.emtcode ARB_FOG_EXP2 0x03
-.emtcode ARB_FOG_LINEAR 0x04
-
-/* GL_ARB_vertex_program option */
-.emtcode ARB_POSITION_INVARIANT 0x05
-
-/* GL_ARB_fragment_program_shadow option */
-.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06
-
-/* GL_ARB_draw_buffers option */
-.emtcode ARB_DRAW_BUFFERS 0x07
-
-/* GL_ARB_fragment_program instruction class */
-.emtcode OP_ALU_INST 0x00
-.emtcode OP_TEX_INST 0x01
-
-/* GL_ARB_vertex_program instruction class */
-/* OP_ALU_INST */
-
-/* GL_ARB_fragment_program instruction type */
-.emtcode OP_ALU_VECTOR 0x00
-.emtcode OP_ALU_SCALAR 0x01
-.emtcode OP_ALU_BINSC 0x02
-.emtcode OP_ALU_BIN 0x03
-.emtcode OP_ALU_TRI 0x04
-.emtcode OP_ALU_SWZ 0x05
-.emtcode OP_TEX_SAMPLE 0x06
-.emtcode OP_TEX_KIL 0x07
-
-/* GL_ARB_vertex_program instruction type */
-.emtcode OP_ALU_ARL 0x08
-/* OP_ALU_VECTOR */
-/* OP_ALU_SCALAR */
-/* OP_ALU_BINSC */
-/* OP_ALU_BIN */
-/* OP_ALU_TRI */
-/* OP_ALU_SWZ */
-
-/* GL_ARB_fragment_program instruction code */
-.emtcode OP_ABS 0x00
-.emtcode OP_ABS_SAT 0x1B
-.emtcode OP_FLR 0x09
-.emtcode OP_FLR_SAT 0x26
-.emtcode OP_FRC 0x0A
-.emtcode OP_FRC_SAT 0x27
-.emtcode OP_LIT 0x0C
-.emtcode OP_LIT_SAT 0x2A
-.emtcode OP_MOV 0x11
-.emtcode OP_MOV_SAT 0x30
-.emtcode OP_COS 0x1F
-.emtcode OP_COS_SAT 0x20
-.emtcode OP_EX2 0x07
-.emtcode OP_EX2_SAT 0x25
-.emtcode OP_LG2 0x0B
-.emtcode OP_LG2_SAT 0x29
-.emtcode OP_RCP 0x14
-.emtcode OP_RCP_SAT 0x33
-.emtcode OP_RSQ 0x15
-.emtcode OP_RSQ_SAT 0x34
-.emtcode OP_SIN 0x38
-.emtcode OP_SIN_SAT 0x39
-.emtcode OP_SCS 0x35
-.emtcode OP_SCS_SAT 0x36
-.emtcode OP_POW 0x13
-.emtcode OP_POW_SAT 0x32
-.emtcode OP_ADD 0x01
-.emtcode OP_ADD_SAT 0x1C
-.emtcode OP_DP3 0x03
-.emtcode OP_DP3_SAT 0x21
-.emtcode OP_DP4 0x04
-.emtcode OP_DP4_SAT 0x22
-.emtcode OP_DPH 0x05
-.emtcode OP_DPH_SAT 0x23
-.emtcode OP_DST 0x06
-.emtcode OP_DST_SAT 0x24
-.emtcode OP_MAX 0x0F
-.emtcode OP_MAX_SAT 0x2E
-.emtcode OP_MIN 0x10
-.emtcode OP_MIN_SAT 0x2F
-.emtcode OP_MUL 0x12
-.emtcode OP_MUL_SAT 0x31
-.emtcode OP_SGE 0x16
-.emtcode OP_SGE_SAT 0x37
-.emtcode OP_SLT 0x17
-.emtcode OP_SLT_SAT 0x3A
-.emtcode OP_SUB 0x18
-.emtcode OP_SUB_SAT 0x3B
-.emtcode OP_XPD 0x1A
-.emtcode OP_XPD_SAT 0x43
-.emtcode OP_CMP 0x1D
-.emtcode OP_CMP_SAT 0x1E
-.emtcode OP_LRP 0x2B
-.emtcode OP_LRP_SAT 0x2C
-.emtcode OP_MAD 0x0E
-.emtcode OP_MAD_SAT 0x2D
-.emtcode OP_SWZ 0x19
-.emtcode OP_SWZ_SAT 0x3C
-.emtcode OP_TEX 0x3D
-.emtcode OP_TEX_SAT 0x3E
-.emtcode OP_TXB 0x3F
-.emtcode OP_TXB_SAT 0x40
-.emtcode OP_TXP 0x41
-.emtcode OP_TXP_SAT 0x42
-.emtcode OP_KIL 0x28
-
-/* GL_ARB_vertex_program instruction code */
-.emtcode OP_ARL 0x02
-/* OP_ABS */
-/* OP_FLR */
-/* OP_FRC */
-/* OP_LIT */
-/* OP_MOV */
-/* OP_EX2 */
-.emtcode OP_EXP 0x08
-/* OP_LG2 */
-.emtcode OP_LOG 0x0D
-/* OP_RCP */
-/* OP_RSQ */
-/* OP_POW */
-/* OP_ADD */
-/* OP_DP3 */
-/* OP_DP4 */
-/* OP_DPH */
-/* OP_DST */
-/* OP_MAX */
-/* OP_MIN */
-/* OP_MUL */
-/* OP_SGE */
-/* OP_SLT */
-/* OP_SUB */
-/* OP_XPD */
-/* OP_MAD */
-/* OP_SWZ */
-
-/* fragment attribute binding */
-.emtcode FRAGMENT_ATTRIB_COLOR 0x01
-.emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
-.emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
-.emtcode FRAGMENT_ATTRIB_POSITION 0x04
-
-/* vertex attribute binding */
-.emtcode VERTEX_ATTRIB_POSITION 0x01
-.emtcode VERTEX_ATTRIB_WEIGHT 0x02
-.emtcode VERTEX_ATTRIB_NORMAL 0x03
-.emtcode VERTEX_ATTRIB_COLOR 0x04
-.emtcode VERTEX_ATTRIB_FOGCOORD 0x05
-.emtcode VERTEX_ATTRIB_TEXCOORD 0x06
-.emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
-.emtcode VERTEX_ATTRIB_GENERIC 0x08
-
-/* fragment result binding */
-.emtcode FRAGMENT_RESULT_COLOR 0x01
-.emtcode FRAGMENT_RESULT_DEPTH 0x02
-
-/* vertex result binding */
-.emtcode VERTEX_RESULT_POSITION 0x01
-.emtcode VERTEX_RESULT_COLOR 0x02
-.emtcode VERTEX_RESULT_FOGCOORD 0x03
-.emtcode VERTEX_RESULT_POINTSIZE 0x04
-.emtcode VERTEX_RESULT_TEXCOORD 0x05
-
-/* texture target */
-.emtcode TEXTARGET_1D 0x01
-.emtcode TEXTARGET_2D 0x02
-.emtcode TEXTARGET_3D 0x03
-.emtcode TEXTARGET_RECT 0x04
-.emtcode TEXTARGET_CUBE 0x05
-/* GL_ARB_fragment_program_shadow */
-.emtcode TEXTARGET_SHADOW1D 0x06
-.emtcode TEXTARGET_SHADOW2D 0x07
-.emtcode TEXTARGET_SHADOWRECT 0x08
-
-/* face type */
-.emtcode FACE_FRONT 0x00
-.emtcode FACE_BACK 0x01
-
-/* color type */
-.emtcode COLOR_PRIMARY 0x00
-.emtcode COLOR_SECONDARY 0x01
-
-/* component */
-.emtcode COMPONENT_X 0x00
-.emtcode COMPONENT_Y 0x01
-.emtcode COMPONENT_Z 0x02
-.emtcode COMPONENT_W 0x03
-.emtcode COMPONENT_0 0x04
-.emtcode COMPONENT_1 0x05
-
-/* array index type */
-.emtcode ARRAY_INDEX_ABSOLUTE 0x00
-.emtcode ARRAY_INDEX_RELATIVE 0x01
-
-/* matrix name */
-.emtcode MATRIX_MODELVIEW 0x01
-.emtcode MATRIX_PROJECTION 0x02
-.emtcode MATRIX_MVP 0x03
-.emtcode MATRIX_TEXTURE 0x04
-.emtcode MATRIX_PALETTE 0x05
-.emtcode MATRIX_PROGRAM 0x06
-
-/* matrix modifier */
-.emtcode MATRIX_MODIFIER_IDENTITY 0x00
-.emtcode MATRIX_MODIFIER_INVERSE 0x01
-.emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
-.emtcode MATRIX_MODIFIER_INVTRANS 0x03
-
-/* constant type */
-.emtcode CONSTANT_SCALAR 0x01
-.emtcode CONSTANT_VECTOR 0x02
-
-/* program param type */
-.emtcode PROGRAM_PARAM_ENV 0x01
-.emtcode PROGRAM_PARAM_LOCAL 0x02
-
-/* register type */
-.emtcode REGISTER_ATTRIB 0x01
-.emtcode REGISTER_PARAM 0x02
-.emtcode REGISTER_RESULT 0x03
-.emtcode REGISTER_ESTABLISHED_NAME 0x04
-
-/* param binding */
-.emtcode PARAM_NULL 0x00
-.emtcode PARAM_ARRAY_ELEMENT 0x01
-.emtcode PARAM_STATE_ELEMENT 0x02
-.emtcode PARAM_PROGRAM_ELEMENT 0x03
-.emtcode PARAM_PROGRAM_ELEMENTS 0x04
-.emtcode PARAM_CONSTANT 0x05
-
-/* param state property */
-.emtcode STATE_MATERIAL 0x01
-.emtcode STATE_LIGHT 0x02
-.emtcode STATE_LIGHT_MODEL 0x03
-.emtcode STATE_LIGHT_PROD 0x04
-.emtcode STATE_FOG 0x05
-.emtcode STATE_MATRIX_ROWS 0x06
-/* GL_ARB_fragment_program */
-.emtcode STATE_TEX_ENV 0x07
-.emtcode STATE_DEPTH 0x08
-/* GL_ARB_vertex_program */
-.emtcode STATE_TEX_GEN 0x09
-.emtcode STATE_CLIP_PLANE 0x0A
-.emtcode STATE_POINT 0x0B
-
-/* state material property */
-.emtcode MATERIAL_AMBIENT 0x01
-.emtcode MATERIAL_DIFFUSE 0x02
-.emtcode MATERIAL_SPECULAR 0x03
-.emtcode MATERIAL_EMISSION 0x04
-.emtcode MATERIAL_SHININESS 0x05
-
-/* state light property */
-.emtcode LIGHT_AMBIENT 0x01
-.emtcode LIGHT_DIFFUSE 0x02
-.emtcode LIGHT_SPECULAR 0x03
-.emtcode LIGHT_POSITION 0x04
-.emtcode LIGHT_ATTENUATION 0x05
-.emtcode LIGHT_HALF 0x06
-.emtcode LIGHT_SPOT_DIRECTION 0x07
-
-/* state light model property */
-.emtcode LIGHT_MODEL_AMBIENT 0x01
-.emtcode LIGHT_MODEL_SCENECOLOR 0x02
-
-/* state light product property */
-.emtcode LIGHT_PROD_AMBIENT 0x01
-.emtcode LIGHT_PROD_DIFFUSE 0x02
-.emtcode LIGHT_PROD_SPECULAR 0x03
-
-/* state texture environment property */
-.emtcode TEX_ENV_COLOR 0x01
-
-/* state texture generation coord property */
-.emtcode TEX_GEN_EYE 0x01
-.emtcode TEX_GEN_OBJECT 0x02
-
-/* state fog property */
-.emtcode FOG_COLOR 0x01
-.emtcode FOG_PARAMS 0x02
-
-/* state depth property */
-.emtcode DEPTH_RANGE 0x01
-
-/* state point parameters property */
-.emtcode POINT_SIZE 0x01
-.emtcode POINT_ATTENUATION 0x02
-
-/* declaration */
-.emtcode ATTRIB 0x01
-.emtcode PARAM 0x02
-.emtcode TEMP 0x03
-.emtcode OUTPUT 0x04
-.emtcode ALIAS 0x05
-/* GL_ARB_vertex_program */
-.emtcode ADDRESS 0x06
-
-/* error messages */
-.errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
-.errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
-.errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
-.errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
-.errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
-.errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
-.errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
-.errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
-.errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
-.errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
-.errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
-.errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
-.errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
-.errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
-.errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
-.errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
-.errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
-.errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
-.errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
-.errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
-.errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
-.errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
-.errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
-.errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
-.errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
-.errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
-.errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
-.errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
-.errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
-.errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
-.errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
-.errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
-.errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
-.errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
-.errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
-.errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
-.errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
-.errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
-.errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
-.errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
-.errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
-.errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
-.errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
-.errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
-.errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
-.errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
-.errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
-.errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
-.errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
-.errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
-.errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
-.errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
-.errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
-.errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
-.errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
-.errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
-.errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
-.errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
-
-/* extension presence condition registers */
-
-/* GL_ARB_vertex_blend */
-/* GL_EXT_vertex_weighting */
-.regbyte vertex_blend 0x00
-
-/* GL_ARB_matrix_palette */
-.regbyte matrix_palette 0x00
-
-/* GL_ARB_point_parameters */
-/* GL_EXT_point_parameters */
-.regbyte point_parameters 0x00
-
-/* GL_EXT_secondary_color */
-.regbyte secondary_color 0x00
-
-/* GL_EXT_fog_coord */
-.regbyte fog_coord 0x00
-
-/* GL_EXT_texture_rectangle */
-/* GL_NV_texture_rectangle */
-.regbyte texture_rectangle 0x00
-
-/* GL_ARB_fragment_program_shadow */
-.regbyte fragment_program_shadow 0x00
-
-/* GL_ARB_draw_buffers */
-.regbyte draw_buffers 0x00
-
-/* option presence condition registers */
-/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
-/* register is set to 1 to indicate that the OPTION was specified. */
-
-/* GL_ARB_fragment_program */
-.regbyte ARB_precision_hint_fastest 0x00
-.regbyte ARB_precision_hint_nicest 0x00
-.regbyte ARB_fog_exp 0x00
-.regbyte ARB_fog_exp2 0x00
-.regbyte ARB_fog_linear 0x00
-
-/* GL_ARB_vertex_program */
-.regbyte ARB_position_invariant 0x00
-
-/* GL_ARB_fragment_program_shadow */
-.regbyte ARB_fragment_program_shadow 0x00
-
-/* GL_ARB_draw_buffers */
-.regbyte ARB_draw_buffers 0x00
-
-/* program target condition register */
-/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
-/* to distinguish between them we need a register that will store for us the current target. */
-/* the client will typically set the register to apropriate value before parsing a particular */
-/* program. the mapping between program targets and their values is listed below. */
-/* */
-/* program target register value */
-/* ---------------------------------------------- */
-/* FRAGMENT_PROGRAM 0x10 */
-/* VERTEX_PROGRAM 0x20 */
-/* */
-/* the initial value of the register is 0 to catch potential errors with not setting the register */
-/* with the proper value. */
-.regbyte program_target 0x00
-
-/*
- <program> ::= <optionSequence> <statementSequence> "END"
-*/
-program
- programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
-programs
- .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
- .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
-frag_program_1_0
- '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
- optional_space .and fp_optionSequence .and fp_statementSequence .and
- "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
- '\0' .error CODE_AFTER_END;
-vert_program_1_0
- '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
- optional_space .and vp_optionSequence .and vp_statementSequence .and
- "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
- '\0' .error CODE_AFTER_END;
-
-/*
- <optionSequence> ::= <optionSequence> <option>
- | ""
-*/
-fp_optionSequence
- .loop fp_option;
-vp_optionSequence
- .loop vp_option;
-
-/*
- <option> ::= "OPTION" <identifier> ";"
-
-NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
- these options is encountered, the other one is automatically disabled.
- the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
-*/
-fp_option
- "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
- fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
-vp_option
- "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
- vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
-fp_optionString
- .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
- .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
- .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
- .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
- fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
- fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
- fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
- .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
- .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
- .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
- .load ARB_draw_buffers 0x01;
-vp_optionString
- "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
-fp_ARB_fog_exp
- .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
-fp_ARB_fog_exp2
- .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
-fp_ARB_fog_linear
- .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
-
-/*
- <statementSequence> ::= <statementSequence> <statement>
- | ""
-*/
-fp_statementSequence
- .loop fp_statement;
-vp_statementSequence
- .loop vp_statement;
-
-/*
- <statement> ::= <instruction> ";"
- | <namingStatement> ";"
-
-NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
- the first character of instruction) for program debugging purposes.
-*/
-fp_statement
- fp_statement_1 .or fp_statement_2;
-vp_statement
- vp_statement_1 .or vp_statement_2;
-fp_statement_1
- fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
-fp_statement_2
- fp_namingStatement .emit DECLARATION .and semicolon;
-vp_statement_1
- vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
-vp_statement_2
- vp_namingStatement .emit DECLARATION .and semicolon;
-
-/*
-fragment program
- <instruction> ::= <ALUInstruction>
- | <TexInstruction>
-
-vertex program
- <instruction> ::= <ARL_instruction>
- | <VECTORop_instruction>
- | <SCALARop_instruction>
- | <BINSCop_instruction>
- | <BINop_instruction>
- | <TRIop_instruction>
- | <SWZ_instruction>
-*/
-fp_instruction
- ALUInstruction .emit OP_ALU_INST .or
- TexInstruction .emit OP_TEX_INST;
-vp_instruction
- ARL_instruction .emit OP_ALU_ARL .or
- vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
- vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
- vp_BINSCop_instruction .emit OP_ALU_BINSC .or
- vp_BINop_instruction .emit OP_ALU_BIN .or
- vp_TRIop_instruction .emit OP_ALU_TRI .or
- vp_SWZ_instruction .emit OP_ALU_SWZ;
-
-/*
-fragment program
- <ALUInstruction> ::= <VECTORop_instruction>
- | <SCALARop_instruction>
- | <BINSCop_instruction>
- | <BINop_instruction>
- | <TRIop_instruction>
- | <SWZ_instruction>
-*/
-ALUInstruction
- fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
- fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
- fp_BINSCop_instruction .emit OP_ALU_BINSC .or
- fp_BINop_instruction .emit OP_ALU_BIN .or
- fp_TRIop_instruction .emit OP_ALU_TRI .or
- fp_SWZ_instruction .emit OP_ALU_SWZ;
-
-/*
-fragment program
- <TexInstruction> ::= <SAMPLE_instruction>
- | <KIL_instruction>
-*/
-TexInstruction
- SAMPLE_instruction .emit OP_TEX_SAMPLE .or
- KIL_instruction .emit OP_TEX_KIL;
-
-/*
-vertex program
- <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
-*/
-ARL_instruction
- "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
-
-/*
-fragment program
- <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
- <vectorSrcReg>
-
-vertex program
- <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
-*/
-fp_VECTORop_instruction
- fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
-vp_VECTORop_instruction
- vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
-
-/*
-fragment program
- <VECTORop> ::= "ABS" | "ABS_SAT"
- | "FLR" | "FLR_SAT"
- | "FRC" | "FRC_SAT"
- | "LIT" | "LIT_SAT"
- | "MOV" | "MOV_SAT"
-
-vertex program
- <VECTORop> ::= "ABS"
- | "FLR"
- | "FRC"
- | "LIT"
- | "MOV"
-*/
-fp_VECTORop
- "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
- "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
- "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
- "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
- "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
-vp_VECTORop
- "ABS" .emit OP_ABS .or
- "FLR" .emit OP_FLR .or
- "FRC" .emit OP_FRC .or
- "LIT" .emit OP_LIT .or
- "MOV" .emit OP_MOV;
-
-/*
- <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
-*/
-fp_SCALARop_instruction
- fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
-vp_SCALARop_instruction
- vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
-
-/*
-fragment program
- <SCALARop> ::= "COS" | "COS_SAT"
- | "EX2" | "EX2_SAT"
- | "LG2" | "LG2_SAT"
- | "RCP" | "RCP_SAT"
- | "RSQ" | "RSQ_SAT"
- | "SIN" | "SIN_SAT"
- | "SCS" | "SCS_SAT"
-
-vertex program
- <SCALARop> ::= "EX2"
- | "EXP"
- | "LG2"
- | "LOG"
- | "RCP"
- | "RSQ"
-*/
-fp_SCALARop
- "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
- "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
- "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
- "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
- "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
- "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
- "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
-vp_SCALARop
- "EX2" .emit OP_EX2 .or
- "EXP" .emit OP_EXP .or
- "LG2" .emit OP_LG2 .or
- "LOG" .emit OP_LOG .or
- "RCP" .emit OP_RCP .or
- "RSQ" .emit OP_RSQ;
-
-/*
- <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
- <scalarSrcReg>
-*/
-fp_BINSCop_instruction
- fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
- fp_scalarSrcReg;
-vp_BINSCop_instruction
- vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
- vp_scalarSrcReg;
-
-/*
-fragment program
- <BINSCop> ::= "POW" | "POW_SAT"
-
-vertex program
- <BINSCop> ::= "POW"
-*/
-fp_BINSCop
- "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
-vp_BINSCop
- "POW" .emit OP_POW;
-
-/*
-fragment program
- <BINop_instruction> ::= <BINop> <maskedDstReg> ","
- <vectorSrcReg> "," <vectorSrcReg>
-
-vertex program
- <BINop_instruction> ::= <BINop> <maskedDstReg> ","
- <swizzleSrcReg> "," <swizzleSrcReg>
-*/
-fp_BINop_instruction
- fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
- vectorSrcReg;
-vp_BINop_instruction
- vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
- swizzleSrcReg;
-
-/*
-fragment program
- <BINop> ::= "ADD" | "ADD_SAT"
- | "DP3" | "DP3_SAT"
- | "DP4" | "DP4_SAT"
- | "DPH" | "DPH_SAT"
- | "DST" | "DST_SAT"
- | "MAX" | "MAX_SAT"
- | "MIN" | "MIN_SAT"
- | "MUL" | "MUL_SAT"
- | "SGE" | "SGE_SAT"
- | "SLT" | "SLT_SAT"
- | "SUB" | "SUB_SAT"
- | "XPD" | "XPD_SAT"
-
-vertex program
- <BINop> ::= "ADD"
- | "DP3"
- | "DP4"
- | "DPH"
- | "DST"
- | "MAX"
- | "MIN"
- | "MUL"
- | "SGE"
- | "SLT"
- | "SUB"
- | "XPD"
-*/
-fp_BINop
- "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
- "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
- "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
- "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
- "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
- "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
- "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
- "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
- "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
- "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
- "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
- "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
-vp_BINop
- "ADD" .emit OP_ADD .or
- "DP3" .emit OP_DP3 .or
- "DP4" .emit OP_DP4 .or
- "DPH" .emit OP_DPH .or
- "DST" .emit OP_DST .or
- "MAX" .emit OP_MAX .or
- "MIN" .emit OP_MIN .or
- "MUL" .emit OP_MUL .or
- "SGE" .emit OP_SGE .or
- "SLT" .emit OP_SLT .or
- "SUB" .emit OP_SUB .or
- "XPD" .emit OP_XPD;
-
-/*
-fragment program
- <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
- <vectorSrcReg> "," <vectorSrcReg> ","
- <vectorSrcReg>
-
-vertex program
- <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
- <swizzleSrcReg> "," <swizzleSrcReg> ","
- <swizzleSrcReg>
-*/
-fp_TRIop_instruction
- fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
- vectorSrcReg .and comma .and vectorSrcReg;
-vp_TRIop_instruction
- vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
- swizzleSrcReg .and comma .and swizzleSrcReg;
-
-/*
-fragment program
- <TRIop> ::= "CMP" | "CMP_SAT"
- | "LRP" | "LRP_SAT"
- | "MAD" | "MAD_SAT"
-
-vertex program
- <TRIop> ::= "MAD"
-*/
-fp_TRIop
- "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
- "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
- "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
-vp_TRIop
- "MAD" .emit OP_MAD;
-
-/*
-fragment program
- <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
- <srcReg> "," <extendedSwizzle>
-
-vertex program
- <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
- <extendedSwizzle>
-*/
-fp_SWZ_instruction
- SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
- fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
-vp_SWZ_instruction
- "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
- vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
-
-/*
-fragment program
- <SWZop> ::= "SWZ" | "SWZ_SAT"
-*/
-SWZop
- "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
-
-/*
-fragment program
- <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
- <vectorSrcReg> "," <texImageUnit> ","
- <texTarget>
-*/
-SAMPLE_instruction
- SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
- texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
-
-/*
-fragment program
- <SAMPLEop> ::= "TEX" | "TEX_SAT"
- | "TXP" | "TXP_SAT"
- | "TXB" | "TXB_SAT"
-*/
-SAMPLEop
- "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
- "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
- "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
-
-/*
-fragment program
- <KIL_instruction> ::= "KIL" <vectorSrcReg>
-*/
-KIL_instruction
- "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
-
-/*
-fragment program
- <texImageUnit> ::= "texture" <optTexImageUnitNum>
-*/
-texImageUnit
- "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
-
-/*
-fragment program
- <texTarget> ::= "1D"
- | "2D"
- | "3D"
- | "CUBE"
- | "RECT"
- | <shadowTarget> (if option ARB_fragment_program_shadow present)
-*/
-texTarget
- "1D" .emit TEXTARGET_1D .or
- "2D" .emit TEXTARGET_2D .or
- "3D" .emit TEXTARGET_3D .or
- .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
- "CUBE" .emit TEXTARGET_CUBE .or
- .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
-
-/*
-GL_ARB_fragment_program_shadow
- <shadowTarget> ::= "SHADOW1D"
- | "SHADOW2D"
- | "SHADOWRECT"
-*/
-shadowTarget
- "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
- "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
- .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
-
-/*
-fragment program
- <optTexImageUnitNum> ::= ""
- | "[" <texImageUnitNum> "]"
-*/
-optTexImageUnitNum
- optTexImageUnitNum_1 .or .true .emit 0x00;
-optTexImageUnitNum_1
- lbracket_ne .and texImageUnitNum .and rbracket;
-
-/*
-fragment program
- <texImageUnitNum> ::= <integer> from 0 to
- MAX_TEXTURE_IMAGE_UNITS_ARB-1
-*/
-texImageUnitNum
- integer;
-
-/*
- <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
-*/
-fp_scalarSrcReg
- optionalSign .and fp_srcReg .and fp_scalarSuffix;
-vp_scalarSrcReg
- optionalSign .and vp_srcReg .and vp_scalarSuffix;
-
-/*
-vertex program
- <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
-*/
-swizzleSrcReg
- optionalSign .and vp_srcReg .and swizzleSuffix;
-
-/*
-fragment program
- <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
-*/
-vectorSrcReg
- optionalSign .and fp_srcReg .and optionalSuffix;
-
-/*
- <maskedDstReg> ::= <dstReg> <optionalMask>
-*/
-fp_maskedDstReg
- fp_dstReg .and fp_optionalMask;
-vp_maskedDstReg
- vp_dstReg .and vp_optionalMask;
-
-/*
-vertex program
- <maskedAddrReg> ::= <addrReg> <addrWriteMask>
-*/
-maskedAddrReg
- addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
-
-/*
-fragment program
- <extendedSwizzle> ::= <xyzwExtendedSwizzle>
- | <rgbaExtendedSwizzle>
-
-vertex program
- <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
- <extSwizComp> "," <extSwizComp>
-
-NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
-*/
-fp_extendedSwizzle
- rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
-vp_extendedSwizzle
- extSwizComp .and comma .and
- extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- extSwizComp .error EXT_SWIZ_COMP_EXPECTED;
-
-/*
-fragment program
- <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
- <xyzwExtSwizComp> "," <xyzwExtSwizComp>
-*/
-xyzwExtendedSwizzle
- xyzwExtSwizComp .and comma .and
- xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
-
-/*
-fragment program
- <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
- <rgbaExtSwizComp> "," <rgbaExtSwizComp>
-*/
-rgbaExtendedSwizzle
- rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or
- rgbaExtendedSwizzle_4;
-rgbaExtendedSwizzle_1
- rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
- rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;
-rgbaExtendedSwizzle_2
- rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
- rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
-rgbaExtendedSwizzle_3
- rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and
- rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
-rgbaExtendedSwizzle_4
- rgbaExtSwizComp_alpha .and comma .and
- rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
- rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
-
-/*
-fragment program
- <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
-*/
-xyzwExtSwizComp
- optionalSign .and xyzwExtSwizSel;
-
-/*
-fragment program
- <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
-*/
-rgbaExtSwizComp
- optionalSign .and rgbaExtSwizSel;
-rgbaExtSwizComp_digit
- optionalSign .and rgbaExtSwizSel_digit;
-rgbaExtSwizComp_alpha
- optionalSign .and rgbaExtSwizSel_alpha;
-
-/*
-vertex program
- <extSwizComp> ::= <optionalSign> <extSwizSel>
-*/
-extSwizComp
- optionalSign .and extSwizSel;
-
-/*
-fragment program
- <xyzwExtSwizSel> ::= "0"
- | "1"
- | <xyzwComponent>
-*/
-xyzwExtSwizSel
- "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
-
-/*
-fragment program
- <rgbaExtSwizSel> ::= "0"
- | "1"
- | <rgbaComponent>
-*/
-rgbaExtSwizSel
- rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;
-rgbaExtSwizSel_digit
- "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1;
-rgbaExtSwizSel_alpha
- rgbaComponent_single;
-
-/*
-vertex program
- <extSwizSel> ::= "0"
- | "1"
- | <component>
-*/
-extSwizSel
- "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
-
-/*
-fragment program
- <srcReg> ::= <fragmentAttribReg>
- | <temporaryReg>
- | <progParamReg>
-
-vertex program
- <srcReg> ::= <vertexAttribReg>
- | <temporaryReg>
- | <progParamReg>
-*/
-fp_srcReg
- fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
-vp_srcReg
- vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
-fp_srcReg_1
- fragmentAttribReg .emit REGISTER_ATTRIB .or
- fp_progParamReg .emit REGISTER_PARAM .or
- fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
-vp_srcReg_1
- vertexAttribReg .emit REGISTER_ATTRIB .or
- vp_progParamReg .emit REGISTER_PARAM .or
- vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
-
-/*
-fragment program
- <dstReg> ::= <temporaryReg>
- | <fragmentResultReg>
-
-vertex program
- <dstReg> ::= <temporaryReg>
- | <vertexResultReg>
-*/
-fp_dstReg
- fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
-vp_dstReg
- vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
-fp_dstReg_1
- fragmentResultReg .emit REGISTER_RESULT .or
- fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
-vp_dstReg_1
- vertexResultReg .emit REGISTER_RESULT .or
- vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
-
-/*
-fragment program
- <fragmentAttribReg> ::= <establishedName>
- | <fragAttribBinding>
-
-NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
-*/
-fragmentAttribReg
- /*fp_establishedName .or */fragAttribBinding;
-
-/*
-vertex program
- <vertexAttribReg> ::= <establishedName>
- | <vtxAttribBinding>
-
-NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
-*/
-vertexAttribReg
- vtxAttribBinding;
-
-/*
- <temporaryReg> ::= <establishedName>
-*/
-fp_temporaryReg
- fp_establishedName_no_error_on_identifier;
-vp_temporaryReg
- vp_establishedName_no_error_on_identifier;
-
-/*
-fragment program
- <progParamReg> ::= <progParamSingle>
- | <progParamArray> "[" <progParamArrayAbs> "]"
- | <paramSingleItemUse>
-
-vertex program
- <progParamReg> ::= <progParamSingle>
- | <progParamArray> "[" <progParamArrayMem> "]"
- | <paramSingleItemUse>
-*/
-fp_progParamReg
- fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
-vp_progParamReg
- vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
-fp_progParamReg_1
- fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
- rbracket;
-vp_progParamReg_1
- vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
- rbracket;
-
-/*
- <progParamSingle> ::= <establishedName>
-
-NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
-*/
-fp_progParamSingle
- .false;
-vp_progParamSingle
- .false;
-
-/*
- <progParamArray> ::= <establishedName>
-*/
-fp_progParamArray
- fp_establishedName_no_error_on_identifier;
-vp_progParamArray
- vp_establishedName_no_error_on_identifier;
-
-/*
-vertex program
- <progParamArrayMem> ::= <progParamArrayAbs>
- | <progParamArrayRel>
-*/
-progParamArrayMem
- progParamArrayAbs .or progParamArrayRel;
-
-/*
- <progParamArrayAbs> ::= <integer>
-*/
-progParamArrayAbs
- integer_ne .emit ARRAY_INDEX_ABSOLUTE;
-
-/*
-vertex program
- <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
-*/
-progParamArrayRel
- addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
- addrComponent .and addrRegRelOffset;
-
-/*
-vertex program
- <addrRegRelOffset> ::= ""
- | "+" <addrRegPosOffset>
- | "-" <addrRegNegOffset>
-*/
-addrRegRelOffset
- addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
-addrRegRelOffset_1
- plus_ne .and addrRegPosOffset;
-addrRegRelOffset_2
- minus_ne .and addrRegNegOffset;
-
-/*
-vertex program
- <addrRegPosOffset> ::= <integer> from 0 to 63
-*/
-addrRegPosOffset
- integer_0_63;
-
-/*
-vertex program
- <addrRegNegOffset> ::= <integer> from 0 to 64
-*/
-addrRegNegOffset
- integer_0_64;
-
-/*
-fragment program
- <fragmentResultReg> ::= <establishedName>
- | <resultBinding>
-
-NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
-*/
-fragmentResultReg
- fp_resultBinding;
-
-/*
-vertex program
- <vertexResultReg> ::= <establishedName>
- | <resultBinding>
-
-NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
-*/
-vertexResultReg
- vp_resultBinding;
-
-/*
-vertex program
- <addrReg> ::= <establishedName>
-*/
-addrReg
- vp_establishedName_no_error_on_identifier;
-
-/*
-vertex program
- <addrComponent> ::= "." "x"
-*/
-addrComponent
- dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
- .emit COMPONENT_X .emit COMPONENT_X;
-
-/*
-vertex program
- <addrWriteMask> ::= "." "x"
-*/
-addrWriteMask
- dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
-
-/*
- <scalarSuffix> ::= "." <component>
-*/
-fp_scalarSuffix
- dot .and fp_component_single .error INVALID_COMPONENT;
-vp_scalarSuffix
- dot .and vp_component_single .error INVALID_COMPONENT;
-
-/*
-vertex program
- <swizzleSuffix> ::= ""
- | "." <component>
- | "." <component> <component>
- <component> <component>
-*/
-swizzleSuffix
- swizzleSuffix_1 .or
- .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
-swizzleSuffix_1
- dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
-swizzleSuffix_2
- swizzleSuffix_3 .or swizzleSuffix_4;
-swizzleSuffix_3
- vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
- vp_component_multi .error INVALID_COMPONENT;
-swizzleSuffix_4
- "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
- "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
- "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
- "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
-
-/*
-fragment program
- <optionalSuffix> ::= ""
- | "." <component>
- | "." <xyzwComponent> <xyzwComponent>
- <xyzwComponent> <xyzwComponent>
- | "." <rgbaComponent> <rgbaComponent>
- <rgbaComponent> <rgbaComponent>
-*/
-optionalSuffix
- optionalSuffix_1 .or
- .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
-optionalSuffix_1
- dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
-optionalSuffix_2
- optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
-optionalSuffix_3
- xyzwComponent_multi .and xyzwComponent_multi .and
- xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
-optionalSuffix_4
- rgbaComponent_multi .and rgbaComponent_multi .and
- rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
-optionalSuffix_5
- "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
- "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
- "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
- "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or
- "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
- "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
- "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
- "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
-
-/*
-fragment program
- <component> ::= <xyzwComponent>
- | <rgbaComponent>
-
-vertex program
- <component> ::= "x"
- | "y"
- | "z"
- | "w"
-*/
-fp_component_single
- xyzwComponent_single .or rgbaComponent_single;
-vp_component_multi
- 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
- 'w' .emit COMPONENT_W;
-vp_component_single
- "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
- "w" .emit COMPONENT_W;
-
-/*
-fragment program
- <xyzwComponent> ::= "x" | "y" | "z" | "w"
-*/
-xyzwComponent_multi
- 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
- 'w' .emit COMPONENT_W;
-xyzwComponent_single
- "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
- "w" .emit COMPONENT_W;
-
-/*
-fragment program
- <rgbaComponent> ::= "r" | "g" | "b" | "a"
-*/
-rgbaComponent_multi
- 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or
- 'a' .emit COMPONENT_W;
-rgbaComponent_single
- "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or
- "a" .emit COMPONENT_W;
-
-/*
-fragment program
- <optionalMask> ::= ""
- | <xyzwMask>
- | <rgbaMask>
-
-vertex program
- <optionalMask> ::= ""
- | "." "x"
- | "." "y"
- | "." "xy"
- | "." "z"
- | "." "xz"
- | "." "yz"
- | "." "xyz"
- | "." "w"
- | "." "xw"
- | "." "yw"
- | "." "xyw"
- | "." "zw"
- | "." "xzw"
- | "." "yzw"
- | "." "xyzw"
-
-NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
-*/
-fp_optionalMask
- rgbaMask .or xyzwMask .or .true .emit 0x0F;
-vp_optionalMask
- xyzwMask .or .true .emit 0x0F;
-
-/*
-fragment program
- <xyzwMask> ::= "." "x"
- | "." "y"
- | "." "xy"
- | "." "z"
- | "." "xz"
- | "." "yz"
- | "." "xyz"
- | "." "w"
- | "." "xw"
- | "." "yw"
- | "." "xyw"
- | "." "zw"
- | "." "xzw"
- | "." "yzw"
- | "." "xyzw"
-
-NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
-*/
-xyzwMask
- dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
-xyzwMask_1
- "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or
- "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or
- "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or
- "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01;
-
-/*
-fragment program
- <rgbaMask> ::= "." "r"
- | "." "g"
- | "." "rg"
- | "." "b"
- | "." "rb"
- | "." "gb"
- | "." "rgb"
- | "." "a"
- | "." "ra"
- | "." "ga"
- | "." "rga"
- | "." "ba"
- | "." "rba"
- | "." "gba"
- | "." "rgba"
-*/
-rgbaMask
- dot_ne .and rgbaMask_1;
-rgbaMask_1
- "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or
- "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or
- "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or
- "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01;
-
-/*
-fragment program
- <namingStatement> ::= <ATTRIB_statement>
- | <PARAM_statement>
- | <TEMP_statement>
- | <OUTPUT_statement>
- | <ALIAS_statement>
-
-vertex program
- <namingStatement> ::= <ATTRIB_statement>
- | <PARAM_statement>
- | <TEMP_statement>
- | <ADDRESS_statement>
- | <OUTPUT_statement>
- | <ALIAS_statement>
-*/
-fp_namingStatement
- fp_ATTRIB_statement .emit ATTRIB .or
- fp_PARAM_statement .emit PARAM .or
- fp_TEMP_statement .emit TEMP .or
- fp_OUTPUT_statement .emit OUTPUT .or
- fp_ALIAS_statement .emit ALIAS;
-vp_namingStatement
- vp_ATTRIB_statement .emit ATTRIB .or
- vp_PARAM_statement .emit PARAM .or
- vp_TEMP_statement .emit TEMP .or
- ADDRESS_statement .emit ADDRESS .or
- vp_OUTPUT_statement .emit OUTPUT .or
- vp_ALIAS_statement .emit ALIAS;
-
-/*
-fragment program
- <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
- <fragAttribBinding>
-
-vertex program
- <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
- <vtxAttribBinding>
-*/
-fp_ATTRIB_statement
- "ATTRIB" .and space .and fp_establishName .and equal .and
- fragAttribBinding .error FRAGMENT_EXPECTED;
-vp_ATTRIB_statement
- "ATTRIB" .and space .and vp_establishName .and equal .and
- vtxAttribBinding .error VERTEX_EXPECTED;
-
-/*
-fragment program
- <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
-*/
-fragAttribBinding
- "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
-
-/*
-vertex program
- <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
-*/
-vtxAttribBinding
- "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
-
-/*
-fragment program
- <fragAttribItem> ::= "color" <optColorType>
- | "texcoord" <optTexCoordNum>
- | "fogcoord"
- | "position"
-*/
-fragAttribItem
- fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or
- fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or
- .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or
- "position" .emit FRAGMENT_ATTRIB_POSITION;
-fragAttribItem_1
- "color" .and optColorType;
-fragAttribItem_2
- "texcoord" .and optTexCoordNum;
-
-/*
-vertex program
- <vtxAttribItem> ::= "position"
- | "weight" <vtxOptWeightNum>
- | "normal"
- | "color" <optColorType>
- | "fogcoord"
- | "texcoord" <optTexCoordNum>
- | "matrixindex" "[" <vtxWeightNum> "]"
- | "attrib" "[" <vtxAttribNum> "]"
-*/
-vtxAttribItem
- "position" .emit VERTEX_ATTRIB_POSITION .or
- .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or
- "normal" .emit VERTEX_ATTRIB_NORMAL .or
- vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or
- "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or
- vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or
- .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or
- vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;
-vtxAttribItem_1
- "weight" .and vtxOptWeightNum;
-vtxAttribItem_2
- "color" .and optColorType;
-vtxAttribItem_3
- "texcoord" .and optTexCoordNum;
-vtxAttribItem_4
- "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
-vtxAttribItem_5
- "attrib" .and lbracket .and vtxAttribNum .and rbracket;
-
-/*
-vertex program
- <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
-*/
-vtxAttribNum
- integer;
-
-/*
-vertex program
- <vtxOptWeightNum> ::= ""
- | "[" <vtxWeightNum> "]"
-*/
-vtxOptWeightNum
- vtxOptWeightNum_1 .or .true .emit 0x00;
-vtxOptWeightNum_1
- lbracket_ne .and vtxWeightNum .and rbracket;
-
-/*
-vertex program
- <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
- must be divisible by four
-*/
-vtxWeightNum
- integer;
-
-/*
- <PARAM_statement> ::= <PARAM_singleStmt>
- | <PARAM_multipleStmt>
-*/
-fp_PARAM_statement
- fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
-vp_PARAM_statement
- vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
-
-/*
- <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
-*/
-fp_PARAM_singleStmt
- "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
- .true .emit PARAM_NULL;
-vp_PARAM_singleStmt
- "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
- .true .emit PARAM_NULL;
-
-/*
- <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
- <paramMultipleInit>
-*/
-fp_PARAM_multipleStmt
- "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
- fp_paramMultipleInit .and .true .emit PARAM_NULL;
-vp_PARAM_multipleStmt
- "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
- vp_paramMultipleInit .and .true .emit PARAM_NULL;
-
-/*
- <optArraySize> ::= ""
- | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
- (maximum number of allowed program
- parameter bindings)
-*/
-optArraySize
- optional_integer;
-
-/*
- <paramSingleInit> ::= "=" <paramSingleItemDecl>
-*/
-fp_paramSingleInit
- equal .and fp_paramSingleItemDecl;
-vp_paramSingleInit
- equal .and vp_paramSingleItemDecl;
-
-/*
- <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
-*/
-fp_paramMultipleInit
- equal .and lbrace .and fp_paramMultInitList .and rbrace;
-vp_paramMultipleInit
- equal .and lbrace .and vp_paramMultInitList .and rbrace;
-
-/*
- <paramMultInitList> ::= <paramMultipleItem>
- | <paramMultipleItem> "," <paramMultiInitList>
-*/
-fp_paramMultInitList
- fp_paramMultInitList_1 .or fp_paramMultipleItem;
-vp_paramMultInitList
- vp_paramMultInitList_1 .or vp_paramMultipleItem;
-fp_paramMultInitList_1
- fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;
-vp_paramMultInitList_1
- vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;
-
-/*
- <paramSingleItemDecl> ::= <stateSingleItem>
- | <programSingleItem>
- | <paramConstDecl>
-*/
-fp_paramSingleItemDecl
- fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
- programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
- paramConstDecl .emit PARAM_CONSTANT;
-vp_paramSingleItemDecl
- vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
- programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
- paramConstDecl .emit PARAM_CONSTANT;
-
-/*
- <paramSingleItemUse> ::= <stateSingleItem>
- | <programSingleItem>
- | <paramConstUse>
-*/
-fp_paramSingleItemUse
- fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
- programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
- paramConstUse .emit PARAM_CONSTANT;
-vp_paramSingleItemUse
- vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
- programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
- paramConstUse .emit PARAM_CONSTANT;
-
-/*
- <paramMultipleItem> ::= <stateMultipleItem>
- | <programMultipleItem>
- | <paramConstDecl>
-*/
-fp_paramMultipleItem
- fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
- programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
- paramConstDecl .emit PARAM_CONSTANT;
-vp_paramMultipleItem
- vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
- programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
- paramConstDecl .emit PARAM_CONSTANT;
-
-/*
- <stateMultipleItem> ::= <stateSingleItem>
- | "state" "." <stateMatrixRows>
-*/
-fp_stateMultipleItem
- stateMultipleItem_1 .or fp_stateSingleItem;
-vp_stateMultipleItem
- stateMultipleItem_1 .or vp_stateSingleItem;
-stateMultipleItem_1
- "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
-
-/*
-fragment program
- <stateSingleItem> ::= "state" "." <stateMaterialItem>
- | "state" "." <stateLightItem>
- | "state" "." <stateLightModelItem>
- | "state" "." <stateLightProdItem>
- | "state" "." <stateTexEnvItem>
- | "state" "." <stateFogItem>
- | "state" "." <stateDepthItem>
- | "state" "." <stateMatrixRow>
-
-vertex program
- <stateSingleItem> ::= "state" "." <stateMaterialItem>
- | "state" "." <stateLightItem>
- | "state" "." <stateLightModelItem>
- | "state" "." <stateLightProdItem>
- | "state" "." <stateTexGenItem>
- | "state" "." <stateFogItem>
- | "state" "." <stateClipPlaneItem>
- | "state" "." <statePointItem>
- | "state" "." <stateMatrixRow>
-*/
-fp_stateSingleItem
- "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
-vp_stateSingleItem
- "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
-fp_stateSingleItem_1
- stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
- stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;
-vp_stateSingleItem_1
- stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
- stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or
- stateSingleItem_11;
-stateSingleItem_1
- stateMaterialItem .emit STATE_MATERIAL;
-stateSingleItem_2
- stateLightItem .emit STATE_LIGHT;
-stateSingleItem_3
- stateLightModelItem .emit STATE_LIGHT_MODEL;
-stateSingleItem_4
- stateLightProdItem .emit STATE_LIGHT_PROD;
-stateSingleItem_5
- stateTexEnvItem .emit STATE_TEX_ENV;
-stateSingleItem_6
- stateTexGenItem .emit STATE_TEX_GEN;
-stateSingleItem_7
- stateFogItem .emit STATE_FOG;
-stateSingleItem_8
- stateDepthItem .emit STATE_DEPTH;
-stateSingleItem_9
- stateClipPlaneItem .emit STATE_CLIP_PLANE;
-stateSingleItem_10
- statePointItem .emit STATE_POINT;
-stateSingleItem_11
- stateMatrixRow .emit STATE_MATRIX_ROWS;
-
-/*
- <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
-*/
-stateMaterialItem
- "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
-
-/*
- <stateMatProperty> ::= "ambient"
- | "diffuse"
- | "specular"
- | "emission"
- | "shininess"
-*/
-stateMatProperty
- "ambient" .emit MATERIAL_AMBIENT .or
- "diffuse" .emit MATERIAL_DIFFUSE .or
- "specular" .emit MATERIAL_SPECULAR .or
- "emission" .emit MATERIAL_EMISSION .or
- "shininess" .emit MATERIAL_SHININESS;
-
-/*
- <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
- <stateLightProperty>
-*/
-stateLightItem
- "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
- stateLightProperty .error INVALID_LIGHT_PROPERTY;
-
-/*
- <stateLightProperty> ::= "ambient"
- | "diffuse"
- | "specular"
- | "position"
- | "attenuation"
- | "spot" "." <stateSpotProperty>
- | "half"
-*/
-stateLightProperty
- "ambient" .emit LIGHT_AMBIENT .or
- "diffuse" .emit LIGHT_DIFFUSE .or
- "specular" .emit LIGHT_SPECULAR .or
- "position" .emit LIGHT_POSITION .or
- "attenuation" .emit LIGHT_ATTENUATION .or
- stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or
- "half" .emit LIGHT_HALF;
-stateLightProperty_1
- "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;
-
-/*
- <stateSpotProperty> ::= "direction"
-*/
-stateSpotProperty
- "direction";
-
-/*
- <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
-*/
-stateLightModelItem
- "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
-
-/*
- <stateLModProperty> ::= "." "ambient"
- | <optFaceType> "." "scenecolor"
-*/
-stateLModProperty
- stateLModProperty_1 .or stateLModProperty_2;
-stateLModProperty_1
- dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
-stateLModProperty_2
- stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
-stateLModProperty_3
- optFaceType .and dot .and "scenecolor";
-
-/*
- <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
- <optFaceType> "." <stateLProdProperty>
-*/
-stateLightProdItem
- "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
- stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
-
-/*
- <stateLProdProperty> ::= "ambient"
- | "diffuse"
- | "specular"
-*/
-stateLProdProperty
- "ambient" .emit LIGHT_PROD_AMBIENT .or
- "diffuse" .emit LIGHT_PROD_DIFFUSE .or
- "specular" .emit LIGHT_PROD_SPECULAR;
-
-/*
- <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
-*/
-stateLightNumber
- integer;
-
-/*
-fragment program
- <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
- <stateTexEnvProperty>
-*/
-stateTexEnvItem
- "texenv" .and optLegacyTexUnitNum .and dot .and
- stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
-
-/*
-fragment program
- <stateTexEnvProperty> ::= "color"
-*/
-stateTexEnvProperty
- "color" .emit TEX_ENV_COLOR;
-
-/*
-fragment program
- <optLegacyTexUnitNum> ::= ""
- | "[" <legacyTexUnitNum> "]"
-
-NOTE: <optLegaceTexUnitNum> is not optional.
-*/
-optLegacyTexUnitNum
- lbracket_ne .and legacyTexUnitNum .and rbracket;
-
-/*
-fragment program
- <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
-*/
-legacyTexUnitNum
- integer;
-
-/*
-vertex program
- <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
- <stateTexGenType> "." <stateTexGenCoord>
-*/
-stateTexGenItem
- "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
- dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
-
-/*
-vertex program
- <stateTexGenType> ::= "eye"
- | "object"
-*/
-stateTexGenType
- "eye" .emit TEX_GEN_EYE .or
- "object" .emit TEX_GEN_OBJECT;
-
-/*
-vertex program
- <stateTexGenCoord> ::= "s"
- | "t"
- | "r"
- | "q"
-*/
-stateTexGenCoord
- "s" .emit COMPONENT_X .or
- "t" .emit COMPONENT_Y .or
- "r" .emit COMPONENT_Z .or
- "q" .emit COMPONENT_W;
-
-/*
- <stateFogItem> ::= "fog" "." <stateFogProperty>
-*/
-stateFogItem
- "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
-
-/*
- <stateFogProperty> ::= "color"
- | "params"
-*/
-stateFogProperty
- "color" .emit FOG_COLOR .or
- "params" .emit FOG_PARAMS;
-
-/*
-fragment program
- <stateDepthItem> ::= "depth" "." <stateDepthProperty>
-*/
-stateDepthItem
- "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
-
-/*
-fragment program
- <stateDepthProperty> ::= "range"
-*/
-stateDepthProperty
- "range" .emit DEPTH_RANGE;
-
-/*
-vertex program
- <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
-*/
-stateClipPlaneItem
- "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
- "plane" .error INVALID_CLIPPLANE_PROPERTY;
-
-/*
-vertex program
- <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
-*/
-stateClipPlaneNum
- integer;
-
-/*
-vertex program
- <statePointItem> ::= "point" "." <statePointProperty>
-*/
-statePointItem
- "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
-
-/*
-vertex program
- <statePointProperty> ::= "size"
- | "attenuation"
-*/
-statePointProperty
- "size" .emit POINT_SIZE .or
- .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
-
-/*
- <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
- <stateMatrixRowNum> "]"
-*/
-stateMatrixRow
- stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
- lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
-
-/*
- <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
-*/
-stateMatrixRows
- stateMatrixItem .and optMatrixRows;
-
-/*
- <optMatrixRows> ::= ""
- | "." "row" "[" <stateMatrixRowNum> ".."
- <stateMatrixRowNum> "]"
-*/
-optMatrixRows
- optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
-optMatrixRows_1
- dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
- stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
-
-/*
- <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
- <stateOptMatModifier>
-*/
-stateMatrixItem
- "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
-
-/*
- <stateOptMatModifier> ::= ""
- | "." <stateMatModifier>
-*/
-stateOptMatModifier
- stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
-stateOptMatModifier_1
- dot_ne .and stateMatModifier;
-
-/*
- <stateMatModifier> ::= "inverse"
- | "transpose"
- | "invtrans"
-*/
-stateMatModifier
- "inverse" .emit MATRIX_MODIFIER_INVERSE .or
- "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
- "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
-
-/*
- <stateMatrixRowNum> ::= <integer> from 0 to 3
-*/
-stateMatrixRowNum
- integer_0_3;
-
-/*
- <stateMatrixName> ::= "modelview" <stateOptModMatNum>
- | "projection"
- | "mvp"
- | "texture" <optTexCoordNum>
- | "palette" "[" <statePaletteMatNum> "]"
- | "program" "[" <stateProgramMatNum> "]"
-*/
-stateMatrixName
- stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or
- "projection" .emit MATRIX_PROJECTION .or
- "mvp" .emit MATRIX_MVP .or
- stateMatrixName_1_2 .emit MATRIX_TEXTURE .or
- .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or
- stateMatrixName_1_4 .emit MATRIX_PROGRAM;
-stateMatrixName_1_1
- "modelview" .and stateOptModMatNum;
-stateMatrixName_1_2
- "texture" .and optTexCoordNum;
-stateMatrixName_1_3
- "palette" .and lbracket .and statePaletteMatNum .and rbracket;
-stateMatrixName_1_4
- "program" .and lbracket .and stateProgramMatNum .and rbracket;
-
-/*
- <stateOptModMatNum> ::= ""
- | "[" <stateModMatNum> "]"
-*/
-stateOptModMatNum
- .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
- .true .emit 0x00;
-stateOptModMatNum_1
- lbracket_ne .and stateModMatNum .and rbracket;
-
-/*
- <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
-*/
-stateModMatNum
- integer;
-
-/*
- <optTexCoordNum> ::= ""
- | "[" <texCoordNum> "]"
-*/
-optTexCoordNum
- optTexCoordNum_1 .or .true .emit 0x00;
-optTexCoordNum_1
- lbracket_ne .and texCoordNum .and rbracket;
-
-/*
- <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
-*/
-texCoordNum
- integer;
-
-/*
- <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
-*/
-statePaletteMatNum
- integer;
-
-/*
- <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
-*/
-stateProgramMatNum
- integer;
-
-/*
- <programSingleItem> ::= <progEnvParam>
- | <progLocalParam>
-
-NOTE: <programSingleItem> has been modified for correct error handling. If program property
- is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
-*/
-programSingleItem
- "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
-programSingleItem_1
- progEnvParam .or progLocalParam;
-
-/*
- <programMultipleItem> ::= <progEnvParams>
- | <progLocalParams>
-
-NOTE: <programMultipleItem> has been modified for correct error handling. If program property
- is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
-*/
-programMultipleItem
- "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
-programMultipleItem_1
- progEnvParams .or progLocalParams;
-
-/*
- <progEnvParams> ::= "program" "." "env"
- "[" <progEnvParamNums> "]"
-
-NOTE: "program" "." has been moved to <programMultipleItem>.
-*/
-progEnvParams
- "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
-
-/*
- <progEnvParamNums> ::= <progEnvParamNum>
- | <progEnvParamNum> ".." <progEnvParamNum>
-*/
-progEnvParamNums
- progEnvParamNums_1 .or progEnvParamNums_2;
-progEnvParamNums_1
- progEnvParamNum .and dotdot_ne .and progEnvParamNum;
-progEnvParamNums_2
- progEnvParamNum .and .true .emit 0x00;
-
-/*
- <progEnvParam> ::= "program" "." "env"
- "[" <progEnvParamNum> "]"
-
-NOTE: "program" "." has been moved to <programSingleItem>.
-*/
-progEnvParam
- "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
-
-/*
- <progLocalParams> ::= "program" "." "local"
- "[" <progLocalParamNums> "]"
-
-NOTE: "program" "." has been moved to <programMultipleItem>.
-*/
-progLocalParams
- "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
-
-/*
- <progLocalParamNums> ::= <progLocalParamNum>
- | <progLocalParamNum> ".." <progLocalParamNum>
-*/
-progLocalParamNums
- progLocalParamNums_1 .or progLocalParamNums_2;
-progLocalParamNums_1
- progLocalParamNum .and dotdot_ne .and progLocalParamNum;
-progLocalParamNums_2
- progLocalParamNum .and .true .emit 0x00;
-
-/*
- <progLocalParam> ::= "program" "." "local"
- "[" <progLocalParamNum> "]"
-
-NOTE: "program" "." has been moved to <programSingleItem>.
-*/
-progLocalParam
- "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
-
-/*
- <progEnvParamNum> ::= <integer> from 0 to
- MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
-*/
-progEnvParamNum
- integer;
-
-/*
- <progLocalParamNum> ::= <integer> from 0 to
- MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
-*/
-progLocalParamNum
- integer;
-
-/*
- <paramConstDecl> ::= <paramConstScalarDecl>
- | <paramConstVector>
-*/
-paramConstDecl
- paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
-
-/*
- <paramConstUse> ::= <paramConstScalarUse>
- | <paramConstVector>
-*/
-paramConstUse
- paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
-
-/*
- <paramConstScalarDecl> ::= <signedFloatConstant>
-*/
-paramConstScalarDecl
- signedFloatConstant;
-
-/*
- <paramConstScalarUse> ::= <floatConstant>
-*/
-paramConstScalarUse
- floatConstant;
-
-/*
- <paramConstVector> ::= "{" <signedFloatConstant> "}"
- | "{" <signedFloatConstant> ","
- <signedFloatConstant> "}"
- | "{" <signedFloatConstant> ","
- <signedFloatConstant> ","
- <signedFloatConstant> "}"
- | "{" <signedFloatConstant> ","
- <signedFloatConstant> ","
- <signedFloatConstant> ","
- <signedFloatConstant> "}"
-*/
-paramConstVector
- paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
- paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
-paramConstVector_1
- lbrace_ne .and signedFloatConstant .and rbrace;
-paramConstVector_2
- lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
-paramConstVector_3
- lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
- signedFloatConstant .and rbrace;
-paramConstVector_4
- lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
- signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
-
-/*
- <signedFloatConstant> ::= <optionalSign> <floatConstant>
-*/
-signedFloatConstant
- optionalSign .and floatConstant;
-
-/*
- <floatConstant> ::= see text
- The <floatConstant> rule matches a floating-point constant consisting
- of an integer part, a decimal point, a fraction part, an "e" or
- "E", and an optionally signed integer exponent. The integer and
- fraction parts both consist of a sequence of one or more digits ("0"
- through "9"). Either the integer part or the fraction parts (not
- both) may be missing; either the decimal point or the "e" (or "E")
- and the exponent (not both) may be missing.
-*/
-floatConstant
- float;
-
-/*
- <optionalSign> ::= ""
- | "-"
- | "+"
-*/
-optionalSign
- optional_sign_ne;
-
-/*
- <TEMP_statement> ::= "TEMP" <varNameList>
-*/
-fp_TEMP_statement
- "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
-vp_TEMP_statement
- "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
-
-/*
-vertex program
- <ADDRESS_statement> ::= "ADDRESS" <varNameList>
-*/
-ADDRESS_statement
- "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
-
-/*
- <varNameList> ::= <establishName>
- | <establishName> "," <varNameList>
-*/
-fp_varNameList
- fp_varNameList_1 .or fp_establishName;
-vp_varNameList
- vp_varNameList_1 .or vp_establishName;
-fp_varNameList_1
- fp_establishName .and comma_ne .and fp_varNameList;
-vp_varNameList_1
- vp_establishName .and comma_ne .and vp_varNameList;
-
-/*
- <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
- <resultBinding>
-*/
-fp_OUTPUT_statement
- "OUTPUT" .and space .and fp_establishName .and equal .and
- fp_resultBinding .error RESULT_EXPECTED;
-vp_OUTPUT_statement
- "OUTPUT" .and space .and vp_establishName .and equal .and
- vp_resultBinding .error RESULT_EXPECTED;
-
-/*
-fragment program
- <resultBinding> ::= "result" "." "color"
- | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present)
- | "result" "." "depth"
-
-vertex program
- <resultBinding> ::= "result" "." "position"
- | "result" "." <resultColBinding>
- | "result" "." "fogcoord"
- | "result" "." "pointsize"
- | "result" "." "texcoord" <optTexCoordNum>
-*/
-fp_resultBinding
- "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
-vp_resultBinding
- "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
-fp_resultBinding_1
- fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or
- "depth" .emit FRAGMENT_RESULT_DEPTH;
-fp_resultBinding_2
- "color" .and optOutputColorNum;
-vp_resultBinding_1
- .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
- resultColBinding .emit VERTEX_RESULT_COLOR .or
- "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or
- "pointsize" .emit VERTEX_RESULT_POINTSIZE .or
- vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;
-vp_resultBinding_2
- "texcoord" .and optTexCoordNum;
-
-/*
-GL_ARB_draw_buffers
- <optOutputColorNum> ::= ""
- | "[" <outputColorNum> "]"
-*/
-optOutputColorNum
- .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;
-optOutputColorNum_1
- lbracket_ne .and outputColorNum .and rbracket;
-
-/*
-GL_ARB_draw_buffers
- <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
-*/
-outputColorNum
- integer;
-
-/*
-vertex program
- <resultColBinding> ::= "color" <optFaceType> <optColorType>
-*/
-resultColBinding
- "color" .and optFaceType .and optColorType;
-
-/*
- <optFaceType> ::= ""
- | "." "front"
- | "." "back"
-*/
-optFaceType
- FaceType .or .true .emit FACE_FRONT;
-FaceType
- dot_ne .and FaceProperty;
-FaceProperty
- "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
-
-/*
- <optColorType> ::= ""
- | "." "primary"
- | "." "secondary"
-*/
-optColorType
- ColorType .or .true .emit COLOR_PRIMARY;
-ColorType
- dot_ne .and ColorProperty;
-ColorProperty
- "primary" .emit COLOR_PRIMARY .or
- .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
-
-/*
- <ALIAS_statement> ::= "ALIAS" <establishName> "="
- <establishedName>
-*/
-fp_ALIAS_statement
- "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
-vp_ALIAS_statement
- "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;
-fp_ALIAS_statement_1
- space .and fp_establishName;
-vp_ALIAS_statement_1
- space .and vp_establishName;
-
-/*
- <establishName> ::= <identifier>
-*/
-fp_establishName
- fp_identifier;
-vp_establishName
- vp_identifier;
-
-/*
- <establishedName> ::= <identifier>
-*/
-fp_establishedName
- fp_identifier;
-vp_establishedName
- vp_identifier;
-fp_establishedName_no_error_on_identifier
- fp_identifier_ne;
-vp_establishedName_no_error_on_identifier
- vp_identifier_ne;
-
-/*
-fragment program
- <identifier> ::= see text
- The <identifier> rule matches a sequence of one or more letters ("A"
- through "Z", "a" through "z"), digits ("0" through "9), underscores
- ("_"), or dollar signs ("$"); the first character must not be a
- number. Upper and lower case letters are considered different
- (names are case-sensitive). The following strings are reserved
- keywords and may not be used as identifiers:
-
- ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS,
- COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT,
- END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2,
- LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT,
- MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM,
- POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS,
- SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT,
- TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT,
- fragment, program, result, state, and texture.
-
-vertex program
- <identifier> ::= see text
- The <identifier> rule matches a sequence of one or more letters ("A"
- through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
- or dollar signs ("$"); the first character must not be a number. Upper
- and lower case letters are considered different (names are
- case-sensitive). The following strings are reserved keywords and may not
- be used as identifiers:
-
- ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2,
- EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT,
- PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result,
- state, and vertex.
-*/
-fp_identifier
- fp_identifier_ne .error IDENTIFIER_EXPECTED;
-vp_identifier
- vp_identifier_ne .error IDENTIFIER_EXPECTED;
-fp_identifier_ne
- fp_not_reserved_identifier .and identifier_ne;
-vp_identifier_ne
- vp_not_reserved_identifier .and identifier_ne;
-
-fp_not_reserved_identifier
- fp_not_reserved_identifier_1 .or .true;
-fp_not_reserved_identifier_1
- fp_reserved_identifier .and .false .error RESERVED_KEYWORD;
-vp_not_reserved_identifier
- vp_not_reserved_identifier_1 .or .true;
-vp_not_reserved_identifier_1
- vp_reserved_identifier .and .false .error RESERVED_KEYWORD;
-
-fp_reserved_identifier
- "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or
- "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or
- "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or
- "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or
- "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or
- "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or
- "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or
- "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or
- "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or
- "fragment" .or "program" .or "result" .or "state" .or "texture";
-vp_reserved_identifier
- "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or
- "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or
- "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or
- "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or
- "XPD" .or "program" .or "result" .or "state" .or "vertex";
-
-/*
- The <integer> rule matches an integer constant. The integer consists
- of a sequence of one or more digits ("0" through "9").
-*/
-integer
- integer_ne .error INTEGER_EXPECTED;
-
-zero
- '0';
-
-leading_zeroes
- .loop zero;
-
-no_digit
- no_digit_1 .or .true;
-no_digit_1
- digit10 .and .false .error INTEGER_OUT_OF_RANGE;
-
-all_zeroes
- all_zeroes_1 .or no_digit_1;
-all_zeroes_1
- '0' .and .loop zero .and no_digit;
-
-integer_0_3
- integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
-integer_0_3_1
- integer_0_3_2 .or all_zeroes .emit '0';
-integer_0_3_2 /* [1, 3] */
- leading_zeroes .and '1'-'3' .emit * .and no_digit;
-
-integer_0_63
- integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
-integer_0_63_1
- integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or
- all_zeroes .emit '0';
-integer_0_63_2 /* [7, 9] */
- leading_zeroes .and '7'-'9' .emit * .and no_digit;
-integer_0_63_3 /* [10, 59] */
- leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
-integer_0_63_4 /* [60, 63] */
- leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;
-integer_0_63_5 /* [1, 6] */
- leading_zeroes .and '1'-'6' .emit * .and no_digit;
-
-integer_0_64
- integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
-integer_0_64_1
- integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or
- all_zeroes .emit '0';
-integer_0_64_2 /* [7, 9] */
- leading_zeroes .and '7'-'9' .emit * .and no_digit;
-integer_0_64_3 /* [10, 59] */
- leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
-integer_0_64_4 /* [60, 64] */
- leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;
-integer_0_64_5 /* [1, 6] */
- leading_zeroes .and '1'-'6' .emit * .and no_digit;
-
-optional_space
- space .or .true;
-
-space_dst
- space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
-
-space_src
- space .error OPERATION_NEEDS_SOURCE_VARIABLE;
-
-space
- single_space .and .loop single_space;
-
-single_space
- white_char .or comment_block;
-
-white_char
- ' ' .or '\t' .or '\n' .or '\r';
-
-comment_block
- '#' .and .loop comment_char .and new_line;
-
-/* All ASCII characters except '\r', '\n' and '\0' */
-comment_char
- '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
-
-new_line
- '\n' .or crlf .or '\0';
-
-crlf
- '\r' .and '\n';
-
-semicolon
- optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
-
-comma
- optional_space .and ',' .error MISSING_COMMA .and optional_space;
-
-comma_ne
- optional_space .and ',' .and optional_space;
-
-lbracket
- optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
-
-lbracket_ne
- optional_space .and '[' .and optional_space;
-
-rbracket
- optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
-
-dot
- optional_space .and '.' .error MISSING_DOT .and optional_space;
-
-dot_ne
- optional_space .and '.' .and optional_space;
-
-equal
- optional_space .and '=' .error MISSING_EQUAL .and optional_space;
-
-lbrace
- optional_space .and '{' .error MISSING_LBRACE .and optional_space;
-
-lbrace_ne
- optional_space .and '{' .and optional_space;
-
-rbrace
- optional_space .and '}' .error MISSING_RBRACE .and optional_space;
-
-dotdot
- optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
-
-dotdot_ne
- optional_space .and '.' .and '.' .and optional_space;
-
-/*
- The definition below accepts the following floating point number formats:
- .99 .99e99 99. 99.99 99.99e99 99.e99 99e99
- Also 99 format was considered and accepted because of a large number of existing program
- strings with such a format.
-*/
-float
- float_1 .or float_2 .or float_legacy;
-float_1
- '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
-float_2
- integer_ne .and float_3;
-float_3
- float_4 .or float_5;
-float_4
- '.' .and optional_integer .and optional_exponent;
-float_5
- exponent .emit 0x00;
-float_legacy
- integer_ne .and .true .emit 0x00 .emit 0x00;
-
-/*
- Below is a correct version of <float> definiton.
-*/
-/*
-float
- float_1 .or float_2;
-float_1
- '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
-float_2
- integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
-float_3
- float_4 .or float_5;
-float_4
- '.' .and optional_integer .and optional_exponent;
-float_5
- exponent .emit 0x00;
-*/
-
-integer_ne
- integer_ne_1 .and .true .emit 0x00 .emit $;
-integer_ne_1
- digit10 .emit * .and .loop digit10 .emit *;
-
-optional_integer
- integer_ne .or .true .emit 0x00;
-
-/*
-NOTE: If exponent part is omited we treat it as if it was "E+1".
-*/
-optional_exponent
- exponent .or .true .emit 0x00;
-
-exponent
- exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
-exponent_1
- 'e' .or 'E';
-
-optional_sign_ne
- minus_ne .or plus_ne .or .true;
-
-plus_ne
- optional_space .and '+' .and optional_space;
-
-minus_ne
- optional_space .and '-' .emit '-' .and optional_space;
-
-identifier_ne
- first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
-
-follow_idchar
- first_idchar .or digit10;
-
-first_idchar
- 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
-
-digit10
- '0'-'9';
-
-/*
- string filtering - if a string is encountered in grammar ("blabla"), the symbol below is
- executed to create the string. The symbol must not throw any errors and emit bytes - it should
- stop if it encounters invalid character. After this the resulting string (from starting
- position up to the invalid character (but without it) is compared with the grammar string.
-*/
-.string __string_filter;
-
-__string_filter
- .loop __identifier_char;
-
-__identifier_char
- 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
-
-/*
- error token filtering
-*/
-e_signature
- e_signature_char .and .loop e_signature_char;
-e_signature_char
- '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
-
-e_statement
- .loop e_statement_not_term;
-/* All ASCII characters to one of '\r', '\n', '\0' and ';' */
-e_statement_not_term
- '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
-
-e_identifier
- e_identifier_first .and .loop e_identifier_next;
-e_identifier_first
- 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
-e_identifier_next
- e_identifier_first .or '0'-'9';
-
-e_token
- e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
- '-' .or ',' .or ';';
-e_token_number
- e_token_digit .and .loop e_token_digit;
-e_token_digit
- '0'-'9';
-
-e_charordigit
- 'A'-'Z' .or 'a'-'z' .or '0'-'9';
-
diff --git a/src/mesa/shader/asmopcodes.reg b/src/mesa/shader/asmopcodes.reg
deleted file mode 100644
index efd8918f21f..00000000000
--- a/src/mesa/shader/asmopcodes.reg
+++ /dev/null
@@ -1,78 +0,0 @@
-/* */
-/* ARB program opcode registry */
-/* each instruction code has its own unique number */
-/* this registry exists to ensure that this relation retains */
-/* */
-
-/* GL_ARB_vertex_program */
-ABS 0x00
-ADD 0x01
-ARL 0x02
-DP3 0x03
-DP4 0x04
-DPH 0x05
-DST 0x06
-EX2 0x07
-EXP 0x08
-FLR 0x09
-FRC 0x0A
-LG2 0x0B
-LIT 0x0C
-LOG 0x0D
-MAD 0x0E
-MAX 0x0F
-MIN 0x10
-MOV 0x11
-MUL 0x12
-POW 0x13
-RCP 0x14
-RSQ 0x15
-SGE 0x16
-SLT 0x17
-SUB 0x18
-SWZ 0x19
-XPD 0x1A
-
-/* GL_ARB_fragment_program */
-ABS_SAT 0x1B
-ADD_SAT 0x1C
-CMP 0x1D
-CMP_SAT 0x1E
-COS 0x1F
-COS_SAT 0x20
-DP3_SAT 0x21
-DP4_SAT 0x22
-DPH_SAT 0x23
-DST_SAT 0x24
-EX2_SAT 0x25
-FLR_SAT 0x26
-FRC_SAT 0x27
-KIL 0x28
-LG2_SAT 0x29
-LIT_SAT 0x2A
-LRP 0x2B
-LRP_SAT 0x2C
-MAD_SAT 0x2D
-MAX_SAT 0x2E
-MIN_SAT 0x2F
-MOV_SAT 0x30
-MUL_SAT 0x31
-POW_SAT 0x32
-RCP_SAT 0x33
-RSQ_SAT 0x34
-SCS 0x35
-SCS_SAT 0x36
-SGE_SAT 0x37
-SIN 0x38
-SIN_SAT 0x39
-SLT_SAT 0x3A
-SUB_SAT 0x3B
-SWZ_SAT 0x3C
-TEX 0x3D
-TEX_SAT 0x3E
-TXB 0x3F
-TXB_SAT 0x40
-TXP 0x41
-TXP_SAT 0x42
-XPD_SAT 0x43
-
diff --git a/src/mesa/shader/grammar/grammar.syn b/src/mesa/shader/grammar/grammar.syn
deleted file mode 100644
index 5d99f65bfce..00000000000
--- a/src/mesa/shader/grammar/grammar.syn
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.2
- *
- * Copyright (C) 1999-2004 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 grammar.syn
- * syntax of .syn script - used to validate other syntax files
- * \author Michal Krol
- */
-
-.syntax grammar;
-
-/* declaration */
-.emtcode DECLARATION_END 0
-.emtcode DECLARATION_EMITCODE 1
-.emtcode DECLARATION_ERRORTEXT 2
-.emtcode DECLARATION_REGBYTE 3
-.emtcode DECLARATION_LEXER 4
-.emtcode DECLARATION_RULE 5
-
-/* specifier */
-.emtcode SPECIFIER_END 0
-.emtcode SPECIFIER_AND_TAG 1
-.emtcode SPECIFIER_OR_TAG 2
-.emtcode SPECIFIER_CHARACTER_RANGE 3
-.emtcode SPECIFIER_CHARACTER 4
-.emtcode SPECIFIER_STRING 5
-.emtcode SPECIFIER_IDENTIFIER 6
-.emtcode SPECIFIER_TRUE 7
-.emtcode SPECIFIER_FALSE 8
-.emtcode SPECIFIER_DEBUG 9
-
-/* identifier */
-.emtcode IDENTIFIER_SIMPLE 0
-.emtcode IDENTIFIER_LOOP 1
-
-/* error */
-.emtcode ERROR_NOT_PRESENT 0
-.emtcode ERROR_PRESENT 1
-
-/* emit */
-.emtcode EMIT_NULL 0
-.emtcode EMIT_INTEGER 1
-.emtcode EMIT_IDENTIFIER 2
-.emtcode EMIT_CHARACTER 3
-.emtcode EMIT_LAST_CHARACTER 4
-.emtcode EMIT_CURRENT_POSITION 5
-
-.errtext INVALID_GRAMMAR "internal error 2001: invalid grammar script"
-.errtext SYNTAX_EXPECTED "internal error 2002: '.syntax' keyword expected"
-.errtext IDENTIFIER_EXPECTED "internal error 2003: identifier expected"
-.errtext MISSING_SEMICOLON "internal error 2004: missing ';'"
-.errtext INTEGER_EXPECTED "internal error 2005: integer value expected"
-.errtext STRING_EXPECTED "internal error 2006: string expected"
-
-/*
- <grammar> ::= ".syntax" <identifier> ";" <declaration_list>
-*/
-grammar
- grammar_1 .error INVALID_GRAMMAR;
-grammar_1
- optional_space .and ".syntax" .error SYNTAX_EXPECTED .and space .and identifier .and
- semicolon .and declaration_list .and optional_space .and '\0' .emit DECLARATION_END;
-
-/*
- <optional_space> ::= <space>
- | ""
-*/
-optional_space
- space .or .true;
-
-/*
- <space> ::= <single_space> <single_space>*
-*/
-space
- single_space .and .loop single_space;
-
-/*
- <single_space> ::= <white_char>
- | <comment_block>
-*/
-single_space
- white_char .or comment_block;
-
-/*
- <white_char> ::= " "
- | "\t"
- | "\n"
- | "\r"
-*/
-white_char
- ' ' .or '\t' .or '\n' .or '\r';
-
-/*
- <comment_block> ::= "/" "*" <comment_rest>
-*/
-comment_block
- '/' .and '*' .and comment_rest;
-
-/*
- <comment_rest> ::= <comment_char_no_star>* <comment_end>
- | <comment_char_no_star>* "*" <comment_rest>
-*/
-comment_rest
- .loop comment_char_no_star .and comment_rest_1;
-comment_rest_1
- comment_end .or comment_rest_2;
-comment_rest_2
- '*' .and comment_rest;
-
-/*
- <comment_char_no_star> ::= All ASCII characters except "*" and "\0"
-*/
-comment_char_no_star
- '\x2B'-'\xFF' .or '\x01'-'\x29';
-
-/*
- <comment_end> ::= "*" "/"
-*/
-comment_end
- '*' .and '/';
-
-/*
- <identifier> ::= <identifier>
-*/
-identifier
- identifier_ne .error IDENTIFIER_EXPECTED;
-
-/*
- <identifier_ne> ::= <first_idchar> <follow_idchar>*
-*/
-identifier_ne
- first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit '\0';
-
-/*
- <first_idchar> ::= "a"-"z"
- | "A"-"Z"
- | "_"
-*/
-first_idchar
- 'a'-'z' .or 'A'-'Z' .or '_';
-
-/*
- <follow_idchar> ::= <first_idchar>
- | <digit_dec>
-*/
-follow_idchar
- first_idchar .or digit_dec;
-
-/*
- <digit_dec> ::= "0"-"9"
-*/
-digit_dec
- '0'-'9';
-
-/*
- <semicolon> ::= ";"
-*/
-semicolon
- optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
-
-/*
- <declaration_list> ::= <declaration>
- | <declaration_list> <declaration>
-*/
-declaration_list
- declaration .and .loop declaration;
-
-/*
- <declaration> ::= <emitcode_definition>
- | <errortext_definition>
- | <lexer_definition>
- | <rule_definition>
-*/
-declaration
- emitcode_definition .emit DECLARATION_EMITCODE .or
- errortext_definition .emit DECLARATION_ERRORTEXT .or
- regbyte_definition .emit DECLARATION_REGBYTE .or
- lexer_definition .emit DECLARATION_LEXER .or
- rule_definition .emit DECLARATION_RULE;
-
-/*
- <emitcode_definition> ::= ".emtcode" <identifier> <integer>
-*/
-emitcode_definition
- ".emtcode" .and space .and identifier .and space .and integer .and space_or_null;
-
-/*
- <integer> ::= <integer_ne>
-*/
-integer
- integer_ne .error INTEGER_EXPECTED;
-
-/*
- <integer_ne> ::= <hex_integer>
- | <dec_integer>
-*/
-integer_ne
- hex_integer .emit 0x10 .or dec_integer .emit 10;
-
-/*
- <hex_integer> :: <hex_prefix> <digit_hex> <digit_hex>*
-*/
-hex_integer
- hex_prefix .and digit_hex .emit * .and .loop digit_hex .emit * .and .true .emit '\0';
-
-/*
- <hex_prefix> ::= "0x"
- | "0X"
-*/
-hex_prefix
- '0' .and hex_prefix_1;
-hex_prefix_1
- 'x' .or 'X';
-
-/*
- <digit_hex> ::= "0"-"9"
- | "a"-"f"
- | "A"-"F"
-*/
-digit_hex
- '0'-'9' .or 'a'-'f' .or 'A'-'F';
-
-/*
- <dec_integer> :: <digit_dec> <digit_dec>*
-*/
-dec_integer
- digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
-
-/*
- <space_or_null> ::= <space>
- | "\0"
-*/
-space_or_null
- space .or '\0';
-
-/*
- <errortext_definition> ::= ".errtext" <identifier> <string>
-*/
-errortext_definition
- ".errtext" .and space .and identifier .and space .and string .and space_or_null;
-
-/*
- <string> ::= <string_ne>
-*/
-string
- string_ne .error STRING_EXPECTED;
-
-/*
- <string_ne> ::= "\"" <string_char_double_quotes> "\""
-*/
-string_ne
- '"' .and .loop string_char_double_quotes .and '"' .emit '\0';
-
-/*
- <string_char_double_quotes> ::= <escape_sequence>
- | <string_char>
- | "\'"
-*/
-string_char_double_quotes
- escape_sequence .or string_char .emit * .or '\'' .emit *;
-
-/*
- <string_char> ::= All ASCII characters except "\'", "\"", "\n", "\r",
- "\0" and "\\"
-*/
-string_char
- '\x5D'-'\xFF' .or '\x28'-'\x5B' .or '\x23'-'\x26' .or '\x0E'-'\x21' .or '\x0B'-'\x0C' .or
- '\x01'-'\x09';
-
-/*
- <escape_sequence> ::= "\\" <escape_code>
-*/
-escape_sequence
- '\\' .emit * .and escape_code;
-
-/*
- <escape_code> ::= <simple_escape_code>
- | <hex_escape_code>
- | <oct_escape_code>
-*/
-escape_code
- simple_escape_code .emit * .or hex_escape_code .or oct_escape_code;
-
-/*
- <simple_escape_code> ::= "\'"
- | "\""
- | "?"
- | "\\"
- | "a"
- | "b"
- | "f"
- | "n"
- | "r"
- | "t"
- | "v"
-*/
-simple_escape_code
- '\'' .or '"' .or '?' .or '\\' .or 'a' .or 'b' .or 'f' .or 'n' .or 'r' .or 't' .or 'v';
-
-/*
- <hex_escape_code> ::= "x" <digit_hex> <digit_hex>*
-*/
-hex_escape_code
- 'x' .emit * .and digit_hex .emit * .and .loop digit_hex .emit *;
-
-/*
- <oct_escape_code> ::= <digit_oct> <optional_digit_oct> <optional_digit_oct>
-*/
-oct_escape_code
- digit_oct .emit * .and optional_digit_oct .and optional_digit_oct;
-
-/*
- <digit_oct> ::= "0"-"7"
-*/
-digit_oct
- '0'-'7';
-
-/*
- <optional_digit_oct> ::= <digit_oct>
- | ""
-*/
-optional_digit_oct
- digit_oct .emit * .or .true;
-
-/*
- <regbyte_definition> ::= ".regbyte" <identifier> <integer>
-*/
-regbyte_definition
- ".regbyte" .and space .and identifier .and space .and integer .and space_or_null;
-
-/*
- <lexer_definition> ::= ".string" <identifier> ";"
-*/
-lexer_definition
- ".string" .and space .and identifier .and semicolon;
-
-/*
- <rule_definition> ::= <identifier_ne> <definition>
-*/
-rule_definition
- identifier_ne .and space .and definition;
-
-/*
- <definition> ::= <specifier> <optional_specifiers_and_or> ";"
-*/
-definition
- specifier .and optional_specifiers_and_or .and semicolon .emit SPECIFIER_END;
-
-/*
- <optional_specifiers_and_or> ::= <and_specifiers>
- | <or_specifiers>
- | ""
-*/
-optional_specifiers_and_or
- and_specifiers .emit SPECIFIER_AND_TAG .or or_specifiers .emit SPECIFIER_OR_TAG .or .true;
-
-/*
- <specifier> ::= <specifier_condition> <specifier_rule>
-*/
-specifier
- specifier_condition .and optional_space .and specifier_rule;
-
-/*
- <specifier_condition> ::= ".if" "(" <left_operand> <operator> <right_operand> ")"
-*/
-specifier_condition
- specifier_condition_1 .or .true;
-specifier_condition_1
- ".if" .and optional_space .and '(' .and optional_space .and left_operand .and operator .and
- right_operand .and optional_space .and ')';
-
-/*
- <left_operand> ::= <identifier>
-*/
-left_operand
- identifier;
-
-/*
- <operator> ::= "!="
- | "=="
-*/
-operator
- operator_1 .or operator_2;
-operator_1
- optional_space .and '!' .and '=' .and optional_space;
-operator_2
- optional_space .and '=' .and '=' .and optional_space;
-
-/*
- <right_operand> ::= <integer>
-*/
-right_operand
- integer;
-
-/*
- <specifier_rule> ::= <character_range> <optional_error> <emit>*
- | <character> <optional_error> <emit>*
- | <string> <optional_error> <emit>*
- | ".true" <optional_error> <emit>*
- | ".false" <optional_error> <emit>*
- | ".debug" <optional_error> <emit>*
- | <advanced_identifier> <optional_error> <emit>*
-*/
-specifier_rule
- specifier_rule_1 .and optional_error .and .loop emit .and .true .emit EMIT_NULL;
-specifier_rule_1
- character_range .emit SPECIFIER_CHARACTER_RANGE .or
- character .emit SPECIFIER_CHARACTER .or
- string_ne .emit SPECIFIER_STRING .or
- ".true" .emit SPECIFIER_TRUE .or
- ".false" .emit SPECIFIER_FALSE .or
- ".debug" .emit SPECIFIER_DEBUG .or
- advanced_identifier .emit SPECIFIER_IDENTIFIER;
-
-/*
- <character> ::= "\'" <string_char_single_quotes "\'"
-*/
-character
- '\'' .and string_char_single_quotes .and '\'' .emit '\0';
-
-/*
- <string_char_single_quotes> ::= <escape_sequence>
- | <string_char>
- | "\""
-*/
-string_char_single_quotes
- escape_sequence .or string_char .emit * .or '"' .emit *;
-
-/*
- <character_range> ::= <character> "-" <character>
-*/
-character_range
- character .and optional_space .and '-' .and optional_space .and character;
-
-/*
- <advanced_identifier> ::= <optional_loop> <identifier>
-*/
-advanced_identifier
- optional_loop .and identifier;
-
-/*
- <optional_loop> ::= ".loop"
- | ""
-*/
-optional_loop
- optional_loop_1 .emit IDENTIFIER_LOOP .or .true .emit IDENTIFIER_SIMPLE;
-optional_loop_1
- ".loop" .and space;
-
-/*
- <optional_error> ::= <error>
- | ""
-*/
-optional_error
- error .emit ERROR_PRESENT .or .true .emit ERROR_NOT_PRESENT;
-
-/*
- <error> :: ".error" <identifier>
-*/
-error
- space .and ".error" .and space .and identifier;
-
-/*
- <emit> ::= <emit_output>
- | <emit_regbyte>
-*/
-emit
- emit_output .or emit_regbyte;
-
-/*
- <emit_output> ::= ".emit" <emit_param>
-*/
-emit_output
- space .and ".emit" .and space .and emit_param;
-
-/*
- <emit_param> ::= <integer>
- | <identifier>
- | <character>
- | "*"
- | "$"
-*/
-emit_param
- integer_ne .emit EMIT_INTEGER .or
- identifier_ne .emit EMIT_IDENTIFIER .or
- character .emit EMIT_CHARACTER .or
- '*' .emit EMIT_LAST_CHARACTER .or
- '$' .emit EMIT_CURRENT_POSITION;
-
-/*
- <emit_regbyte> ::= ".load" <identifier> <emit_param>
-*/
-emit_regbyte
- space .and ".load" .and space .and identifier .and space .and emit_param;
-
-/*
- <and_specifiers> ::= <and_specifier> <and_specifier>*
-*/
-and_specifiers
- and_specifier .and .loop and_specifier;
-
-/*
- <or_specifiers> ::= <or_specifier> <or_specifier>*
-*/
-or_specifiers
- or_specifier .and .loop or_specifier;
-
-/*
- <and_specifier> ::= ".and" <specifier>
-*/
-and_specifier
- space .and ".and" .and space .and specifier;
-
-/*
- <or_specifier> ::= ".or" <specifier>
-*/
-or_specifier
- space .and ".or" .and space .and specifier;
-
-
-.string __string_filter;
-
-/*
- <__string_filter> ::= <__first_identifier_char> <__next_identifier_char>*
-*/
-__string_filter
- __first_identifier_char .and .loop __next_identifier_char;
-
-/*
- <__first_identifier_char> ::= "a"-"z"
- | "A"-"Z"
- | "_"
- | "."
-*/
-__first_identifier_char
- 'a'-'z' .or 'A'-'Z' .or '_' .or '.';
-
-/*
- <__next_identifier_char> ::= "a"-"z"
- | "A"-"Z"
- | "_"
- | "0"-"9"
-*/
-__next_identifier_char
- 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';
-
diff --git a/src/mesa/shader/slang/Include/BaseTypes.h b/src/mesa/shader/slang/Include/BaseTypes.h
deleted file mode 100755
index c5bf8de17fe..00000000000
--- a/src/mesa/shader/slang/Include/BaseTypes.h
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _BASICTYPES_INCLUDED_
-#define _BASICTYPES_INCLUDED_
-
-//
-// Basic type. Arrays, vectors, etc., are orthogonal to this.
-//
-enum TBasicType {
- EbtVoid,
- EbtFloat,
- EbtInt,
- EbtBool,
- EbtSampler1D,
- EbtSampler2D,
- EbtSampler3D,
- EbtSamplerCube,
- EbtSampler1DShadow,
- EbtSampler2DShadow,
- EbtStruct,
- EbtAddress
-};
-
-__inline bool IsSampler(TBasicType type)
-{
- return type >= EbtSampler1D && type <= EbtSampler2DShadow;
-}
-
-//
-// Qualifiers and built-ins. These are mainly used to see what can be read
-// or written, and by the machine dependent translator to know which registers
-// to allocate variables in. Since built-ins tend to go to different registers
-// than varying or uniform, it makes sense they are peers, not sub-classes.
-//
-enum TQualifier {
- EvqTemporary, // For temporaries (within a function), read/write
- EvqGlobal, // For globals read/write
- EvqConst, // User defined constants and non-output parameters in functions
- EvqAttribute, // Readonly
- EvqVaryingIn, // readonly, fragment shaders only
- EvqVaryingOut, // vertex shaders only read/write
- EvqUniform, // Readonly, vertex and fragment
-
- // pack/unpack input and output
- EvqInput,
- EvqOutput,
-
- // parameters
- EvqIn,
- EvqOut,
- EvqInOut,
- EvqConstReadOnly,
-
- // built-ins written by vertex shader
- EvqPosition,
- EvqPointSize,
- EvqClipVertex,
-
- // built-ins read by fragment shader
- EvqFace,
- EvqFragCoord,
-
- // built-ins written by fragment shader
- EvqFragColor,
- EvqFragDepth,
-
- // end of list
- EvqLast
-};
-
-//
-// This is just for debug print out, carried along with the definitions above.
-//
-__inline const char* getQualifierString(TQualifier q)
-{
- switch (q) {
- case EvqTemporary: return "Temporary"; break;
- case EvqGlobal: return "Global"; break;
- case EvqConst: return "const"; break;
- case EvqConstReadOnly: return "const"; break;
- case EvqAttribute: return "attribute"; break;
- case EvqVaryingIn: return "varying"; break;
- case EvqVaryingOut: return "varying"; break;
- case EvqUniform: return "uniform"; break;
- case EvqIn: return "in"; break;
- case EvqOut: return "out"; break;
- case EvqInOut: return "inout"; break;
- case EvqInput: return "input"; break;
- case EvqOutput: return "output"; break;
- case EvqPosition: return "Position"; break;
- case EvqPointSize: return "PointSize"; break;
- case EvqClipVertex: return "ClipVertex"; break;
- case EvqFace: return "Face"; break;
- case EvqFragCoord: return "FragCoord"; break;
- case EvqFragColor: return "FragColor"; break;
- case EvqFragDepth: return "FragDepth"; break;
- default: return "unknown qualifier";
- }
-}
-
-#endif // _BASICTYPES_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/Common.h b/src/mesa/shader/slang/Include/Common.h
deleted file mode 100755
index 4a9c0d34a74..00000000000
--- a/src/mesa/shader/slang/Include/Common.h
+++ /dev/null
@@ -1,288 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _COMMON_INCLUDED_
-#define _COMMON_INCLUDED_
-
-#ifdef _WIN32
- #include <basetsd.h>
-#elif defined (solaris)
- #include <sys/int_types.h>
- #define UINT_PTR uintptr_t
-#else
- #include <stdint.h>
- #define UINT_PTR uintptr_t
-#endif
-
-/* windows only pragma */
-#ifdef _MSC_VER
- #pragma warning(disable : 4786) // Don't warn about too long identifiers
- #pragma warning(disable : 4514) // unused inline method
- #pragma warning(disable : 4201) // nameless union
-#endif
-
-//
-// Doing the push and pop below for warnings does not leave the warning state
-// the way it was. This seems like a defect in the compiler. We would like
-// to do this, but since it does not work correctly right now, it is turned
-// off.
-//
-//??#pragma warning(push, 3)
-
- #include <set>
- #include <vector>
- #include <map>
- #include <list>
- #include <string>
- #include <stdio.h>
-
-//??#pragma warning(pop)
-
-typedef int TSourceLoc;
-
-#include <assert.h>
-#include "PoolAlloc.h"
-
-//
-// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
-//
-#define POOL_ALLOCATOR_NEW_DELETE(A) \
- void* operator new(size_t s) { return (A).allocate(s); } \
- void* operator new(size_t, void *_Where) { return (_Where); } \
- void operator delete(void*) { } \
- void operator delete(void *, void *) { } \
- void* operator new[](size_t s) { return (A).allocate(s); } \
- void* operator new[](size_t, void *_Where) { return (_Where); } \
- void operator delete[](void*) { } \
- void operator delete[](void *, void *) { }
-
-#ifdef _M_AMD64
-//
-// The current version of STL that comes with the PSDK (as required for the AMD64 compiler)
-// has a very old version of the STL which is very out of date. As a result, various additions needed
-// making to it to get the compilers compiling!
-//
-
-//
-// A new version of the Map template class - the operator[] now returns the correct type reference
-//
-template <class _K, class _Ty, class _Pr = std::less<_K>, class _A = std::allocator<_Ty> >
-class TBaseMap : public std::map <_K, _Ty, _Pr, _A >
-{
-public :
- _Ty& operator[] (const _K& _Kv)
- {
- iterator _P = insert(value_type(_Kv, _Ty())).first;
- return ((*_P).second);
- }
-
- explicit TBaseMap(const _Pr& _Pred = _Pr(), const _A& _Al = _A())
- : std::map<_K, _Ty, _Pr, _A >(_Pred, _Al) {};
-
-
-};
-
-//
-// A new version of the List template class - the begin function now checks for NULL to eliminate access violations
-//
-template <class _Ty, class _A = std::allocator<_Ty> >
-class TBaseList : public std::list <_Ty, _A >
-{
-public :
- iterator begin()
- {
- return (iterator(_Head == 0 ? 0 : _Acc::_Next(_Head)));
- }
-
- const_iterator begin() const
- {
- return (const_iterator(_Head == 0 ? 0 : _Acc::_Next(_Head)));
- }
-
- //
- // These are required - apparently!
- //
- explicit TBaseList(const _A& _Al = _A())
- : std::list<_Ty, _A >(_Al) {};
- explicit TBaseList(size_type _N, const _Ty& _V = _Ty(), const _A& _Al = _A())
- : std::list<_Ty, _A >(N, _V, _Al) {};
-
-};
-
-//
-// A new version of the set class - this defines the required insert method
-//
-template<class _K, class _Pr = std::less<_K>, class _A = std::allocator<_K> >
-class TBaseSet : public std::set <_K, _Pr, _A>
-{
-public :
-
- //
- // This method wasn't defined
- //
- template<class _Iter>
- void insert(_Iter _First, _Iter _Last)
- { // insert [_First, _Last)
- for (; _First != _Last; ++_First)
- this->insert(*_First);
- }
-
- //
- // These methods were not resolved if I declared the previous method??
- //
- _Pairib insert(const value_type& _X)
- {
- _Imp::_Pairib _Ans = _Tr.insert(_X);
- return (_Pairib(_Ans.first, _Ans.second));
- }
-
- iterator insert(iterator _P, const value_type& _X)
- {
- return (_Tr.insert((_Imp::iterator&)_P, _X));
- }
-
- void insert(_It _F, _It _L)
- {
- for (; _F != _L; ++_F)
- _Tr.insert(*_F);
- }
-
-};
-
-#else
-
-#define TBaseMap std::map
-#define TBaseList std::list
-#define TBaseSet std::set
-
-#endif //_M_AMD64
-
-//
-// Pool version of string.
-//
-typedef pool_allocator<char> TStringAllocator;
-typedef std::basic_string <char, std::char_traits<char>, TStringAllocator > TString;
-inline TString* NewPoolTString(const char* s)
-{
- void* memory = GlobalPoolAllocator.allocate(sizeof(TString));
- return new(memory) TString(s);
-}
-
-//
-// Pool allocator versions of vectors, lists, and maps
-//
-template <class T> class TVector : public std::vector<T, pool_allocator<T> > {
-public:
- typedef typename std::vector<T, pool_allocator<T> >::size_type size_type;
- TVector() : std::vector<T, pool_allocator<T> >() {}
- TVector(const pool_allocator<T>& a) : std::vector<T, pool_allocator<T> >(a) {}
- TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {}
-};
-
-template <class T> class TList : public TBaseList <T, pool_allocator<T> > {
-public:
- typedef typename TBaseList<T, pool_allocator<T> >::size_type size_type;
- TList() : TBaseList<T, pool_allocator<T> >() {}
- TList(const pool_allocator<T>& a) : TBaseList<T, pool_allocator<T> >(a) {}
- TList(size_type i): TBaseList<T, pool_allocator<T> >(i) {}
-};
-
-// This is called TStlSet, because TSet is taken by an existing compiler class.
-template <class T, class CMP> class TStlSet : public std::set<T, CMP, pool_allocator<T> > {
- // No pool allocator versions of constructors in std::set.
-};
-
-
-template <class K, class D, class CMP = std::less<K> > class TMap :
- public TBaseMap<K, D, CMP, pool_allocator<std::pair<K, D> > > {
-public:
- typedef pool_allocator<std::pair <K, D> > tAllocator;
-
- TMap() : TBaseMap<K, D, CMP, tAllocator >() {}
-/*
- TMap(const tAllocator& a) : TBaseMap<K, D, CMP, tAllocator >(key_compare(), a) {}
-*/
- TMap(const tAllocator& a) : TBaseMap<K, D, CMP, tAllocator >() {}
-};
-
-//
-// Persistent string memory. Should only be used for strings that survive
-// across compiles/links.
-//
-typedef std::basic_string<char> TPersistString;
-
-//
-// templatized min and max functions.
-//
-template <class T> T Min(const T a, const T b) { return a < b ? a : b; }
-template <class T> T Max(const T a, const T b) { return a > b ? a : b; }
-
-//
-// Create a TString object from an integer.
-//
-inline const TString String(const int i, const int base = 10)
-{
- char text[16]; // 32 bit ints are at most 10 digits in base 10
-
- #ifdef _WIN32
- itoa(i, text, base);
- #else
- // we assume base 10 for all cases
- sprintf(text, "%d", i);
- #endif
-
- return text;
-}
-
-const unsigned int SourceLocLineMask = 0xffff;
-const unsigned int SourceLocStringShift = 16;
-
-__inline TPersistString FormatSourceLoc(const TSourceLoc loc)
-{
- char locText[64];
-
- int string = loc >> SourceLocStringShift;
- int line = loc & SourceLocLineMask;
-
- if (line)
- sprintf(locText, "%d:%d", string, line);
- else
- sprintf(locText, "%d:? ", string);
-
- return TPersistString(locText);
-}
-typedef TMap<TString, TString> TPragmaTable;
-typedef TMap<TString, TString>::tAllocator TPragmaTableAllocator;
-
-#endif // _COMMON_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/ConstantUnion.h b/src/mesa/shader/slang/Include/ConstantUnion.h
deleted file mode 100755
index a60ae114f68..00000000000
--- a/src/mesa/shader/slang/Include/ConstantUnion.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _CONSTANT_UNION_INCLUDED_
-#define _CONSTANT_UNION_INCLUDED_
-
-
-class constUnion {
-public:
-
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- union {
- int iConst; // used for ivec
- bool bConst; // used for bvec
- float fConst; // used for vec, mat
- } ;
-};
-
-#endif // _CONSTANT_UNION_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/InfoSink.h b/src/mesa/shader/slang/Include/InfoSink.h
deleted file mode 100755
index 14d44a34adc..00000000000
--- a/src/mesa/shader/slang/Include/InfoSink.h
+++ /dev/null
@@ -1,135 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _INFOSINK_INCLUDED_
-#define _INFOSINK_INCLUDED_
-
-#include "../Include/Common.h"
-#include <math.h>
-
-//
-// TPrefixType is used to centralize how info log messages start.
-// See below.
-//
-enum TPrefixType {
- EPrefixNone,
- EPrefixWarning,
- EPrefixError,
- EPrefixInternalError,
- EPrefixUnimplemented
-};
-
-enum TOutputStream {
- ENull = 0,
- EDebugger = 0x01,
- EStdOut = 0x02,
- EString = 0x04
-};
-//
-// Encapsulate info logs for all objects that have them.
-//
-// The methods are a general set of tools for getting a variety of
-// messages and types inserted into the log.
-//
-class TInfoSinkBase {
-public:
- TInfoSinkBase() : outputStream(4) {}
- void erase() { sink.erase(); }
- TInfoSinkBase& operator<<(const TPersistString& t) { append(t); return *this; }
- TInfoSinkBase& operator<<(char c) { append(1, c); return *this; }
- TInfoSinkBase& operator<<(const char* s) { append(s); return *this; }
- TInfoSinkBase& operator<<(int n) { append(String(n)); return *this; }
- TInfoSinkBase& operator<<(const unsigned int n) { append(String(n)); return *this; }
- TInfoSinkBase& operator<<(float n) { char buf[40];
- sprintf(buf, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ?
- "%f" : "%g", n);
- append(buf);
- return *this; }
- TInfoSinkBase& operator+(const TPersistString& t) { append(t); return *this; }
- TInfoSinkBase& operator+(const TString& t) { append(t); return *this; }
- TInfoSinkBase& operator<<(const TString& t) { append(t); return *this; }
- TInfoSinkBase& operator+(const char* s) { append(s); return *this; }
- const char* c_str() const { return sink.c_str(); }
- void prefix(TPrefixType message) {
- switch(message) {
- case EPrefixNone: break;
- case EPrefixWarning: append("WARNING: "); break;
- case EPrefixError: append("ERROR: "); break;
- case EPrefixInternalError: append("INTERNAL ERROR: "); break;
- case EPrefixUnimplemented: append("UNIMPLEMENTED: "); break;
- default: append("UNKOWN ERROR: "); break;
- }
- }
- void location(TSourceLoc loc) {
- append(FormatSourceLoc(loc).c_str());
- append(": ");
- }
- void message(TPrefixType message, const char* s) {
- prefix(message);
- append(s);
- append("\n");
- }
- void message(TPrefixType message, const char* s, TSourceLoc loc) {
- prefix(message);
- location(loc);
- append(s);
- append("\n");
- }
-
- void setOutputStream(int output = 4)
- {
- outputStream = output;
- }
-
-protected:
- void append(const char *s);
-
- void append(int count, char c);
- void append(const TPersistString& t);
- void append(const TString& t);
-
- void checkMem(size_t growth) { if (sink.capacity() < sink.size() + growth + 2)
- sink.reserve(sink.capacity() + sink.capacity() / 2); }
- void appendToStream(const char* s);
- TPersistString sink;
- int outputStream;
-};
-
-class TInfoSink {
-public:
- TInfoSinkBase info;
- TInfoSinkBase debug;
-};
-
-#endif // _INFOSINK_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/InitializeGlobals.h b/src/mesa/shader/slang/Include/InitializeGlobals.h
deleted file mode 100755
index 3d9a42a2b5f..00000000000
--- a/src/mesa/shader/slang/Include/InitializeGlobals.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef __INITIALIZE_GLOBALS_INCLUDED_
-#define __INITIALIZE_GLOBALS_INCLUDED_
-
-void InitializeGlobalPools();
-void FreeGlobalPools();
-bool InitializePoolIndex();
-void FreePoolIndex();
-
-#endif // __INITIALIZE_GLOBALS_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/InitializeParseContext.h b/src/mesa/shader/slang/Include/InitializeParseContext.h
deleted file mode 100755
index 7d565b31321..00000000000
--- a/src/mesa/shader/slang/Include/InitializeParseContext.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef __INITIALIZE_PARSE_CONTEXT_INCLUDED_
-#define __INITIALIZE_PARSE_CONTEXT_INCLUDED_
-#include "osinclude.h"
-
-bool InitializeParseContextIndex();
-bool InitializeGlobalParseContext();
-bool FreeParseContext();
-bool FreeParseContextIndex();
-
-#endif // __INITIALIZE_PARSE_CONTEXT_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/PoolAlloc.h b/src/mesa/shader/slang/Include/PoolAlloc.h
deleted file mode 100755
index e224d3b8676..00000000000
--- a/src/mesa/shader/slang/Include/PoolAlloc.h
+++ /dev/null
@@ -1,346 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _POOLALLOC_INCLUDED_
-#define _POOLALLOC_INCLUDED_
-
-#ifdef _DEBUG
-# define GUARD_BLOCKS // define to enable guard block sanity checking
-#endif
-
-//
-// This header defines an allocator that can be used to efficiently
-// allocate a large number of small requests for heap memory, with the
-// intention that they are not individually deallocated, but rather
-// collectively deallocated at one time.
-//
-// This simultaneously
-//
-// * Makes each individual allocation much more efficient; the
-// typical allocation is trivial.
-// * Completely avoids the cost of doing individual deallocation.
-// * Saves the trouble of tracking down and plugging a large class of leaks.
-//
-// Individual classes can use this allocator by supplying their own
-// new and delete methods.
-//
-// STL containers can use this allocator by using the pool_allocator
-// class as the allocator (second) template argument.
-//
-
-#include <stddef.h>
-#include <vector>
-
-// If we are using guard blocks, we must track each indivual
-// allocation. If we aren't using guard blocks, these
-// never get instantiated, so won't have any impact.
-//
-
-class TAllocation {
-public:
- TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) :
- size(size), mem(mem), prevAlloc(prev) {
- // Allocations are bracketed:
- // [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
- // This would be cleaner with if (guardBlockSize)..., but that
- // makes the compiler print warnings about 0 length memsets,
- // even with the if() protecting them.
-# ifdef GUARD_BLOCKS
- memset(preGuard(), guardBlockBeginVal, guardBlockSize);
- memset(data(), userDataFill, size);
- memset(postGuard(), guardBlockEndVal, guardBlockSize);
-# endif
- }
-
- void check() const {
- checkGuardBlock(preGuard(), guardBlockBeginVal, "before");
- checkGuardBlock(postGuard(), guardBlockEndVal, "after");
- }
-
- void checkAllocList() const;
-
- // Return total size needed to accomodate user buffer of 'size',
- // plus our tracking data.
- inline static size_t allocationSize(size_t size) {
- return size + 2 * guardBlockSize + headerSize();
- }
-
- // Offset from surrounding buffer to get to user data buffer.
- inline static unsigned char* offsetAllocation(unsigned char* m) {
- return m + guardBlockSize + headerSize();
- }
-
-private:
- void checkGuardBlock(unsigned char* blockMem, unsigned char val, char* locText) const;
-
- // Find offsets to pre and post guard blocks, and user data buffer
- unsigned char* preGuard() const { return mem + headerSize(); }
- unsigned char* data() const { return preGuard() + guardBlockSize; }
- unsigned char* postGuard() const { return data() + size; }
-
- size_t size; // size of the user data area
- unsigned char* mem; // beginning of our allocation (pts to header)
- TAllocation* prevAlloc; // prior allocation in the chain
-
- // Support MSVC++ 6.0
- const static unsigned char guardBlockBeginVal;
- const static unsigned char guardBlockEndVal;
- const static unsigned char userDataFill;
-
-# ifdef GUARD_BLOCKS
- const static size_t guardBlockSize;
- inline static size_t headerSize() { return sizeof(TAllocation); }
-# else
- const static size_t guardBlockSize;
- inline static size_t headerSize() { return 0; }
-# endif
-};
-
-//
-// There are several stacks. One is to track the pushing and popping
-// of the user, and not yet implemented. The others are simply a
-// repositories of free pages or used pages.
-//
-// Page stacks are linked together with a simple header at the beginning
-// of each allocation obtained from the underlying OS. Multi-page allocations
-// are returned to the OS. Individual page allocations are kept for future
-// re-use.
-//
-// The "page size" used is not, nor must it match, the underlying OS
-// page size. But, having it be about that size or equal to a set of
-// pages is likely most optimal.
-//
-class TPoolAllocator {
-public:
- TPoolAllocator(bool global = false, int growthIncrement = 8*1024, int allocationAlignment = 16);
-
- //
- // Don't call the destructor just to free up the memory, call pop()
- //
- ~TPoolAllocator();
-
- //
- // Call push() to establish a new place to pop memory too. Does not
- // have to be called to get things started.
- //
- void push();
-
- //
- // Call pop() to free all memory allocated since the last call to push(),
- // or if no last call to push, frees all memory since first allocation.
- //
- void pop();
-
- //
- // Call popAll() to free all memory allocated.
- //
- void popAll();
-
- //
- // Call allocate() to actually acquire memory. Returns 0 if no memory
- // available, otherwise a properly aligned pointer to 'numBytes' of memory.
- //
- void* allocate(size_t numBytes);
-
- //
- // There is no deallocate. The point of this class is that
- // deallocation can be skipped by the user of it, as the model
- // of use is to simultaneously deallocate everything at once
- // by calling pop(), and to not have to solve memory leak problems.
- //
-
-protected:
- friend struct tHeader;
-
- struct tHeader {
- tHeader(tHeader* nextPage, size_t pageCount) :
-#ifdef GUARD_BLOCKS
- lastAllocation(0),
-#endif
- nextPage(nextPage), pageCount(pageCount) { }
-
- ~tHeader() {
-#ifdef GUARD_BLOCKS
- if (lastAllocation)
- lastAllocation->checkAllocList();
-#endif
- }
-
- tHeader* nextPage;
- size_t pageCount;
-#ifdef GUARD_BLOCKS
- TAllocation* lastAllocation;
-#endif
- };
-
- struct tAllocState {
- size_t offset;
- tHeader* page;
- };
- typedef std::vector<tAllocState> tAllocStack;
-
- // Track allocations if and only if we're using guard blocks
- void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) {
-# ifdef GUARD_BLOCKS
- new(memory) TAllocation(numBytes, memory, block->lastAllocation);
- block->lastAllocation = reinterpret_cast<TAllocation*>(memory);
-# endif
-
- // This is optimized entirely away if GUARD_BLOCKS is not defined.
- return TAllocation::offsetAllocation(memory);
- }
-
- bool global; // should be true if this object is globally scoped
- size_t pageSize; // granularity of allocation from the OS
- size_t alignment; // all returned allocations will be aligned at
- // this granularity, which will be a power of 2
- size_t alignmentMask;
- size_t headerSkip; // amount of memory to skip to make room for the
- // header (basically, size of header, rounded
- // up to make it aligned
- size_t currentPageOffset; // next offset in top of inUseList to allocate from
- tHeader* freeList; // list of popped memory
- tHeader* inUseList; // list of all memory currently being used
- tAllocStack stack; // stack of where to allocate from, to partition pool
-
- int numCalls; // just an interesting statistic
- size_t totalBytes; // just an interesting statistic
-private:
- TPoolAllocator& operator=(const TPoolAllocator&); // dont allow assignment operator
- TPoolAllocator(const TPoolAllocator&); // dont allow default copy constructor
-};
-
-
-//
-// There could potentially be many pools with pops happening at
-// different times. But a simple use is to have a global pop
-// with everyone using the same global allocator.
-//
-typedef TPoolAllocator* PoolAllocatorPointer;
-extern TPoolAllocator& GetGlobalPoolAllocator();
-#define GlobalPoolAllocator GetGlobalPoolAllocator()
-struct TThreadGlobalPools
-{
- TPoolAllocator* globalPoolAllocator;
-};
-
-//
-// This STL compatible allocator is intended to be used as the allocator
-// parameter to templatized STL containers, like vector and map.
-//
-// It will use the pools for allocation, and not
-// do any deallocation, but will still do destruction.
-//
-template<class T>
-class pool_allocator {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T *pointer;
- typedef const T *const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T value_type;
- template<class Other>
- struct rebind {
- typedef pool_allocator<Other> other;
- };
- pointer address(reference x) const { return &x; }
- const_pointer address(const_reference x) const { return &x; }
-
-#ifdef USING_SGI_STL
- pool_allocator() { }
-#else
- pool_allocator() : allocator(GlobalPoolAllocator) { }
- pool_allocator(TPoolAllocator& a) : allocator(a) { }
- pool_allocator(const pool_allocator<T>& p) : allocator(p.allocator) { }
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER >= 1300
- template<class Other>
-#ifdef USING_SGI_STL
- pool_allocator(const pool_allocator<Other>& p) /*: allocator(p.getAllocator())*/ { }
-#else
- pool_allocator(const pool_allocator<Other>& p) : allocator(p.getAllocator()) { }
-#endif
-#endif
-
-#ifndef _WIN32
- template<class Other>
- pool_allocator(const pool_allocator<Other>& p) : allocator(p.getAllocator()) { }
-#endif
-
-#ifdef USING_SGI_STL
- static pointer allocate(size_type n) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n)); }
- pointer allocate(size_type n, const void*) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n)); }
-
- static void deallocate(void*, size_type) { }
- static void deallocate(pointer, size_type) { }
-#else
- pointer allocate(size_type n) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T))); }
- pointer allocate(size_type n, const void*) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T))); }
-
- void deallocate(void*, size_type) { }
- void deallocate(pointer, size_type) { }
-#endif
-
- pointer _Charalloc(size_t n) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n)); }
-
- void construct(pointer p, const T& val) { new ((void *)p) T(val); }
- void destroy(pointer p) { p->T::~T(); }
-
- bool operator==(const pool_allocator& rhs) const { return &getAllocator() == &rhs.getAllocator(); }
- bool operator!=(const pool_allocator& rhs) const { return &getAllocator() != &rhs.getAllocator(); }
-
- size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
- size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
-
-#ifdef USING_SGI_STL
- //void setAllocator(TPoolAllocator* a) { allocator = a; }
- static TPoolAllocator& getAllocator() { return GlobalPoolAllocator; }
-#else
- void setAllocator(TPoolAllocator* a) { allocator = *a; }
- TPoolAllocator& getAllocator() const { return allocator; }
-
-protected:
- TPoolAllocator& allocator;
-#endif
-};
-
-#endif // _POOLALLOC_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/ResourceLimits.h b/src/mesa/shader/slang/Include/ResourceLimits.h
deleted file mode 100755
index ef24244c288..00000000000
--- a/src/mesa/shader/slang/Include/ResourceLimits.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef _RESOURCE_LIMITS_INCLUDED_
-#define _RESOURCE_LIMITS_INCLUDED_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct TBuiltInResource_ {
- int maxLights;
- int maxClipPlanes;
- int maxTextureUnits;
- int maxTextureCoords;
- int maxVertexAttribs;
- int maxVertexUniformComponents;
- int maxVaryingFloats;
- int maxVertexTextureImageUnits;
- int maxCombinedTextureImageUnits;
- int maxTextureImageUnits;
- int maxFragmentUniformComponents;
- int maxDrawBuffers;
-} TBuiltInResource;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RESOURCE_LIMITS_INCLUDED_ */
diff --git a/src/mesa/shader/slang/Include/ShHandle.h b/src/mesa/shader/slang/Include/ShHandle.h
deleted file mode 100755
index 82c0314f348..00000000000
--- a/src/mesa/shader/slang/Include/ShHandle.h
+++ /dev/null
@@ -1,177 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _SHHANDLE_INCLUDED_
-#define _SHHANDLE_INCLUDED_
-
-//
-// Machine independent part of the compiler private objects
-// sent as ShHandle to the driver.
-//
-// This should not be included by driver code.
-//
-
-#define SH_EXPORTING
-#include "../Public/ShaderLangExt.h"
-#include "InfoSink.h"
-
-class TCompiler;
-class TLinker;
-class TUniformMap;
-namespace Lf {
- class TBindingList;
- class TLinker;
- class TLibrary;
-}
-
-//
-// The base class used to back handles returned to the driver.
-//
-class TShHandleBase {
-public:
- TShHandleBase() { }
- virtual ~TShHandleBase() { }
- virtual TCompiler* getAsCompiler() { return 0; }
- virtual TLinker* getAsLinker() { return 0; }
- virtual Lf::TLinker* getAsNewLinker() { return 0; }
- virtual TUniformMap* getAsUniformMap() { return 0; }
- virtual Lf::TBindingList* getAsBindingList() { return 0; }
- virtual Lf::TLibrary* getAsLibrary() { return 0; }
-};
-//
-// The base class for the machine dependent linker to derive from
-// for managing where uniforms live.
-//
-class TUniformMap : public TShHandleBase {
-public:
- TUniformMap() { }
- virtual ~TUniformMap() { }
- virtual TUniformMap* getAsUniformMap() { return this; }
- virtual int getLocation(const char* name) = 0;
- virtual TInfoSink& getInfoSink() { return infoSink; }
- TInfoSink infoSink;
-};
-
-class TIntermNode;
-
-//
-// The base class for the machine dependent compiler to derive from
-// for managing object code from the compile.
-//
-class TCompiler : public TShHandleBase {
-public:
- TCompiler(EShLanguage l, TInfoSink& sink) : infoSink(sink) , language(l), haveValidObjectCode(false) { }
- virtual ~TCompiler() { }
- EShLanguage getLanguage() { return language; }
- virtual TInfoSink& getInfoSink() { return infoSink; }
-
- virtual bool compile(TIntermNode* root) = 0;
-
- virtual TCompiler* getAsCompiler() { return this; }
- virtual bool linkable() { return haveValidObjectCode; }
-
- TInfoSink& infoSink;
-protected:
- EShLanguage language;
- bool haveValidObjectCode;
-};
-
-//
-// Link operations are base on a list of compile results...
-//
-typedef TVector<TCompiler*> TCompilerList;
-typedef TVector<TShHandleBase*> THandleList;
-
-//
-// The base class for the machine dependent linker to derive from
-// to manage the resulting executable.
-//
-
-class TLinker : public TShHandleBase {
-public:
- TLinker(EShExecutable e, TInfoSink& iSink) :
- infoSink(iSink),
- executable(e),
- haveReturnableObjectCode(false),
- appAttributeBindings(0),
- fixedAttributeBindings(0),
- excludedAttributes(0),
- excludedCount(0),
- uniformBindings(0) { }
- virtual TLinker* getAsLinker() { return this; }
- virtual ~TLinker() { }
- virtual bool link(TCompilerList&, TUniformMap*) = 0;
- virtual bool link(THandleList&) { return false; }
- virtual void setAppAttributeBindings(const ShBindingTable* t) { appAttributeBindings = t; }
- virtual void setFixedAttributeBindings(const ShBindingTable* t) { fixedAttributeBindings = t; }
- virtual void getAttributeBindings(ShBindingTable const **t) const = 0;
- virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; }
- virtual ShBindingTable* getUniformBindings() const { return uniformBindings; }
- virtual const void* getObjectCode() const { return 0; } // a real compiler would be returning object code here
- virtual TInfoSink& getInfoSink() { return infoSink; }
- TInfoSink& infoSink;
-protected:
- EShExecutable executable;
- bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver
-
- const ShBindingTable* appAttributeBindings;
- const ShBindingTable* fixedAttributeBindings;
- const int* excludedAttributes;
- int excludedCount;
- ShBindingTable* uniformBindings; // created by the linker
-};
-
-//
-// This is the interface between the machine independent code
-// and the machine dependent code.
-//
-// The machine dependent code should derive from the classes
-// above. Then Construct*() and Delete*() will create and
-// destroy the machine dependent objects, which contain the
-// above machine independent information.
-//
-TCompiler* ConstructCompiler(EShLanguage, int);
-
-TShHandleBase* ConstructLinker(EShExecutable, int);
-TShHandleBase* ConstructBindings();
-TShHandleBase* ConstructLibrary();
-void DeleteLinker(TShHandleBase*);
-
-TUniformMap* ConstructUniformMap();
-void DeleteCompiler(TCompiler*);
-
-void DeleteUniformMap(TUniformMap*);
-void freeTargetDependentData(void*);
-
-#endif // _SHHANDLE_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/Types.h b/src/mesa/shader/slang/Include/Types.h
deleted file mode 100755
index 9415879afe3..00000000000
--- a/src/mesa/shader/slang/Include/Types.h
+++ /dev/null
@@ -1,297 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _TYPES_INCLUDED
-#define _TYPES_INCLUDED
-
-#include "../Include/Common.h"
-#include "../Include/BaseTypes.h"
-
-//
-// Need to have association of line numbers to types in a list for building structs.
-//
-class TType;
-struct TTypeLine {
- TType* type;
- int line;
-};
-typedef TVector<TTypeLine> TTypeList;
-
-inline TTypeList* NewPoolTTypeList()
-{
- void* memory = GlobalPoolAllocator.allocate(sizeof(TTypeList));
- return new(memory) TTypeList;
-}
-
-//
-// This is a workaround for a problem with the yacc stack, It can't have
-// types that the compiler thinks non-trivial constructors. It should
-// just be used while recognizing the grammar, not anything else. Pointers
-// could be used, but also trying to avoid lots of memory management overhead.
-//
-// Not as bad as it looks, there is no actual assumption that the fields
-// match up or are name the same or anything like that.
-//
-class TPublicType {
-public:
- TBasicType type;
- TQualifier qualifier;
- int size; // size of vector or matrix, not size of array
- bool matrix;
- bool array;
- TType* userDef;
- int line;
-};
-
-typedef std::map<TTypeList*, TTypeList*> TStructureMap;
-typedef std::map<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
-//
-// Base class for things that have a type.
-//
-class TType {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- explicit TType(TBasicType t, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) :
- type(t), qualifier(q), size(s), matrix(m), array(a), arraySize(0), structure(0),
- structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), typeName(0), mangled(0)
- { }
- explicit TType(TPublicType p) :
- type(p.type), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(0),
- structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), typeName(0), mangled(0)
- {
- if (p.userDef) {
- structure = p.userDef->getStruct();
- structureSize = setStructSize(p.userDef->getStruct());
- typeName = NewPoolTString(p.userDef->getTypeName().c_str());
- }
- }
- explicit TType(TTypeList* userDef, TString n) :
- type(EbtStruct), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0),
- structure(userDef), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) {
- structureSize = setStructSize(userDef);
- typeName = NewPoolTString(n.c_str());
- }
- explicit TType() {}
- virtual ~TType() {}
-
- TType (const TType& type) { *this = type; }
-
- void copyType(const TType& copyOf, TStructureMap& remapper)
- {
- type = copyOf.type;
- qualifier = copyOf.qualifier;
- size = copyOf.size;
- matrix = copyOf.matrix;
- array = copyOf.array;
- arraySize = copyOf.arraySize;
-
- TStructureMapIterator iter;
- if (copyOf.structure) {
- if ((iter = remapper.find(structure)) == remapper.end()) {
- // create the new structure here
- structure = NewPoolTTypeList();
- for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
- TTypeLine typeLine;
- typeLine.line = (*copyOf.structure)[i].line;
- typeLine.type = (*copyOf.structure)[i].type->clone(remapper);
- structure->push_back(typeLine);
- }
- } else {
- structure = iter->second;
- }
- } else
- structure = 0;
-
- fieldName = 0;
- if (copyOf.fieldName)
- fieldName = NewPoolTString(copyOf.fieldName->c_str());
- typeName = 0;
- if (copyOf.typeName)
- typeName = NewPoolTString(copyOf.typeName->c_str());
-
- mangled = 0;
- if (copyOf.mangled)
- mangled = NewPoolTString(copyOf.mangled->c_str());
-
- structureSize = copyOf.structureSize;
- maxArraySize = copyOf.maxArraySize;
- assert (copyOf.arrayInformationType == 0);
- arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level
- }
-
- TType* clone(TStructureMap& remapper)
- {
- TType *newType = new TType();
- newType->copyType(*this, remapper);
-
- return newType;
- }
-
- int setStructSize(TTypeList* userDef)
- {
- int stSize = 0;
- for (TTypeList::iterator tl = userDef->begin(); tl != userDef->end(); tl++) {
- if (((*tl).type)->isArray()) {
- if (((*tl).type)->getStruct()) {
- int structSize = setStructSize(((*tl).type)->getStruct());
- stSize += structSize * ((*tl).type)->getArraySize();
- } else {
- stSize += ((*tl).type)->getInstanceSize() * ((*tl).type)->getArraySize();
- }
- } else if (((*tl).type)->isMatrix() || ((*tl).type)->isVector()){
- stSize += ((*tl).type)->getInstanceSize();
- } else if (((*tl).type)->getStruct()) {
- //?? We should actually be calling getStructSize() function and not setStructSize. This problem occurs in case
- // of nested/embedded structs.
- stSize += setStructSize(((*tl).type)->getStruct());
- } else
- stSize += 1;
- }
- structureSize = stSize;
- return stSize;
- }
-
- virtual void setType(TBasicType t, int s, bool m, bool a, int aS = 0)
- { type = t; size = s; matrix = m; array = a; arraySize = aS; }
- virtual void setType(TBasicType t, int s, bool m, TType* userDef = 0)
- { type = t;
- size = s;
- matrix = m;
- if (userDef)
- structure = userDef->getStruct();
- // leave array information intact.
- }
- virtual void setTypeName(const TString& n) { typeName = NewPoolTString(n.c_str()); }
- virtual void setFieldName(const TString& n) { fieldName = NewPoolTString(n.c_str()); }
- virtual const TString& getTypeName() const
- {
- assert (typeName);
- return *typeName;
- }
-
- virtual const TString& getFieldName() const
- {
- assert (fieldName);
- return *fieldName;
- }
-
- virtual TBasicType getBasicType() const { return type; }
- virtual TQualifier getQualifier() const { return qualifier; }
- virtual void changeQualifier(TQualifier q) { qualifier = q; }
-
- // One-dimensional size of single instance type
- virtual int getNominalSize() const { return size; }
-
- // Full-dimensional size of single instance of type
- virtual int getInstanceSize() const
- {
- if (matrix)
- return size * size;
- else
- return size;
- }
-
- virtual bool isMatrix() const { return matrix ? true : false; }
- virtual bool isArray() const { return array ? true : false; }
- int getArraySize() const { return arraySize; }
- void setArraySize(int s) { array = true; arraySize = s; }
- void setMaxArraySize (int s) { maxArraySize = s; }
- int getMaxArraySize () const { return maxArraySize; }
- void setArrayInformationType(TType* t) { arrayInformationType = t; }
- TType* getArrayInformationType() { return arrayInformationType; }
- virtual bool isVector() const { return size > 1 && !matrix; }
- static char* getBasicString(TBasicType t) {
- switch (t) {
- case EbtVoid: return "void"; break;
- case EbtFloat: return "float"; break;
- case EbtInt: return "int"; break;
- case EbtBool: return "bool"; break;
- case EbtSampler1D: return "sampler1D"; break;
- case EbtSampler2D: return "sampler2D"; break;
- case EbtSampler3D: return "sampler3D"; break;
- case EbtSamplerCube: return "samplerCube"; break;
- case EbtSampler1DShadow: return "sampler1DShadow"; break;
- case EbtSampler2DShadow: return "sampler2DShadow"; break;
- case EbtStruct: return "structure"; break;
- default: return "unknown type";
- }
- }
- const char* getBasicString() const { return TType::getBasicString(type); }
- const char* getQualifierString() const { return ::getQualifierString(qualifier); }
- TTypeList* getStruct() { return structure; }
- int getStructSize() const { return structureSize; }
- TTypeList* getStruct() const { return structure; }
- TString& getMangledName() {
- if (!mangled) {
- mangled = NewPoolTString("");
- buildMangledName(*mangled);
- *mangled+=';';
- }
-
- return *mangled;
- }
- bool operator==(const TType& right) const {
- return type == right.type &&
- size == right.size &&
- matrix == right.matrix &&
- array == right.array &&
- structure == right.structure;
- // don't check the qualifier, it's not ever what's being sought after
- }
- bool operator!=(const TType& right) const {
- return !operator==(right);
- }
- TString getCompleteString() const;
-
-protected:
- void buildMangledName(TString&);
-
- TBasicType type : 6;
- TQualifier qualifier : 7;
- int size : 8; // size of vector or matrix, not size of array
- unsigned int matrix : 1;
- unsigned int array : 1;
-
- int arraySize;
- TTypeList* structure; // 0 unless this is a struct
- int structureSize;
- int maxArraySize;
- TType* arrayInformationType;
- TString *fieldName; // for structure field names
- TString *typeName; // for structure field type name
- TString *mangled;
-
-};
-
-#endif // _TYPES_INCLUDED_
diff --git a/src/mesa/shader/slang/Include/intermediate.h b/src/mesa/shader/slang/Include/intermediate.h
deleted file mode 100755
index 13e22c2749a..00000000000
--- a/src/mesa/shader/slang/Include/intermediate.h
+++ /dev/null
@@ -1,516 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-//
-// Definition of the in-memory high-level intermediate representation
-// of shaders. This is a tree that parser creates.
-//
-// Nodes in the tree are defined as a hierarchy of classes derived from
-// TIntermNode. Each is a node in a tree. There is no preset branching factor;
-// each node can have it's own type of list of children.
-//
-
-#ifndef __INTERMEDIATE_H
-#define __INTERMEDIATE_H
-
-#include "../Include/Common.h"
-#include "../Include/Types.h"
-#include "../Include/ConstantUnion.h"
-
-//
-// Operators used by the high-level (parse tree) representation.
-//
-enum TOperator {
- EOpNull, // if in a node, should only mean a node is still being built
- EOpSequence, // denotes a list of statements, or parameters, etc.
- EOpFunctionCall,
- EOpFunction, // For function definition
- EOpParameters, // an aggregate listing the parameters to a function
-
- //
- // Unary operators
- //
-
- EOpNegative,
- EOpLogicalNot,
- EOpVectorLogicalNot,
- EOpBitwiseNot,
-
- EOpPostIncrement,
- EOpPostDecrement,
- EOpPreIncrement,
- EOpPreDecrement,
-
- EOpConvIntToBool,
- EOpConvFloatToBool,
- EOpConvBoolToFloat,
- EOpConvIntToFloat,
- EOpConvFloatToInt,
- EOpConvBoolToInt,
-
- //
- // binary operations
- //
-
- EOpAdd,
- EOpSub,
- EOpMul,
- EOpDiv,
- EOpMod,
- EOpRightShift,
- EOpLeftShift,
- EOpAnd,
- EOpInclusiveOr,
- EOpExclusiveOr,
- EOpEqual,
- EOpNotEqual,
- EOpVectorEqual,
- EOpVectorNotEqual,
- EOpLessThan,
- EOpGreaterThan,
- EOpLessThanEqual,
- EOpGreaterThanEqual,
- EOpComma,
-
- EOpVectorTimesScalar,
- EOpVectorTimesMatrix,
- EOpMatrixTimesVector,
- EOpMatrixTimesScalar,
-
- EOpLogicalOr,
- EOpLogicalXor,
- EOpLogicalAnd,
-
- EOpIndexDirect,
- EOpIndexIndirect,
- EOpIndexDirectStruct,
-
- EOpVectorSwizzle,
-
- //
- // Built-in functions potentially mapped to operators
- //
-
- EOpRadians,
- EOpDegrees,
- EOpSin,
- EOpCos,
- EOpTan,
- EOpAsin,
- EOpAcos,
- EOpAtan,
-
- EOpPow,
- EOpExp,
- EOpLog,
- EOpExp2,
- EOpLog2,
- EOpSqrt,
- EOpInverseSqrt,
-
- EOpAbs,
- EOpSign,
- EOpFloor,
- EOpCeil,
- EOpFract,
- EOpMin,
- EOpMax,
- EOpClamp,
- EOpMix,
- EOpStep,
- EOpSmoothStep,
-
- EOpLength,
- EOpDistance,
- EOpDot,
- EOpCross,
- EOpNormalize,
- EOpFaceForward,
- EOpReflect,
- EOpRefract,
-
- EOpDPdx, // Fragment only
- EOpDPdy, // Fragment only
- EOpFwidth, // Fragment only
-
- EOpMatrixTimesMatrix,
-
- EOpAny,
- EOpAll,
-
- EOpItof, // pack/unpack only
- EOpFtoi, // pack/unpack only
- EOpSkipPixels, // pack/unpack only
- EOpReadInput, // unpack only
- EOpWritePixel, // unpack only
- EOpBitmapLsb, // unpack only
- EOpBitmapMsb, // unpack only
- EOpWriteOutput, // pack only
- EOpReadPixel, // pack only
-
- //
- // Branch
- //
-
- EOpKill, // Fragment only
- EOpReturn,
- EOpBreak,
- EOpContinue,
-
- //
- // Constructors
- //
-
- EOpConstructInt,
- EOpConstructBool,
- EOpConstructFloat,
- EOpConstructVec2,
- EOpConstructVec3,
- EOpConstructVec4,
- EOpConstructBVec2,
- EOpConstructBVec3,
- EOpConstructBVec4,
- EOpConstructIVec2,
- EOpConstructIVec3,
- EOpConstructIVec4,
- EOpConstructMat2,
- EOpConstructMat3,
- EOpConstructMat4,
- EOpConstructStruct,
-
- //
- // moves
- //
-
- EOpAssign,
- EOpAddAssign,
- EOpSubAssign,
- EOpMulAssign,
- EOpVectorTimesMatrixAssign,
- EOpVectorTimesScalarAssign,
- EOpMatrixTimesScalarAssign,
- EOpMatrixTimesMatrixAssign,
- EOpDivAssign,
- EOpModAssign,
- EOpAndAssign,
- EOpInclusiveOrAssign,
- EOpExclusiveOrAssign,
- EOpLeftShiftAssign,
- EOpRightShiftAssign
-};
-
-class TIntermTraverser;
-class TIntermAggregate;
-class TIntermBinary;
-class TIntermConstantUnion;
-class TIntermSelection;
-class TIntermTyped;
-class TIntermSymbol;
-class TInfoSink;
-
-//
-// Base class for the tree nodes
-//
-class TIntermNode {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
-
- TIntermNode() : line(0) {}
- virtual TSourceLoc getLine() const { return line; }
- virtual void setLine(TSourceLoc l) { line = l; }
- virtual void traverse(TIntermTraverser*) = 0;
- virtual TIntermTyped* getAsTyped() { return 0; }
- virtual TIntermConstantUnion* getAsConstantUnion() { return 0; }
- virtual TIntermAggregate* getAsAggregate() { return 0; }
- virtual TIntermBinary* getAsBinaryNode() { return 0; }
- virtual TIntermSelection* getAsSelectionNode() { return 0; }
- virtual TIntermSymbol* getAsSymbolNode() { return 0; }
- virtual ~TIntermNode() { }
-protected:
- TSourceLoc line;
-};
-
-//
-// This is just to help yacc.
-//
-struct TIntermNodePair {
- TIntermNode* node1;
- TIntermNode* node2;
-};
-
-class TIntermSymbol;
-class TIntermBinary;
-
-//
-// Intermediate class for nodes that have a type.
-//
-class TIntermTyped : public TIntermNode {
-public:
- TIntermTyped(const TType& t) : type(t) { }
- virtual TIntermTyped* getAsTyped() { return this; }
- virtual void setType(const TType& t) { type = t; }
- virtual TType getType() const { return type; }
- virtual TType* getTypePointer() { return &type; }
-
- virtual TBasicType getBasicType() const { return type.getBasicType(); }
- virtual TQualifier getQualifier() const { return type.getQualifier(); }
- virtual int getNominalSize() const { return type.getNominalSize(); }
- virtual int getSize() const { return type.getInstanceSize(); }
- virtual bool isMatrix() const { return type.isMatrix(); }
- virtual bool isArray() const { return type.isArray(); }
- virtual bool isVector() const { return type.isVector(); }
- const char* getBasicString() const { return type.getBasicString(); }
- const char* getQualifierString() const { return type.getQualifierString(); }
- TString getCompleteString() const { return type.getCompleteString(); }
-
-protected:
- TType type;
-};
-
-//
-// Handle for, do-while, and while loops.
-//
-class TIntermLoop : public TIntermNode {
-public:
- TIntermLoop(TIntermNode* aBody, TIntermTyped* aTest, TIntermTyped* aTerminal, bool testFirst) :
- body(aBody),
- test(aTest),
- terminal(aTerminal),
- first(testFirst) { }
- virtual void traverse(TIntermTraverser*);
- TIntermNode* getBody() { return body; }
- TIntermTyped* getTest() { return test; }
- TIntermTyped* getTerminal() { return terminal; }
- bool testFirst() { return first; }
-protected:
- TIntermNode* body; // code to loop over
- TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops
- TIntermTyped* terminal; // exists for for-loops
- bool first; // true for while and for, not for do-while
-};
-
-//
-// Handle break, continue, return, and kill.
-//
-class TIntermBranch : public TIntermNode {
-public:
- TIntermBranch(TOperator op, TIntermTyped* e) :
- flowOp(op),
- expression(e) { }
- virtual void traverse(TIntermTraverser*);
- TOperator getFlowOp() { return flowOp; }
- TIntermTyped* getExpression() { return expression; }
-protected:
- TOperator flowOp;
- TIntermTyped* expression; // non-zero except for "return exp;" statements
-};
-
-//
-// Nodes that correspond to symbols or constants in the source code.
-//
-class TIntermSymbol : public TIntermTyped {
-public:
- // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym. If sym comes from
- // per process globalpoolallocator, then it causes increased memory usage per compile
- // it is essential to use "symbol = sym" to assign to symbol
- TIntermSymbol(int i, const TString& sym, const TType& t) :
- TIntermTyped(t), id(i) { symbol = sym;}
- virtual int getId() const { return id; }
- virtual const TString& getSymbol() const { return symbol; }
- virtual void traverse(TIntermTraverser*);
- virtual TIntermSymbol* getAsSymbolNode() { return this; }
-protected:
- int id;
- TString symbol;
-};
-
-class TIntermConstantUnion : public TIntermTyped {
-public:
- TIntermConstantUnion(constUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
- constUnion* getUnionArrayPointer() const { return unionArrayPointer; }
- void setUnionArrayPointer(constUnion *c) { unionArrayPointer = c; }
- virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
- virtual void traverse(TIntermTraverser* );
- virtual TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&, bool);
-protected:
- constUnion *unionArrayPointer;
-};
-
-//
-// Intermediate class for node types that hold operators.
-//
-class TIntermOperator : public TIntermTyped {
-public:
- TOperator getOp() { return op; }
- bool modifiesState() const;
- bool isConstructor() const;
- virtual bool promote(TInfoSink&) { return true; }
-protected:
- TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat)), op(o) {}
- TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
- TOperator op;
-};
-
-//
-// Nodes for all the basic binary math operators.
-//
-class TIntermBinary : public TIntermOperator {
-public:
- TIntermBinary(TOperator o) : TIntermOperator(o) {}
- virtual void traverse(TIntermTraverser*);
- virtual void setLeft(TIntermTyped* n) { left = n; }
- virtual void setRight(TIntermTyped* n) { right = n; }
- virtual TIntermTyped* getLeft() const { return left; }
- virtual TIntermTyped* getRight() const { return right; }
- virtual TIntermBinary* getAsBinaryNode() { return this; }
- virtual bool promote(TInfoSink&);
-protected:
- TIntermTyped* left;
- TIntermTyped* right;
-};
-
-//
-// Nodes for unary math operators.
-//
-class TIntermUnary : public TIntermOperator {
-public:
- TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
- TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
- virtual void traverse(TIntermTraverser*);
- virtual void setOperand(TIntermTyped* o) { operand = o; }
- virtual TIntermTyped* getOperand() { return operand; }
- virtual bool promote(TInfoSink&);
-protected:
- TIntermTyped* operand;
-};
-
-typedef TVector<TIntermNode*> TIntermSequence;
-typedef TVector<int> TQualifierList;
-//
-// Nodes that operate on an arbitrary sized set of children.
-//
-class TIntermAggregate : public TIntermOperator {
-public:
- TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }
- TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
- ~TIntermAggregate() { delete pragmaTable; }
- virtual TIntermAggregate* getAsAggregate() { return this; }
- virtual void setOperator(TOperator o) { op = o; }
- virtual TIntermSequence& getSequence() { return sequence; }
- virtual void setName(const TString& n) { name = n; }
- virtual const TString& getName() const { return name; }
- virtual void traverse(TIntermTraverser*);
- virtual void setUserDefined() { userDefined = true; }
- virtual bool isUserDefined() { return userDefined; }
- virtual TQualifierList& getQualifier() { return qualifier; }
- void setOptimize(bool o) { optimize = o; }
- void setDebug(bool d) { debug = d; }
- bool getOptimize() { return optimize; }
- bool getDebug() { return debug; }
- void addToPragmaTable(const TPragmaTable& pTable);
- const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
-protected:
- TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
- TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
- TIntermSequence sequence;
- TQualifierList qualifier;
- TString name;
- bool userDefined; // used for user defined function names
- bool optimize;
- bool debug;
- TPragmaTable *pragmaTable;
-};
-
-//
-// For if tests. Simplified since there is no switch statement.
-//
-class TIntermSelection : public TIntermTyped {
-public:
- TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :
- TIntermTyped(TType(EbtVoid)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
- TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) :
- TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
- virtual void traverse(TIntermTraverser*);
- virtual TIntermNode* getCondition() const { return condition; }
- virtual TIntermNode* getTrueBlock() const { return trueBlock; }
- virtual TIntermNode* getFalseBlock() const { return falseBlock; }
- virtual TIntermSelection* getAsSelectionNode() { return this; }
-protected:
- TIntermTyped* condition;
- TIntermNode* trueBlock;
- TIntermNode* falseBlock;
-};
-
-//
-// For traversing the tree. User should derive from this,
-// put their traversal specific data in it, and then pass
-// it to a Traverse method.
-//
-// When using this, just fill in the methods for nodes you want visited.
-// Return false from a pre-visit to skip visiting that node's subtree.
-//
-class TIntermTraverser {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
-
- TIntermTraverser() :
- visitSymbol(0),
- visitConstantUnion(0),
- visitBinary(0),
- visitUnary(0),
- visitSelection(0),
- visitAggregate(0),
- visitLoop(0),
- visitBranch(0),
- depth(0),
- preVisit(true),
- postVisit(false),
- rightToLeft(false) {}
-
- void (*visitSymbol)(TIntermSymbol*, TIntermTraverser*);
- void (*visitConstantUnion)(TIntermConstantUnion*, TIntermTraverser*);
- bool (*visitBinary)(bool preVisit, TIntermBinary*, TIntermTraverser*);
- bool (*visitUnary)(bool preVisit, TIntermUnary*, TIntermTraverser*);
- bool (*visitSelection)(bool preVisit, TIntermSelection*, TIntermTraverser*);
- bool (*visitAggregate)(bool preVisit, TIntermAggregate*, TIntermTraverser*);
- bool (*visitLoop)(bool preVisit, TIntermLoop*, TIntermTraverser*);
- bool (*visitBranch)(bool preVisit, TIntermBranch*, TIntermTraverser*);
-
- int depth;
- bool preVisit;
- bool postVisit;
- bool rightToLeft;
-};
-
-#endif // __INTERMEDIATE_H
diff --git a/src/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp b/src/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp
deleted file mode 100755
index 76ed54d4a36..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp
+++ /dev/null
@@ -1,2942 +0,0 @@
-#line 2 "Gen_glslang.cpp"
-/* A lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header: /cvs/mesa/Mesa/src/mesa/shader/slang/MachineIndependent/Gen_glslang.cpp,v 1.3 2005-03-18 14:30:27 michal Exp $
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-#include <stdio.h>
-#include <unistd.h>
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-static YY_BUFFER_STATE yy_current_buffer = 0;
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart YY_PROTO(( FILE *input_file ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-
-#define yywrap() 1
-#define YY_SKIP_YYWRAP
-typedef unsigned char YY_CHAR;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-typedef int yy_state_type;
-extern char *yytext;
-#define yytext_ptr yytext
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 144
-#define YY_END_OF_BUFFER 145
-static yyconst short int yy_accept[428] =
- { 0,
- 0, 0, 0, 0, 145, 143, 142, 142, 127, 133,
- 138, 122, 123, 131, 130, 119, 128, 126, 132, 143,
- 143, 120, 116, 134, 121, 135, 139, 143, 124, 125,
- 137, 143, 143, 143, 143, 143, 143, 143, 143, 143,
- 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
- 143, 117, 136, 118, 129, 141, 144, 143, 143, 113,
- 99, 118, 107, 102, 97, 105, 95, 106, 96, 0,
- 94, 0, 98, 90, 0, 0, 0, 125, 117, 124,
- 114, 110, 112, 111, 115, 86, 103, 109, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 8, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 11, 13, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 104, 108, 140,
- 93, 0, 1, 92, 0, 0, 88, 89, 0, 100,
- 101, 0, 0, 43, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 9, 0, 0, 0, 0, 0, 0, 0, 17,
- 0, 0, 0, 0, 0, 14, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 87, 86, 0, 19, 0, 0,
- 83, 0, 0, 0, 0, 0, 0, 0, 12, 46,
- 0, 0, 0, 0, 0, 51, 65, 0, 0, 0,
- 0, 0, 0, 62, 24, 25, 26, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 49, 20, 0, 0, 0, 0, 0, 0, 27, 28,
- 29, 18, 0, 0, 140, 0, 0, 92, 0, 0,
- 0, 0, 6, 33, 34, 35, 44, 3, 0, 0,
- 0, 0, 76, 77, 78, 0, 21, 66, 16, 73,
-
- 74, 75, 70, 71, 72, 0, 15, 68, 0, 30,
- 31, 32, 0, 0, 0, 0, 0, 0, 0, 63,
- 0, 0, 0, 0, 0, 0, 0, 45, 0, 85,
- 0, 0, 10, 0, 0, 91, 0, 0, 0, 0,
- 64, 59, 54, 0, 0, 0, 69, 50, 57, 23,
- 0, 82, 58, 42, 52, 0, 0, 0, 0, 0,
- 0, 93, 92, 0, 0, 53, 22, 0, 0, 0,
- 0, 0, 0, 47, 4, 0, 5, 0, 0, 7,
- 60, 0, 0, 55, 0, 0, 0, 0, 48, 67,
- 56, 2, 61, 84, 36, 37, 38, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0, 0, 39, 0, 0,
- 0, 0, 0, 79, 0, 80, 0, 0, 0, 40,
- 0, 41, 0, 0, 0, 81, 0
- } ;
-
-static yyconst int yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 5, 1, 1, 1, 6, 7, 1, 8,
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 21, 21, 22, 22, 23, 24, 25,
- 26, 27, 28, 1, 29, 29, 30, 31, 32, 29,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 33, 34, 35, 33, 33, 33, 33, 36, 33, 33,
- 37, 1, 38, 39, 33, 1, 40, 41, 42, 43,
-
- 44, 45, 46, 47, 48, 33, 49, 50, 51, 52,
- 53, 54, 33, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst int yy_meta[68] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
- 2, 2, 1, 1, 1, 1, 1, 1, 2, 2,
- 2, 2, 3, 3, 3, 3, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 1, 1, 1, 1
- } ;
-
-static yyconst short int yy_base[432] =
- { 0,
- 0, 0, 67, 0, 678, 679, 679, 679, 651, 109,
- 130, 679, 679, 650, 127, 679, 126, 124, 139, 151,
- 671, 647, 679, 151, 647, 121, 679, 668, 679, 679,
- 124, 147, 154, 155, 158, 171, 174, 157, 156, 184,
- 175, 160, 178, 162, 176, 181, 190, 197, 193, 195,
- 179, 679, 193, 679, 679, 679, 679, 656, 666, 679,
- 679, 679, 679, 679, 679, 679, 679, 679, 679, 665,
- 679, 665, 679, 246, 663, 662, 0, 679, 679, 679,
- 639, 679, 679, 679, 638, 253, 679, 679, 612, 605,
- 608, 616, 615, 602, 617, 604, 610, 598, 595, 608,
-
- 595, 592, 592, 598, 586, 593, 590, 600, 586, 592,
- 597, 679, 136, 596, 587, 581, 586, 588, 578, 592,
- 592, 575, 580, 577, 566, 200, 580, 576, 578, 567,
- 570, 136, 575, 567, 579, 203, 572, 679, 679, 263,
- 275, 616, 679, 282, 614, 311, 318, 325, 613, 679,
- 679, 612, 611, 679, 559, 563, 572, 569, 553, 553,
- 200, 568, 565, 565, 563, 560, 552, 558, 545, 556,
- 559, 679, 556, 544, 551, 553, 546, 535, 534, 547,
- 548, 543, 268, 544, 535, 532, 536, 534, 525, 528,
- 526, 536, 522, 520, 520, 522, 519, 530, 529, 201,
-
- 524, 519, 508, 290, 526, 528, 517, 562, 561, 337,
- 560, 349, 356, 559, 0, 363, 514, 679, 512, 293,
- 679, 504, 502, 510, 499, 516, 505, 297, 679, 679,
- 499, 509, 509, 494, 368, 679, 679, 371, 498, 492,
- 491, 492, 374, 679, 679, 679, 679, 490, 495, 486,
- 499, 494, 486, 490, 482, 485, 489, 494, 493, 484,
- 679, 679, 490, 479, 479, 484, 483, 480, 679, 679,
- 679, 679, 470, 482, 379, 386, 521, 393, 400, 520,
- 422, 482, 679, 679, 679, 679, 679, 679, 470, 471,
- 465, 475, 679, 679, 679, 466, 679, 679, 679, 679,
-
- 679, 679, 679, 679, 679, 473, 679, 679, 471, 679,
- 679, 679, 461, 466, 456, 469, 469, 458, 465, 679,
- 463, 465, 449, 458, 464, 459, 447, 679, 449, 679,
- 448, 451, 679, 429, 448, 679, 440, 439, 439, 452,
- 679, 454, 679, 453, 452, 439, 679, 679, 679, 679,
- 435, 679, 679, 679, 679, 432, 443, 436, 442, 439,
- 434, 679, 679, 426, 438, 679, 679, 431, 438, 437,
- 419, 441, 418, 679, 679, 418, 679, 413, 412, 679,
- 679, 411, 410, 679, 422, 405, 404, 376, 679, 679,
- 679, 679, 679, 679, 397, 242, 397, 389, 382, 384,
-
- 380, 380, 379, 324, 321, 321, 310, 679, 308, 292,
- 282, 266, 268, 285, 265, 679, 246, 258, 229, 679,
- 221, 679, 199, 145, 131, 679, 679, 471, 179, 473,
- 475
- } ;
-
-static yyconst short int yy_def[432] =
- { 0,
- 427, 1, 427, 3, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 428, 427, 427, 427, 427, 429, 427, 427, 427,
- 427, 427, 427, 427, 427, 430, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
-
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 431,
- 427, 428, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
-
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 429, 430, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 431, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
-
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
-
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 0, 427, 427, 427,
- 427
- } ;
-
-static yyconst short int yy_nxt[747] =
- { 0,
- 6, 7, 8, 7, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 21, 21, 21,
- 21, 21, 22, 23, 24, 25, 26, 27, 28, 28,
- 28, 28, 28, 28, 28, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 28, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 28, 28, 28, 52, 53, 54, 55, 6, 56, 57,
- 56, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 58, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 59, 59, 59, 59, 59,
-
- 59, 59, 59, 6, 6, 6, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
- 6, 6, 6, 6, 61, 62, 63, 66, 68, 70,
- 70, 70, 70, 70, 70, 70, 84, 85, 71, 87,
- 86, 69, 67, 72, 74, 64, 79, 86, 86, 86,
- 86, 86, 88, 86, 73, 86, 75, 75, 75, 75,
- 75, 75, 76, 80, 86, 81, 82, 86, 86, 86,
- 149, 86, 86, 200, 86, 177, 77, 86, 178, 179,
- 426, 201, 180, 86, 94, 110, 86, 425, 86, 116,
-
- 86, 97, 89, 90, 95, 98, 91, 96, 92, 109,
- 99, 77, 93, 104, 111, 120, 100, 117, 138, 119,
- 101, 105, 102, 106, 122, 137, 107, 115, 112, 123,
- 118, 103, 108, 121, 134, 113, 124, 125, 135, 193,
- 128, 424, 114, 129, 132, 264, 126, 136, 133, 127,
- 205, 130, 206, 265, 194, 223, 224, 139, 131, 144,
- 423, 145, 145, 145, 145, 145, 145, 145, 152, 152,
- 152, 152, 152, 152, 152, 400, 401, 146, 208, 208,
- 208, 208, 208, 208, 208, 245, 246, 247, 422, 146,
- 70, 70, 70, 70, 70, 70, 70, 211, 211, 211,
-
- 211, 211, 211, 211, 421, 420, 210, 269, 270, 271,
- 284, 285, 286, 212, 293, 294, 295, 419, 210, 418,
- 417, 213, 416, 213, 415, 212, 214, 214, 214, 214,
- 214, 214, 214, 75, 75, 75, 75, 75, 75, 76,
- 76, 76, 76, 76, 76, 76, 76, 276, 414, 276,
- 413, 412, 277, 277, 277, 277, 277, 277, 277, 279,
- 411, 279, 410, 409, 280, 280, 280, 280, 280, 280,
- 280, 214, 214, 214, 214, 214, 214, 214, 152, 152,
- 152, 152, 152, 152, 152, 300, 301, 302, 303, 304,
- 305, 310, 311, 312, 208, 208, 208, 208, 208, 208,
-
- 208, 277, 277, 277, 277, 277, 277, 277, 211, 211,
- 211, 211, 211, 211, 211, 280, 280, 280, 280, 280,
- 280, 280, 408, 407, 212, 336, 406, 405, 404, 403,
- 402, 399, 362, 398, 397, 396, 212, 214, 214, 214,
- 214, 214, 214, 214, 277, 277, 277, 277, 277, 277,
- 277, 363, 395, 394, 393, 392, 391, 385, 386, 387,
- 390, 389, 384, 280, 280, 280, 280, 280, 280, 280,
- 388, 142, 142, 142, 153, 153, 209, 209, 383, 382,
- 381, 380, 379, 378, 377, 376, 375, 374, 373, 372,
- 371, 370, 369, 368, 367, 366, 365, 364, 361, 360,
-
- 359, 358, 357, 356, 355, 354, 353, 352, 351, 350,
- 349, 348, 347, 346, 345, 344, 343, 342, 341, 340,
- 339, 338, 337, 335, 334, 333, 332, 331, 330, 329,
- 328, 327, 326, 325, 324, 323, 322, 321, 320, 319,
- 318, 317, 316, 315, 314, 313, 309, 308, 307, 306,
- 299, 298, 297, 296, 292, 291, 290, 289, 288, 287,
- 283, 282, 281, 278, 275, 275, 274, 273, 272, 268,
- 267, 266, 263, 262, 261, 260, 259, 258, 257, 256,
- 255, 254, 253, 252, 251, 250, 249, 248, 244, 243,
- 242, 241, 240, 239, 238, 237, 236, 235, 234, 233,
-
- 232, 231, 230, 229, 228, 227, 226, 225, 222, 221,
- 220, 219, 218, 217, 216, 216, 215, 74, 143, 207,
- 204, 203, 202, 199, 198, 197, 196, 195, 192, 191,
- 190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
- 176, 175, 174, 173, 172, 171, 170, 169, 168, 167,
- 166, 165, 164, 163, 162, 161, 160, 159, 158, 157,
- 156, 155, 154, 151, 150, 148, 147, 143, 141, 140,
- 72, 86, 83, 78, 74, 65, 60, 427, 5, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
-
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427
- } ;
-
-static yyconst short int yy_chk[747] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 10, 10, 11, 15, 17, 18,
- 18, 18, 18, 18, 18, 18, 26, 26, 19, 31,
- 32, 17, 15, 19, 20, 11, 24, 33, 34, 39,
- 38, 35, 31, 42, 19, 44, 20, 20, 20, 20,
- 20, 20, 20, 24, 36, 24, 24, 37, 41, 45,
- 429, 43, 51, 132, 46, 113, 20, 40, 113, 113,
- 425, 132, 113, 47, 34, 39, 49, 424, 50, 42,
-
- 48, 35, 32, 32, 34, 35, 33, 34, 33, 38,
- 35, 20, 33, 37, 39, 45, 35, 43, 53, 44,
- 36, 37, 36, 37, 46, 51, 37, 41, 40, 47,
- 43, 36, 37, 45, 50, 40, 47, 47, 50, 126,
- 48, 423, 40, 48, 49, 200, 47, 50, 49, 47,
- 136, 48, 136, 200, 126, 161, 161, 53, 48, 74,
- 421, 74, 74, 74, 74, 74, 74, 74, 86, 86,
- 86, 86, 86, 86, 86, 396, 396, 74, 140, 140,
- 140, 140, 140, 140, 140, 183, 183, 183, 419, 74,
- 141, 141, 141, 141, 141, 141, 141, 144, 144, 144,
-
- 144, 144, 144, 144, 418, 417, 141, 204, 204, 204,
- 220, 220, 220, 144, 228, 228, 228, 415, 141, 414,
- 413, 146, 412, 146, 411, 144, 146, 146, 146, 146,
- 146, 146, 146, 147, 147, 147, 147, 147, 147, 147,
- 148, 148, 148, 148, 148, 148, 148, 210, 410, 210,
- 409, 407, 210, 210, 210, 210, 210, 210, 210, 212,
- 406, 212, 405, 404, 212, 212, 212, 212, 212, 212,
- 212, 213, 213, 213, 213, 213, 213, 213, 216, 216,
- 216, 216, 216, 216, 216, 235, 235, 235, 238, 238,
- 238, 243, 243, 243, 275, 275, 275, 275, 275, 275,
-
- 275, 276, 276, 276, 276, 276, 276, 276, 278, 278,
- 278, 278, 278, 278, 278, 279, 279, 279, 279, 279,
- 279, 279, 403, 402, 278, 281, 401, 400, 399, 398,
- 397, 395, 334, 388, 387, 386, 278, 281, 281, 281,
- 281, 281, 281, 281, 334, 334, 334, 334, 334, 334,
- 334, 335, 385, 383, 382, 379, 378, 372, 372, 372,
- 376, 373, 371, 335, 335, 335, 335, 335, 335, 335,
- 372, 428, 428, 428, 430, 430, 431, 431, 370, 369,
- 368, 365, 364, 361, 360, 359, 358, 357, 356, 351,
- 346, 345, 344, 342, 340, 339, 338, 337, 332, 331,
-
- 329, 327, 326, 325, 324, 323, 322, 321, 319, 318,
- 317, 316, 315, 314, 313, 309, 306, 296, 292, 291,
- 290, 289, 282, 280, 277, 274, 273, 268, 267, 266,
- 265, 264, 263, 260, 259, 258, 257, 256, 255, 254,
- 253, 252, 251, 250, 249, 248, 242, 241, 240, 239,
- 234, 233, 232, 231, 227, 226, 225, 224, 223, 222,
- 219, 217, 214, 211, 209, 208, 207, 206, 205, 203,
- 202, 201, 199, 198, 197, 196, 195, 194, 193, 192,
- 191, 190, 189, 188, 187, 186, 185, 184, 182, 181,
- 180, 179, 178, 177, 176, 175, 174, 173, 171, 170,
-
- 169, 168, 167, 166, 165, 164, 163, 162, 160, 159,
- 158, 157, 156, 155, 153, 152, 149, 145, 142, 137,
- 135, 134, 133, 131, 130, 129, 128, 127, 125, 124,
- 123, 122, 121, 120, 119, 118, 117, 116, 115, 114,
- 111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
- 101, 100, 99, 98, 97, 96, 95, 94, 93, 92,
- 91, 90, 89, 85, 81, 76, 75, 72, 70, 59,
- 58, 28, 25, 22, 21, 14, 9, 5, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
-
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
- 427, 427, 427, 427, 427, 427
- } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-char *yytext;
-#line 1 "glslang.l"
-#define INITIAL 0
-/*
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-*/
-/* Based on
-ANSI C grammar, Lex specification
-
-In 1985, Jeff Lee published this Lex specification together with a Yacc
-grammar for the April 30, 1985 ANSI C draft. Tom Stockfisch reposted
-both to net.sources in 1987; that original, as mentioned in the answer
-to question 17.25 of the comp.lang.c FAQ, can be ftp'ed from ftp.uu.net,
-file usenet/net.sources/ansi.c.grammar.Z.
-
-I intend to keep this version as close to the current C Standard grammar
-as possible; please let me know if you discover discrepancies.
-
-Jutta Degener, 1995
-*/
-#define YY_NO_UNPUT 1
-#line 59 "glslang.l"
-#include <stdio.h>
-#include <stdlib.h>
-#include "ParseHelper.h"
-#include "glslang_tab.h"
-
-/* windows only pragma */
-#ifdef _MSC_VER
-#pragma warning(disable : 4102)
-#endif
-
-int yy_input(char* buf, int max_size);
-TSourceLoc yylineno;
-
-#ifdef _WIN32
- extern int yyparse(TParseContext&);
- #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
-#else
- extern int yyparse(void*);
- #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
- #define parseContext (*((TParseContext*)(parseContextLocal)))
-#endif
-
-#define YY_INPUT(buf,result,max_size) (result = yy_input(buf, max_size))
-
-#define YY_NEVER_INTERACTIVE 1
-#define FIELDS 1
-
-#line 753 "Gen_glslang.cpp"
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-#endif
-
-#if YY_STACK_USED
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-#line 91 "glslang.l"
-
-#line 906 "Gen_glslang.cpp"
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yy_start;
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 428 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 679 );
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- yy_act = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 92 "glslang.l"
-{ /* ?? carriage and/or line-feed? */ };
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 94 "glslang.l"
-{ pyylval->lex.line = yylineno; return(ATTRIBUTE); }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 95 "glslang.l"
-{ pyylval->lex.line = yylineno; return(CONST_QUAL); }
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 96 "glslang.l"
-{ pyylval->lex.line = yylineno; return(UNIFORM); }
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 97 "glslang.l"
-{ pyylval->lex.line = yylineno; return(VARYING); }
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 99 "glslang.l"
-{ pyylval->lex.line = yylineno; return(BREAK); }
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 100 "glslang.l"
-{ pyylval->lex.line = yylineno; return(CONTINUE); }
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 101 "glslang.l"
-{ pyylval->lex.line = yylineno; return(DO); }
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 102 "glslang.l"
-{ pyylval->lex.line = yylineno; return(FOR); }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 103 "glslang.l"
-{ pyylval->lex.line = yylineno; return(WHILE); }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 105 "glslang.l"
-{ pyylval->lex.line = yylineno; return(IF); }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 106 "glslang.l"
-{ pyylval->lex.line = yylineno; return(ELSE); }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 108 "glslang.l"
-{ pyylval->lex.line = yylineno; return(IN_QUAL); }
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 109 "glslang.l"
-{ pyylval->lex.line = yylineno; return(OUT_QUAL); }
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 110 "glslang.l"
-{ pyylval->lex.line = yylineno; return(INOUT_QUAL); }
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 112 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT_TYPE); }
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 113 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(INT_TYPE); }
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 114 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(VOID_TYPE); }
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 115 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(BOOL_TYPE); }
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 116 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.b = true; return(BOOLCONSTANT); }
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 117 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.b = false; return(BOOLCONSTANT); }
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 119 "glslang.l"
-{ pyylval->lex.line = yylineno; return(DISCARD); }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 120 "glslang.l"
-{ pyylval->lex.line = yylineno; return(RETURN); }
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 122 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX2); }
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 123 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX3); }
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 124 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX4); }
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 126 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); }
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 127 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); }
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 128 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC4); }
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 129 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); }
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 130 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); }
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 131 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 132 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); }
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 133 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); }
- YY_BREAK
-case 35:
-YY_RULE_SETUP
-#line 134 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); }
- YY_BREAK
-case 36:
-YY_RULE_SETUP
-#line 136 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; }
- YY_BREAK
-case 37:
-YY_RULE_SETUP
-#line 137 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }
- YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 138 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER3D; }
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 139 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBE; }
- YY_BREAK
-case 40:
-YY_RULE_SETUP
-#line 140 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DSHADOW; }
- YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 141 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DSHADOW; }
- YY_BREAK
-case 42:
-YY_RULE_SETUP
-#line 143 "glslang.l"
-{ pyylval->lex.line = yylineno; return(STRUCT); }
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 145 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 44:
-YY_RULE_SETUP
-#line 147 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 148 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 149 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 150 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 48:
-YY_RULE_SETUP
-#line 151 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 49:
-YY_RULE_SETUP
-#line 152 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 50:
-YY_RULE_SETUP
-#line 153 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 51:
-YY_RULE_SETUP
-#line 155 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 52:
-YY_RULE_SETUP
-#line 156 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 53:
-YY_RULE_SETUP
-#line 157 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 54:
-YY_RULE_SETUP
-#line 159 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 55:
-YY_RULE_SETUP
-#line 160 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 56:
-YY_RULE_SETUP
-#line 161 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 57:
-YY_RULE_SETUP
-#line 162 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 58:
-YY_RULE_SETUP
-#line 163 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 59:
-YY_RULE_SETUP
-#line 164 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 60:
-YY_RULE_SETUP
-#line 165 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 61:
-YY_RULE_SETUP
-#line 166 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 62:
-YY_RULE_SETUP
-#line 168 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 63:
-YY_RULE_SETUP
-#line 169 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 64:
-YY_RULE_SETUP
-#line 170 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 65:
-YY_RULE_SETUP
-#line 171 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 66:
-YY_RULE_SETUP
-#line 172 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 67:
-YY_RULE_SETUP
-#line 173 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 68:
-YY_RULE_SETUP
-#line 175 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 69:
-YY_RULE_SETUP
-#line 176 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 70:
-YY_RULE_SETUP
-#line 178 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 71:
-YY_RULE_SETUP
-#line 179 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 72:
-YY_RULE_SETUP
-#line 180 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 73:
-YY_RULE_SETUP
-#line 181 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 74:
-YY_RULE_SETUP
-#line 182 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 75:
-YY_RULE_SETUP
-#line 183 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 76:
-YY_RULE_SETUP
-#line 184 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 77:
-YY_RULE_SETUP
-#line 185 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 78:
-YY_RULE_SETUP
-#line 186 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 79:
-YY_RULE_SETUP
-#line 188 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 80:
-YY_RULE_SETUP
-#line 189 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 81:
-YY_RULE_SETUP
-#line 190 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 82:
-YY_RULE_SETUP
-#line 192 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 83:
-YY_RULE_SETUP
-#line 193 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 84:
-YY_RULE_SETUP
-#line 195 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 85:
-YY_RULE_SETUP
-#line 196 "glslang.l"
-{ PaReservedWord(); return 0; }
- YY_BREAK
-case 86:
-YY_RULE_SETUP
-#line 198 "glslang.l"
-{
- pyylval->lex.line = yylineno;
- pyylval->lex.string = NewPoolTString(yytext);
- return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
-}
- YY_BREAK
-case 87:
-YY_RULE_SETUP
-#line 204 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
- YY_BREAK
-case 88:
-YY_RULE_SETUP
-#line 205 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
- YY_BREAK
-case 89:
-YY_RULE_SETUP
-#line 206 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;}
- YY_BREAK
-case 90:
-YY_RULE_SETUP
-#line 207 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
- YY_BREAK
-case 91:
-YY_RULE_SETUP
-#line 209 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }
- YY_BREAK
-case 92:
-YY_RULE_SETUP
-#line 210 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }
- YY_BREAK
-case 93:
-YY_RULE_SETUP
-#line 211 "glslang.l"
-{ pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }
- YY_BREAK
-case 94:
-YY_RULE_SETUP
-#line 213 "glslang.l"
-{ int ret = PaParseComment(pyylval->lex.line, parseContext); if (!ret) return ret; }
- YY_BREAK
-case 95:
-YY_RULE_SETUP
-#line 215 "glslang.l"
-{ pyylval->lex.line = yylineno; return(ADD_ASSIGN); }
- YY_BREAK
-case 96:
-YY_RULE_SETUP
-#line 216 "glslang.l"
-{ pyylval->lex.line = yylineno; return(SUB_ASSIGN); }
- YY_BREAK
-case 97:
-YY_RULE_SETUP
-#line 217 "glslang.l"
-{ pyylval->lex.line = yylineno; return(MUL_ASSIGN); }
- YY_BREAK
-case 98:
-YY_RULE_SETUP
-#line 218 "glslang.l"
-{ pyylval->lex.line = yylineno; return(DIV_ASSIGN); }
- YY_BREAK
-case 99:
-YY_RULE_SETUP
-#line 219 "glslang.l"
-{ pyylval->lex.line = yylineno; return(MOD_ASSIGN); }
- YY_BREAK
-case 100:
-YY_RULE_SETUP
-#line 220 "glslang.l"
-{ pyylval->lex.line = yylineno; return(LEFT_ASSIGN); }
- YY_BREAK
-case 101:
-YY_RULE_SETUP
-#line 221 "glslang.l"
-{ pyylval->lex.line = yylineno; return(RIGHT_ASSIGN); }
- YY_BREAK
-case 102:
-YY_RULE_SETUP
-#line 222 "glslang.l"
-{ pyylval->lex.line = yylineno; return(AND_ASSIGN); }
- YY_BREAK
-case 103:
-YY_RULE_SETUP
-#line 223 "glslang.l"
-{ pyylval->lex.line = yylineno; return(XOR_ASSIGN); }
- YY_BREAK
-case 104:
-YY_RULE_SETUP
-#line 224 "glslang.l"
-{ pyylval->lex.line = yylineno; return(OR_ASSIGN); }
- YY_BREAK
-case 105:
-YY_RULE_SETUP
-#line 226 "glslang.l"
-{ pyylval->lex.line = yylineno; return(INC_OP); }
- YY_BREAK
-case 106:
-YY_RULE_SETUP
-#line 227 "glslang.l"
-{ pyylval->lex.line = yylineno; return(DEC_OP); }
- YY_BREAK
-case 107:
-YY_RULE_SETUP
-#line 228 "glslang.l"
-{ pyylval->lex.line = yylineno; return(AND_OP); }
- YY_BREAK
-case 108:
-YY_RULE_SETUP
-#line 229 "glslang.l"
-{ pyylval->lex.line = yylineno; return(OR_OP); }
- YY_BREAK
-case 109:
-YY_RULE_SETUP
-#line 230 "glslang.l"
-{ pyylval->lex.line = yylineno; return(XOR_OP); }
- YY_BREAK
-case 110:
-YY_RULE_SETUP
-#line 231 "glslang.l"
-{ pyylval->lex.line = yylineno; return(LE_OP); }
- YY_BREAK
-case 111:
-YY_RULE_SETUP
-#line 232 "glslang.l"
-{ pyylval->lex.line = yylineno; return(GE_OP); }
- YY_BREAK
-case 112:
-YY_RULE_SETUP
-#line 233 "glslang.l"
-{ pyylval->lex.line = yylineno; return(EQ_OP); }
- YY_BREAK
-case 113:
-YY_RULE_SETUP
-#line 234 "glslang.l"
-{ pyylval->lex.line = yylineno; return(NE_OP); }
- YY_BREAK
-case 114:
-YY_RULE_SETUP
-#line 235 "glslang.l"
-{ pyylval->lex.line = yylineno; return(LEFT_OP); }
- YY_BREAK
-case 115:
-YY_RULE_SETUP
-#line 236 "glslang.l"
-{ pyylval->lex.line = yylineno; return(RIGHT_OP); }
- YY_BREAK
-case 116:
-YY_RULE_SETUP
-#line 237 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(SEMICOLON); }
- YY_BREAK
-case 117:
-YY_RULE_SETUP
-#line 238 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(LEFT_BRACE); }
- YY_BREAK
-case 118:
-YY_RULE_SETUP
-#line 239 "glslang.l"
-{ pyylval->lex.line = yylineno; return(RIGHT_BRACE); }
- YY_BREAK
-case 119:
-YY_RULE_SETUP
-#line 240 "glslang.l"
-{ pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return(COMMA); }
- YY_BREAK
-case 120:
-YY_RULE_SETUP
-#line 241 "glslang.l"
-{ pyylval->lex.line = yylineno; return(COLON); }
- YY_BREAK
-case 121:
-YY_RULE_SETUP
-#line 242 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(EQUAL); }
- YY_BREAK
-case 122:
-YY_RULE_SETUP
-#line 243 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.lexAfterType = false; parseContext.inTypeParen = true; return(LEFT_PAREN); }
- YY_BREAK
-case 123:
-YY_RULE_SETUP
-#line 244 "glslang.l"
-{ pyylval->lex.line = yylineno; parseContext.inTypeParen = false; return(RIGHT_PAREN); }
- YY_BREAK
-case 124:
-YY_RULE_SETUP
-#line 245 "glslang.l"
-{ pyylval->lex.line = yylineno; return(LEFT_BRACKET); }
- YY_BREAK
-case 125:
-YY_RULE_SETUP
-#line 246 "glslang.l"
-{ pyylval->lex.line = yylineno; return(RIGHT_BRACKET); }
- YY_BREAK
-case 126:
-YY_RULE_SETUP
-#line 247 "glslang.l"
-{ BEGIN(FIELDS); return(DOT); }
- YY_BREAK
-case 127:
-YY_RULE_SETUP
-#line 248 "glslang.l"
-{ pyylval->lex.line = yylineno; return(BANG); }
- YY_BREAK
-case 128:
-YY_RULE_SETUP
-#line 249 "glslang.l"
-{ pyylval->lex.line = yylineno; return(DASH); }
- YY_BREAK
-case 129:
-YY_RULE_SETUP
-#line 250 "glslang.l"
-{ pyylval->lex.line = yylineno; return(TILDE); }
- YY_BREAK
-case 130:
-YY_RULE_SETUP
-#line 251 "glslang.l"
-{ pyylval->lex.line = yylineno; return(PLUS); }
- YY_BREAK
-case 131:
-YY_RULE_SETUP
-#line 252 "glslang.l"
-{ pyylval->lex.line = yylineno; return(STAR); }
- YY_BREAK
-case 132:
-YY_RULE_SETUP
-#line 253 "glslang.l"
-{ pyylval->lex.line = yylineno; return(SLASH); }
- YY_BREAK
-case 133:
-YY_RULE_SETUP
-#line 254 "glslang.l"
-{ pyylval->lex.line = yylineno; return(PERCENT); }
- YY_BREAK
-case 134:
-YY_RULE_SETUP
-#line 255 "glslang.l"
-{ pyylval->lex.line = yylineno; return(LEFT_ANGLE); }
- YY_BREAK
-case 135:
-YY_RULE_SETUP
-#line 256 "glslang.l"
-{ pyylval->lex.line = yylineno; return(RIGHT_ANGLE); }
- YY_BREAK
-case 136:
-YY_RULE_SETUP
-#line 257 "glslang.l"
-{ pyylval->lex.line = yylineno; return(VERTICAL_BAR); }
- YY_BREAK
-case 137:
-YY_RULE_SETUP
-#line 258 "glslang.l"
-{ pyylval->lex.line = yylineno; return(CARET); }
- YY_BREAK
-case 138:
-YY_RULE_SETUP
-#line 259 "glslang.l"
-{ pyylval->lex.line = yylineno; return(AMPERSAND); }
- YY_BREAK
-case 139:
-YY_RULE_SETUP
-#line 260 "glslang.l"
-{ pyylval->lex.line = yylineno; return(QUESTION); }
- YY_BREAK
-case 140:
-YY_RULE_SETUP
-#line 262 "glslang.l"
-{
-BEGIN(INITIAL);
- pyylval->lex.line = yylineno;
- pyylval->lex.string = NewPoolTString(yytext);
- return FIELD_SELECTION; }
- YY_BREAK
-case 141:
-YY_RULE_SETUP
-#line 267 "glslang.l"
-{}
- YY_BREAK
-case 142:
-YY_RULE_SETUP
-#line 269 "glslang.l"
-{ }
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(FIELDS):
-#line 270 "glslang.l"
-{ (&parseContext)->AfterEOF = true; yy_delete_buffer(YY_CURRENT_BUFFER); yyterminate();}
- YY_BREAK
-case 143:
-YY_RULE_SETUP
-#line 271 "glslang.l"
-{ parseContext.infoSink.info << "FLEX: Unknown char " << yytext << "\n";
- return 0; }
- YY_BREAK
-case 144:
-YY_RULE_SETUP
-#line 274 "glslang.l"
-ECHO;
- YY_BREAK
-#line 1723 "Gen_glslang.cpp"
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-static int yy_get_next_buffer()
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
-
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = yy_start;
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 428 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
- {
- register int yy_is_jam;
- register char *yy_cp = yy_c_buf_p;
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 428 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 427);
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-#endif /* ifndef YY_NO_UNPUT */
-
-
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-
- return c;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
-
-
- {
- yy_flush_buffer( b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
-#else
-void yy_flush_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
- }
-
-
-#ifndef YY_NO_SCAN_BUFFER
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
-char *base;
-yy_size_t size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
-yyconst char *yy_str;
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len );
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
-yyconst char *bytes;
-int len;
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
-#line 274 "glslang.l"
-
-
-
-//Including Pre-processor.
-extern "C" {
- #include "./preprocessor/preprocess.h"
-}
-
-//
-// The YY_INPUT macro just calls this. Maybe this could be just put into
-// the macro directly.
-//
-
-int yy_input(char* buf, int max_size)
-{
- char *char_token =NULL;
- int len;
-
- if ((len = yylex_CPP(buf, max_size)) == 0)
- return 0;
- if (len >= max_size)
- YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-
- buf[len] = ' ';
- return len+1;
-}
-
-
-//
-// Parse an array of strings using yyparse. We set up globals used by
-// yywrap.
-//
-// Returns 0 for success, as per yyparse().
-//
-int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseContextLocal)
-{
- int argv0len;
- ScanFromString(argv[0]);
-
- //Storing the Current Compiler Parse context into the cpp structure.
- cpp->pC = (void*)&parseContextLocal;
-
- if (!argv || argc == 0 || !argv[0])
- return 1;
-
- if (!strLen) {
- argv0len = (int) strlen(argv[0]);
- strLen = &argv0len;
- }
- yyrestart(0);
- (&parseContextLocal)->AfterEOF = false;
- cpp->PaWhichStr = 0;
- cpp->PaArgv = argv;
- cpp->PaArgc = argc;
- cpp->PaStrLen = strLen;
- yylineno = 1;
-
- if (*cpp->PaStrLen >= 0) {
- int ret;
- #ifdef _WIN32
- ret = yyparse(parseContextLocal);
- #else
- ret = yyparse((void*)(&parseContextLocal));
- #endif
- if (cpp->CompileError == 1 || parseContextLocal.recoveredFromError || parseContextLocal.numErrors > 0)
- return 1;
- else
- return 0;
- }
- else
- return 0;
-}
-
-void yyerror(char *s)
-{
- if (((TParseContext *)cpp->pC)->AfterEOF) {
- if (cpp->tokensBeforeEOF == 1) {
- GlobalParseContext->error(yylineno, "syntax error", "pre-mature EOF", s, "");
- GlobalParseContext->recover();
- }
- } else {
- GlobalParseContext->error(yylineno, "syntax error", yytext, s, "");
- GlobalParseContext->recover();
- }
-}
-
-void PaReservedWord()
-{
- GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", "");
- GlobalParseContext->recover();
-}
-
-int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbol)
-{
- symbol = parseContextLocal.symbolTable.find(id);
- if (parseContextLocal.lexAfterType == false && symbol && symbol->isVariable()) {
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType()) {
- parseContextLocal.lexAfterType = true;
- return TYPE_NAME;
- }
- }
-
- return IDENTIFIER;
-}
-
-int PaParseComment(int &lineno, TParseContext& parseContextLocal)
-{
- int transitionFlag = 0;
- int nextChar;
-
- while (transitionFlag != 2) {
- nextChar = yyinput();
- if (nextChar == '\n')
- lineno++;
- switch (nextChar) {
- case '*' :
- transitionFlag = 1;
- break;
- case '/' : /* if star is the previous character, then it is the end of comment */
- if (transitionFlag == 1) {
- return 1 ;
- }
- break;
- case EOF :
- /* Raise error message here */
- parseContextLocal.error(yylineno, "End of shader found before end of comment.", "", "", "");
- GlobalParseContext->recover();
- return YY_NULL;
- default : /* Any other character will be a part of the comment */
- transitionFlag = 0;
- }
- }
- return 1;
-}
-
-extern "C" {
-
-void CPPDebugLogMsg(const char *msg)
-{
- ((TParseContext *)cpp->pC)->infoSink.debug.message(EPrefixNone, msg);
-}
-
-void CPPWarningToInfoLog(const char *msg)
-{
- ((TParseContext *)cpp->pC)->infoSink.info.message(EPrefixWarning, msg, yylineno);
-}
-
-void CPPShInfoLogMsg(const char *msg)
-{
- ((TParseContext *)cpp->pC)->error(yylineno,"", "",msg,"");
- GlobalParseContext->recover();
-}
-
-void CPPErrorToInfoLog(char *msg)
-{
- ((TParseContext *)cpp->pC)->error(yylineno,"syntax error", "",msg,"");
- GlobalParseContext->recover();
-}
-
-void SetLineNumber(int line)
-{
- yylineno &= ~SourceLocLineMask;
- yylineno |= line;
-}
-
-void SetStringNumber(int string)
-{
- yylineno = (string << SourceLocStringShift) | (yylineno & SourceLocLineMask);
-}
-
-int GetStringNumber(void)
-{
- return yylineno >> 16;
-}
-
-int GetLineNumber(void)
-{
- return yylineno & SourceLocLineMask;
-}
-
-void IncLineNumber(void)
-{
- if ((yylineno & SourceLocLineMask) <= SourceLocLineMask)
- ++yylineno;
-}
-
-void DecLineNumber(void)
-{
- if ((yylineno & SourceLocLineMask) > 0)
- --yylineno;
-}
-
-void HandlePragma(const char **tokens, int numTokens)
-{
- if (!strcmp(tokens[0], "optimize")) {
- if (numTokens != 4) {
- CPPShInfoLogMsg("optimize pragma syntax is incorrect");
- return;
- }
-
- if (strcmp(tokens[1], "(")) {
- CPPShInfoLogMsg("\"(\" expected after 'optimize' keyword");
- return;
- }
-
- if (!strcmp(tokens[2], "on"))
- ((TParseContext *)cpp->pC)->contextPragma.optimize = true;
- else if (!strcmp(tokens[2], "off"))
- ((TParseContext *)cpp->pC)->contextPragma.optimize = false;
- else {
- CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'optimize' pragma");
- return;
- }
-
- if (strcmp(tokens[3], ")")) {
- CPPShInfoLogMsg("\")\" expected to end 'optimize' pragma");
- return;
- }
- } else if (!strcmp(tokens[0], "debug")) {
- if (numTokens != 4) {
- CPPShInfoLogMsg("debug pragma syntax is incorrect");
- return;
- }
-
- if (strcmp(tokens[1], "(")) {
- CPPShInfoLogMsg("\"(\" expected after 'debug' keyword");
- return;
- }
-
- if (!strcmp(tokens[2], "on"))
- ((TParseContext *)cpp->pC)->contextPragma.debug = true;
- else if (!strcmp(tokens[2], "off"))
- ((TParseContext *)cpp->pC)->contextPragma.debug = false;
- else {
- CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'debug' pragma");
- return;
- }
-
- if (strcmp(tokens[3], ")")) {
- CPPShInfoLogMsg("\")\" expected to end 'debug' pragma");
- return;
- }
- } else {
- /*
- // implementation specific pragma
- // use ((TParseContext *)cpp->pC)->contextPragma.pragmaTable to store the information about pragma
- // For now, just ignore the pragma that the implementation cannot recognize
- // An Example of one such implementation for a pragma that has a syntax like
- // #pragma pragmaname(pragmavalue)
- // This implementation stores the current pragmavalue against the pragma name in pragmaTable.
- if (numTokens == 4 && !strcmp(tokens[1], "(") && !strcmp(tokens[3], ")")) {
- TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;
- TPragmaTable::iterator iter;
- iter = pragmaTable.find(TString(tokens[0]));
- if (iter != pragmaTable.end()) {
- iter->second = tokens[2];
- } else {
- pragmaTable[tokens[0]] = tokens[2];
- }
- }
- */
- }
-}
-
-void StoreStr(char *string)
-{
- TString strSrc;
- strSrc = TString(string);
-
- ((TParseContext *)cpp->pC)->HashErrMsg = ((TParseContext *)cpp->pC)->HashErrMsg + " " + strSrc;
-}
-
-const char* GetStrfromTStr(void)
-{
- cpp->ErrMsg = (((TParseContext *)cpp->pC)->HashErrMsg).c_str();
- return cpp->ErrMsg;
-}
-
-void ResetTString(void)
-{
- ((TParseContext *)cpp->pC)->HashErrMsg = "";
-}
-
-TBehavior GetBehavior(const char* behavior)
-{
- if (!strcmp("require", behavior))
- return EBhRequire;
- else if (!strcmp("enable", behavior))
- return EBhEnable;
- else if (!strcmp("disable", behavior))
- return EBhDisable;
- else if (!strcmp("warn", behavior))
- return EBhWarn;
- else {
- CPPShInfoLogMsg((TString("behavior '") + behavior + "' is not supported").c_str());
- return EBhDisable;
- }
-}
-
-void updateExtensionBehavior(const char* extName, const char* behavior)
-{
- TBehavior behaviorVal = GetBehavior(behavior);
- TMap<TString, TBehavior>:: iterator iter;
- TString msg;
-
- // special cased for all extension
- if (!strcmp(extName, "all")) {
- if (behaviorVal == EBhRequire || behaviorVal == EBhEnable) {
- CPPShInfoLogMsg("extension 'all' cannot have 'require' or 'enable' behavior");
- return;
- } else {
- for (iter = ((TParseContext *)cpp->pC)->extensionBehavior.begin(); iter != ((TParseContext *)cpp->pC)->extensionBehavior.end(); ++iter)
- iter->second = behaviorVal;
- }
- } else {
- iter = ((TParseContext *)cpp->pC)->extensionBehavior.find(TString(extName));
- if (iter == ((TParseContext *)cpp->pC)->extensionBehavior.end()) {
- switch (behaviorVal) {
- case EBhRequire:
- CPPShInfoLogMsg((TString("extension '") + extName + "' is not supported").c_str());
- break;
- case EBhEnable:
- case EBhWarn:
- case EBhDisable:
- msg = TString("extension '") + extName + "' is not supported";
- ((TParseContext *)cpp->pC)->infoSink.info.message(EPrefixWarning, msg.c_str(), yylineno);
- break;
- }
- return;
- } else
- iter->second = behaviorVal;
- }
-}
-
-}
-
-void setInitialState()
-{
- yy_start = 1;
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/Gen_glslang_tab.cpp b/src/mesa/shader/slang/MachineIndependent/Gen_glslang_tab.cpp
deleted file mode 100755
index 69aa6087262..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/Gen_glslang_tab.cpp
+++ /dev/null
@@ -1,4354 +0,0 @@
-/* A Bison parser, made by GNU Bison 1.875. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* Written by Richard Stallman by simplifying the original so called
- ``semantic'' parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- ATTRIBUTE = 258,
- CONST_QUAL = 259,
- BOOL_TYPE = 260,
- FLOAT_TYPE = 261,
- INT_TYPE = 262,
- BREAK = 263,
- CONTINUE = 264,
- DO = 265,
- ELSE = 266,
- FOR = 267,
- IF = 268,
- DISCARD = 269,
- RETURN = 270,
- BVEC2 = 271,
- BVEC3 = 272,
- BVEC4 = 273,
- IVEC2 = 274,
- IVEC3 = 275,
- IVEC4 = 276,
- VEC2 = 277,
- VEC3 = 278,
- VEC4 = 279,
- MATRIX2 = 280,
- MATRIX3 = 281,
- MATRIX4 = 282,
- IN_QUAL = 283,
- OUT_QUAL = 284,
- INOUT_QUAL = 285,
- UNIFORM = 286,
- VARYING = 287,
- STRUCT = 288,
- VOID_TYPE = 289,
- WHILE = 290,
- SAMPLER1D = 291,
- SAMPLER2D = 292,
- SAMPLER3D = 293,
- SAMPLERCUBE = 294,
- SAMPLER1DSHADOW = 295,
- SAMPLER2DSHADOW = 296,
- IDENTIFIER = 297,
- TYPE_NAME = 298,
- FLOATCONSTANT = 299,
- INTCONSTANT = 300,
- BOOLCONSTANT = 301,
- FIELD_SELECTION = 302,
- LEFT_OP = 303,
- RIGHT_OP = 304,
- INC_OP = 305,
- DEC_OP = 306,
- LE_OP = 307,
- GE_OP = 308,
- EQ_OP = 309,
- NE_OP = 310,
- AND_OP = 311,
- OR_OP = 312,
- XOR_OP = 313,
- MUL_ASSIGN = 314,
- DIV_ASSIGN = 315,
- ADD_ASSIGN = 316,
- MOD_ASSIGN = 317,
- LEFT_ASSIGN = 318,
- RIGHT_ASSIGN = 319,
- AND_ASSIGN = 320,
- XOR_ASSIGN = 321,
- OR_ASSIGN = 322,
- SUB_ASSIGN = 323,
- LEFT_PAREN = 324,
- RIGHT_PAREN = 325,
- LEFT_BRACKET = 326,
- RIGHT_BRACKET = 327,
- LEFT_BRACE = 328,
- RIGHT_BRACE = 329,
- DOT = 330,
- COMMA = 331,
- COLON = 332,
- EQUAL = 333,
- SEMICOLON = 334,
- BANG = 335,
- DASH = 336,
- TILDE = 337,
- PLUS = 338,
- STAR = 339,
- SLASH = 340,
- PERCENT = 341,
- LEFT_ANGLE = 342,
- RIGHT_ANGLE = 343,
- VERTICAL_BAR = 344,
- CARET = 345,
- AMPERSAND = 346,
- QUESTION = 347
- };
-#endif
-#define ATTRIBUTE 258
-#define CONST_QUAL 259
-#define BOOL_TYPE 260
-#define FLOAT_TYPE 261
-#define INT_TYPE 262
-#define BREAK 263
-#define CONTINUE 264
-#define DO 265
-#define ELSE 266
-#define FOR 267
-#define IF 268
-#define DISCARD 269
-#define RETURN 270
-#define BVEC2 271
-#define BVEC3 272
-#define BVEC4 273
-#define IVEC2 274
-#define IVEC3 275
-#define IVEC4 276
-#define VEC2 277
-#define VEC3 278
-#define VEC4 279
-#define MATRIX2 280
-#define MATRIX3 281
-#define MATRIX4 282
-#define IN_QUAL 283
-#define OUT_QUAL 284
-#define INOUT_QUAL 285
-#define UNIFORM 286
-#define VARYING 287
-#define STRUCT 288
-#define VOID_TYPE 289
-#define WHILE 290
-#define SAMPLER1D 291
-#define SAMPLER2D 292
-#define SAMPLER3D 293
-#define SAMPLERCUBE 294
-#define SAMPLER1DSHADOW 295
-#define SAMPLER2DSHADOW 296
-#define IDENTIFIER 297
-#define TYPE_NAME 298
-#define FLOATCONSTANT 299
-#define INTCONSTANT 300
-#define BOOLCONSTANT 301
-#define FIELD_SELECTION 302
-#define LEFT_OP 303
-#define RIGHT_OP 304
-#define INC_OP 305
-#define DEC_OP 306
-#define LE_OP 307
-#define GE_OP 308
-#define EQ_OP 309
-#define NE_OP 310
-#define AND_OP 311
-#define OR_OP 312
-#define XOR_OP 313
-#define MUL_ASSIGN 314
-#define DIV_ASSIGN 315
-#define ADD_ASSIGN 316
-#define MOD_ASSIGN 317
-#define LEFT_ASSIGN 318
-#define RIGHT_ASSIGN 319
-#define AND_ASSIGN 320
-#define XOR_ASSIGN 321
-#define OR_ASSIGN 322
-#define SUB_ASSIGN 323
-#define LEFT_PAREN 324
-#define RIGHT_PAREN 325
-#define LEFT_BRACKET 326
-#define RIGHT_BRACKET 327
-#define LEFT_BRACE 328
-#define RIGHT_BRACE 329
-#define DOT 330
-#define COMMA 331
-#define COLON 332
-#define EQUAL 333
-#define SEMICOLON 334
-#define BANG 335
-#define DASH 336
-#define TILDE 337
-#define PLUS 338
-#define STAR 339
-#define SLASH 340
-#define PERCENT 341
-#define LEFT_ANGLE 342
-#define RIGHT_ANGLE 343
-#define VERTICAL_BAR 344
-#define CARET 345
-#define AMPERSAND 346
-#define QUESTION 347
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 39 "glslang.y"
-
-
-/* Based on:
-ANSI C Yacc grammar
-
-In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
-matching Lex specification) for the April 30, 1985 draft version of the
-ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
-original, as mentioned in the answer to question 17.25 of the comp.lang.c
-FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
-
-I intend to keep this version as close to the current C Standard grammar as
-possible; please let me know if you discover discrepancies.
-
-Jutta Degener, 1995
-*/
-
-#include "SymbolTable.h"
-#include "ParseHelper.h"
-#include "../Public/ShaderLang.h"
-
-#ifdef _WIN32
- #define YYPARSE_PARAM parseContext
- #define YYPARSE_PARAM_DECL TParseContext&
- #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
- #define YYLEX_PARAM parseContext
-#else
- #define YYPARSE_PARAM parseContextLocal
- #define parseContext (*((TParseContext*)(parseContextLocal)))
- #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
- #define YYLEX_PARAM (void*)(parseContextLocal)
- extern void yyerror(char*);
-#endif
-
-#define FRAG_VERT_ONLY(S, L) { \
- if (parseContext.language != EShLangFragment && \
- parseContext.language != EShLangVertex) { \
- parseContext.error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define VERTEX_ONLY(S, L) { \
- if (parseContext.language != EShLangVertex) { \
- parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define FRAG_ONLY(S, L) { \
- if (parseContext.language != EShLangFragment) { \
- parseContext.error(L, " supported in fragment shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define PACK_ONLY(S, L) { \
- if (parseContext.language != EShLangPack) { \
- parseContext.error(L, " supported in pack shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define UNPACK_ONLY(S, L) { \
- if (parseContext.language != EShLangUnpack) { \
- parseContext.error(L, " supported in unpack shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define PACK_UNPACK_ONLY(S, L) { \
- if (parseContext.language != EShLangUnpack && \
- parseContext.language != EShLangPack) { \
- parseContext.error(L, " supported in pack/unpack shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 117 "glslang.y"
-typedef union YYSTYPE {
- struct {
- TSourceLoc line;
- union {
- TString *string;
- float f;
- int i;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TSourceLoc line;
- TOperator op;
- union {
- TIntermNode* intermNode;
- TIntermNodePair nodePair;
- TIntermTyped* intermTypedNode;
- TIntermAggregate* intermAggregate;
- };
- union {
- TPublicType type;
- TQualifier qualifier;
- TFunction* function;
- TParameter param;
- TTypeLine typeLine;
- TTypeList* typeList;
- };
- } interm;
-} YYSTYPE;
-/* Line 191 of yacc.c. */
-#line 369 "glslang.tab.c"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations. */
-#line 148 "glslang.y"
-
-#ifndef _WIN32
- extern int yylex(YYSTYPE*, void*);
-#endif
-
-
-/* Line 214 of yacc.c. */
-#line 386 "glslang.tab.c"
-
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# else
-# ifndef YYSTACK_USE_ALLOCA
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC malloc
-# define YYSTACK_FREE free
-# endif
-#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short yyss;
- YYSTYPE yyvs;
- };
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined (__STDC__) || defined (__cplusplus)
- typedef signed char yysigned_char;
-#else
- typedef short yysigned_char;
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 59
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1231
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 93
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 75
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 214
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 331
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 347
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const unsigned char yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
- 85, 86, 87, 88, 89, 90, 91, 92
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const unsigned short yyprhs[] =
-{
- 0, 0, 3, 5, 7, 9, 11, 13, 17, 19,
- 24, 26, 30, 33, 36, 38, 40, 43, 46, 49,
- 51, 54, 58, 61, 63, 65, 67, 69, 71, 73,
- 75, 77, 79, 81, 83, 85, 87, 89, 91, 93,
- 95, 97, 99, 102, 105, 108, 110, 112, 114, 116,
- 118, 122, 126, 130, 132, 136, 140, 142, 146, 150,
- 152, 156, 160, 164, 168, 170, 174, 178, 180, 184,
- 186, 190, 192, 196, 198, 202, 204, 208, 210, 214,
- 216, 222, 224, 228, 230, 232, 234, 236, 238, 240,
- 242, 244, 246, 248, 250, 252, 256, 258, 261, 264,
- 267, 269, 271, 274, 278, 282, 285, 291, 295, 298,
- 302, 305, 306, 308, 310, 312, 314, 319, 321, 325,
- 331, 338, 344, 346, 349, 354, 360, 365, 367, 370,
- 372, 374, 376, 378, 380, 382, 384, 386, 388, 390,
- 392, 394, 396, 398, 400, 402, 404, 406, 408, 410,
- 412, 414, 416, 418, 420, 422, 424, 426, 432, 437,
- 439, 442, 446, 448, 452, 454, 459, 461, 463, 465,
- 467, 469, 471, 473, 475, 477, 480, 481, 482, 488,
- 490, 492, 495, 499, 501, 504, 506, 509, 515, 519,
- 521, 523, 528, 529, 536, 537, 546, 547, 555, 557,
- 559, 561, 562, 565, 569, 572, 575, 578, 582, 585,
- 587, 590, 592, 594, 595
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const short yyrhs[] =
-{
- 164, 0, -1, 42, -1, 94, -1, 45, -1, 44,
- -1, 46, -1, 69, 121, 70, -1, 95, -1, 96,
- 71, 97, 72, -1, 98, -1, 96, 75, 47, -1,
- 96, 50, -1, 96, 51, -1, 121, -1, 99, -1,
- 101, 70, -1, 100, 70, -1, 102, 34, -1, 102,
- -1, 102, 119, -1, 101, 76, 119, -1, 103, 69,
- -1, 104, -1, 42, -1, 6, -1, 7, -1, 5,
- -1, 22, -1, 23, -1, 24, -1, 16, -1, 17,
- -1, 18, -1, 19, -1, 20, -1, 21, -1, 25,
- -1, 26, -1, 27, -1, 43, -1, 96, -1, 50,
- 105, -1, 51, 105, -1, 106, 105, -1, 83, -1,
- 81, -1, 80, -1, 82, -1, 105, -1, 107, 84,
- 105, -1, 107, 85, 105, -1, 107, 86, 105, -1,
- 107, -1, 108, 83, 107, -1, 108, 81, 107, -1,
- 108, -1, 109, 48, 108, -1, 109, 49, 108, -1,
- 109, -1, 110, 87, 109, -1, 110, 88, 109, -1,
- 110, 52, 109, -1, 110, 53, 109, -1, 110, -1,
- 111, 54, 110, -1, 111, 55, 110, -1, 111, -1,
- 112, 91, 111, -1, 112, -1, 113, 90, 112, -1,
- 113, -1, 114, 89, 113, -1, 114, -1, 115, 56,
- 114, -1, 115, -1, 116, 58, 115, -1, 116, -1,
- 117, 57, 116, -1, 117, -1, 117, 92, 121, 77,
- 119, -1, 118, -1, 105, 120, 119, -1, 78, -1,
- 59, -1, 60, -1, 62, -1, 61, -1, 68, -1,
- 63, -1, 64, -1, 65, -1, 66, -1, 67, -1,
- 119, -1, 121, 76, 119, -1, 118, -1, 124, 79,
- -1, 132, 79, -1, 125, 70, -1, 127, -1, 126,
- -1, 127, 129, -1, 126, 76, 129, -1, 134, 42,
- 69, -1, 136, 42, -1, 136, 42, 71, 122, 72,
- -1, 135, 130, 128, -1, 130, 128, -1, 135, 130,
- 131, -1, 130, 131, -1, -1, 28, -1, 29, -1,
- 30, -1, 136, -1, 136, 71, 122, 72, -1, 133,
- -1, 132, 76, 42, -1, 132, 76, 42, 71, 72,
- -1, 132, 76, 42, 71, 122, 72, -1, 132, 76,
- 42, 78, 142, -1, 134, -1, 134, 42, -1, 134,
- 42, 71, 72, -1, 134, 42, 71, 122, 72, -1,
- 134, 42, 78, 142, -1, 136, -1, 135, 136, -1,
- 4, -1, 3, -1, 32, -1, 31, -1, 34, -1,
- 6, -1, 7, -1, 5, -1, 22, -1, 23, -1,
- 24, -1, 16, -1, 17, -1, 18, -1, 19, -1,
- 20, -1, 21, -1, 25, -1, 26, -1, 27, -1,
- 36, -1, 37, -1, 38, -1, 39, -1, 40, -1,
- 41, -1, 137, -1, 43, -1, 33, 42, 73, 138,
- 74, -1, 33, 73, 138, 74, -1, 139, -1, 138,
- 139, -1, 136, 140, 79, -1, 141, -1, 140, 76,
- 141, -1, 42, -1, 42, 71, 122, 72, -1, 119,
- -1, 123, -1, 146, -1, 145, -1, 143, -1, 152,
- -1, 153, -1, 156, -1, 163, -1, 73, 74, -1,
- -1, -1, 73, 147, 151, 148, 74, -1, 150, -1,
- 145, -1, 73, 74, -1, 73, 151, 74, -1, 144,
- -1, 151, 144, -1, 79, -1, 121, 79, -1, 13,
- 69, 121, 70, 154, -1, 144, 11, 144, -1, 144,
- -1, 121, -1, 134, 42, 78, 142, -1, -1, 35,
- 69, 157, 155, 70, 149, -1, -1, 10, 158, 144,
- 35, 69, 121, 70, 79, -1, -1, 12, 69, 159,
- 160, 162, 70, 149, -1, 152, -1, 143, -1, 155,
- -1, -1, 161, 79, -1, 161, 79, 121, -1, 9,
- 79, -1, 8, 79, -1, 15, 79, -1, 15, 121,
- 79, -1, 14, 79, -1, 165, -1, 164, 165, -1,
- 166, -1, 123, -1, -1, 124, 167, 150, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned short yyrline[] =
-{
- 0, 210, 210, 245, 248, 261, 266, 271, 277, 280,
- 348, 351, 460, 470, 483, 491, 586, 590, 597, 601,
- 608, 614, 623, 629, 640, 656, 657, 658, 659, 660,
- 661, 662, 663, 664, 665, 666, 667, 668, 669, 670,
- 671, 682, 685, 695, 705, 727, 728, 729, 730, 736,
- 737, 746, 755, 767, 768, 776, 787, 788, 797, 809,
- 810, 820, 830, 840, 853, 854, 864, 877, 878, 890,
- 891, 903, 904, 916, 917, 930, 931, 944, 945, 958,
- 959, 976, 977, 990, 991, 992, 993, 994, 995, 996,
- 997, 998, 999, 1000, 1004, 1007, 1018, 1026, 1027, 1035,
- 1071, 1074, 1081, 1089, 1110, 1129, 1140, 1167, 1172, 1182,
- 1187, 1197, 1200, 1203, 1206, 1212, 1217, 1235, 1238, 1246,
- 1254, 1262, 1284, 1288, 1297, 1306, 1315, 1405, 1408, 1425,
- 1429, 1436, 1444, 1453, 1458, 1463, 1468, 1479, 1484, 1489,
- 1494, 1499, 1504, 1509, 1514, 1519, 1524, 1530, 1536, 1542,
- 1548, 1554, 1560, 1566, 1572, 1578, 1583, 1596, 1606, 1614,
- 1617, 1632, 1650, 1654, 1660, 1665, 1681, 1685, 1689, 1690,
- 1696, 1697, 1698, 1699, 1700, 1704, 1705, 1705, 1705, 1713,
- 1714, 1719, 1722, 1730, 1733, 1739, 1740, 1744, 1752, 1756,
- 1766, 1771, 1788, 1788, 1793, 1793, 1800, 1800, 1813, 1816,
- 1822, 1825, 1831, 1835, 1842, 1849, 1856, 1863, 1874, 1883,
- 1887, 1894, 1897, 1903, 1903
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "ATTRIBUTE", "CONST_QUAL", "BOOL_TYPE",
- "FLOAT_TYPE", "INT_TYPE", "BREAK", "CONTINUE", "DO", "ELSE", "FOR",
- "IF", "DISCARD", "RETURN", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
- "IVEC4", "VEC2", "VEC3", "VEC4", "MATRIX2", "MATRIX3", "MATRIX4",
- "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM", "VARYING", "STRUCT",
- "VOID_TYPE", "WHILE", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D",
- "SAMPLERCUBE", "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "IDENTIFIER",
- "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT", "BOOLCONSTANT",
- "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP",
- "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN",
- "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN",
- "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN",
- "RIGHT_PAREN", "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE",
- "RIGHT_BRACE", "DOT", "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG",
- "DASH", "TILDE", "PLUS", "STAR", "SLASH", "PERCENT", "LEFT_ANGLE",
- "RIGHT_ANGLE", "VERTICAL_BAR", "CARET", "AMPERSAND", "QUESTION",
- "$accept", "variable_identifier", "primary_expression",
- "postfix_expression", "integer_expression", "function_call",
- "function_call_generic", "function_call_header_no_parameters",
- "function_call_header_with_parameters", "function_call_header",
- "function_identifier", "constructor_identifier", "unary_expression",
- "unary_operator", "multiplicative_expression", "additive_expression",
- "shift_expression", "relational_expression", "equality_expression",
- "and_expression", "exclusive_or_expression", "inclusive_or_expression",
- "logical_and_expression", "logical_xor_expression",
- "logical_or_expression", "conditional_expression",
- "assignment_expression", "assignment_operator", "expression",
- "constant_expression", "declaration", "function_prototype",
- "function_declarator", "function_header_with_parameters",
- "function_header", "parameter_declarator", "parameter_declaration",
- "parameter_qualifier", "parameter_type_specifier",
- "init_declarator_list", "single_declaration", "fully_specified_type",
- "type_qualifier", "type_specifier", "struct_specifier",
- "struct_declaration_list", "struct_declaration",
- "struct_declarator_list", "struct_declarator", "initializer",
- "declaration_statement", "statement", "simple_statement",
- "compound_statement", "@1", "@2", "statement_no_new_scope",
- "compound_statement_no_new_scope", "statement_list",
- "expression_statement", "selection_statement",
- "selection_rest_statement", "condition", "iteration_statement", "@3",
- "@4", "@5", "for_init_statement", "conditionopt", "for_rest_statement",
- "jump_statement", "translation_unit", "external_declaration",
- "function_definition", "@6", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const unsigned short yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
- 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
- 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const unsigned char yyr1[] =
-{
- 0, 93, 94, 95, 95, 95, 95, 95, 96, 96,
- 96, 96, 96, 96, 97, 98, 99, 99, 100, 100,
- 101, 101, 102, 103, 103, 104, 104, 104, 104, 104,
- 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
- 104, 105, 105, 105, 105, 106, 106, 106, 106, 107,
- 107, 107, 107, 108, 108, 108, 109, 109, 109, 110,
- 110, 110, 110, 110, 111, 111, 111, 112, 112, 113,
- 113, 114, 114, 115, 115, 116, 116, 117, 117, 118,
- 118, 119, 119, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 121, 121, 122, 123, 123, 124,
- 125, 125, 126, 126, 127, 128, 128, 129, 129, 129,
- 129, 130, 130, 130, 130, 131, 131, 132, 132, 132,
- 132, 132, 133, 133, 133, 133, 133, 134, 134, 135,
- 135, 135, 135, 136, 136, 136, 136, 136, 136, 136,
- 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
- 136, 136, 136, 136, 136, 136, 136, 137, 137, 138,
- 138, 139, 140, 140, 141, 141, 142, 143, 144, 144,
- 145, 145, 145, 145, 145, 146, 147, 148, 146, 149,
- 149, 150, 150, 151, 151, 152, 152, 153, 154, 154,
- 155, 155, 157, 156, 158, 156, 159, 156, 160, 160,
- 161, 161, 162, 162, 163, 163, 163, 163, 163, 164,
- 164, 165, 165, 167, 166
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const unsigned char yyr2[] =
-{
- 0, 2, 1, 1, 1, 1, 1, 3, 1, 4,
- 1, 3, 2, 2, 1, 1, 2, 2, 2, 1,
- 2, 3, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 2, 2, 1, 1, 1, 1, 1,
- 3, 3, 3, 1, 3, 3, 1, 3, 3, 1,
- 3, 3, 3, 3, 1, 3, 3, 1, 3, 1,
- 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
- 5, 1, 3, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 1, 2, 2, 2,
- 1, 1, 2, 3, 3, 2, 5, 3, 2, 3,
- 2, 0, 1, 1, 1, 1, 4, 1, 3, 5,
- 6, 5, 1, 2, 4, 5, 4, 1, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 5, 4, 1,
- 2, 3, 1, 3, 1, 4, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 2, 0, 0, 5, 1,
- 1, 2, 3, 1, 2, 1, 2, 5, 3, 1,
- 1, 4, 0, 6, 0, 8, 0, 7, 1, 1,
- 1, 0, 2, 3, 2, 2, 2, 3, 2, 1,
- 2, 1, 1, 0, 3
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const unsigned char yydefact[] =
-{
- 0, 130, 129, 136, 134, 135, 140, 141, 142, 143,
- 144, 145, 137, 138, 139, 146, 147, 148, 132, 131,
- 0, 133, 149, 150, 151, 152, 153, 154, 156, 212,
- 213, 0, 101, 111, 0, 117, 122, 0, 127, 155,
- 0, 209, 211, 0, 0, 97, 0, 99, 111, 112,
- 113, 114, 102, 0, 111, 0, 98, 123, 128, 1,
- 210, 0, 0, 0, 159, 0, 214, 103, 108, 110,
- 115, 0, 118, 104, 0, 0, 0, 164, 0, 162,
- 158, 160, 136, 134, 135, 0, 0, 194, 0, 0,
- 0, 0, 140, 141, 142, 143, 144, 145, 137, 138,
- 139, 146, 147, 148, 0, 2, 156, 5, 4, 6,
- 0, 0, 0, 176, 181, 185, 47, 46, 48, 45,
- 3, 8, 41, 10, 15, 0, 0, 19, 0, 23,
- 49, 0, 53, 56, 59, 64, 67, 69, 71, 73,
- 75, 77, 79, 81, 94, 0, 167, 0, 170, 183,
- 169, 168, 0, 171, 172, 173, 174, 105, 0, 107,
- 109, 0, 0, 27, 25, 26, 31, 32, 33, 34,
- 35, 36, 28, 29, 30, 37, 38, 39, 40, 124,
- 49, 96, 0, 166, 126, 157, 0, 0, 161, 205,
- 204, 0, 196, 0, 208, 206, 0, 192, 42, 43,
- 0, 175, 0, 12, 13, 0, 0, 17, 16, 0,
- 18, 20, 22, 84, 85, 87, 86, 89, 90, 91,
- 92, 93, 88, 83, 0, 44, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 186, 182, 184,
- 0, 0, 119, 0, 121, 125, 0, 163, 0, 0,
- 0, 207, 0, 7, 177, 0, 14, 11, 21, 82,
- 50, 51, 52, 55, 54, 57, 58, 62, 63, 60,
- 61, 65, 66, 68, 70, 72, 74, 76, 78, 0,
- 95, 0, 116, 120, 165, 0, 199, 198, 201, 0,
- 190, 0, 0, 0, 9, 0, 106, 0, 200, 0,
- 0, 189, 187, 0, 0, 178, 80, 0, 202, 0,
- 0, 0, 180, 193, 179, 0, 203, 197, 188, 191,
- 195
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const short yydefgoto[] =
-{
- -1, 120, 121, 122, 265, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
- 138, 139, 140, 141, 142, 143, 144, 224, 145, 182,
- 146, 147, 31, 32, 33, 68, 52, 53, 69, 34,
- 35, 36, 37, 38, 39, 63, 64, 78, 79, 184,
- 148, 149, 150, 151, 202, 303, 323, 324, 152, 153,
- 154, 312, 302, 155, 262, 191, 259, 298, 309, 310,
- 156, 40, 41, 42, 46
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -297
-static const short yypact[] =
-{
- 1149, -297, -297, -297, -297, -297, -297, -297, -297, -297,
- -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
- -27, -297, -297, -297, -297, -297, -297, -297, -297, -297,
- -42, -28, -32, 4, 18, -297, 19, 1188, -297, -297,
- 1108, -297, -297, -10, 1188, -297, -3, -297, 36, -297,
- -297, -297, -297, 1188, 83, 33, -297, -9, -297, -297,
- -297, 1188, 39, 1025, -297, 235, -297, -297, -297, -297,
- -18, 1188, -52, -297, 685, 957, 1064, -17, 20, -297,
- -297, -297, 29, 45, 63, 21, 23, -297, 75, 77,
- 66, 753, 78, 79, 81, 82, 84, 85, 87, 89,
- 90, 91, 93, 94, 95, 96, 97, -297, -297, -297,
- 957, 957, 957, 120, -297, -297, -297, -297, -297, -297,
- -297, -297, 5, -297, -297, 98, 1, 821, 100, -297,
- 57, 957, 42, -56, 37, -40, 76, 61, 80, 106,
- 111, 138, -41, -297, -297, 30, -297, -42, -297, -297,
- -297, -297, 316, -297, -297, -297, -297, 127, 957, -297,
- -297, 889, 957, -297, -297, -297, -297, -297, -297, -297,
- -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
- -297, -297, 128, -297, -297, -297, 957, 39, -297, -297,
- -297, 397, -297, 957, -297, -297, 31, -297, -297, -297,
- 3, -297, 397, -297, -297, 957, 152, -297, -297, 957,
- -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
- -297, -297, -297, -297, 957, -297, 957, 957, 957, 957,
- 957, 957, 957, 957, 957, 957, 957, 957, 957, 957,
- 957, 957, 957, 957, 957, 957, 957, -297, -297, -297,
- 957, 129, -297, 130, -297, -297, 131, -297, 169, 549,
- 12, -297, 617, -297, 397, 133, 134, -297, -297, -297,
- -297, -297, -297, 42, 42, -56, -56, 37, 37, 37,
- 37, -40, -40, 76, 61, 80, 106, 111, 138, 60,
- -297, 135, -297, -297, -297, 137, -297, -297, 617, 397,
- 134, 167, 141, 140, -297, 957, -297, 957, -297, 136,
- 142, 205, -297, 143, 478, -297, -297, 13, 957, 478,
- 397, 957, -297, -297, -297, 139, 134, -297, -297, -297,
- -297
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const short yypgoto[] =
-{
- -297, -297, -297, -297, -297, -297, -297, -297, -297, -297,
- -297, -297, -53, -297, -91, -89, -143, -97, -20, -16,
- -21, -15, -14, -22, -297, -57, -75, -297, -90, -155,
- 9, 10, -297, -297, -297, 154, 175, 172, 160, -297,
- -297, -257, -19, -33, -297, 171, -4, -297, 46, -160,
- -25, -107, -296, -297, -297, -297, -84, 190, 35, 6,
- -297, -297, -35, -297, -297, -297, -297, -297, -297, -297,
- -297, -297, 224, -297, -297
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -101
-static const short yytable[] =
-{
- 183, 196, 254, 251, 58, 301, 253, 1, 2, 29,
- 30, 62, 233, 234, 54, 43, 244, 181, 322, 161,
- 70, 180, 200, 322, 157, 229, 162, 230, 62, 54,
- 62, 256, 49, 50, 51, 18, 19, 45, 70, 1,
- 2, 301, 47, 62, 48, 249, 44, 235, 236, 29,
- 30, 245, 211, 158, 186, 203, 204, 198, 199, 81,
- 73, 57, 74, 61, 49, 50, 51, 18, 19, 75,
- 65, 208, 81, 263, -100, 72, 205, 209, 225, 246,
- 206, 77, 299, 325, 258, 231, 232, 183, 246, 246,
- 277, 278, 279, 280, 55, 291, 187, 56, -27, 188,
- 189, 181, 190, 260, 181, 180, 246, 246, 180, 247,
- 261, 49, 50, 51, -25, 266, 213, 214, 215, 216,
- 217, 218, 219, 220, 221, 222, 226, 227, 228, 181,
- 237, 238, -26, 180, 268, 223, 246, 305, 273, 274,
- 281, 282, 275, 276, 192, 194, 193, -31, -32, 269,
- -33, -34, 239, -35, -36, 289, -28, 249, -29, -30,
- -37, 329, -38, -39, 197, -24, -40, 242, 207, 212,
- 240, 290, 300, 270, 271, 272, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 180, 180, 311, 181, 201, 241, 243, 180, 250, 267,
- 255, 292, 293, 294, 295, 304, 307, 306, 300, 313,
- 246, 314, 319, 328, 315, 318, 320, 317, 330, 283,
- 285, 321, 288, 67, 284, 159, 71, 286, 326, 287,
- 316, 160, 76, 257, 296, 327, 66, 264, 1, 2,
- 82, 83, 84, 85, 86, 87, 183, 88, 89, 90,
- 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 102, 103, 308, 60, 297, 18, 19, 20, 21,
- 104, 22, 23, 24, 25, 26, 27, 105, 106, 107,
- 108, 109, 0, 0, 0, 110, 111, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 112, 0, 0, 0, 113, 114,
- 0, 0, 0, 0, 115, 116, 117, 118, 119, 1,
- 2, 82, 83, 84, 85, 86, 87, 0, 88, 89,
- 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
- 100, 101, 102, 103, 0, 0, 0, 18, 19, 20,
- 21, 104, 22, 23, 24, 25, 26, 27, 105, 106,
- 107, 108, 109, 0, 0, 0, 110, 111, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 112, 0, 0, 0, 113,
- 248, 0, 0, 0, 0, 115, 116, 117, 118, 119,
- 1, 2, 82, 83, 84, 85, 86, 87, 0, 88,
- 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
- 99, 100, 101, 102, 103, 0, 0, 0, 18, 19,
- 20, 21, 104, 22, 23, 24, 25, 26, 27, 105,
- 106, 107, 108, 109, 0, 0, 0, 110, 111, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
- 113, 0, 0, 0, 0, 0, 115, 116, 117, 118,
- 119, 1, 2, 82, 83, 84, 85, 86, 87, 0,
- 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
- 98, 99, 100, 101, 102, 103, 0, 0, 0, 18,
- 19, 20, 21, 104, 22, 23, 24, 25, 26, 27,
- 105, 106, 107, 108, 109, 0, 0, 0, 110, 111,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 112, 0, 0,
- 0, 65, 1, 2, 82, 83, 84, 115, 116, 117,
- 118, 119, 0, 0, 0, 92, 93, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 0, 0, 0,
- 18, 19, 20, 21, 0, 22, 23, 24, 25, 26,
- 27, 105, 106, 107, 108, 109, 0, 0, 0, 110,
- 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
- 1, 2, 82, 83, 84, 0, 0, 0, 115, 116,
- 117, 118, 119, 92, 93, 94, 95, 96, 97, 98,
- 99, 100, 101, 102, 103, 0, 0, 0, 18, 19,
- 20, 21, 0, 22, 23, 24, 25, 26, 27, 105,
- 106, 107, 108, 109, 0, 0, 0, 110, 111, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
- 163, 164, 165, 0, 0, 0, 0, 116, 117, 118,
- 119, 166, 167, 168, 169, 170, 171, 172, 173, 174,
- 175, 176, 177, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 105, 178, 107,
- 108, 109, 0, 0, 0, 110, 111, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 112, 0, 0, 179, 163, 164,
- 165, 0, 0, 0, 0, 116, 117, 118, 119, 166,
- 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
- 177, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 105, 178, 107, 108, 109,
- 0, 0, 0, 110, 111, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 112, 0, 0, 0, 163, 164, 165, 0,
- 0, 0, 195, 116, 117, 118, 119, 166, 167, 168,
- 169, 170, 171, 172, 173, 174, 175, 176, 177, 0,
- 0, 0, 0, 0, 0, 210, 0, 0, 0, 0,
- 0, 0, 0, 105, 178, 107, 108, 109, 0, 0,
- 0, 110, 111, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 112, 0, 0, 0, 163, 164, 165, 0, 0, 0,
- 0, 116, 117, 118, 119, 166, 167, 168, 169, 170,
- 171, 172, 173, 174, 175, 176, 177, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 105, 178, 107, 108, 109, 0, 0, 0, 110,
- 111, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
- 0, 252, 163, 164, 165, 0, 0, 0, 0, 116,
- 117, 118, 119, 166, 167, 168, 169, 170, 171, 172,
- 173, 174, 175, 176, 177, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 105,
- 178, 107, 108, 109, 0, 0, 0, 110, 111, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
- 3, 4, 5, 0, 0, 0, 0, 116, 117, 118,
- 119, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 0, 0, 0, 0, 0, 20, 21,
- 0, 22, 23, 24, 25, 26, 27, 0, 28, 3,
- 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 0, 0, 0, 0, 0, 20, 21, 80,
- 22, 23, 24, 25, 26, 27, 0, 28, 59, 0,
- 0, 1, 2, 3, 4, 5, 0, 0, 0, 0,
- 0, 0, 0, 0, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 0, 0, 185, 18,
- 19, 20, 21, 0, 22, 23, 24, 25, 26, 27,
- 0, 28, 1, 2, 3, 4, 5, 0, 0, 0,
- 0, 0, 0, 0, 0, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 0, 0, 0,
- 18, 19, 20, 21, 0, 22, 23, 24, 25, 26,
- 27, 0, 28, 3, 4, 5, 0, 0, 0, 0,
- 0, 0, 0, 0, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 0, 0, 0, 0,
- 0, 20, 21, 0, 22, 23, 24, 25, 26, 27,
- 0, 28
-};
-
-static const short yycheck[] =
-{
- 75, 91, 162, 158, 37, 262, 161, 3, 4, 0,
- 0, 44, 52, 53, 33, 42, 57, 74, 314, 71,
- 53, 74, 112, 319, 42, 81, 78, 83, 61, 48,
- 63, 186, 28, 29, 30, 31, 32, 79, 71, 3,
- 4, 298, 70, 76, 76, 152, 73, 87, 88, 40,
- 40, 92, 127, 71, 71, 50, 51, 110, 111, 63,
- 69, 42, 71, 73, 28, 29, 30, 31, 32, 78,
- 73, 70, 76, 70, 70, 42, 71, 76, 131, 76,
- 75, 42, 70, 70, 191, 48, 49, 162, 76, 76,
- 233, 234, 235, 236, 76, 250, 76, 79, 69, 79,
- 79, 158, 79, 193, 161, 158, 76, 76, 161, 79,
- 79, 28, 29, 30, 69, 205, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 84, 85, 86, 186,
- 54, 55, 69, 186, 209, 78, 76, 77, 229, 230,
- 237, 238, 231, 232, 69, 79, 69, 69, 69, 224,
- 69, 69, 91, 69, 69, 245, 69, 264, 69, 69,
- 69, 321, 69, 69, 69, 69, 69, 56, 70, 69,
- 90, 246, 262, 226, 227, 228, 229, 230, 231, 232,
- 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
- 243, 244, 299, 250, 74, 89, 58, 250, 71, 47,
- 72, 72, 72, 72, 35, 72, 69, 72, 298, 42,
- 76, 70, 70, 320, 74, 79, 11, 307, 79, 239,
- 241, 78, 244, 48, 240, 71, 54, 242, 318, 243,
- 305, 71, 61, 187, 259, 319, 46, 202, 3, 4,
- 5, 6, 7, 8, 9, 10, 321, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 298, 40, 259, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 69, -1, -1, -1, 73, 74,
- -1, -1, -1, -1, 79, 80, 81, 82, 83, 3,
- 4, 5, 6, 7, 8, 9, 10, -1, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, -1, -1, -1, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, -1, -1, -1, 50, 51, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 69, -1, -1, -1, 73,
- 74, -1, -1, -1, -1, 79, 80, 81, 82, 83,
- 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, -1, -1, -1, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
- 73, -1, -1, -1, -1, -1, 79, 80, 81, 82,
- 83, 3, 4, 5, 6, 7, 8, 9, 10, -1,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, -1, -1, -1, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, -1, -1, -1, 50, 51,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 69, -1, -1,
- -1, 73, 3, 4, 5, 6, 7, 79, 80, 81,
- 82, 83, -1, -1, -1, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
- 31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, -1, -1, -1, 50,
- 51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
- 3, 4, 5, 6, 7, -1, -1, -1, 79, 80,
- 81, 82, 83, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, -1, -1, -1, 31, 32,
- 33, 34, -1, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
- 5, 6, 7, -1, -1, -1, -1, 80, 81, 82,
- 83, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 42, 43, 44,
- 45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 69, -1, -1, 72, 5, 6,
- 7, -1, -1, -1, -1, 80, 81, 82, 83, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 42, 43, 44, 45, 46,
- -1, -1, -1, 50, 51, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 69, -1, -1, -1, 5, 6, 7, -1,
- -1, -1, 79, 80, 81, 82, 83, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, -1,
- -1, -1, -1, -1, -1, 34, -1, -1, -1, -1,
- -1, -1, -1, 42, 43, 44, 45, 46, -1, -1,
- -1, 50, 51, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 69, -1, -1, -1, 5, 6, 7, -1, -1, -1,
- -1, 80, 81, 82, 83, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 42, 43, 44, 45, 46, -1, -1, -1, 50,
- 51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 69, -1,
- -1, 72, 5, 6, 7, -1, -1, -1, -1, 80,
- 81, 82, 83, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 42,
- 43, 44, 45, 46, -1, -1, -1, 50, 51, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 69, -1, -1, -1,
- 5, 6, 7, -1, -1, -1, -1, 80, 81, 82,
- 83, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, -1, -1, -1, -1, -1, 33, 34,
- -1, 36, 37, 38, 39, 40, 41, -1, 43, 5,
- 6, 7, -1, -1, -1, -1, -1, -1, -1, -1,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, -1, -1, -1, -1, -1, 33, 34, 74,
- 36, 37, 38, 39, 40, 41, -1, 43, 0, -1,
- -1, 3, 4, 5, 6, 7, -1, -1, -1, -1,
- -1, -1, -1, -1, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, -1, -1, 74, 31,
- 32, 33, 34, -1, 36, 37, 38, 39, 40, 41,
- -1, 43, 3, 4, 5, 6, 7, -1, -1, -1,
- -1, -1, -1, -1, -1, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, -1, -1, -1,
- 31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
- 41, -1, 43, 5, 6, 7, -1, -1, -1, -1,
- -1, -1, -1, -1, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
- -1, 33, 34, -1, 36, 37, 38, 39, 40, 41,
- -1, 43
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const unsigned char yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 31, 32,
- 33, 34, 36, 37, 38, 39, 40, 41, 43, 123,
- 124, 125, 126, 127, 132, 133, 134, 135, 136, 137,
- 164, 165, 166, 42, 73, 79, 167, 70, 76, 28,
- 29, 30, 129, 130, 135, 76, 79, 42, 136, 0,
- 165, 73, 136, 138, 139, 73, 150, 129, 128, 131,
- 136, 130, 42, 69, 71, 78, 138, 42, 140, 141,
- 74, 139, 5, 6, 7, 8, 9, 10, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 35, 42, 43, 44, 45, 46,
- 50, 51, 69, 73, 74, 79, 80, 81, 82, 83,
- 94, 95, 96, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
- 115, 116, 117, 118, 119, 121, 123, 124, 143, 144,
- 145, 146, 151, 152, 153, 156, 163, 42, 71, 128,
- 131, 71, 78, 5, 6, 7, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 43, 72,
- 105, 118, 122, 119, 142, 74, 71, 76, 79, 79,
- 79, 158, 69, 69, 79, 79, 121, 69, 105, 105,
- 121, 74, 147, 50, 51, 71, 75, 70, 70, 76,
- 34, 119, 69, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 78, 120, 105, 84, 85, 86, 81,
- 83, 48, 49, 52, 53, 87, 88, 54, 55, 91,
- 90, 89, 56, 58, 57, 92, 76, 79, 74, 144,
- 71, 122, 72, 122, 142, 72, 122, 141, 144, 159,
- 121, 79, 157, 70, 151, 97, 121, 47, 119, 119,
- 105, 105, 105, 107, 107, 108, 108, 109, 109, 109,
- 109, 110, 110, 111, 112, 113, 114, 115, 116, 121,
- 119, 122, 72, 72, 72, 35, 143, 152, 160, 70,
- 121, 134, 155, 148, 72, 77, 72, 69, 155, 161,
- 162, 144, 154, 42, 70, 74, 119, 121, 79, 70,
- 11, 78, 145, 149, 150, 70, 121, 149, 144, 142,
- 79
-};
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-
-#define YYFAIL goto yyerrlab
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up");\
- YYERROR; \
- } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run). */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.first_line = Rhs[1].first_line; \
- Current.first_column = Rhs[1].first_column; \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
-#endif
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval)
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-# define YYDSYMPRINT(Args) \
-do { \
- if (yydebug) \
- yysymprint Args; \
-} while (0)
-
-# define YYDSYMPRINTF(Title, Token, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Token, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (cinluded). |
-`------------------------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_stack_print (short *bottom, short *top)
-#else
-static void
-yy_stack_print (bottom, top)
- short *bottom;
- short *top;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (/* Nothing. */; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yy_reduce_print (int yyrule)
-#else
-static void
-yy_reduce_print (yyrule)
- int yyrule;
-#endif
-{
- int yyi;
- unsigned int yylineno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
- yyrule - 1, yylineno);
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
- YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
- YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (Rule); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YYDSYMPRINT(Args)
-# define YYDSYMPRINTF(Title, Token, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#if YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
-{
- register const char *yys = yystr;
-
- while (*yys++ != '\0')
- continue;
-
- return yys - yystr - 1;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-# if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
-{
- register char *yyd = yydest;
- register const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-#endif /* !YYERROR_VERBOSE */
-
-
-
-#if YYDEBUG
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yysymprint (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- if (yytype < YYNTOKENS)
- {
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-# ifdef YYPRINT
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- }
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- switch (yytype)
- {
- default:
- break;
- }
- YYFPRINTF (yyoutput, ")");
-}
-
-#endif /* ! YYDEBUG */
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-#if defined (__STDC__) || defined (__cplusplus)
-static void
-yydestruct (int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yytype, yyvaluep)
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- /* Pacify ``unused variable'' warnings. */
- (void) yyvaluep;
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-
-/* Prevent warnings from -Wmissing-prototypes. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM);
-# else
-int yyparse ();
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-int yyparse (void *YYPARSE_PARAM)
-# else
-int yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-# endif
-#else /* ! YYPARSE_PARAM */
-#if defined (__STDC__) || defined (__cplusplus)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
- /* The lookahead symbol. */
-int yychar;
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far. */
-int yynerrs;
-
- register int yystate;
- register int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- short yyssa[YYINITDEPTH];
- short *yyss = yyssa;
- register short *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK (yyvsp--, yyssp--)
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyoverflowlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- short *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2:
-#line 210 "glslang.y"
- {
- // The symbol table search was done in the lexical phase
- const TSymbol* symbol = yyvsp[0].lex.symbol;
- const TVariable* variable;
- if (symbol == 0) {
- parseContext.error(yyvsp[0].lex.line, "undeclared identifier", yyvsp[0].lex.string->c_str(), "");
- parseContext.recover();
- TType type(EbtFloat);
- TVariable* fakeVariable = new TVariable(yyvsp[0].lex.string, type);
- parseContext.symbolTable.insert(*fakeVariable);
- variable = fakeVariable;
- } else {
- // This identifier can only be a variable type symbol
- if (! symbol->isVariable()) {
- parseContext.error(yyvsp[0].lex.line, "variable expected", yyvsp[0].lex.string->c_str(), "");
- parseContext.recover();
- }
- variable = static_cast<const TVariable*>(symbol);
- }
-
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
-
- if (variable->getType().getQualifier() == EvqConst ) {
- constUnion* constArray = variable->getConstPointer();
- TType t(variable->getType());
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(constArray, t, yyvsp[0].lex.line);
- } else
- yyval.interm.intermTypedNode = parseContext.intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(), yyvsp[0].lex.line);
- ;}
- break;
-
- case 3:
-#line 245 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 4:
-#line 248 "glslang.y"
- {
- //
- // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
- // check for overflow for constants
- //
- if (abs(yyvsp[0].lex.i) >= (1 << 16)) {
- parseContext.error(yyvsp[0].lex.line, " integer constant overflow", "", "");
- parseContext.recover();
- }
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = yyvsp[0].lex.i;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
- ;}
- break;
-
- case 5:
-#line 261 "glslang.y"
- {
- constUnion *unionArray = new constUnion[1];
- unionArray->fConst = yyvsp[0].lex.f;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].lex.line);
- ;}
- break;
-
- case 6:
-#line 266 "glslang.y"
- {
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = yyvsp[0].lex.b;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[0].lex.line);
- ;}
- break;
-
- case 7:
-#line 271 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
- ;}
- break;
-
- case 8:
-#line 277 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 9:
-#line 280 "glslang.y"
- {
- if (!yyvsp[-3].interm.intermTypedNode->isArray() && !yyvsp[-3].interm.intermTypedNode->isMatrix() && !yyvsp[-3].interm.intermTypedNode->isVector()) {
- if (yyvsp[-3].interm.intermTypedNode->getAsSymbolNode())
- parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", yyvsp[-3].interm.intermTypedNode->getAsSymbolNode()->getSymbol().c_str(), "");
- else
- parseContext.error(yyvsp[-2].lex.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
- parseContext.recover();
- }
- if (yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst && !yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
- if (yyvsp[-3].interm.intermTypedNode->isVector()) { // constant folding for vectors
- TVectorFields fields;
- fields.num = 1;
- fields.offsets[0] = yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst; // need to do it this way because v.xy sends fields integer array
- yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
- } else if (yyvsp[-3].interm.intermTypedNode->isMatrix()) { // constant folding for matrices
- yyval.interm.intermTypedNode = parseContext.addConstMatrixNode(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, yyvsp[-3].interm.intermTypedNode, yyvsp[-2].lex.line);
- }
- } else {
- if (yyvsp[-1].interm.intermTypedNode->getQualifier() == EvqConst) {
- if ((yyvsp[-3].interm.intermTypedNode->isVector() || yyvsp[-3].interm.intermTypedNode->isMatrix()) && yyvsp[-3].interm.intermTypedNode->getType().getNominalSize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst && !yyvsp[-3].interm.intermTypedNode->isArray() ) {
- parseContext.error(yyvsp[-2].lex.line, "", "[", "field selection out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- parseContext.recover();
- } else {
- if (yyvsp[-3].interm.intermTypedNode->isArray()) {
- if (yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {
- if (yyvsp[-3].interm.intermTypedNode->getType().getMaxArraySize() <= yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst) {
- if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst, true, yyvsp[-2].lex.line))
- parseContext.recover();
- } else {
- if (parseContext.arraySetMaxSize(yyvsp[-3].interm.intermTypedNode->getAsSymbolNode(), yyvsp[-3].interm.intermTypedNode->getTypePointer(), 0, false, yyvsp[-2].lex.line))
- parseContext.recover();
- }
- } else if ( yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst >= yyvsp[-3].interm.intermTypedNode->getType().getArraySize()) {
- parseContext.error(yyvsp[-2].lex.line, "", "[", "array index out of range '%d'", yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- parseContext.recover();
- }
- }
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
- }
- } else {
- if (yyvsp[-3].interm.intermTypedNode->isArray() && yyvsp[-3].interm.intermTypedNode->getType().getArraySize() == 0) {
- parseContext.error(yyvsp[-2].lex.line, "", "[", "array must be redeclared with a size before being indexed with a variable");
- parseContext.recover();
- }
-
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexIndirect, yyvsp[-3].interm.intermTypedNode, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
- }
- }
- if (yyval.interm.intermTypedNode == 0) {
- constUnion *unionArray = new constUnion[1];
- unionArray->fConst = 0.0;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[-2].lex.line);
- } else if (yyvsp[-3].interm.intermTypedNode->isArray()) {
- if (yyvsp[-3].interm.intermTypedNode->getType().getStruct())
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getType().getStruct(), yyvsp[-3].interm.intermTypedNode->getType().getTypeName()));
- else
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize(), yyvsp[-3].interm.intermTypedNode->isMatrix()));
- } else if (yyvsp[-3].interm.intermTypedNode->isMatrix() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
- else if (yyvsp[-3].interm.intermTypedNode->isMatrix())
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-3].interm.intermTypedNode->getNominalSize()));
- else if (yyvsp[-3].interm.intermTypedNode->isVector() && yyvsp[-3].interm.intermTypedNode->getType().getQualifier() == EvqConst)
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqConst));
- else if (yyvsp[-3].interm.intermTypedNode->isVector())
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-3].interm.intermTypedNode->getBasicType(), EvqTemporary));
- else
- yyval.interm.intermTypedNode->setType(yyvsp[-3].interm.intermTypedNode->getType());
- ;}
- break;
-
- case 10:
-#line 348 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 11:
-#line 351 "glslang.y"
- {
- if (yyvsp[-2].interm.intermTypedNode->isArray()) {
- parseContext.error(yyvsp[0].lex.line, "cannot apply dot operator to an array", ".", "");
- parseContext.recover();
- }
-
- if (yyvsp[-2].interm.intermTypedNode->isVector()) {
- TVectorFields fields;
- if (! parseContext.parseVectorFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {
- fields.num = 1;
- fields.offsets[0] = 0;
- parseContext.recover();
- }
-
- if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) { // constant folding for vector fields
- yyval.interm.intermTypedNode = parseContext.addConstVectorNode(fields, yyvsp[-2].interm.intermTypedNode, yyvsp[0].lex.line);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- else
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqConst, (int) (*yyvsp[0].lex.string).size()));
- } else {
- if (fields.num == 1) {
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = fields.offsets[0];
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));
- } else {
- TString vectorString = *yyvsp[0].lex.string;
- TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, yyvsp[0].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpVectorSwizzle, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(),EvqTemporary, (int) vectorString.size()));
- }
- }
- } else if (yyvsp[-2].interm.intermTypedNode->isMatrix()) {
- TMatrixFields fields;
- if (! parseContext.parseMatrixFields(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode->getNominalSize(), fields, yyvsp[0].lex.line)) {
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = 0;
- fields.col = 0;
- parseContext.recover();
- }
-
- if (fields.wholeRow || fields.wholeCol) {
- parseContext.error(yyvsp[-1].lex.line, " non-scalar fields not implemented yet", ".", "");
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = 0;
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType(), EvqTemporary, yyvsp[-2].interm.intermTypedNode->getNominalSize()));
- } else {
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = fields.col * yyvsp[-2].interm.intermTypedNode->getNominalSize() + fields.row;
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirect, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode->setType(TType(yyvsp[-2].interm.intermTypedNode->getBasicType()));
- }
- } else if (yyvsp[-2].interm.intermTypedNode->getBasicType() == EbtStruct) {
- bool fieldFound = false;
- TTypeList* fields = yyvsp[-2].interm.intermTypedNode->getType().getStruct();
- if (fields == 0) {
- parseContext.error(yyvsp[-1].lex.line, "structure has no fields", "Internal Error", "");
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- } else {
- unsigned int i;
- for (i = 0; i < fields->size(); ++i) {
- if ((*fields)[i].type->getFieldName() == *yyvsp[0].lex.string) {
- fieldFound = true;
- break;
- }
- }
- if (fieldFound) {
- if (yyvsp[-2].interm.intermTypedNode->getType().getQualifier() == EvqConst) {
- yyval.interm.intermTypedNode = parseContext.addConstStruct(*yyvsp[0].lex.string, yyvsp[-2].interm.intermTypedNode, yyvsp[-1].lex.line);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- else {
- yyval.interm.intermTypedNode->setType(*(*fields)[i].type);
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- yyval.interm.intermTypedNode->getTypePointer()->changeQualifier(EvqConst);
- }
- } else {
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = i;
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), yyvsp[0].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addIndex(EOpIndexDirectStruct, yyvsp[-2].interm.intermTypedNode, index, yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode->setType(*(*fields)[i].type);
- }
- } else {
- parseContext.error(yyvsp[-1].lex.line, " no such field in structure", yyvsp[0].lex.string->c_str(), "");
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- }
- } else {
- parseContext.error(yyvsp[-1].lex.line, " field selection requires structure, vector, or matrix on left hand side", yyvsp[0].lex.string->c_str(), "");
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- // don't delete $3.string, it's from the pool
- ;}
- break;
-
- case 12:
-#line 460 "glslang.y"
- {
- if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostIncrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.unaryOpError(yyvsp[0].lex.line, "++", yyvsp[-1].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 13:
-#line 470 "glslang.y"
- {
- if (parseContext.lValueErrorCheck(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPostDecrement, yyvsp[-1].interm.intermTypedNode, yyvsp[0].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.unaryOpError(yyvsp[0].lex.line, "--", yyvsp[-1].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-1].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 14:
-#line 483 "glslang.y"
- {
- if (parseContext.integerErrorCheck(yyvsp[0].interm.intermTypedNode, "[]"))
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 15:
-#line 491 "glslang.y"
- {
- TFunction* fnCall = yyvsp[0].interm.function;
- TOperator op = fnCall->getBuiltInOp();
-
- if (op != EOpNull) {
- //
- // Then this should be a constructor.
- //
- TType type(EbtVoid); // use this to get the type back
- if (parseContext.constructorErrorCheck(yyvsp[0].interm.line, yyvsp[0].interm.intermNode, *fnCall, op, &type)) {
- yyval.interm.intermTypedNode = 0;
- } else {
- //
- // It's a constructor, of type 'type'.
- //
- yyval.interm.intermTypedNode = parseContext.addConstructor(yyvsp[0].interm.intermNode, &type, op, fnCall, yyvsp[0].interm.line);
- }
-
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.recover();
- yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(0, op, yyvsp[0].interm.line);
- }
- yyval.interm.intermTypedNode->setType(type);
- } else {
- //
- // Not a constructor. Find it in the symbol table.
- //
- const TFunction* fnCandidate;
- bool builtIn;
- fnCandidate = parseContext.findFunction(yyvsp[0].interm.line, fnCall, &builtIn);
- if (fnCandidate) {
- //
- // A declared function. But, it might still map to a built-in
- // operation.
- //
- op = fnCandidate->getBuiltInOp();
- if (builtIn && op != EOpNull) {
- //
- // A function call mapped to a built-in operation.
- //
- if (fnCandidate->getParamCount() == 1) {
- //
- // Treat it like a built-in unary operator.
- //
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(op, yyvsp[0].interm.intermNode, 0, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.error(yyvsp[0].interm.intermNode->getLine(), " wrong operand type", "Internal Error",
- "built in unary operator function. Type: %s",
- static_cast<TIntermTyped*>(yyvsp[0].interm.intermNode)->getCompleteString().c_str());
- YYERROR;
- }
- } else {
- yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, op, yyvsp[0].interm.line);
- }
- } else {
- // This is a real function call
-
- yyval.interm.intermTypedNode = parseContext.intermediate.setAggregateOperator(yyvsp[0].interm.intermAggregate, EOpFunctionCall, yyvsp[0].interm.line);
- yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
-
- // this is how we know whether the given function is a builtIn function or a user defined function
- // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
- // if builtIn == true, it's definitely a builtIn function with EOpNull
- if (!builtIn)
- yyval.interm.intermTypedNode->getAsAggregate()->setUserDefined();
- yyval.interm.intermTypedNode->getAsAggregate()->setName(fnCandidate->getMangledName());
-
- TQualifier qual;
- TQualifierList& qualifierList = yyval.interm.intermTypedNode->getAsAggregate()->getQualifier();
- for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
- qual = (*fnCandidate)[i].type->getQualifier();
- if (qual == EvqOut || qual == EvqInOut) {
- if (parseContext.lValueErrorCheck(yyval.interm.intermTypedNode->getLine(), "assign", yyval.interm.intermTypedNode->getAsAggregate()->getSequence()[i]->getAsTyped())) {
- parseContext.error(yyvsp[0].interm.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
- parseContext.recover();
- }
- }
- qualifierList.push_back(qual);
- }
- }
- yyval.interm.intermTypedNode->setType(fnCandidate->getReturnType());
- } else {
- // error message was put out by PaFindFunction()
- // Put on a dummy node for error recovery
- constUnion *unionArray = new constUnion[1];
- unionArray->fConst = 0.0;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), yyvsp[0].interm.line);
- parseContext.recover();
- }
- }
- delete fnCall;
- ;}
- break;
-
- case 16:
-#line 586 "glslang.y"
- {
- yyval.interm = yyvsp[-1].interm;
- yyval.interm.line = yyvsp[0].lex.line;
- ;}
- break;
-
- case 17:
-#line 590 "glslang.y"
- {
- yyval.interm = yyvsp[-1].interm;
- yyval.interm.line = yyvsp[0].lex.line;
- ;}
- break;
-
- case 18:
-#line 597 "glslang.y"
- {
- yyval.interm.function = yyvsp[-1].interm.function;
- yyval.interm.intermNode = 0;
- ;}
- break;
-
- case 19:
-#line 601 "glslang.y"
- {
- yyval.interm.function = yyvsp[0].interm.function;
- yyval.interm.intermNode = 0;
- ;}
- break;
-
- case 20:
-#line 608 "glslang.y"
- {
- TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };
- yyvsp[-1].interm.function->addParameter(param);
- yyval.interm.function = yyvsp[-1].interm.function;
- yyval.interm.intermNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 21:
-#line 614 "glslang.y"
- {
- TParameter param = { 0, new TType(yyvsp[0].interm.intermTypedNode->getType()) };
- yyvsp[-2].interm.function->addParameter(param);
- yyval.interm.function = yyvsp[-2].interm.function;
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
- ;}
- break;
-
- case 22:
-#line 623 "glslang.y"
- {
- yyval.interm.function = yyvsp[-1].interm.function;
- ;}
- break;
-
- case 23:
-#line 629 "glslang.y"
- {
- if (yyvsp[0].interm.op == EOpConstructStruct) {
- TString tempString = "";
- TFunction *function = new TFunction(&tempString, *(yyvsp[0].interm.type.userDef), yyvsp[0].interm.op);
- yyval.interm.function = function;
- }
- else {
- TFunction *function = new TFunction(yyvsp[0].interm.op);
- yyval.interm.function = function;
- }
- ;}
- break;
-
- case 24:
-#line 640 "glslang.y"
- {
- if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
- parseContext.recover();
- TType type(EbtVoid);
- TFunction *function = new TFunction(yyvsp[0].lex.string, type);
- yyval.interm.function = function;
- ;}
- break;
-
- case 25:
-#line 656 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructFloat; ;}
- break;
-
- case 26:
-#line 657 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructInt; ;}
- break;
-
- case 27:
-#line 658 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBool; ;}
- break;
-
- case 28:
-#line 659 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec2; ;}
- break;
-
- case 29:
-#line 660 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec3; ;}
- break;
-
- case 30:
-#line 661 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructVec4; ;}
- break;
-
- case 31:
-#line 662 "glslang.y"
- { FRAG_VERT_ONLY("bvec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec2; ;}
- break;
-
- case 32:
-#line 663 "glslang.y"
- { FRAG_VERT_ONLY("bvec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec3; ;}
- break;
-
- case 33:
-#line 664 "glslang.y"
- { FRAG_VERT_ONLY("bvec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructBVec4; ;}
- break;
-
- case 34:
-#line 665 "glslang.y"
- { FRAG_VERT_ONLY("ivec2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec2; ;}
- break;
-
- case 35:
-#line 666 "glslang.y"
- { FRAG_VERT_ONLY("ivec3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec3; ;}
- break;
-
- case 36:
-#line 667 "glslang.y"
- { FRAG_VERT_ONLY("ivec4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructIVec4; ;}
- break;
-
- case 37:
-#line 668 "glslang.y"
- { FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat2; ;}
- break;
-
- case 38:
-#line 669 "glslang.y"
- { FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat3; ;}
- break;
-
- case 39:
-#line 670 "glslang.y"
- { FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpConstructMat4; ;}
- break;
-
- case 40:
-#line 671 "glslang.y"
- {
- TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line };
- yyval.interm.type = t;
- yyval.interm.line = yyvsp[0].lex.line;
- yyval.interm.op = EOpConstructStruct;
- ;}
- break;
-
- case 41:
-#line 682 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 42:
-#line 685 "glslang.y"
- {
- if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreIncrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.unaryOpError(yyvsp[-1].lex.line, "++", yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 43:
-#line 695 "glslang.y"
- {
- if (parseContext.lValueErrorCheck(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(EOpPreDecrement, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.unaryOpError(yyvsp[-1].lex.line, "--", yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 44:
-#line 705 "glslang.y"
- {
- if (yyvsp[-1].interm.op != EOpNull) {
- yyval.interm.intermTypedNode = parseContext.intermediate.addUnaryMath(yyvsp[-1].interm.op, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- char* errorOp = "";
- switch(yyvsp[-1].interm.op) {
- case EOpNegative: errorOp = "-"; break;
- case EOpLogicalNot: errorOp = "!"; break;
- case EOpBitwiseNot: errorOp = "~"; break;
- default: break;
- }
- parseContext.unaryOpError(yyvsp[-1].interm.line, errorOp, yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- }
- } else
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 45:
-#line 727 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNull; ;}
- break;
-
- case 46:
-#line 728 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpNegative; ;}
- break;
-
- case 47:
-#line 729 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLogicalNot; ;}
- break;
-
- case 48:
-#line 730 "glslang.y"
- { PACK_UNPACK_ONLY("~", yyvsp[0].lex.line);
- yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpBitwiseNot; ;}
- break;
-
- case 49:
-#line 736 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 50:
-#line 737 "glslang.y"
- {
- FRAG_VERT_ONLY("*", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMul, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "*", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 51:
-#line 746 "glslang.y"
- {
- FRAG_VERT_ONLY("/", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpDiv, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "/", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 52:
-#line 755 "glslang.y"
- {
- PACK_UNPACK_ONLY("%", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpMod, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "%", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 53:
-#line 767 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 54:
-#line 768 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAdd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "+", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 55:
-#line 776 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpSub, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "-", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 56:
-#line 787 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 57:
-#line 788 "glslang.y"
- {
- PACK_UNPACK_ONLY("<<", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLeftShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "<<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 58:
-#line 797 "glslang.y"
- {
- PACK_UNPACK_ONLY(">>", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpRightShift, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, ">>", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 59:
-#line 809 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 60:
-#line 810 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "<", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 61:
-#line 820 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThan, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, ">", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 62:
-#line 830 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "<=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 63:
-#line 840 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, ">=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 64:
-#line 853 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 65:
-#line 854 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "==", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 66:
-#line 864 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpNotEqual, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "!=", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 67:
-#line 877 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 68:
-#line 878 "glslang.y"
- {
- PACK_UNPACK_ONLY("&", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 69:
-#line 890 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 70:
-#line 891 "glslang.y"
- {
- PACK_UNPACK_ONLY("^", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 71:
-#line 903 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 72:
-#line 904 "glslang.y"
- {
- PACK_UNPACK_ONLY("|", yyvsp[-1].lex.line);
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "|", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 73:
-#line 916 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 74:
-#line 917 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "&&", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 75:
-#line 930 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 76:
-#line 931 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalXor, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "^^", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 77:
-#line 944 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 78:
-#line 945 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addBinaryMath(EOpLogicalOr, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line, parseContext.symbolTable);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, "||", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- yyval.interm.intermTypedNode = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), yyvsp[-1].lex.line);
- }
- ;}
- break;
-
- case 79:
-#line 958 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 80:
-#line 959 "glslang.y"
- {
- if (parseContext.boolErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.intermTypedNode))
- parseContext.recover();
-
- yyval.interm.intermTypedNode = parseContext.intermediate.addSelection(yyvsp[-4].interm.intermTypedNode, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-3].lex.line);
- if (yyvsp[-2].interm.intermTypedNode->getType() != yyvsp[0].interm.intermTypedNode->getType())
- yyval.interm.intermTypedNode = 0;
-
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-3].lex.line, ":", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 81:
-#line 976 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 82:
-#line 977 "glslang.y"
- {
- if (parseContext.lValueErrorCheck(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermTypedNode = parseContext.intermediate.addAssign(yyvsp[-1].interm.op, yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].interm.line);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.assignError(yyvsp[-1].interm.line, "assign", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[-2].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 83:
-#line 990 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAssign; ;}
- break;
-
- case 84:
-#line 991 "glslang.y"
- { FRAG_VERT_ONLY("*=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpMulAssign; ;}
- break;
-
- case 85:
-#line 992 "glslang.y"
- { FRAG_VERT_ONLY("/=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpDivAssign; ;}
- break;
-
- case 86:
-#line 993 "glslang.y"
- { PACK_UNPACK_ONLY("%=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpModAssign; ;}
- break;
-
- case 87:
-#line 994 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAddAssign; ;}
- break;
-
- case 88:
-#line 995 "glslang.y"
- { yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpSubAssign; ;}
- break;
-
- case 89:
-#line 996 "glslang.y"
- { PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpLeftShiftAssign; ;}
- break;
-
- case 90:
-#line 997 "glslang.y"
- { PACK_UNPACK_ONLY("<<=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpRightShiftAssign; ;}
- break;
-
- case 91:
-#line 998 "glslang.y"
- { PACK_UNPACK_ONLY("&=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpAndAssign; ;}
- break;
-
- case 92:
-#line 999 "glslang.y"
- { PACK_UNPACK_ONLY("^=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpExclusiveOrAssign; ;}
- break;
-
- case 93:
-#line 1000 "glslang.y"
- { PACK_UNPACK_ONLY("|=", yyvsp[0].lex.line); yyval.interm.line = yyvsp[0].lex.line; yyval.interm.op = EOpInclusiveOrAssign; ;}
- break;
-
- case 94:
-#line 1004 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 95:
-#line 1007 "glslang.y"
- {
- yyval.interm.intermTypedNode = parseContext.intermediate.addComma(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.intermTypedNode, yyvsp[-1].lex.line);
- if (yyval.interm.intermTypedNode == 0) {
- parseContext.binaryOpError(yyvsp[-1].lex.line, ",", yyvsp[-2].interm.intermTypedNode->getCompleteString(), yyvsp[0].interm.intermTypedNode->getCompleteString());
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- }
- ;}
- break;
-
- case 96:
-#line 1018 "glslang.y"
- {
- if (parseContext.constErrorCheck(yyvsp[0].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 97:
-#line 1026 "glslang.y"
- { yyval.interm.intermNode = 0; ;}
- break;
-
- case 98:
-#line 1027 "glslang.y"
- {
- if (yyvsp[-1].interm.intermAggregate)
- yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence);
- yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
- ;}
- break;
-
- case 99:
-#line 1035 "glslang.y"
- {
- //
- // Multiple declarations of the same function are allowed.
- //
- // If this is a definition, the definition production code will check for redefinitions
- // (we don't know at this point if it's a definition or not).
- //
- // Redeclarations are allowed. But, return types and parameter qualifiers must match.
- //
- TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(yyvsp[-1].interm.function->getMangledName()));
- if (prevDec) {
- if (prevDec->getReturnType() != yyvsp[-1].interm.function->getReturnType()) {
- parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same return type", yyvsp[-1].interm.function->getReturnType().getBasicString(), "");
- parseContext.recover();
- }
- for (int i = 0; i < prevDec->getParamCount(); ++i) {
- if ((*prevDec)[i].type->getQualifier() != (*yyvsp[-1].interm.function)[i].type->getQualifier()) {
- parseContext.error(yyvsp[0].lex.line, "overloaded functions must have the same parameter qualifiers", (*yyvsp[-1].interm.function)[i].type->getQualifierString(), "");
- parseContext.recover();
- }
- }
- }
-
- //
- // If this is a redeclaration, it could also be a definition,
- // in which case, we want to use the variable names from this one, and not the one that's
- // being redeclared. So, pass back up this declaration, not the one in the symbol table.
- //
- yyval.interm.function = yyvsp[-1].interm.function;
- yyval.interm.line = yyvsp[0].lex.line;
-
- parseContext.symbolTable.insert(*yyval.interm.function);
- ;}
- break;
-
- case 100:
-#line 1071 "glslang.y"
- {
- yyval.interm.function = yyvsp[0].interm.function;
- ;}
- break;
-
- case 101:
-#line 1074 "glslang.y"
- {
- yyval.interm.function = yyvsp[0].interm.function;
- ;}
- break;
-
- case 102:
-#line 1081 "glslang.y"
- {
- // Add the parameter
- yyval.interm.function = yyvsp[-1].interm.function;
- if (yyvsp[0].interm.param.type->getBasicType() != EbtVoid)
- yyvsp[-1].interm.function->addParameter(yyvsp[0].interm.param);
- else
- delete yyvsp[0].interm.param.type;
- ;}
- break;
-
- case 103:
-#line 1089 "glslang.y"
- {
- //
- // Only first parameter of one-parameter functions can be void
- // The check for named parameters not being void is done in parameter_declarator
- //
- if (yyvsp[0].interm.param.type->getBasicType() == EbtVoid) {
- //
- // This parameter > first is void
- //
- parseContext.error(yyvsp[-1].lex.line, "cannot be an argument type except for '(void)'", "void", "");
- parseContext.recover();
- delete yyvsp[0].interm.param.type;
- } else {
- // Add the parameter
- yyval.interm.function = yyvsp[-2].interm.function;
- yyvsp[-2].interm.function->addParameter(yyvsp[0].interm.param);
- }
- ;}
- break;
-
- case 104:
-#line 1110 "glslang.y"
- {
- if (yyvsp[-2].interm.type.qualifier != EvqGlobal && yyvsp[-2].interm.type.qualifier != EvqTemporary) {
- parseContext.error(yyvsp[-1].lex.line, "no qualifiers allowed for function return", getQualifierString(yyvsp[-2].interm.type.qualifier), "");
- parseContext.recover();
- }
- // make sure a sampler is not involved as well...
- if (parseContext.structQualifierErrorCheck(yyvsp[-1].lex.line, yyvsp[-2].interm.type))
- parseContext.recover();
-
- // Add the function as a prototype after parsing it (we do not support recursion)
- TFunction *function;
- TType type(yyvsp[-2].interm.type);
- function = new TFunction(yyvsp[-1].lex.string, type);
- yyval.interm.function = function;
- ;}
- break;
-
- case 105:
-#line 1129 "glslang.y"
- {
- if (yyvsp[-1].interm.type.type == EbtVoid) {
- parseContext.error(yyvsp[0].lex.line, "illegal use of type 'void'", yyvsp[0].lex.string->c_str(), "");
- parseContext.recover();
- }
- if (parseContext.reservedErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string))
- parseContext.recover();
- TParameter param = {yyvsp[0].lex.string, new TType(yyvsp[-1].interm.type)};
- yyval.interm.line = yyvsp[0].lex.line;
- yyval.interm.param = param;
- ;}
- break;
-
- case 106:
-#line 1140 "glslang.y"
- {
- // Check that we can make an array out of this type
- if (yyvsp[-4].interm.type.array) {
- parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-4].interm.type).getCompleteString().c_str(), "");
- parseContext.recover();
- }
- if (parseContext.reservedErrorCheck(yyvsp[-3].lex.line, *yyvsp[-3].lex.string))
- parseContext.recover();
- yyvsp[-4].interm.type.array = true;
- TType* type = new TType(yyvsp[-4].interm.type);
- if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())
- type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- TParameter param = { yyvsp[-3].lex.string, type };
- yyval.interm.line = yyvsp[-3].lex.line;
- yyval.interm.param = param;
- ;}
- break;
-
- case 107:
-#line 1167 "glslang.y"
- {
- yyval.interm = yyvsp[0].interm;
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
- parseContext.recover();
- ;}
- break;
-
- case 108:
-#line 1172 "glslang.y"
- {
- yyval.interm = yyvsp[0].interm;
- if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))
- parseContext.recover();
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
- parseContext.recover();
- ;}
- break;
-
- case 109:
-#line 1182 "glslang.y"
- {
- yyval.interm = yyvsp[0].interm;
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, yyvsp[-2].interm.type.qualifier, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
- parseContext.recover();
- ;}
- break;
-
- case 110:
-#line 1187 "glslang.y"
- {
- yyval.interm = yyvsp[0].interm;
- if (parseContext.parameterSamplerErrorCheck(yyvsp[0].interm.line, yyvsp[-1].interm.qualifier, *yyvsp[0].interm.param.type))
- parseContext.recover();
- if (parseContext.paramErrorCheck(yyvsp[0].interm.line, EvqTemporary, yyvsp[-1].interm.qualifier, yyval.interm.param.type))
- parseContext.recover();
- ;}
- break;
-
- case 111:
-#line 1197 "glslang.y"
- {
- yyval.interm.qualifier = EvqIn;
- ;}
- break;
-
- case 112:
-#line 1200 "glslang.y"
- {
- yyval.interm.qualifier = EvqIn;
- ;}
- break;
-
- case 113:
-#line 1203 "glslang.y"
- {
- yyval.interm.qualifier = EvqOut;
- ;}
- break;
-
- case 114:
-#line 1206 "glslang.y"
- {
- yyval.interm.qualifier = EvqInOut;
- ;}
- break;
-
- case 115:
-#line 1212 "glslang.y"
- {
- TParameter param = { 0, new TType(yyvsp[0].interm.type) };
- yyval.interm.param = param;
-
- ;}
- break;
-
- case 116:
-#line 1217 "glslang.y"
- {
- // Check that we can make an array out of this type
- if (yyvsp[-3].interm.type.array) {
- parseContext.error(yyvsp[-2].lex.line, "cannot declare arrays of this type", TType(yyvsp[-3].interm.type).getCompleteString().c_str(), "");
- parseContext.recover();
- }
- yyvsp[-3].interm.type.array = true;
- TType* type = new TType(yyvsp[-3].interm.type);
- if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion())
- type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
-
- TParameter param = { 0, type };
- yyval.interm.line = yyvsp[-2].lex.line;
- yyval.interm.param = param;
- ;}
- break;
-
- case 117:
-#line 1235 "glslang.y"
- {
- yyval.interm = yyvsp[0].interm;
- ;}
- break;
-
- case 118:
-#line 1238 "glslang.y"
- {
- yyval.interm = yyvsp[-2].interm;
- if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.type))
- parseContext.recover();
-
- if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
- parseContext.recover();
- ;}
- break;
-
- case 119:
-#line 1246 "glslang.y"
- {
- yyval.interm = yyvsp[-4].interm;
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))
- parseContext.recover();
- ;}
- break;
-
- case 120:
-#line 1254 "glslang.y"
- {
- yyval.interm = yyvsp[-5].interm;
- if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-5].interm.type))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))
- parseContext.recover();
- ;}
- break;
-
- case 121:
-#line 1262 "glslang.y"
- {
- yyval.interm = yyvsp[-4].interm;
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-4].interm.type))
- parseContext.recover();
-
- TIntermNode* intermNode;
- if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-4].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {
- //
- // build the intermediate representation
- //
- if (intermNode)
- yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-4].interm.intermNode, intermNode, yyvsp[-1].lex.line);
- else
- yyval.interm.intermAggregate = yyvsp[-4].interm.intermAggregate;
- } else {
- parseContext.recover();
- yyval.interm.intermAggregate = 0;
- }
- ;}
- break;
-
- case 122:
-#line 1284 "glslang.y"
- {
- yyval.interm.type = yyvsp[0].interm.type;
- yyval.interm.intermAggregate = 0;
- ;}
- break;
-
- case 123:
-#line 1288 "glslang.y"
- {
- yyval.interm.intermAggregate = 0;
- yyval.interm.type = yyvsp[-1].interm.type;
- if (parseContext.structQualifierErrorCheck(yyvsp[0].lex.line, yyvsp[-1].interm.type))
- parseContext.recover();
-
- if (parseContext.nonInitErrorCheck(yyvsp[0].lex.line, *yyvsp[0].lex.string, yyval.interm.type))
- parseContext.recover();
- ;}
- break;
-
- case 124:
-#line 1297 "glslang.y"
- {
- yyval.interm.intermAggregate = 0;
- yyval.interm.type = yyvsp[-3].interm.type;
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck(yyvsp[-1].lex.line, *yyvsp[-2].lex.string, yyval.interm.type, 0))
- parseContext.recover();
- ;}
- break;
-
- case 125:
-#line 1306 "glslang.y"
- {
- yyval.interm.intermAggregate = 0;
- yyval.interm.type = yyvsp[-4].interm.type;
- if (parseContext.structQualifierErrorCheck(yyvsp[-3].lex.line, yyvsp[-4].interm.type))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck(yyvsp[-2].lex.line, *yyvsp[-3].lex.string, yyval.interm.type, yyvsp[-1].interm.intermTypedNode))
- parseContext.recover();
- ;}
- break;
-
- case 126:
-#line 1315 "glslang.y"
- {
- yyval.interm.type = yyvsp[-3].interm.type;
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
- parseContext.recover();
-
- TIntermNode* intermNode;
- if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode)) {
- //
- // Build intermediate representation
- //
- if (intermNode)
- yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, yyvsp[-1].lex.line);
- else
- yyval.interm.intermAggregate = 0;
- } else {
- parseContext.recover();
- yyval.interm.intermAggregate = 0;
- }
- ;}
- break;
-
- case 127:
-#line 1405 "glslang.y"
- {
- yyval.interm.type = yyvsp[0].interm.type;
- ;}
- break;
-
- case 128:
-#line 1408 "glslang.y"
- {
- TPublicType t = { yyvsp[0].interm.type.type, yyvsp[-1].interm.type.qualifier, yyvsp[0].interm.type.size, yyvsp[0].interm.type.matrix, false, yyvsp[0].interm.type.userDef, 0 };
- if (yyvsp[-1].interm.type.qualifier == EvqAttribute &&
- (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {
- parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");
- parseContext.recover();
- }
- if ((yyvsp[-1].interm.type.qualifier == EvqVaryingIn || yyvsp[-1].interm.type.qualifier == EvqVaryingOut) &&
- (yyvsp[0].interm.type.type == EbtBool || yyvsp[0].interm.type.type == EbtInt)) {
- parseContext.error(yyvsp[0].interm.type.line, "cannot be bool or int", getQualifierString(yyvsp[-1].interm.type.qualifier), "");
- parseContext.recover();
- }
- yyval.interm.type = t;
- ;}
- break;
-
- case 129:
-#line 1425 "glslang.y"
- {
- TPublicType t = { EbtVoid, EvqConst, 1, false, false, 0 };
- yyval.interm.type = t;
- ;}
- break;
-
- case 130:
-#line 1429 "glslang.y"
- {
- VERTEX_ONLY("attribute", yyvsp[0].lex.line);
- if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
- parseContext.recover();
- TPublicType t = { EbtVoid, EvqAttribute, 1, false, false, 0 };
- yyval.interm.type = t;
- ;}
- break;
-
- case 131:
-#line 1436 "glslang.y"
- {
- if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
- parseContext.recover();
- TPublicType t = { EbtVoid, EvqVaryingIn, 1, false, false, 0 };
- if (parseContext.language == EShLangVertex)
- t.qualifier = EvqVaryingOut;
- yyval.interm.type = t;
- ;}
- break;
-
- case 132:
-#line 1444 "glslang.y"
- {
- if (parseContext.globalErrorCheck(yyvsp[0].lex.line, parseContext.symbolTable.atGlobalLevel(), "uniform"))
- parseContext.recover();
- TPublicType t = { EbtVoid, EvqUniform, 1, false, false, 0 };
- yyval.interm.type = t;
- ;}
- break;
-
- case 133:
-#line 1453 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtVoid, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 134:
-#line 1458 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 135:
-#line 1463 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 136:
-#line 1468 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 137:
-#line 1479 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 2, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 138:
-#line 1484 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 3, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 139:
-#line 1489 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 4, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 140:
-#line 1494 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 2, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 141:
-#line 1499 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 3, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 142:
-#line 1504 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 4, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 143:
-#line 1509 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 2, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 144:
-#line 1514 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 3, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 145:
-#line 1519 "glslang.y"
- {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 4, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 146:
-#line 1524 "glslang.y"
- {
- FRAG_VERT_ONLY("mat2", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 2, true, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 147:
-#line 1530 "glslang.y"
- {
- FRAG_VERT_ONLY("mat3", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 3, true, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 148:
-#line 1536 "glslang.y"
- {
- FRAG_VERT_ONLY("mat4", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 4, true, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 149:
-#line 1542 "glslang.y"
- {
- FRAG_VERT_ONLY("sampler1D", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler1D, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 150:
-#line 1548 "glslang.y"
- {
- FRAG_VERT_ONLY("sampler2D", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler2D, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 151:
-#line 1554 "glslang.y"
- {
- FRAG_VERT_ONLY("sampler3D", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler3D, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 152:
-#line 1560 "glslang.y"
- {
- FRAG_VERT_ONLY("samplerCube", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSamplerCube, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 153:
-#line 1566 "glslang.y"
- {
- FRAG_VERT_ONLY("sampler1DShadow", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler1DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 154:
-#line 1572 "glslang.y"
- {
- FRAG_VERT_ONLY("sampler2DShadow", yyvsp[0].lex.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler2DShadow, qual, 1, false, false, 0, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 155:
-#line 1578 "glslang.y"
- {
- FRAG_VERT_ONLY("struct", yyvsp[0].interm.type.line);
- yyval.interm.type = yyvsp[0].interm.type;
- yyval.interm.type.qualifier = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- ;}
- break;
-
- case 156:
-#line 1583 "glslang.y"
- {
- //
- // This is for user defined type names. The lexical phase looked up the
- // type.
- //
- TType& structure = static_cast<TVariable*>(yyvsp[0].lex.symbol)->getType();
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtStruct, qual, 1, false, false, &structure, yyvsp[0].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 157:
-#line 1596 "glslang.y"
- {
- TType* structure = new TType(yyvsp[-1].interm.typeList, *yyvsp[-3].lex.string);
- TVariable* userTypeDef = new TVariable(yyvsp[-3].lex.string, *structure, true);
- if (! parseContext.symbolTable.insert(*userTypeDef)) {
- parseContext.error(yyvsp[-3].lex.line, "redefinition", yyvsp[-3].lex.string->c_str(), "struct");
- parseContext.recover();
- }
- TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-4].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 158:
-#line 1606 "glslang.y"
- {
- TType* structure = new TType(yyvsp[-1].interm.typeList, TString(""));
- TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, yyvsp[-3].lex.line };
- yyval.interm.type = t;
- ;}
- break;
-
- case 159:
-#line 1614 "glslang.y"
- {
- yyval.interm.typeList = yyvsp[0].interm.typeList;
- ;}
- break;
-
- case 160:
-#line 1617 "glslang.y"
- {
- yyval.interm.typeList = yyvsp[-1].interm.typeList;
- for (unsigned int i = 0; i < yyvsp[0].interm.typeList->size(); ++i) {
- for (unsigned int j = 0; j < yyval.interm.typeList->size(); ++j) {
- if ((*yyval.interm.typeList)[j].type->getFieldName() == (*yyvsp[0].interm.typeList)[i].type->getFieldName()) {
- parseContext.error((*yyvsp[0].interm.typeList)[i].line, "duplicate field name in structure:", "struct", (*yyvsp[0].interm.typeList)[i].type->getFieldName().c_str());
- parseContext.recover();
- }
- }
- yyval.interm.typeList->push_back((*yyvsp[0].interm.typeList)[i]);
- }
- ;}
- break;
-
- case 161:
-#line 1632 "glslang.y"
- {
- yyval.interm.typeList = yyvsp[-1].interm.typeList;
-
- if (parseContext.voidErrorCheck(yyvsp[-2].interm.type.line, (*yyvsp[-1].interm.typeList)[0].type->getFieldName(), yyvsp[-2].interm.type)) {
- parseContext.recover();
- }
- for (unsigned int i = 0; i < yyval.interm.typeList->size(); ++i) {
- //
- // Careful not to replace already know aspects of type, like array-ness
- //
- (*yyval.interm.typeList)[i].type->setType(yyvsp[-2].interm.type.type, yyvsp[-2].interm.type.size, yyvsp[-2].interm.type.matrix, yyvsp[-2].interm.type.userDef);
- if (yyvsp[-2].interm.type.userDef)
- (*yyval.interm.typeList)[i].type->setTypeName(yyvsp[-2].interm.type.userDef->getTypeName());
- }
- ;}
- break;
-
- case 162:
-#line 1650 "glslang.y"
- {
- yyval.interm.typeList = NewPoolTTypeList();
- yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
- ;}
- break;
-
- case 163:
-#line 1654 "glslang.y"
- {
- yyval.interm.typeList->push_back(yyvsp[0].interm.typeLine);
- ;}
- break;
-
- case 164:
-#line 1660 "glslang.y"
- {
- yyval.interm.typeLine.type = new TType(EbtVoid);
- yyval.interm.typeLine.line = yyvsp[0].lex.line;
- yyval.interm.typeLine.type->setFieldName(*yyvsp[0].lex.string);
- ;}
- break;
-
- case 165:
-#line 1665 "glslang.y"
- {
- yyval.interm.typeLine.type = new TType(EbtVoid);
- yyval.interm.typeLine.line = yyvsp[-3].lex.line;
- yyval.interm.typeLine.type->setFieldName(*yyvsp[-3].lex.string);
-
- if (yyvsp[-1].interm.intermTypedNode->getAsConstantUnion() == 0 || yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getBasicType() != EbtInt ||
- yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst <= 0) {
- parseContext.error(yyvsp[-2].lex.line, "structure field array size must be a positive integer", yyvsp[-3].lex.string->c_str(), "");
- parseContext.recover();
- } else {
- yyval.interm.typeLine.type->setArraySize(yyvsp[-1].interm.intermTypedNode->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- }
- ;}
- break;
-
- case 166:
-#line 1681 "glslang.y"
- { yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode; ;}
- break;
-
- case 167:
-#line 1685 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 168:
-#line 1689 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermAggregate; ;}
- break;
-
- case 169:
-#line 1690 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 170:
-#line 1696 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 171:
-#line 1697 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 172:
-#line 1698 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 173:
-#line 1699 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 174:
-#line 1700 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 175:
-#line 1704 "glslang.y"
- { yyval.interm.intermAggregate = 0; ;}
- break;
-
- case 176:
-#line 1705 "glslang.y"
- { parseContext.symbolTable.push(); ;}
- break;
-
- case 177:
-#line 1705 "glslang.y"
- { parseContext.symbolTable.pop(); ;}
- break;
-
- case 178:
-#line 1705 "glslang.y"
- {
- if (yyvsp[-2].interm.intermAggregate != 0)
- yyvsp[-2].interm.intermAggregate->setOperator(EOpSequence);
- yyval.interm.intermAggregate = yyvsp[-2].interm.intermAggregate;
- ;}
- break;
-
- case 179:
-#line 1713 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 180:
-#line 1714 "glslang.y"
- { yyval.interm.intermNode = yyvsp[0].interm.intermNode; ;}
- break;
-
- case 181:
-#line 1719 "glslang.y"
- {
- yyval.interm.intermNode = 0;
- ;}
- break;
-
- case 182:
-#line 1722 "glslang.y"
- {
- if (yyvsp[-1].interm.intermAggregate)
- yyvsp[-1].interm.intermAggregate->setOperator(EOpSequence);
- yyval.interm.intermNode = yyvsp[-1].interm.intermAggregate;
- ;}
- break;
-
- case 183:
-#line 1730 "glslang.y"
- {
- yyval.interm.intermAggregate = parseContext.intermediate.makeAggregate(yyvsp[0].interm.intermNode, 0);
- ;}
- break;
-
- case 184:
-#line 1733 "glslang.y"
- {
- yyval.interm.intermAggregate = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
- ;}
- break;
-
- case 185:
-#line 1739 "glslang.y"
- { yyval.interm.intermNode = 0; ;}
- break;
-
- case 186:
-#line 1740 "glslang.y"
- { yyval.interm.intermNode = static_cast<TIntermNode*>(yyvsp[-1].interm.intermTypedNode); ;}
- break;
-
- case 187:
-#line 1744 "glslang.y"
- {
- if (parseContext.boolErrorCheck(yyvsp[-4].lex.line, yyvsp[-2].interm.intermTypedNode))
- parseContext.recover();
- yyval.interm.intermNode = parseContext.intermediate.addSelection(yyvsp[-2].interm.intermTypedNode, yyvsp[0].interm.nodePair, yyvsp[-4].lex.line);
- ;}
- break;
-
- case 188:
-#line 1752 "glslang.y"
- {
- yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermNode;
- yyval.interm.nodePair.node2 = yyvsp[0].interm.intermNode;
- ;}
- break;
-
- case 189:
-#line 1756 "glslang.y"
- {
- yyval.interm.nodePair.node1 = yyvsp[0].interm.intermNode;
- yyval.interm.nodePair.node2 = 0;
- ;}
- break;
-
- case 190:
-#line 1766 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- if (parseContext.boolErrorCheck(yyvsp[0].interm.intermTypedNode->getLine(), yyvsp[0].interm.intermTypedNode))
- parseContext.recover();
- ;}
- break;
-
- case 191:
-#line 1771 "glslang.y"
- {
- TIntermNode* intermNode;
- if (parseContext.structQualifierErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
- parseContext.recover();
- if (parseContext.boolErrorCheck(yyvsp[-2].lex.line, yyvsp[-3].interm.type))
- parseContext.recover();
-
- if (!parseContext.executeInitializer(yyvsp[-2].lex.line, *yyvsp[-2].lex.string, yyvsp[-3].interm.type, yyvsp[0].interm.intermTypedNode, intermNode))
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- else {
- parseContext.recover();
- yyval.interm.intermTypedNode = 0;
- }
- ;}
- break;
-
- case 192:
-#line 1788 "glslang.y"
- { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;}
- break;
-
- case 193:
-#line 1788 "glslang.y"
- {
- parseContext.symbolTable.pop();
- yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, true, yyvsp[-5].lex.line);
- --parseContext.loopNestingLevel;
- ;}
- break;
-
- case 194:
-#line 1793 "glslang.y"
- { ++parseContext.loopNestingLevel; ;}
- break;
-
- case 195:
-#line 1793 "glslang.y"
- {
- if (parseContext.boolErrorCheck(yyvsp[0].lex.line, yyvsp[-2].interm.intermTypedNode))
- parseContext.recover();
-
- yyval.interm.intermNode = parseContext.intermediate.addLoop(yyvsp[-5].interm.intermNode, yyvsp[-2].interm.intermTypedNode, 0, false, yyvsp[-4].lex.line);
- --parseContext.loopNestingLevel;
- ;}
- break;
-
- case 196:
-#line 1800 "glslang.y"
- { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ;}
- break;
-
- case 197:
-#line 1800 "glslang.y"
- {
- parseContext.symbolTable.pop();
- yyval.interm.intermNode = parseContext.intermediate.makeAggregate(yyvsp[-3].interm.intermNode, yyvsp[-5].lex.line);
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(
- yyval.interm.intermNode,
- parseContext.intermediate.addLoop(yyvsp[0].interm.intermNode, reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node1), reinterpret_cast<TIntermTyped*>(yyvsp[-2].interm.nodePair.node2), true, yyvsp[-6].lex.line),
- yyvsp[-6].lex.line);
- yyval.interm.intermNode->getAsAggregate()->setOperator(EOpSequence);
- --parseContext.loopNestingLevel;
- ;}
- break;
-
- case 198:
-#line 1813 "glslang.y"
- {
- yyval.interm.intermNode = yyvsp[0].interm.intermNode;
- ;}
- break;
-
- case 199:
-#line 1816 "glslang.y"
- {
- yyval.interm.intermNode = yyvsp[0].interm.intermNode;
- ;}
- break;
-
- case 200:
-#line 1822 "glslang.y"
- {
- yyval.interm.intermTypedNode = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 201:
-#line 1825 "glslang.y"
- {
- yyval.interm.intermTypedNode = 0;
- ;}
- break;
-
- case 202:
-#line 1831 "glslang.y"
- {
- yyval.interm.nodePair.node1 = yyvsp[-1].interm.intermTypedNode;
- yyval.interm.nodePair.node2 = 0;
- ;}
- break;
-
- case 203:
-#line 1835 "glslang.y"
- {
- yyval.interm.nodePair.node1 = yyvsp[-2].interm.intermTypedNode;
- yyval.interm.nodePair.node2 = yyvsp[0].interm.intermTypedNode;
- ;}
- break;
-
- case 204:
-#line 1842 "glslang.y"
- {
- if (parseContext.loopNestingLevel <= 0) {
- parseContext.error(yyvsp[-1].lex.line, "continue statement only allowed in loops", "", "");
- parseContext.recover();
- }
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpContinue, yyvsp[-1].lex.line);
- ;}
- break;
-
- case 205:
-#line 1849 "glslang.y"
- {
- if (parseContext.loopNestingLevel <= 0) {
- parseContext.error(yyvsp[-1].lex.line, "break statement only allowed in loops", "", "");
- parseContext.recover();
- }
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpBreak, yyvsp[-1].lex.line);
- ;}
- break;
-
- case 206:
-#line 1856 "glslang.y"
- {
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].lex.line);
- if (parseContext.currentFunctionType->getBasicType() != EbtVoid) {
- parseContext.error(yyvsp[-1].lex.line, "non-void function must return a value", "return", "");
- parseContext.recover();
- }
- ;}
- break;
-
- case 207:
-#line 1863 "glslang.y"
- {
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpReturn, yyvsp[-1].interm.intermTypedNode, yyvsp[-2].lex.line);
- parseContext.functionReturnsValue = true;
- if (parseContext.currentFunctionType->getBasicType() == EbtVoid) {
- parseContext.error(yyvsp[-2].lex.line, "void function cannot return a value", "return", "");
- parseContext.recover();
- } else if (*(parseContext.currentFunctionType) != yyvsp[-1].interm.intermTypedNode->getType()) {
- parseContext.error(yyvsp[-2].lex.line, "function return is not matching type:", "return", "");
- parseContext.recover();
- }
- ;}
- break;
-
- case 208:
-#line 1874 "glslang.y"
- {
- FRAG_ONLY("discard", yyvsp[-1].lex.line);
- yyval.interm.intermNode = parseContext.intermediate.addBranch(EOpKill, yyvsp[-1].lex.line);
- ;}
- break;
-
- case 209:
-#line 1883 "glslang.y"
- {
- yyval.interm.intermNode = yyvsp[0].interm.intermNode;
- parseContext.treeRoot = yyval.interm.intermNode;
- ;}
- break;
-
- case 210:
-#line 1887 "glslang.y"
- {
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-1].interm.intermNode, yyvsp[0].interm.intermNode, 0);
- parseContext.treeRoot = yyval.interm.intermNode;
- ;}
- break;
-
- case 211:
-#line 1894 "glslang.y"
- {
- yyval.interm.intermNode = yyvsp[0].interm.intermNode;
- ;}
- break;
-
- case 212:
-#line 1897 "glslang.y"
- {
- yyval.interm.intermNode = yyvsp[0].interm.intermNode;
- ;}
- break;
-
- case 213:
-#line 1903 "glslang.y"
- {
- TFunction& function = *(yyvsp[0].interm.function);
- TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(function.getMangledName()));
- //
- // Note: 'prevDec' could be 'function' if this is the first time we've seen function
- // as it would have just been put in the symbol table. Otherwise, we're looking up
- // an earlier occurance.
- //
- if (prevDec->isDefined()) {
- //
- // Then this function already has a body.
- //
- parseContext.error(yyvsp[0].interm.line, "function already has a body", function.getName().c_str(), "");
- parseContext.recover();
- }
- prevDec->setDefined();
-
- //
- // Raise error message if main function takes any parameters or return anything other than void
- //
- if (function.getName() == "main") {
- if (function.getParamCount() > 0) {
- parseContext.error(yyvsp[0].interm.line, "function cannot take any parameter(s)", function.getName().c_str(), "");
- parseContext.recover();
- }
- if (function.getReturnType().getBasicType() != EbtVoid) {
- parseContext.error(yyvsp[0].interm.line, "", function.getReturnType().getBasicString(), "main function cannot return a value" );
- parseContext.recover();
- }
- }
-
- //
- // New symbol table scope for body of function plus its arguments
- //
- parseContext.symbolTable.push();
-
- //
- // Remember the return type for later checking for RETURN statements.
- //
- parseContext.currentFunctionType = &(prevDec->getReturnType());
- parseContext.functionReturnsValue = false;
-
- //
- // Insert parameters into the symbol table.
- // If the parameter has no name, it's not an error, just don't insert it
- // (could be used for unused args).
- //
- // Also, accumulate the list of parameters into the HIL, so lower level code
- // knows where to find parameters.
- //
- TIntermAggregate* paramNodes = new TIntermAggregate;
- for (int i = 0; i < function.getParamCount(); i++) {
- TParameter& param = function[i];
- if (param.name != 0) {
- TVariable *variable = new TVariable(param.name, *param.type);
- //
- // Insert the parameters with name in the symbol table.
- //
- if (! parseContext.symbolTable.insert(*variable)) {
- parseContext.error(yyvsp[0].interm.line, "redefinition", variable->getName().c_str(), "");
- parseContext.recover();
- delete variable;
- }
- //
- // Transfer ownership of name pointer to symbol table.
- //
- param.name = 0;
-
- //
- // Add the parameter to the HIL
- //
- paramNodes = parseContext.intermediate.growAggregate(
- paramNodes,
- parseContext.intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(), yyvsp[0].interm.line),
- yyvsp[0].interm.line);
- } else {
- paramNodes = parseContext.intermediate.growAggregate(paramNodes, parseContext.intermediate.addSymbol(0, "", *param.type, yyvsp[0].interm.line), yyvsp[0].interm.line);
- }
- }
- parseContext.intermediate.setAggregateOperator(paramNodes, EOpParameters, yyvsp[0].interm.line);
- yyvsp[0].interm.intermAggregate = paramNodes;
- parseContext.loopNestingLevel = 0;
- ;}
- break;
-
- case 214:
-#line 1988 "glslang.y"
- {
- //?? Check that all paths return a value if return type != void ?
- // May be best done as post process phase on intermediate code
- if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) {
- parseContext.error(yyvsp[-2].interm.line, "function does not return a value:", "", yyvsp[-2].interm.function->getName().c_str());
- parseContext.recover();
- }
- parseContext.symbolTable.pop();
- yyval.interm.intermNode = parseContext.intermediate.growAggregate(yyvsp[-2].interm.intermAggregate, yyvsp[0].interm.intermNode, 0);
- parseContext.intermediate.setAggregateOperator(yyval.interm.intermNode, EOpFunction, yyvsp[-2].interm.line);
- yyval.interm.intermNode->getAsAggregate()->setName(yyvsp[-2].interm.function->getMangledName().c_str());
- yyval.interm.intermNode->getAsAggregate()->setType(yyvsp[-2].interm.function->getReturnType());
-
- // store the pragma information for debug and optimize and other vendor specific
- // information. This information can be queried from the parse tree
- yyval.interm.intermNode->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
- yyval.interm.intermNode->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
- yyval.interm.intermNode->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable);
- ;}
- break;
-
-
- }
-
-/* Line 999 of yacc.c. */
-#line 4158 "glslang.tab.c"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-
-
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (YYPACT_NINF < yyn && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- int yytype = YYTRANSLATE (yychar);
- char *yymsg;
- int yyx, yycount;
-
- yycount = 0;
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- yysize += yystrlen (yytname[yyx]) + 15, yycount++;
- yysize += yystrlen ("syntax error, unexpected ") + 1;
- yysize += yystrlen (yytname[yytype]);
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
- yyp = yystpcpy (yyp, yytname[yytype]);
-
- if (yycount < 5)
- {
- yycount = 0;
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *));
- yyx++)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- const char *yyq = ! yycount ? ", expecting " : " or ";
- yyp = yystpcpy (yyp, yyq);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yycount++;
- }
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
- }
- else
- yyerror ("syntax error; also virtual memory exhausted");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- {
- /* Pop the error token. */
- YYPOPSTACK;
- /* Pop the rest of the stack. */
- while (yyss < yyssp)
- {
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[*yyssp], yyvsp);
- YYPOPSTACK;
- }
- YYABORT;
- }
-
- YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
- yydestruct (yytoken, &yylval);
- yychar = YYEMPTY;
-
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*----------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action. |
-`----------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[yystate], yyvsp);
- yyvsp--;
- yystate = *--yyssp;
-
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
- *++yyvsp = yylval;
-
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here. |
-`----------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- return yyresult;
-}
-
-
-#line 209 "glslang.y"
-
-
diff --git a/src/mesa/shader/slang/MachineIndependent/InfoSink.cpp b/src/mesa/shader/slang/MachineIndependent/InfoSink.cpp
deleted file mode 100755
index 9a1aaa26f9e..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/InfoSink.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "Include/InfoSink.h"
-
-#ifdef _WIN32
- #include <windows.h>
-#endif
-
-void TInfoSinkBase::append(const char *s)
-{
- if (outputStream & EString) {
- checkMem(strlen(s));
- sink.append(s);
- }
-
-#ifdef _WIN32
- if (outputStream & EDebugger)
- OutputDebugString(s);
-#endif
-
- if (outputStream & EStdOut)
- fprintf(stdout, "%s", s);
-}
-
-void TInfoSinkBase::append(int count, char c)
-{
- if (outputStream & EString) {
- checkMem(count);
- sink.append(count, c);
- }
-
-#ifdef _WIN32
- if (outputStream & EDebugger) {
- char str[2];
- str[0] = c;
- str[1] = '\0';
- OutputDebugString(str);
- }
-#endif
-
- if (outputStream & EStdOut)
- fprintf(stdout, "%c", c);
-}
-
-void TInfoSinkBase::append(const TPersistString& t)
-{
- if (outputStream & EString) {
- checkMem(t.size());
- sink.append(t);
- }
-
-#ifdef _WIN32
- if (outputStream & EDebugger)
- OutputDebugString(t.c_str());
-#endif
-
- if (outputStream & EStdOut)
- fprintf(stdout, "%s", t.c_str());
-}
-
-void TInfoSinkBase::append(const TString& t)
-{
- if (outputStream & EString) {
- checkMem(t.size());
- sink.append(t.c_str());
- }
-
-#ifdef _WIN32
- if (outputStream & EDebugger)
- OutputDebugString(t.c_str());
-#endif
-
- if (outputStream & EStdOut)
- fprintf(stdout, "%s", t.c_str());
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/Initialize.cpp b/src/mesa/shader/slang/MachineIndependent/Initialize.cpp
deleted file mode 100755
index 0913e531afb..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/Initialize.cpp
+++ /dev/null
@@ -1,948 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-//
-// Create strings that declare built-in definitions, add built-ins that
-// cannot be expressed in the files, and establish mappings between
-// built-in functions and operators.
-//
-
-#include "../Include/intermediate.h"
-#include "Initialize.h"
-
-void TBuiltIns::initialize()
-{
- //
- // Initialize all the built-in strings for parsing.
- //
- TString BuiltInFunctions;
- TString BuiltInFunctionsVertex;
- TString BuiltInFunctionsFragment;
- TString StandardVertexVaryings;
- TString StandardFragmentVaryings;
- TString StandardVertexAttributes;
- TString StandardUniforms;
-
- {
- //============================================================================
- //
- // Prototypes for built-in functions seen by both vertex and fragment shaders.
- //
- //============================================================================
-
- TString& s = BuiltInFunctions;
-
- //
- // Angle and Trigonometric Functions.
- //
- s.append(TString("float radians(float degrees);"));
- s.append(TString("vec2 radians(vec2 degrees);"));
- s.append(TString("vec3 radians(vec3 degrees);"));
- s.append(TString("vec4 radians(vec4 degrees);"));
-
- s.append(TString("float degrees(float radians);"));
- s.append(TString("vec2 degrees(vec2 radians);"));
- s.append(TString("vec3 degrees(vec3 radians);"));
- s.append(TString("vec4 degrees(vec4 radians);"));
-
- s.append(TString("float sin(float angle);"));
- s.append(TString("vec2 sin(vec2 angle);"));
- s.append(TString("vec3 sin(vec3 angle);"));
- s.append(TString("vec4 sin(vec4 angle);"));
-
- s.append(TString("float cos(float angle);"));
- s.append(TString("vec2 cos(vec2 angle);"));
- s.append(TString("vec3 cos(vec3 angle);"));
- s.append(TString("vec4 cos(vec4 angle);"));
-
- s.append(TString("float tan(float angle);"));
- s.append(TString("vec2 tan(vec2 angle);"));
- s.append(TString("vec3 tan(vec3 angle);"));
- s.append(TString("vec4 tan(vec4 angle);"));
-
- s.append(TString("float asin(float x);"));
- s.append(TString("vec2 asin(vec2 x);"));
- s.append(TString("vec3 asin(vec3 x);"));
- s.append(TString("vec4 asin(vec4 x);"));
-
- s.append(TString("float acos(float x);"));
- s.append(TString("vec2 acos(vec2 x);"));
- s.append(TString("vec3 acos(vec3 x);"));
- s.append(TString("vec4 acos(vec4 x);"));
-
- s.append(TString("float atan(float y, float x);"));
- s.append(TString("vec2 atan(vec2 y, vec2 x);"));
- s.append(TString("vec3 atan(vec3 y, vec3 x);"));
- s.append(TString("vec4 atan(vec4 y, vec4 x);"));
-
- s.append(TString("float atan(float y_over_x);"));
- s.append(TString("vec2 atan(vec2 y_over_x);"));
- s.append(TString("vec3 atan(vec3 y_over_x);"));
- s.append(TString("vec4 atan(vec4 y_over_x);"));
-
- //
- // Exponential Functions.
- //
- s.append(TString("float pow(float x, float y);"));
- s.append(TString("vec2 pow(vec2 x, vec2 y);"));
- s.append(TString("vec3 pow(vec3 x, vec3 y);"));
- s.append(TString("vec4 pow(vec4 x, vec4 y);"));
-
- s.append(TString("float exp(float x);"));
- s.append(TString("vec2 exp(vec2 x);"));
- s.append(TString("vec3 exp(vec3 x);"));
- s.append(TString("vec4 exp(vec4 x);"));
-
- s.append(TString("float log(float x);"));
- s.append(TString("vec2 log(vec2 x);"));
- s.append(TString("vec3 log(vec3 x);"));
- s.append(TString("vec4 log(vec4 x);"));
-
- s.append(TString("float exp2(float x);"));
- s.append(TString("vec2 exp2(vec2 x);"));
- s.append(TString("vec3 exp2(vec3 x);"));
- s.append(TString("vec4 exp2(vec4 x);"));
-
- s.append(TString("float log2(float x);"));
- s.append(TString("vec2 log2(vec2 x);"));
- s.append(TString("vec3 log2(vec3 x);"));
- s.append(TString("vec4 log2(vec4 x);"));
-
- s.append(TString("float sqrt(float x);"));
- s.append(TString("vec2 sqrt(vec2 x);"));
- s.append(TString("vec3 sqrt(vec3 x);"));
- s.append(TString("vec4 sqrt(vec4 x);"));
-
- s.append(TString("float inversesqrt(float x);"));
- s.append(TString("vec2 inversesqrt(vec2 x);"));
- s.append(TString("vec3 inversesqrt(vec3 x);"));
- s.append(TString("vec4 inversesqrt(vec4 x);"));
-
- //
- // Common Functions.
- //
- s.append(TString("float abs(float x);"));
- s.append(TString("vec2 abs(vec2 x);"));
- s.append(TString("vec3 abs(vec3 x);"));
- s.append(TString("vec4 abs(vec4 x);"));
-
- s.append(TString("float sign(float x);"));
- s.append(TString("vec2 sign(vec2 x);"));
- s.append(TString("vec3 sign(vec3 x);"));
- s.append(TString("vec4 sign(vec4 x);"));
-
- s.append(TString("float floor(float x);"));
- s.append(TString("vec2 floor(vec2 x);"));
- s.append(TString("vec3 floor(vec3 x);"));
- s.append(TString("vec4 floor(vec4 x);"));
-
- s.append(TString("float ceil(float x);"));
- s.append(TString("vec2 ceil(vec2 x);"));
- s.append(TString("vec3 ceil(vec3 x);"));
- s.append(TString("vec4 ceil(vec4 x);"));
-
- s.append(TString("float fract(float x);"));
- s.append(TString("vec2 fract(vec2 x);"));
- s.append(TString("vec3 fract(vec3 x);"));
- s.append(TString("vec4 fract(vec4 x);"));
-
- s.append(TString("float mod(float x, float y);"));
- s.append(TString("vec2 mod(vec2 x, float y);"));
- s.append(TString("vec3 mod(vec3 x, float y);"));
- s.append(TString("vec4 mod(vec4 x, float y);"));
- s.append(TString("vec2 mod(vec2 x, vec2 y);"));
- s.append(TString("vec3 mod(vec3 x, vec3 y);"));
- s.append(TString("vec4 mod(vec4 x, vec4 y);"));
-
- s.append(TString("float min(float x, float y);"));
- s.append(TString("vec2 min(vec2 x, float y);"));
- s.append(TString("vec3 min(vec3 x, float y);"));
- s.append(TString("vec4 min(vec4 x, float y);"));
- s.append(TString("vec2 min(vec2 x, vec2 y);"));
- s.append(TString("vec3 min(vec3 x, vec3 y);"));
- s.append(TString("vec4 min(vec4 x, vec4 y);"));
-
- s.append(TString("float max(float x, float y);"));
- s.append(TString("vec2 max(vec2 x, float y);"));
- s.append(TString("vec3 max(vec3 x, float y);"));
- s.append(TString("vec4 max(vec4 x, float y);"));
- s.append(TString("vec2 max(vec2 x, vec2 y);"));
- s.append(TString("vec3 max(vec3 x, vec3 y);"));
- s.append(TString("vec4 max(vec4 x, vec4 y);"));
-
- s.append(TString("float clamp(float x, float minVal, float maxVal);"));
- s.append(TString("vec2 clamp(vec2 x, float minVal, float maxVal);"));
- s.append(TString("vec3 clamp(vec3 x, float minVal, float maxVal);"));
- s.append(TString("vec4 clamp(vec4 x, float minVal, float maxVal);"));
- s.append(TString("vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);"));
- s.append(TString("vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);"));
- s.append(TString("vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);"));
-
- s.append(TString("float mix(float x, float y, float a);"));
- s.append(TString("vec2 mix(vec2 x, vec2 y, float a);"));
- s.append(TString("vec3 mix(vec3 x, vec3 y, float a);"));
- s.append(TString("vec4 mix(vec4 x, vec4 y, float a);"));
- s.append(TString("vec2 mix(vec2 x, vec2 y, vec2 a);"));
- s.append(TString("vec3 mix(vec3 x, vec3 y, vec3 a);"));
- s.append(TString("vec4 mix(vec4 x, vec4 y, vec4 a);"));
-
- s.append(TString("float step(float edge, float x);"));
- s.append(TString("vec2 step(vec2 edge, vec2 x);"));
- s.append(TString("vec3 step(vec3 edge, vec3 x);"));
- s.append(TString("vec4 step(vec4 edge, vec4 x);"));
- s.append(TString("vec2 step(float edge, vec2 x);"));
- s.append(TString("vec3 step(float edge, vec3 x);"));
- s.append(TString("vec4 step(float edge, vec4 x);"));
-
- s.append(TString("float smoothstep(float edge0, float edge1, float x);"));
- s.append(TString("vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);"));
- s.append(TString("vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);"));
- s.append(TString("vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);"));
- s.append(TString("vec2 smoothstep(float edge0, float edge1, vec2 x);"));
- s.append(TString("vec3 smoothstep(float edge0, float edge1, vec3 x);"));
- s.append(TString("vec4 smoothstep(float edge0, float edge1, vec4 x);"));
-
- //
- // Geometric Functions.
- //
- s.append(TString("float length(float x);"));
- s.append(TString("float length(vec2 x);"));
- s.append(TString("float length(vec3 x);"));
- s.append(TString("float length(vec4 x);"));
-
- s.append(TString("float distance(float p0, float p1);"));
- s.append(TString("float distance(vec2 p0, vec2 p1);"));
- s.append(TString("float distance(vec3 p0, vec3 p1);"));
- s.append(TString("float distance(vec4 p0, vec4 p1);"));
-
- s.append(TString("float dot(float x, float y);"));
- s.append(TString("float dot(vec2 x, vec2 y);"));
- s.append(TString("float dot(vec3 x, vec3 y);"));
- s.append(TString("float dot(vec4 x, vec4 y);"));
-
- s.append(TString("vec3 cross(vec3 x, vec3 y);"));
- s.append(TString("float normalize(float x);"));
- s.append(TString("vec2 normalize(vec2 x);"));
- s.append(TString("vec3 normalize(vec3 x);"));
- s.append(TString("vec4 normalize(vec4 x);"));
-
- s.append(TString("float faceforward(float N, float I, float Nref);"));
- s.append(TString("vec2 faceforward(vec2 N, vec2 I, vec2 Nref);"));
- s.append(TString("vec3 faceforward(vec3 N, vec3 I, vec3 Nref);"));
- s.append(TString("vec4 faceforward(vec4 N, vec4 I, vec4 Nref);"));
-
- s.append(TString("float reflect(float I, float N);"));
- s.append(TString("vec2 reflect(vec2 I, vec2 N);"));
- s.append(TString("vec3 reflect(vec3 I, vec3 N);"));
- s.append(TString("vec4 reflect(vec4 I, vec4 N);"));
-
- s.append(TString("float refract(float I, float N, float eta);"));
- s.append(TString("vec2 refract(vec2 I, vec2 N, float eta);"));
- s.append(TString("vec3 refract(vec3 I, vec3 N, float eta);"));
- s.append(TString("vec4 refract(vec4 I, vec4 N, float eta);"));
-
- //
- // Matrix Functions.
- //
- s.append(TString("mat2 matrixCompMult(mat2 x, mat2 y);"));
- s.append(TString("mat3 matrixCompMult(mat3 x, mat3 y);"));
- s.append(TString("mat4 matrixCompMult(mat4 x, mat4 y);"));
-
- //
- // Vector relational functions.
- //
- s.append(TString("bvec2 lessThan(vec2 x, vec2 y);"));
- s.append(TString("bvec3 lessThan(vec3 x, vec3 y);"));
- s.append(TString("bvec4 lessThan(vec4 x, vec4 y);"));
-
- s.append(TString("bvec2 lessThan(ivec2 x, ivec2 y);"));
- s.append(TString("bvec3 lessThan(ivec3 x, ivec3 y);"));
- s.append(TString("bvec4 lessThan(ivec4 x, ivec4 y);"));
-
- s.append(TString("bvec2 lessThanEqual(vec2 x, vec2 y);"));
- s.append(TString("bvec3 lessThanEqual(vec3 x, vec3 y);"));
- s.append(TString("bvec4 lessThanEqual(vec4 x, vec4 y);"));
-
- s.append(TString("bvec2 lessThanEqual(ivec2 x, ivec2 y);"));
- s.append(TString("bvec3 lessThanEqual(ivec3 x, ivec3 y);"));
- s.append(TString("bvec4 lessThanEqual(ivec4 x, ivec4 y);"));
-
- s.append(TString("bvec2 greaterThan(vec2 x, vec2 y);"));
- s.append(TString("bvec3 greaterThan(vec3 x, vec3 y);"));
- s.append(TString("bvec4 greaterThan(vec4 x, vec4 y);"));
-
- s.append(TString("bvec2 greaterThan(ivec2 x, ivec2 y);"));
- s.append(TString("bvec3 greaterThan(ivec3 x, ivec3 y);"));
- s.append(TString("bvec4 greaterThan(ivec4 x, ivec4 y);"));
-
- s.append(TString("bvec2 greaterThanEqual(vec2 x, vec2 y);"));
- s.append(TString("bvec3 greaterThanEqual(vec3 x, vec3 y);"));
- s.append(TString("bvec4 greaterThanEqual(vec4 x, vec4 y);"));
-
- s.append(TString("bvec2 greaterThanEqual(ivec2 x, ivec2 y);"));
- s.append(TString("bvec3 greaterThanEqual(ivec3 x, ivec3 y);"));
- s.append(TString("bvec4 greaterThanEqual(ivec4 x, ivec4 y);"));
-
- s.append(TString("bvec2 equal(vec2 x, vec2 y);"));
- s.append(TString("bvec3 equal(vec3 x, vec3 y);"));
- s.append(TString("bvec4 equal(vec4 x, vec4 y);"));
-
- s.append(TString("bvec2 equal(ivec2 x, ivec2 y);"));
- s.append(TString("bvec3 equal(ivec3 x, ivec3 y);"));
- s.append(TString("bvec4 equal(ivec4 x, ivec4 y);"));
-
- s.append(TString("bvec2 equal(bvec2 x, bvec2 y);"));
- s.append(TString("bvec3 equal(bvec3 x, bvec3 y);"));
- s.append(TString("bvec4 equal(bvec4 x, bvec4 y);"));
-
- s.append(TString("bvec2 notEqual(vec2 x, vec2 y);"));
- s.append(TString("bvec3 notEqual(vec3 x, vec3 y);"));
- s.append(TString("bvec4 notEqual(vec4 x, vec4 y);"));
-
- s.append(TString("bvec2 notEqual(ivec2 x, ivec2 y);"));
- s.append(TString("bvec3 notEqual(ivec3 x, ivec3 y);"));
- s.append(TString("bvec4 notEqual(ivec4 x, ivec4 y);"));
-
- s.append(TString("bvec2 notEqual(bvec2 x, bvec2 y);"));
- s.append(TString("bvec3 notEqual(bvec3 x, bvec3 y);"));
- s.append(TString("bvec4 notEqual(bvec4 x, bvec4 y);"));
-
- s.append(TString("bool any(bvec2 x);"));
- s.append(TString("bool any(bvec3 x);"));
- s.append(TString("bool any(bvec4 x);"));
-
- s.append(TString("bool all(bvec2 x);"));
- s.append(TString("bool all(bvec3 x);"));
- s.append(TString("bool all(bvec4 x);"));
-
- s.append(TString("bvec2 not(bvec2 x);"));
- s.append(TString("bvec3 not(bvec3 x);"));
- s.append(TString("bvec4 not(bvec4 x);"));
-
- //
- // Texture Functions.
- //
- s.append(TString("vec4 texture1D(sampler1D sampler, float coord);"));
- s.append(TString("vec4 texture1DProj(sampler1D sampler, vec2 coord);"));
- s.append(TString("vec4 texture1DProj(sampler1D sampler, vec4 coord);"));
-
- s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord);"));
- s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord);"));
- s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord);"));
-
- s.append(TString("vec4 texture3D(sampler3D sampler, vec3 coord);"));
- s.append(TString("vec4 texture3DProj(sampler3D sampler, vec4 coord);"));
-
- s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord);"));
-
- s.append(TString("vec4 shadow1D(sampler1DShadow sampler, vec3 coord);"));
-
- s.append(TString("vec4 shadow2D(sampler2DShadow sampler, vec3 coord);"));
-
- s.append(TString("vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord);"));
-
- s.append(TString("vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord);"));
-
-
- //
- // Noise functions.
- //
- s.append(TString("float noise1(float x);"));
- s.append(TString("float noise1(vec2 x);"));
- s.append(TString("float noise1(vec3 x);"));
- s.append(TString("float noise1(vec4 x);"));
-
- s.append(TString("vec2 noise2(float x);"));
- s.append(TString("vec2 noise2(vec2 x);"));
- s.append(TString("vec2 noise2(vec3 x);"));
- s.append(TString("vec2 noise2(vec4 x);"));
-
- s.append(TString("vec3 noise3(float x);"));
- s.append(TString("vec3 noise3(vec2 x);"));
- s.append(TString("vec3 noise3(vec3 x);"));
- s.append(TString("vec3 noise3(vec4 x);"));
-
- s.append(TString("vec4 noise4(float x);"));
- s.append(TString("vec4 noise4(vec2 x);"));
- s.append(TString("vec4 noise4(vec3 x);"));
- s.append(TString("vec4 noise4(vec4 x);"));
-
- s.append(TString("\n"));
- }
- {
- //============================================================================
- //
- // Prototypes for built-in functions seen by vertex shaders only.
- //
- //============================================================================
-
- TString& s = BuiltInFunctionsVertex;
-
- //
- // Geometric Functions.
- //
- s.append(TString("vec4 ftransform();"));
-
- //
- // Texture Functions.
- //
- s.append(TString("vec4 texture1DLod(sampler1D sampler, float coord, float lod);"));
- s.append(TString("vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);"));
- s.append(TString("vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);"));
-
- s.append(TString("vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);"));
- s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);"));
- s.append(TString("vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);"));
-
- s.append(TString("vec4 texture3DLod(sampler3D sampler, vec3 coord, float lod);"));
- s.append(TString("vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);"));
- s.append(TString("vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);"));
-
- s.append(TString("vec4 shadow1DLod(sampler1DShadow sampler, vec3 coord, float lod);"));
- s.append(TString("vec4 shadow2DLod(sampler2DShadow sampler, vec3 coord, float lod);"));
- s.append(TString("vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);"));
- s.append(TString("vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);"));
-
- s.append(TString("\n"));
- }
- {
- //============================================================================
- //
- // Prototypes for built-in functions seen by fragment shaders only.
- //
- //============================================================================
-
- TString& s = BuiltInFunctionsFragment;
-
- //
- // Texture Functions.
- //
- s.append(TString("vec4 texture1D(sampler1D sampler, float coord, float bias);"));
- s.append(TString("vec4 texture1DProj(sampler1D sampler, vec2 coord, float bias);"));
- s.append(TString("vec4 texture1DProj(sampler1D sampler, vec4 coord, float bias);"));
-
- s.append(TString("vec4 texture2D(sampler2D sampler, vec2 coord, float bias);"));
- s.append(TString("vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);"));
- s.append(TString("vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);"));
-
- s.append(TString("vec4 texture3D(sampler3D sampler, vec3 coord, float bias);"));
- s.append(TString("vec4 texture3DProj(sampler3D sampler, vec4 coord, float bias);"));
- s.append(TString("vec4 textureCube(samplerCube sampler, vec3 coord, float bias);"));
-
- s.append(TString("vec4 shadow1D(sampler1DShadow sampler, vec3 coord, float bias);"));
- s.append(TString("vec4 shadow2D(sampler2DShadow sampler, vec3 coord, float bias);"));
- s.append(TString("vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord, float bias);"));
- s.append(TString("vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord, float bias);"));
-
- s.append(TString("float dFdx(float p);"));
- s.append(TString("vec2 dFdx(vec2 p);"));
- s.append(TString("vec3 dFdx(vec3 p);"));
- s.append(TString("vec4 dFdx(vec4 p);"));
-
- s.append(TString("float dFdy(float p);"));
- s.append(TString("vec2 dFdy(vec2 p);"));
- s.append(TString("vec3 dFdy(vec3 p);"));
- s.append(TString("vec4 dFdy(vec4 p);"));
-
- s.append(TString("float fwidth(float p);"));
- s.append(TString("vec2 fwidth(vec2 p);"));
- s.append(TString("vec3 fwidth(vec3 p);"));
- s.append(TString("vec4 fwidth(vec4 p);"));
-
- s.append(TString("\n"));
- }
- {
- //============================================================================
- //
- // Standard Uniforms
- //
- //============================================================================
-
- TString& s = StandardUniforms;
-
-
- //
- // OpenGL'uniform' state. Page numbers are in reference to version
- // 1.4 of the OpenGL specification.
- //
-
- //
- // Matrix state. p. 31, 32, 37, 39, 40.
- //
- s.append(TString("uniform mat4 gl_ModelViewMatrix;"));
- s.append(TString("uniform mat4 gl_ProjectionMatrix;"));
- s.append(TString("uniform mat4 gl_ModelViewProjectionMatrix;"));
-
- //
- // Derived matrix state that provides inverse and transposed versions
- // of the matrices above.
- //
- s.append(TString("uniform mat3 gl_NormalMatrix;"));
-
- s.append(TString("uniform mat4 gl_ModelViewMatrixInverse;"));
- s.append(TString("uniform mat4 gl_ProjectionMatrixInverse;"));
- s.append(TString("uniform mat4 gl_ModelViewProjectionMatrixInverse;"));
-
- s.append(TString("uniform mat4 gl_ModelViewMatrixTranspose;"));
- s.append(TString("uniform mat4 gl_ProjectionMatrixTranspose;"));
- s.append(TString("uniform mat4 gl_ModelViewProjectionMatrixTranspose;"));
-
- s.append(TString("uniform mat4 gl_ModelViewMatrixInverseTranspose;"));
- s.append(TString("uniform mat4 gl_ProjectionMatrixInverseTranspose;"));
- s.append(TString("uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;"));
-
- //
- // Normal scaling p. 39.
- //
- s.append(TString("uniform float gl_NormalScale;"));
-
- //
- // Depth range in window coordinates, p. 33
- //
- s.append(TString("struct gl_DepthRangeParameters {"));
- s.append(TString(" float near;")); // n
- s.append(TString(" float far;")); // f
- s.append(TString(" float diff;")); // f - n
- s.append(TString("};"));
- s.append(TString("uniform gl_DepthRangeParameters gl_DepthRange;"));
-
-
- //
- // Point Size, p. 66, 67.
- //
- s.append(TString("struct gl_PointParameters {"));
- s.append(TString(" float size;"));
- s.append(TString(" float sizeMin;"));
- s.append(TString(" float sizeMax;"));
- s.append(TString(" float fadeThresholdSize;"));
- s.append(TString(" float distanceConstantAttenuation;"));
- s.append(TString(" float distanceLinearAttenuation;"));
- s.append(TString(" float distanceQuadraticAttenuation;"));
- s.append(TString("};"));
-
- s.append(TString("uniform gl_PointParameters gl_Point;"));
-
- //
- // Material State p. 50, 55.
- //
- s.append(TString("struct gl_MaterialParameters {"));
- s.append(TString(" vec4 emission;")); // Ecm
- s.append(TString(" vec4 ambient;")); // Acm
- s.append(TString(" vec4 diffuse;")); // Dcm
- s.append(TString(" vec4 specular;")); // Scm
- s.append(TString(" float shininess;")); // Srm
- s.append(TString("};"));
- s.append(TString("uniform gl_MaterialParameters gl_FrontMaterial;"));
- s.append(TString("uniform gl_MaterialParameters gl_BackMaterial;"));
-
- //
- // Light State p 50, 53, 55.
- //
-
- s.append(TString("struct gl_LightSourceParameters {"));
- s.append(TString(" vec4 ambient;")); // Acli
- s.append(TString(" vec4 diffuse;")); // Dcli
- s.append(TString(" vec4 specular;")); // Scli
- s.append(TString(" vec4 position;")); // Ppli
- s.append(TString(" vec4 halfVector;")); // Derived: Hi
- s.append(TString(" vec3 spotDirection;")); // Sdli
- s.append(TString(" float spotExponent;")); // Srli
- s.append(TString(" float spotCutoff;")); // Crli
- // (range: [0.0,90.0], 180.0)
- s.append(TString(" float spotCosCutoff;")); // Derived: cos(Crli)
- // (range: [1.0,0.0],-1.0)
- s.append(TString(" float constantAttenuation;")); // K0
- s.append(TString(" float linearAttenuation;")); // K1
- s.append(TString(" float quadraticAttenuation;"));// K2
- s.append(TString("};"));
-
-
- s.append(TString("struct gl_LightModelParameters {"));
- s.append(TString(" vec4 ambient;")); // Acs
- s.append(TString("};"));
-
- s.append(TString("uniform gl_LightModelParameters gl_LightModel;"));
-
- //
- // Derived state from products of light and material.
- //
-
- s.append(TString("struct gl_LightModelProducts {"));
- s.append(TString(" vec4 sceneColor;")); // Derived. Ecm + Acm * Acs
- s.append(TString("};"));
-
- s.append(TString("uniform gl_LightModelProducts gl_FrontLightModelProduct;"));
- s.append(TString("uniform gl_LightModelProducts gl_BackLightModelProduct;"));
-
- s.append(TString("struct gl_LightProducts {"));
- s.append(TString(" vec4 ambient;")); // Acm * Acli
- s.append(TString(" vec4 diffuse;")); // Dcm * Dcli
- s.append(TString(" vec4 specular;")); // Scm * Scli
- s.append(TString("};"));
-
-
-
-
- //
- // Fog p. 161
- //
- s.append(TString("struct gl_FogParameters {"));
- s.append(TString(" vec4 color;"));
- s.append(TString(" float density;"));
- s.append(TString(" float start;"));
- s.append(TString(" float end;"));
- s.append(TString(" float scale;")); // 1 / (gl_FogEnd - gl_FogStart)
- s.append(TString("};"));
-
- s.append(TString("uniform gl_FogParameters gl_Fog;"));
-
- s.append(TString("\n"));
- }
- {
- //============================================================================
- //
- // Vertex attributes, p. 19.
- //
- //============================================================================
-
- TString& s = StandardVertexAttributes;
-
- s.append(TString("attribute vec4 gl_Color;"));
- s.append(TString("attribute vec4 gl_SecondaryColor;"));
- s.append(TString("attribute vec3 gl_Normal;"));
- s.append(TString("attribute vec4 gl_Vertex;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord0;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord1;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord2;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord3;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord4;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord5;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord6;"));
- s.append(TString("attribute vec4 gl_MultiTexCoord7;"));
- s.append(TString("attribute float gl_FogCoord;"));
-
- s.append(TString("\n"));
- }
- {
- //============================================================================
- //
- // Define the output varying interface from the vertex shader.
- //
- //============================================================================
-
- TString& s = StandardVertexVaryings;
-
- s.append(TString("varying vec4 gl_FrontColor;"));
- s.append(TString("varying vec4 gl_BackColor;"));
- s.append(TString("varying vec4 gl_FrontSecondaryColor;"));
- s.append(TString("varying vec4 gl_BackSecondaryColor;"));
- s.append(TString("varying vec4 gl_TexCoord[];"));
- s.append(TString("varying float gl_FogFragCoord;"));
-
- s.append(TString("\n"));
- }
- {
- //============================================================================
- //
- // Define the input varying interface to the fragment shader.
- //
- //============================================================================
-
- TString& s = StandardFragmentVaryings;
-
- s.append(TString("varying vec4 gl_Color;"));
- s.append(TString("varying vec4 gl_SecondaryColor;"));
- s.append(TString("varying vec4 gl_TexCoord[];"));
- s.append(TString("varying float gl_FogFragCoord;"));
-
- s.append(TString("\n"));
- }
-
- builtInStrings[EShLangFragment].push_back(BuiltInFunctions.c_str());
- builtInStrings[EShLangFragment].push_back(BuiltInFunctionsFragment);
- builtInStrings[EShLangFragment].push_back(StandardUniforms);
- builtInStrings[EShLangFragment].push_back(StandardFragmentVaryings);
-
- builtInStrings[EShLangVertex].push_back(BuiltInFunctions);
- builtInStrings[EShLangVertex].push_back(BuiltInFunctionsVertex);
- builtInStrings[EShLangVertex].push_back(StandardVertexVaryings);
- builtInStrings[EShLangVertex].push_back(StandardVertexAttributes);
- builtInStrings[EShLangVertex].push_back(StandardUniforms);
-}
-
-
-void TBuiltIns::initialize(const TBuiltInResource &resources)
-{
- //
- // Initialize all the built-in strings for parsing.
- //
- TString StandardUniforms;
-
- {
- //============================================================================
- //
- // Standard Uniforms
- //
- //============================================================================
-
- TString& s = StandardUniforms;
-
- //
- // Implementation dependent constants. The example values below
- // are the minimum values allowed for these maximums.
- //
- char builtInConstant[80];
- sprintf(builtInConstant, "const int gl_MaxLights = %d;", resources.maxLights); // GL 1.0
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes); // GL 1.0
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits); // GL 1.2
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords); // ARB_fragment_program
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs); // ARB_vertex_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents); // ARB_vertex_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats); // ARB_vertex_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits); // ARB_vertex_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits); // ARB_vertex_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits); // ARB_fragment_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents); // ARB_fragment_shader
- s.append(TString(builtInConstant));
-
- sprintf(builtInConstant, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers); // proposed ARB_draw_buffers
- s.append(TString(builtInConstant));
-
- //
- // OpenGL'uniform' state. Page numbers are in reference to version
- // 1.4 of the OpenGL specification.
- //
-
- //
- // Matrix state. p. 31, 32, 37, 39, 40.
- //
- s.append(TString("uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];"));
-
- //
- // Derived matrix state that provides inverse and transposed versions
- // of the matrices above.
- //
- s.append(TString("uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];"));
-
- s.append(TString("uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];"));
-
- s.append(TString("uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];"));
-
- //
- // Clip planes p. 42.
- //
- s.append(TString("uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];"));
-
- //
- // Light State p 50, 53, 55.
- //
- s.append(TString("uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];"));
-
- //
- // Derived state from products of light.
- //
- s.append(TString("uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];"));
- s.append(TString("uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];"));
-
- //
- // Textureg Environment and Generation, p. 152, p. 40-42.
- //
- s.append(TString("uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];"));
- s.append(TString("uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];"));
- s.append(TString("uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];"));
-
- s.append(TString("\n"));
- }
-
- builtInStrings[EShLangFragment].push_back(StandardUniforms);
- builtInStrings[EShLangVertex].push_back(StandardUniforms);
-}
-
-void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
-{
- //
- // First, insert some special built-in variables that are not in
- // the built-in header files.
- //
- switch(language) {
-
- case EShLangFragment: {
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EvqFace, 1)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EvqFragCoord, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EvqFragColor, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragDepth"), TType(EbtFloat, EvqFragDepth, 1)));
-
- }
- break;
-
- case EShLangVertex:
- symbolTable.insert(*new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EvqPosition, 4)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EvqPointSize, 1)));
- symbolTable.insert(*new TVariable(NewPoolTString("gl_ClipVertex"), TType(EbtFloat, EvqClipVertex, 4)));
- break;
- default: break;
- }
-
- //
- // Next, identify which built-ins from the already loaded headers have
- // a mapping to an operator. Those that are not identified as such are
- // expected to be resolved through a library of functions, versus as
- // operations.
- //
- symbolTable.relateToOperator("not", EOpVectorLogicalNot);
-
- symbolTable.relateToOperator("matrixCompMult", EOpMul);
- symbolTable.relateToOperator("mod", EOpMod);
-
- symbolTable.relateToOperator("equal", EOpVectorEqual);
- symbolTable.relateToOperator("notEqual", EOpVectorNotEqual);
- symbolTable.relateToOperator("lessThan", EOpLessThan);
- symbolTable.relateToOperator("greaterThan", EOpGreaterThan);
- symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual);
- symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual);
-
- symbolTable.relateToOperator("radians", EOpRadians);
- symbolTable.relateToOperator("degrees", EOpDegrees);
- symbolTable.relateToOperator("sin", EOpSin);
- symbolTable.relateToOperator("cos", EOpCos);
- symbolTable.relateToOperator("tan", EOpTan);
- symbolTable.relateToOperator("asin", EOpAsin);
- symbolTable.relateToOperator("acos", EOpAcos);
- symbolTable.relateToOperator("atan", EOpAtan);
-
- symbolTable.relateToOperator("pow", EOpPow);
- symbolTable.relateToOperator("exp2", EOpExp2);
- symbolTable.relateToOperator("log", EOpLog);
- symbolTable.relateToOperator("exp", EOpExp);
- symbolTable.relateToOperator("log2", EOpLog2);
- symbolTable.relateToOperator("sqrt", EOpSqrt);
- symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt);
-
- symbolTable.relateToOperator("abs", EOpAbs);
- symbolTable.relateToOperator("sign", EOpSign);
- symbolTable.relateToOperator("floor", EOpFloor);
- symbolTable.relateToOperator("ceil", EOpCeil);
- symbolTable.relateToOperator("fract", EOpFract);
- symbolTable.relateToOperator("min", EOpMin);
- symbolTable.relateToOperator("max", EOpMax);
- symbolTable.relateToOperator("clamp", EOpClamp);
- symbolTable.relateToOperator("mix", EOpMix);
- symbolTable.relateToOperator("step", EOpStep);
- symbolTable.relateToOperator("smoothstep", EOpSmoothStep);
-
- symbolTable.relateToOperator("length", EOpLength);
- symbolTable.relateToOperator("distance", EOpDistance);
- symbolTable.relateToOperator("dot", EOpDot);
- symbolTable.relateToOperator("cross", EOpCross);
- symbolTable.relateToOperator("normalize", EOpNormalize);
- symbolTable.relateToOperator("forward", EOpFaceForward);
- symbolTable.relateToOperator("reflect", EOpReflect);
- symbolTable.relateToOperator("refract", EOpRefract);
-
- symbolTable.relateToOperator("any", EOpAny);
- symbolTable.relateToOperator("all", EOpAll);
-
- switch(language) {
-
- case EShLangVertex:
- break;
-
- case EShLangFragment:
- symbolTable.relateToOperator("dFdx", EOpDPdx);
- symbolTable.relateToOperator("dFdy", EOpDPdy);
- symbolTable.relateToOperator("fwidth", EOpFwidth);
-
- break;
-
- case EShLangPack:
- case EShLangUnpack:
- symbolTable.relateToOperator("itof", EOpItof);
- symbolTable.relateToOperator("ftoi", EOpFtoi);
- symbolTable.relateToOperator("skipPixels", EOpSkipPixels);
- symbolTable.relateToOperator("readInput", EOpReadInput);
- symbolTable.relateToOperator("writePixel", EOpWritePixel);
- symbolTable.relateToOperator("bitmapLSB", EOpBitmapLsb);
- symbolTable.relateToOperator("bitmapMSB", EOpBitmapMsb);
- symbolTable.relateToOperator("writeOutput", EOpWriteOutput);
- symbolTable.relateToOperator("readPixel", EOpReadPixel);
- break;
- default: assert (false && "Language not supported");
- }
-}
-
-void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
-{
- //
- // First, insert some special built-in variables that are not in
- // the built-in header files.
- //
- switch(language) {
-
- case EShLangFragment: {
- // Set up gl_FragData. The array size.
- TType fragData(EbtFloat, EvqFragColor, 4, false, true);
- fragData.setArraySize(resources.maxDrawBuffers);
- symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));
- }
- break;
-
- default: break;
- }
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/Initialize.h b/src/mesa/shader/slang/MachineIndependent/Initialize.h
deleted file mode 100755
index b273f06caea..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/Initialize.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _INITIALIZE_INCLUDED_
-#define _INITIALIZE_INCLUDED_
-
-#include "Include/ResourceLimits.h"
-#include "../Include/Common.h"
-#include "../Include/ShHandle.h"
-#include "SymbolTable.h"
-
-typedef TVector<TString> TBuiltInStrings;
-
-class TBuiltIns {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- void initialize();
- void initialize(const TBuiltInResource& resources);
- TBuiltInStrings* getBuiltInStrings() { return builtInStrings; }
-protected:
- TBuiltInStrings builtInStrings[EShLangCount];
-};
-
-void IdentifyBuiltIns(EShLanguage, TSymbolTable&);
-void IdentifyBuiltIns(EShLanguage, TSymbolTable&, const TBuiltInResource &resources);
-
-#endif // _INITIALIZE_INCLUDED_
diff --git a/src/mesa/shader/slang/MachineIndependent/IntermTraverse.cpp b/src/mesa/shader/slang/MachineIndependent/IntermTraverse.cpp
deleted file mode 100755
index da77806ddc2..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/IntermTraverse.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "../Include/intermediate.h"
-
-//
-// Traverse the intermediate representation tree, and
-// call a node type specific function for each node.
-// Done recursively through the member function Traverse().
-// Node types can be skipped if their function to call is 0,
-// but their subtree will still be traversed.
-// Nodes with children can have their whole subtree skipped
-// if preVisit is turned on and the type specific function
-// returns false.
-//
-// preVisit, postVisit, and rightToLeft control what order
-// nodes are visited in.
-//
-
-//
-// Traversal functions for terminals are straighforward....
-//
-void TIntermSymbol::traverse(TIntermTraverser* it)
-{
- if (it->visitSymbol)
- it->visitSymbol(this, it);
-}
-
-void TIntermConstantUnion::traverse(TIntermTraverser* it)
-{
- if (it->visitConstantUnion)
- it->visitConstantUnion(this, it);
-}
-
-//
-// Traverse a binary node.
-//
-void TIntermBinary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- //
- // visit the node before children if pre-visiting.
- //
- if (it->preVisit && it->visitBinary)
- visit = it->visitBinary(true, this, it);
-
- //
- // Visit the children, in the right order.
- //
- if (visit) {
- ++it->depth;
- if (it->rightToLeft) {
- if (right)
- right->traverse(it);
- if (left)
- left->traverse(it);
- } else {
- if (left)
- left->traverse(it);
- if (right)
- right->traverse(it);
- }
- --it->depth;
- }
-
- //
- // Visit the node after the children, if requested and the traversal
- // hasn't been cancelled yet.
- //
- if (visit && it->postVisit && it->visitBinary)
- it->visitBinary(false, this, it);
-}
-
-//
-// Traverse a unary node. Same comments in binary node apply here.
-//
-void TIntermUnary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit && it->visitUnary)
- visit = it->visitUnary(true, this, it);
-
- if (visit) {
- ++it->depth;
- operand->traverse(it);
- --it->depth;
- }
-
- if (visit && it->postVisit && it->visitUnary)
- it->visitUnary(false, this, it);
-}
-
-//
-// Traverse an aggregate node. Same comments in binary node apply here.
-//
-void TIntermAggregate::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit && it->visitAggregate)
- visit = it->visitAggregate(true, this, it);
-
- if (visit) {
- ++it->depth;
-
- TIntermSequence::iterator sit;
- if (it->rightToLeft) {
- sit = sequence.end();
- while (sit != sequence.begin()) {
- --sit;
- (*sit)->traverse(it);
- }
- } else {
- for (sit = sequence.begin(); sit != sequence.end(); ++sit)
- (*sit)->traverse(it);
- }
-
- --it->depth;
- }
-
- if (visit && it->postVisit && it->visitAggregate)
- it->visitAggregate(false, this, it);
-}
-
-//
-// Traverse a selection node. Same comments in binary node apply here.
-//
-void TIntermSelection::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit && it->visitSelection)
- visit = it->visitSelection(true, this, it);
-
- if (visit) {
- ++it->depth;
- if (it->rightToLeft) {
- if (falseBlock)
- falseBlock->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- condition->traverse(it);
- } else {
- condition->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- if (falseBlock)
- falseBlock->traverse(it);
- }
- --it->depth;
- }
-
- if (visit && it->postVisit && it->visitSelection)
- it->visitSelection(false, this, it);
-}
-
-//
-// Traverse a loop node. Same comments in binary node apply here.
-//
-void TIntermLoop::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit && it->visitLoop)
- visit = it->visitLoop(true, this, it);
-
- if (visit) {
- ++it->depth;
- if (it->rightToLeft) {
- if (terminal)
- terminal->traverse(it);
- if (body)
- body->traverse(it);
- if (test)
- test->traverse(it);
- } else {
- if (test)
- test->traverse(it);
- if (body)
- body->traverse(it);
- if (terminal)
- terminal->traverse(it);
- }
- --it->depth;
- }
-
- if (visit && it->postVisit && it->visitLoop)
- it->visitLoop(false, this, it);
-}
-
-//
-// Traverse a branch node. Same comments in binary node apply here.
-//
-void TIntermBranch::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit && it->visitBranch)
- visit = it->visitBranch(true, this, it);
-
- if (visit && expression) {
- ++it->depth;
- expression->traverse(it);
- --it->depth;
- }
-
- if (visit && it->postVisit && it->visitBranch)
- it->visitBranch(false, this, it);
-}
-
diff --git a/src/mesa/shader/slang/MachineIndependent/Intermediate.cpp b/src/mesa/shader/slang/MachineIndependent/Intermediate.cpp
deleted file mode 100755
index 056fe17de02..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/Intermediate.cpp
+++ /dev/null
@@ -1,2110 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-//
-// Build the intermediate representation.
-//
-
-#include "../Include/ShHandle.h"
-#include "localintermediate.h"
-#include "QualifierAlive.h"
-#include "RemoveTree.h"
-#include <float.h>
-
-////////////////////////////////////////////////////////////////////////////
-//
-// First set of functions are to help build the intermediate representation.
-// These functions are not member functions of the nodes.
-// They are called from parser productions.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-//
-// Add a terminal node for an identifier in an expression.
-//
-// Returns the added node.
-//
-TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, TSourceLoc line)
-{
- TIntermSymbol* node = new TIntermSymbol(id, name, type);
- node->setLine(line);
-
- return node;
-}
-
-//
-// Connect two nodes with a new parent that does a binary operation on the nodes.
-//
-// Returns the added node.
-//
-TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TSymbolTable& symbolTable)
-{
- switch (op) {
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- if (left->getType().isMatrix() || left->getType().isArray() || left->getType().isVector() || left->getType().getBasicType() == EbtStruct) {
- return 0;
- }
- break;
- case EOpLogicalOr:
- case EOpLogicalXor:
- case EOpLogicalAnd:
- if (left->getType().getBasicType() != EbtBool || left->getType().isMatrix() || left->getType().isArray() || left->getType().isVector()) {
- return 0;
- }
- break;
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpMul:
- if (left->getType().getBasicType() == EbtStruct || left->getType().getBasicType() == EbtBool)
- return 0;
- default: break;
- }
-
- //
- // First try converting the children to compatible types.
- //
-
- if (!(left->getType().getStruct() && right->getType().getStruct())) {
- TIntermTyped* child = addConversion(op, left->getType(), right);
- if (child)
- right = child;
- else {
- child = addConversion(op, right->getType(), left);
- if (child)
- left = child;
- else
- return 0;
- }
- } else {
- if (left->getType() != right->getType())
- return 0;
- }
-
-
- //
- // Need a new node holding things together then. Make
- // one and promote it to the right type.
- //
- TIntermBinary* node = new TIntermBinary(op);
- if (line == 0)
- line = right->getLine();
- node->setLine(line);
-
- node->setLeft(left);
- node->setRight(right);
- if (! node->promote(infoSink))
- return 0;
-
- TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
- TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
-
- if (leftTempConstant)
- leftTempConstant = copyConstUnion(left->getAsConstantUnion())->getAsConstantUnion();
-
- if (rightTempConstant)
- rightTempConstant = copyConstUnion(right->getAsConstantUnion())->getAsConstantUnion();
-
- if (right->getType().getQualifier() == EvqConst && left->getType().getQualifier() == EvqConst) {
- if (right->getAsAggregate()) {
- rightTempConstant = changeAggrToTempConst(right->getAsAggregate(), symbolTable, line);
- if (rightTempConstant->getUnionArrayPointer() == 0)
- return 0;
- }
-
- if (left->getAsAggregate()) {
- leftTempConstant = changeAggrToTempConst(left->getAsAggregate(), symbolTable, line);
- if (leftTempConstant->getUnionArrayPointer() == 0)
- return 0;
- }
- }
-
- //
- // See if we can fold constants.
- //
-
- TIntermTyped* typedReturnNode = 0;
- if ( leftTempConstant && rightTempConstant) {
- if (leftTempConstant->getSize() == 1 && rightTempConstant->getSize() > 1)
- typedReturnNode = rightTempConstant->fold(node->getOp(), leftTempConstant, infoSink, false);
- else
- typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink, true);
-
- if (typedReturnNode)
- return typedReturnNode;
- else {
- node->setLeft(leftTempConstant);
- node->setRight(rightTempConstant);
- }
- } else if (leftTempConstant) {
- node->setLeft(copyConstUnion(leftTempConstant));
- } else if (rightTempConstant) {
- node->setRight(rightTempConstant);
- }
-
- return node;
-}
-
-//
-// Connect two nodes through an assignment.
-//
-// Returns the added node.
-//
-TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
-{
- //
- // Like adding binary math, except the conversion can only go
- // from right to left.
- //
- TIntermBinary* node = new TIntermBinary(op);
- if (line == 0)
- line = left->getLine();
- node->setLine(line);
-
- if (right->getAsConstantUnion()) { // if the right node of assignment is a TempConstant node, allocate its own new space and remove the pointer to the symbol table value
- right = copyConstUnion(right->getAsConstantUnion()) ;
- if (right == 0)
- return 0;
- }
-
- TIntermTyped* child = addConversion(op, left->getType(), right);
- if (child == 0)
- return 0;
-
- node->setLeft(left);
- node->setRight(child);
- if (! node->promote(infoSink))
- return 0;
-
- return node;
-}
-
-//
-// Connect two nodes through an index operator, where the left node is the base
-// of an array or struct, and the right node is a direct or indirect offset.
-//
-// Returns the added node.
-// The caller should set the type of the returned node.
-//
-TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc line)
-{
- TIntermBinary* node = new TIntermBinary(op);
- if (line == 0)
- line = index->getLine();
- node->setLine(line);
- node->setLeft(base);
- node->setRight(index);
-
- // caller should set the type
-
- return node;
-}
-
-//
-// Add one node as the parent of another that it operates on.
-//
-// Returns the added node.
-//
-TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, TSourceLoc line, TSymbolTable& symbolTable)
-{
- TIntermUnary* node;
- TIntermTyped* child = childNode->getAsTyped();
-
- if (child == 0) {
- infoSink.info.message(EPrefixInternalError, "Bad type in AddUnaryMath", line);
- return 0;
- }
-
- switch (op) {
- case EOpLogicalNot:
- if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) {
- return 0;
- }
- break;
-
- case EOpPostIncrement:
- case EOpPreIncrement:
- case EOpPostDecrement:
- case EOpPreDecrement:
- case EOpNegative:
- if (child->getType().getBasicType() == EbtStruct)
- return 0;
- default: break;
- }
-
- //
- // Do we need to promote the operand?
- //
- // Note: Implicit promotions were removed from the language.
- //
- TBasicType newType = EbtVoid;
- switch (op) {
- case EOpConstructInt: newType = EbtInt; break;
- case EOpConstructBool: newType = EbtBool; break;
- case EOpConstructFloat: newType = EbtFloat; break;
- default: break;
- }
-
- if (newType != EbtVoid) {
- child = addConversion(op, TType(newType, EvqTemporary, child->getNominalSize(),
- child->isMatrix(),
- child->isArray()),
- child);
- if (child == 0)
- return 0;
- }
-
- //
- // For constructors, we are now done, it's all in the conversion.
- //
- switch (op) {
- case EOpConstructInt:
- case EOpConstructBool:
- case EOpConstructFloat:
- return child;
- default: break;
- }
-
- if (child->getAsConstantUnion())
- child = copyConstUnion(child->getAsConstantUnion());
-
- if (child->getAsAggregate() && child->getType().getQualifier() == EvqConst) {
- child = changeAggrToTempConst(child->getAsAggregate(), symbolTable, line);
- if (child->getAsConstantUnion()->getUnionArrayPointer() == 0)
- return 0;
- }
-
- TIntermConstantUnion *childTempConstant = child->getAsConstantUnion();
-
- //
- // Make a new node for the operator.
- //
- node = new TIntermUnary(op);
- if (line == 0)
- line = child->getLine();
- node->setLine(line);
- node->setOperand(child);
-
- if (! node->promote(infoSink))
- return 0;
-
- if (childTempConstant) {
- TIntermTyped* newChild = childTempConstant->fold(op, 0, infoSink, true);
-
- if (newChild) {
- return newChild;
- }
- }
-
- return node;
-}
-
-//
-// This is the safe way to change the operator on an aggregate, as it
-// does lots of error checking and fixing. Especially for establishing
-// a function call's operation on it's set of parameters. Sequences
-// of instructions are also aggregates, but they just direnctly set
-// their operator to EOpSequence.
-//
-// Returns an aggregate node, which could be the one passed in if
-// it was already an aggregate.
-//
-TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, TSourceLoc line)
-{
- TIntermAggregate* aggNode;
-
- //
- // Make sure we have an aggregate. If not turn it into one.
- //
- if (node) {
- aggNode = node->getAsAggregate();
- if (aggNode == 0 || aggNode->getOp() != EOpNull) {
- //
- // Make an aggregate containing this node.
- //
- aggNode = new TIntermAggregate();
- aggNode->getSequence().push_back(node);
- if (line == 0)
- line = node->getLine();
- }
- } else
- aggNode = new TIntermAggregate();
-
- //
- // Set the operator.
- //
- aggNode->setOperator(op);
- if (line != 0)
- aggNode->setLine(line);
-
- return aggNode;
-}
-
-//
-// Convert one type to another.
-//
-// Returns the node representing the conversion, which could be the same
-// node passed in if no conversion was needed.
-//
-// Return 0 if a conversion can't be done.
-//
-TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node)
-{
- //
- // Does the base type allow operation?
- //
- switch (node->getBasicType()) {
- case EbtVoid:
- case EbtSampler1D:
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSampler1DShadow:
- case EbtSampler2DShadow:
- return 0;
- default: break;
- }
-
- //
- // Otherwise, if types are identical, no problem
- //
- if (type == node->getType())
- return node;
-
- //
- // If one's a structure, then no conversions.
- //
- if (type.getStruct() || node->getType().getStruct())
- return 0;
-
- TBasicType promoteTo;
-
- switch (op) {
- //
- // Explicit conversions
- //
- case EOpConstructBool:
- promoteTo = EbtBool;
- break;
- case EOpConstructFloat:
- promoteTo = EbtFloat;
- break;
- case EOpConstructInt:
- promoteTo = EbtInt;
- break;
- default:
- //
- // implicit conversions were removed from the language.
- //
- if (type.getBasicType() != node->getType().getBasicType())
- return 0;
- //
- // Size and structure could still differ, but that's
- // handled by operator promotion.
- //
- return node;
- }
-
- //
- // Do conversion.
- //
- bool allConstant = true;
- // check to see if there is an aggregate node
- if (node->getAsAggregate()) {
- if (node->getAsAggregate()->getOp() != EOpFunctionCall) {
- // if the aggregate node is a constructor or a comma operator, look at its children, if they are constant
- // convert them into the right type
- TIntermSequence &sequenceVector = node->getAsAggregate()->getSequence() ;
- for (TIntermSequence::iterator p = sequenceVector.begin();
- p != sequenceVector.end(); p++) {
- if (!(*p)->getAsTyped()->getAsConstantUnion())
- allConstant = false;
- }
- } else
- allConstant = false;
- }
- if (allConstant && node->getAsAggregate()) { // we can do the constant folding here as all the nodes of the aggregate are const
- TIntermSequence &sequenceVector = node->getAsAggregate()->getSequence() ;
- for (TIntermSequence::iterator p = sequenceVector.begin();
- p != sequenceVector.end(); p++) {
- TIntermTyped* newNode = 0;
- constUnion *unionArray = new constUnion[1];
-
- switch (promoteTo) {
- case EbtFloat:
- switch ((*p)->getAsTyped()->getType().getBasicType()) {
-
- case EbtInt:
- unionArray->fConst = static_cast<float>((*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- newNode = addConstantUnion(unionArray, TType(EbtFloat, EvqConst), node->getLine()); break;
- case EbtBool:
- unionArray->fConst = static_cast<float>((*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->bConst);
- newNode = newNode = addConstantUnion(unionArray, TType(EbtFloat, EvqConst), node->getLine()); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- break;
- case EbtInt:
- switch ((*p)->getAsTyped()->getType().getBasicType()) {
- case EbtFloat:
- unionArray->iConst = static_cast<int>((*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->fConst);
- newNode = addConstantUnion(unionArray, TType(EbtInt, EvqConst), node->getLine());
- break;
- case EbtBool:
- unionArray->iConst = static_cast<int>((*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->bConst);
- newNode = addConstantUnion(unionArray, TType(EbtInt, EvqConst), node->getLine());
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- break;
- case EbtBool:
- switch ((*p)->getAsTyped()->getType().getBasicType()) {
- case EbtFloat:
- unionArray->bConst = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->fConst != 0.0 ;
- newNode = addConstantUnion(unionArray, TType(EbtBool, EvqConst), node->getLine());
- break;
- case EbtInt:
- unionArray->bConst = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->iConst != 0 ;
- newNode = addConstantUnion(unionArray, TType(EbtBool, EvqConst), node->getLine());
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- if (newNode) {
- sequenceVector.erase(p);
- sequenceVector.insert(p, newNode);
- }
- }
- return node->getAsAggregate();
- } else if (node->getAsConstantUnion()) {
-
- return (promoteConstantUnion(promoteTo, node->getAsConstantUnion()));
- } else {
-
- //
- // Add a new newNode for the conversion.
- //
- TIntermUnary* newNode = 0;
-
- TOperator newOp = EOpNull;
- switch (promoteTo) {
- case EbtFloat:
- switch (node->getBasicType()) {
- case EbtInt: newOp = EOpConvIntToFloat; break;
- case EbtBool: newOp = EOpConvBoolToFloat; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- break;
- case EbtBool:
- switch (node->getBasicType()) {
- case EbtInt: newOp = EOpConvIntToBool; break;
- case EbtFloat: newOp = EOpConvFloatToBool; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- break;
- case EbtInt:
- switch (node->getBasicType()) {
- case EbtBool: newOp = EOpConvBoolToInt; break;
- case EbtFloat: newOp = EOpConvFloatToInt; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
- return 0;
- }
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Bad promotion type", node->getLine());
- return 0;
- }
-
- TType type(promoteTo, EvqTemporary, node->getNominalSize(), node->isMatrix(), node->isArray());
- newNode = new TIntermUnary(newOp, type);
- newNode->setLine(node->getLine());
- newNode->setOperand(node);
-
- return newNode;
- }
-}
-
-//
-// Safe way to combine two nodes into an aggregate. Works with null pointers,
-// a node that's not a aggregate yet, etc.
-//
-// Returns the resulting aggregate, unless 0 was passed in for
-// both existing nodes.
-//
-TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc line)
-{
- if (left == 0 && right == 0)
- return 0;
-
- TIntermAggregate* aggNode = 0;
- if (left)
- aggNode = left->getAsAggregate();
- if (!aggNode || aggNode->getOp() != EOpNull) {
- aggNode = new TIntermAggregate;
- if (left)
- aggNode->getSequence().push_back(left);
- }
-
- if (right)
- aggNode->getSequence().push_back(right);
-
- if (line != 0)
- aggNode->setLine(line);
-
- return aggNode;
-}
-
-//
-// Turn an existing node into an aggregate.
-//
-// Returns an aggregate, unless 0 was passed in for the existing node.
-//
-TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc line)
-{
- if (node == 0)
- return 0;
-
- TIntermAggregate* aggNode = new TIntermAggregate;
- aggNode->getSequence().push_back(node);
-
- if (line != 0)
- aggNode->setLine(line);
- else
- aggNode->setLine(node->getLine());
-
- return aggNode;
-}
-
-//
-// For "if" test nodes. There are three children; a condition,
-// a true path, and a false path. The two paths are in the
-// nodePair.
-//
-// Returns the selection node created.
-//
-TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc line)
-{
- //
- // For compile time constant selections, prune the code and
- // test now.
- //
-
- if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
- if (cond->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->bConst)
- return nodePair.node1;
- else
- return nodePair.node2;
- }
-
- TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
- node->setLine(line);
-
- return node;
-}
-
-
-TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line)
-{
- if (left->getType().getQualifier() == EvqConst && right->getType().getQualifier() == EvqConst) {
- return right;
- } else {
- TIntermTyped *commaAggregate = growAggregate(left, right, line);
- commaAggregate->getAsAggregate()->setOperator(EOpComma);
- commaAggregate->setType(right->getType());
- commaAggregate->getTypePointer()->changeQualifier(EvqTemporary);
- return commaAggregate;
- }
-}
-
-//
-// For "?:" test nodes. There are three children; a condition,
-// a true path, and a false path. The two paths are specified
-// as separate parameters.
-//
-// Returns the selection node created, or 0 if one could not be.
-//
-TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc line)
-{
- //
- // Get compatible types.
- //
- TIntermTyped* child = addConversion(EOpSequence, trueBlock->getType(), falseBlock);
- if (child)
- falseBlock = child;
- else {
- child = addConversion(EOpSequence, falseBlock->getType(), trueBlock);
- if (child)
- trueBlock = child;
- else
- return 0;
- }
-
- //
- // See if condition is constant, and select now.
- //
-
- if (cond->getAsConstantUnion()) {
- if (cond->getAsConstantUnion()->getUnionArrayPointer()->bConst)
- return trueBlock;
- else
- return falseBlock;
- }
-
- //
- // Make a selection node.
- //
- TIntermSelection* node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock->getType());
- node->setLine(line);
-
- return node;
-}
-
-//
-// Constant terminal nodes. Has a union that contains bool, float or int constants
-//
-// Returns the constant union node created.
-//
-
-TIntermConstantUnion* TIntermediate::addConstantUnion(constUnion* unionArrayPointer, const TType& t, TSourceLoc line)
-{
- TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
- node->setLine(line);
-
- return node;
-}
-
-TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line)
-{
-
- TIntermAggregate* node = new TIntermAggregate(EOpSequence);
-
- node->setLine(line);
- TIntermConstantUnion* constIntNode;
- TIntermSequence &sequenceVector = node->getSequence();
- constUnion* unionArray;
-
- for (int i = 0; i < fields.num; i++) {
- unionArray = new constUnion[1];
- unionArray->iConst = fields.offsets[i];
- constIntNode = addConstantUnion(unionArray, TType(EbtInt, EvqConst), line);
- sequenceVector.push_back(constIntNode);
- }
-
- return node;
-}
-
-//
-// Create loop nodes.
-//
-TIntermNode* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, TSourceLoc line)
-{
- TIntermNode* node = new TIntermLoop(body, test, terminal, testFirst);
- node->setLine(line);
-
- return node;
-}
-
-//
-// Add branches.
-//
-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TSourceLoc line)
-{
- return addBranch(branchOp, 0, line);
-}
-
-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, TSourceLoc line)
-{
- TIntermBranch* node = new TIntermBranch(branchOp, expression);
- node->setLine(line);
-
- return node;
-}
-
-//
-// This is to be executed once the final root is put on top by the parsing
-// process.
-//
-bool TIntermediate::postProcess(TIntermNode* root, EShLanguage language)
-{
- if (root == 0)
- return true;
-
- //
- // First, finish off the top level sequence, if any
- //
- TIntermAggregate* aggRoot = root->getAsAggregate();
- if (aggRoot && aggRoot->getOp() == EOpNull)
- aggRoot->setOperator(EOpSequence);
-
- return true;
-}
-
-//
-// This deletes the tree.
-//
-void TIntermediate::remove(TIntermNode* root)
-{
- if (root)
- RemoveAllTreeNodes(root);
-}
-
-////////////////////////////////////////////////////////////////
-//
-// Member functions of the nodes used for building the tree.
-//
-////////////////////////////////////////////////////////////////
-
-//
-// Say whether or not an operation node changes the value of a variable.
-//
-// Returns true if state is modified.
-//
-bool TIntermOperator::modifiesState() const
-{
- switch (op) {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- case EOpAssign:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpMulAssign:
- case EOpVectorTimesMatrixAssign:
- case EOpVectorTimesScalarAssign:
- case EOpMatrixTimesScalarAssign:
- case EOpMatrixTimesMatrixAssign:
- case EOpDivAssign:
- case EOpModAssign:
- case EOpAndAssign:
- case EOpInclusiveOrAssign:
- case EOpExclusiveOrAssign:
- case EOpLeftShiftAssign:
- case EOpRightShiftAssign:
- return true;
- default:
- return false;
- }
-}
-
-//
-// returns true if the operator is for one of the constructors
-//
-bool TIntermOperator::isConstructor() const
-{
- switch (op) {
- case EOpConstructVec2:
- case EOpConstructVec3:
- case EOpConstructVec4:
- case EOpConstructMat2:
- case EOpConstructMat3:
- case EOpConstructMat4:
- case EOpConstructFloat:
- case EOpConstructIVec2:
- case EOpConstructIVec3:
- case EOpConstructIVec4:
- case EOpConstructInt:
- case EOpConstructBVec2:
- case EOpConstructBVec3:
- case EOpConstructBVec4:
- case EOpConstructBool:
- case EOpConstructStruct:
- return true;
- default:
- return false;
- }
-}
-//
-// Make sure the type of a unary operator is appropriate for its
-// combination of operation and operand type.
-//
-// Returns false in nothing makes sense.
-//
-bool TIntermUnary::promote(TInfoSink&)
-{
- switch (op) {
- case EOpLogicalNot:
- if (operand->getBasicType() != EbtBool)
- return false;
- break;
- case EOpBitwiseNot:
- if (operand->getBasicType() != EbtInt)
- return false;
- break;
- case EOpNegative:
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- if (operand->getBasicType() == EbtBool)
- return false;
- break;
-
- // operators for built-ins are already type checked against their prototype
- case EOpAny:
- case EOpAll:
- case EOpVectorLogicalNot:
- return true;
-
- default:
- if (operand->getBasicType() != EbtFloat)
- return false;
- }
-
- setType(operand->getType());
-
- return true;
-}
-
-//
-// Establishes the type of the resultant operation, as well as
-// makes the operator the correct one for the operands.
-//
-// Returns false if operator can't work on operands.
-//
-bool TIntermBinary::promote(TInfoSink& infoSink)
-{
- int size = left->getNominalSize();
- if (right->getNominalSize() > size)
- size = right->getNominalSize();
-
- TBasicType type = left->getBasicType();
-
- //
- // Don't operate on arrays.
- //
- if (left->isArray() || right->isArray())
- return false;
-
- //
- // Base assumption: just make the type the same as the left
- // operand. Then only deviations from this need be coded.
- //
- setType(TType(type, EvqTemporary, left->getNominalSize(), left->isMatrix()));
-
- //
- // All scalars. Code after this test assumes this case is removed!
- //
- if (size == 1) {
-
- switch (op) {
-
- //
- // Promote to conditional
- //
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- setType(TType(EbtBool));
- break;
-
- //
- // And and Or operate on conditionals
- //
- case EOpLogicalAnd:
- case EOpLogicalOr:
- if (left->getBasicType() != EbtBool || right->getBasicType() != EbtBool)
- return false;
- setType(TType(EbtBool));
- break;
-
- //
- // Check for integer only operands.
- //
- case EOpMod:
- case EOpRightShift:
- case EOpLeftShift:
- case EOpAnd:
- case EOpInclusiveOr:
- case EOpExclusiveOr:
- if (left->getBasicType() != EbtInt || right->getBasicType() != EbtInt)
- return false;
- break;
- case EOpModAssign:
- case EOpAndAssign:
- case EOpInclusiveOrAssign:
- case EOpExclusiveOrAssign:
- case EOpLeftShiftAssign:
- case EOpRightShiftAssign:
- if (left->getBasicType() != EbtInt || right->getBasicType() != EbtInt)
- return false;
- // fall through
-
- //
- // Everything else should have matching types
- //
- default:
- if (left->getBasicType() != right->getBasicType() ||
- left->isMatrix() != right->isMatrix())
- return false;
- }
-
- return true;
- }
-
- //
- // Are the sizes compatible?
- //
- if ( left->getNominalSize() != size && left->getNominalSize() != 1 ||
- right->getNominalSize() != size && right->getNominalSize() != 1)
- return false;
-
- //
- // Can these two operands be combined?
- //
- switch (op) {
- case EOpMul:
- if (!left->isMatrix() && right->isMatrix()) {
- if (left->isVector())
- op = EOpVectorTimesMatrix;
- else {
- op = EOpMatrixTimesScalar;
- setType(TType(type, EvqTemporary, size, true));
- }
- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
- op = EOpMatrixTimesVector;
- setType(TType(type, EvqTemporary, size, false));
- } else {
- op = EOpMatrixTimesScalar;
- }
- } else if (left->isMatrix() && right->isMatrix()) {
- op = EOpMatrixTimesMatrix;
- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
- // leave as component product
- } else if (left->isVector() || right->isVector()) {
- op = EOpVectorTimesScalar;
- setType(TType(type, EvqTemporary, size, false));
- }
- } else {
- infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
- return false;
- }
- break;
- case EOpMulAssign:
- if (!left->isMatrix() && right->isMatrix()) {
- if (left->isVector())
- op = EOpVectorTimesMatrixAssign;
- else {
- return false;
- }
- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
- return false;
- } else {
- op = EOpMatrixTimesScalarAssign;
- }
- } else if (left->isMatrix() && right->isMatrix()) {
- op = EOpMatrixTimesMatrixAssign;
- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
- // leave as component product
- } else if (left->isVector() || right->isVector()) {
- if (! left->isVector())
- return false;
- op = EOpVectorTimesScalarAssign;
- setType(TType(type, EvqTemporary, size, false));
- }
- } else {
- infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
- return false;
- }
- break;
- case EOpAssign:
- if (left->getNominalSize() != right->getNominalSize())
- return false;
- // fall through
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpMod:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpDivAssign:
- case EOpModAssign:
- if (left->isMatrix() && right->isVector() ||
- left->isVector() && right->isMatrix() ||
- left->getBasicType() != right->getBasicType())
- return false;
- setType(TType(type, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
- break;
-
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- if (left->isMatrix() && right->isVector() ||
- left->isVector() && right->isMatrix() ||
- left->getBasicType() != right->getBasicType())
- return false;
- setType(TType(EbtBool));
- break;
-
-default:
- return false;
- }
-
- //
- // One more check for assignment. The Resulting type has to match the left operand.
- //
- switch (op) {
- case EOpAssign:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpMulAssign:
- case EOpDivAssign:
- case EOpModAssign:
- case EOpAndAssign:
- case EOpInclusiveOrAssign:
- case EOpExclusiveOrAssign:
- case EOpLeftShiftAssign:
- case EOpRightShiftAssign:
- if (getType() != left->getType())
- return false;
- break;
- default:
- break;
- }
-
- return true;
-}
-
-bool compareStructure(const TType& leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray, int& index)
-{
- TTypeList* fields = leftNodeType.getStruct();
-
- size_t structSize = fields->size();
-
- for (size_t j = 0; j < structSize; j++) {
- int size = (*fields)[j].type->getInstanceSize();
- for (int i = 0; i < size; i++) {
- switch ((*fields)[j].type->getBasicType()) {
- case EbtFloat:
- if (leftUnionArray[index].fConst != rightUnionArray[index].fConst)
- return false;
- index++;
- break;
- case EbtInt:
- if (leftUnionArray[index].iConst != rightUnionArray[index].iConst)
- return false;
- index++;
- break;
- case EbtBool:
- if (leftUnionArray[index].bConst != rightUnionArray[index].bConst)
- return false;
- index++;
- break;
- case EbtStruct:
- if (!compareStructure(*(*fields)[j].type, rightUnionArray, leftUnionArray, index))
- return false;
- break;
- default:
- assert(true && "Cannot compare");
- break;
- }
-
- }
- }
- return true;
-}
-
-//
-// The fold functions see if an operation on a constant can be done in place,
-// without generating run-time code.
-//
-// Returns the node to keep using, which may or may not be the node passed in.
-//
-
-TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink, bool leftOperand)
-{
- constUnion *unionArray = this->getUnionArrayPointer();
-
- if (constantNode) {
- if (constantNode->getAsConstantUnion() && constantNode->getSize() == 1 && constantNode->getType().getBasicType() != EbtStruct
- && this->getSize() > 1) {
- TIntermConstantUnion *node = constantNode->getAsConstantUnion();
- TIntermConstantUnion *newNode;
- constUnion* tempConstArray;
- switch(op) {
- case EOpAdd:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst + node->getUnionArrayPointer()->fConst; break;
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst + node->getUnionArrayPointer()->iConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"+\"", this->getLine());
- return 0;
- }
- }
- }
- break;
- case EOpMatrixTimesScalar:
- case EOpVectorTimesScalar:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst * node->getUnionArrayPointer()->fConst; break;
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst * node->getUnionArrayPointer()->iConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"*\"", this->getLine());
- return 0;
- }
- }
- }
- break;
- case EOpSub:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat:
- if (leftOperand)
- tempConstArray[i].fConst = unionArray[i].fConst - node->getUnionArrayPointer()->fConst;
- else
- tempConstArray[i].fConst = node->getUnionArrayPointer()->fConst - unionArray[i].fConst;
- break;
-
- case EbtInt:
- if (leftOperand)
- tempConstArray[i].iConst = unionArray[i].iConst - node->getUnionArrayPointer()->iConst;
- else
- tempConstArray[i].iConst = node->getUnionArrayPointer()->iConst - unionArray[i].iConst;
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"-\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpDiv:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat:
- if (leftOperand) {
- if (node->getUnionArrayPointer()->fConst == 0.0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].fConst = FLT_MAX;
- } else
- tempConstArray[i].fConst = unionArray[i].fConst / node->getUnionArrayPointer()->fConst;
- } else {
- if (unionArray[i].fConst == 0.0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].fConst = FLT_MAX;
- } else
- tempConstArray[i].fConst = node->getUnionArrayPointer()->fConst / unionArray[i].fConst;
- }
- break;
-
- case EbtInt:
- if (leftOperand) {
- if (node->getUnionArrayPointer()->iConst == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].iConst = INT_MAX;
- } else
- tempConstArray[i].iConst = unionArray[i].iConst / node->getUnionArrayPointer()->iConst;
- } else {
- if (unionArray[i].iConst == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].iConst = INT_MAX;
- } else
- tempConstArray[i].iConst = node->getUnionArrayPointer()->iConst / unionArray[i].iConst;
- }
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst && node->getUnionArrayPointer()->bConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"&&\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpLogicalXor: // this code is written for possible future use, will not get executed currently
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst ^ node->getUnionArrayPointer()->bConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"^^\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst || node->getUnionArrayPointer()->bConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"||\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- default:
- infoSink.info.message(EPrefixInternalError, "Invalid operator for constant folding", this->getLine());
- return 0;
- }
- newNode = new TIntermConstantUnion(tempConstArray, this->getType());
- newNode->setLine(this->getLine());
-
- return newNode;
- } else if (constantNode->getAsConstantUnion() && (this->getSize() > 1 || this->getType().getBasicType() == EbtStruct)) {
- TIntermConstantUnion *node = constantNode->getAsConstantUnion();
- constUnion *rightUnionArray = node->getUnionArrayPointer();
- constUnion* tempConstArray = 0;
- TIntermConstantUnion *tempNode;
- int index = 0;
- bool boolNodeFlag = false;
- switch(op) {
- case EOpAdd:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst + rightUnionArray[i].fConst; break;
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst + rightUnionArray[i].iConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"+\"", this->getLine());
- return 0;
- }
- }
- }
- break;
- case EOpSub:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat:
- if (leftOperand)
- tempConstArray[i].fConst = unionArray[i].fConst - rightUnionArray[i].fConst;
- else
- tempConstArray[i].fConst = rightUnionArray[i].fConst - unionArray[i].fConst;
- break;
-
- case EbtInt:
- if (leftOperand)
- tempConstArray[i].iConst = unionArray[i].iConst - rightUnionArray[i].iConst;
- else
- tempConstArray[i].iConst = rightUnionArray[i].iConst - unionArray[i].iConst;
- break;
-
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"-\"", this->getLine());
- return 0;
- }
- }
- }
- break;
- case EOpMul:
- if (this->isVector()) { // two vectors multiplied together
- int size = this->getSize();
- tempConstArray = new constUnion[size];
-
- for (int i = 0; i < size; i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat: tempConstArray[i].fConst = unionArray[i].fConst * rightUnionArray[i].fConst; break;
- case EbtInt: tempConstArray[i].iConst = unionArray[i].iConst * rightUnionArray[i].iConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for vector multiply", this->getLine());
- return 0;
- }
- }
- }
- break;
- case EOpMatrixTimesMatrix:
- if (this->getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", this->getLine());
- return 0;
- }
- {// support MSVC++6.0
- int size = this->getNominalSize();
- tempConstArray = new constUnion[size*size];
- for (int row = 0; row < size; row++) {
- for (int column = 0; column < size; column++) {
- tempConstArray[size * column + row].fConst = 0.0;
- for (int i = 0; i < size; i++) {
- tempConstArray[size * column + row].fConst += unionArray[i * size + row].fConst * (rightUnionArray[column * size + i].fConst);
- }
- }
- }
- }
- break;
- case EOpDiv:
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtFloat:
- if (leftOperand) {
- if (rightUnionArray[i].fConst == 0.0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].fConst = FLT_MAX;
- } else
- tempConstArray[i].fConst = unionArray[i].fConst / rightUnionArray[i].fConst;
- } else {
- if (unionArray[i].fConst == 0.0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].fConst = FLT_MAX;
- } else
- tempConstArray[i].fConst = rightUnionArray[i].fConst / unionArray[i].fConst;
- }
- break;
-
- case EbtInt:
- if (leftOperand) {
- if (rightUnionArray[i].iConst == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].iConst = INT_MAX;
- } else
- tempConstArray[i].iConst = unionArray[i].iConst / rightUnionArray[i].iConst;
- } else {
- if (unionArray[i].iConst == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- tempConstArray[i].iConst = INT_MAX;
- } else
- tempConstArray[i].iConst = rightUnionArray[i].iConst / unionArray[i].iConst;
- }
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpMatrixTimesVector:
- if (node->getBasicType() != EbtFloat) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix times vector", this->getLine());
- return 0;
- }
- tempConstArray = new constUnion[this->getNominalSize()];
-
- {// support MSVC++6.0
- for (int size = this->getNominalSize(), i = 0; i < size; i++) {
- tempConstArray[i].fConst = 0.0;
- for (int j = 0; j < size; j++) {
- tempConstArray[i].fConst += ((unionArray[j*size + i].fConst) * rightUnionArray[j].fConst);
- }
- }
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, node->getType());
- tempNode->setLine(this->getLine());
-
- return tempNode;
-
- case EOpVectorTimesMatrix:
- if (this->getType().getBasicType() != EbtFloat) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for vector times matrix", this->getLine());
- return 0;
- }
-
- tempConstArray = new constUnion[this->getNominalSize()];
- {// support MSVC++6.0
- for (int size = this->getNominalSize(), i = 0; i < size; i++) {
- tempConstArray[i].fConst = 0.0;
- for (int j = 0; j < size; j++) {
- tempConstArray[i].fConst += ((unionArray[j].fConst) * rightUnionArray[i*size + j].fConst);
- }
- }
- }
- break;
-
- case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst && rightUnionArray[i].bConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"&&\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpLogicalXor: // this code is written for possible future use, will not get executed currently
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst ^ rightUnionArray[i].bConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"^^\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
- tempConstArray = new constUnion[this->getSize()];
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = unionArray[i].bConst || rightUnionArray[i].bConst; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"||\"", this->getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpEqual:
-
- switch (this->getType().getBasicType()) {
- case EbtFloat:
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- if (unionArray[i].fConst != rightUnionArray[i].fConst) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
- break;
-
- case EbtInt:
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- if (unionArray[i].iConst != rightUnionArray[i].iConst) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
- break;
- case EbtBool:
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- if (unionArray[i].bConst != rightUnionArray[i].bConst) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
- break;
- case EbtStruct:
- if (!compareStructure(node->getType(), node->getUnionArrayPointer(), unionArray, index))
- boolNodeFlag = true;
- break;
-
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"==\"", this->getLine());
- return 0;
- }
-
- tempConstArray = new constUnion[1];
- if (!boolNodeFlag) {
- tempConstArray->bConst = true;
- }
- else {
- tempConstArray->bConst = false;
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EvqConst));
- tempNode->setLine(this->getLine());
-
- return tempNode;
-
- case EOpNotEqual:
- switch (this->getType().getBasicType()) {
- case EbtFloat:
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- if (unionArray[i].fConst == rightUnionArray[i].fConst) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
- break;
-
- case EbtInt:
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- if (unionArray[i].iConst == rightUnionArray[i].iConst) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
- break;
- case EbtBool:
- {// support MSVC++6.0
- for (int i = 0; i < this->getSize(); i++) {
- if (unionArray[i].bConst == rightUnionArray[i].bConst) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- }
- break;
- case EbtStruct:
- if (compareStructure(node->getType(), node->getUnionArrayPointer(), unionArray, index))
- boolNodeFlag = true;
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"!=\"", this->getLine());
- return 0;
- }
-
- tempConstArray = new constUnion[1];
- if (!boolNodeFlag) {
- tempConstArray->bConst = true;
- }
- else {
- tempConstArray->bConst = false;
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EvqConst));
- tempNode->setLine(this->getLine());
-
- return tempNode;
-
- default:
- infoSink.info.message(EPrefixInternalError, "Invalid operator for constant folding", this->getLine());
- return 0;
- }
- tempNode = new TIntermConstantUnion(tempConstArray, this->getType());
- tempNode->setLine(this->getLine());
-
- return tempNode;
- } else if (this->getSize() == 1 && this->getType().getBasicType() != EbtStruct
- && constantNode->getSize() == 1 && constantNode->getType().getBasicType() != EbtStruct ) { // scalar constant folding
- constUnion *unionArray = new constUnion[1];
- TIntermConstantUnion* newNode = 0;
-
- switch (this->getType().getBasicType()) {
- case EbtInt:
- {
- //
- // Dealing with two operands, us and constant.
- //
- // Do Binary operations.
- //
- int rightValue = constantNode->getAsConstantUnion()->getUnionArrayPointer()->iConst;
- int leftValue = this->getUnionArrayPointer()->iConst;
- //int line = this->getLine();
-
- switch(op) {
- //?? add constant intrinsics
- case EOpAdd: unionArray->iConst = leftValue + rightValue; break;
- case EOpSub: unionArray->iConst = leftValue - rightValue; break;
- case EOpMul: unionArray->iConst = leftValue * rightValue; break;
- case EOpDiv:
- if (rightValue == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- unionArray->iConst = INT_MAX;
- } else
- unionArray->iConst = leftValue / rightValue; break;
-
- case EOpMod: unionArray->iConst = leftValue % rightValue; break;
-
- case EOpRightShift: unionArray->iConst = leftValue >> rightValue; break;
- case EOpLeftShift: unionArray->iConst = leftValue << rightValue; break;
-
- case EOpAnd: unionArray->iConst = leftValue & rightValue; break;
- case EOpInclusiveOr: unionArray->iConst = leftValue | rightValue; break;
- case EOpExclusiveOr: unionArray->iConst = leftValue ^ rightValue; break;
-
- // the following assume it's okay to have memory leaks
- case EOpEqual:
- unionArray->bConst = leftValue == rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpNotEqual:
- unionArray->bConst = leftValue != rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpLessThan:
- unionArray->bConst = leftValue < rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpGreaterThan:
- unionArray->bConst = leftValue > rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpLessThanEqual:
- unionArray->bConst = leftValue <= rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpGreaterThanEqual:
- unionArray->bConst = leftValue >= rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
-
- default:
- //infoSink.info.message(EPrefixInternalError, "Binary operation not folded into constant int", line);
- return 0;
- }
- if (!newNode) {
- newNode = new TIntermConstantUnion(unionArray, TType(EbtInt, EvqConst));
- }
- newNode->setLine(constantNode->getLine());
- return newNode;
- }
- case EbtFloat:
- {
- float rightValue = constantNode->getAsConstantUnion()->getUnionArrayPointer()->fConst;
- float leftValue = this->getUnionArrayPointer()->fConst;
-
- switch(op) {
- //?? add constant intrinsics
- case EOpAdd: unionArray->fConst = leftValue + rightValue; break;
- case EOpSub: unionArray->fConst = leftValue - rightValue; break;
- case EOpMul: unionArray->fConst = leftValue * rightValue; break;
- case EOpDiv:
- if (rightValue == 0.0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", this->getLine());
- unionArray->fConst = FLT_MAX;
- } else
- unionArray->fConst = leftValue / rightValue; break;
-
- // the following assume it's okay to have memory leaks (cleaned up by pool allocator)
- case EOpEqual:
- unionArray->bConst = leftValue == rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpNotEqual:
- unionArray->bConst = leftValue != rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpLessThan:
- unionArray->bConst = leftValue < rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpGreaterThan:
- unionArray->bConst = leftValue > rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpLessThanEqual:
- unionArray->bConst = leftValue <= rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
- case EOpGreaterThanEqual:
- unionArray->bConst = leftValue >= rightValue;
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- break;
-
- default:
- //infoSink.info.message(EPrefixInternalError, "Binary operation not folded into constant float", line);
- return 0;
- }
- if (!newNode) {
- newNode = new TIntermConstantUnion(unionArray, TType(EbtFloat, EvqConst));
- }
- newNode->setLine(constantNode->getLine());
- return newNode;
- }
- case EbtBool:
- {
- bool rightValue = constantNode->getAsConstantUnion()->getUnionArrayPointer()->bConst;
- bool leftValue = this->getUnionArrayPointer()->bConst;
-
- switch(op) {
- //?? add constant intrinsics
- case EOpLogicalAnd: unionArray->bConst = leftValue & rightValue; break;
- case EOpLogicalXor: unionArray->bConst = leftValue ^ rightValue; break;
- case EOpLogicalOr: unionArray->bConst = leftValue | rightValue; break;
- default:
- infoSink.info.message(EPrefixInternalError, "Binary operator cannot be folded into constant bool", line);
- return 0;
- }
- newNode = new TIntermConstantUnion(unionArray, TType(EbtBool, EvqConst));
- newNode->setLine(constantNode->getLine());
- return newNode;
- }
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot fold constant", this->getLine());
- return 0;
- }
- }
- } else {
- //
- // Do unary operations
- //
- TIntermConstantUnion *newNode = 0;
- constUnion* tempConstArray = new constUnion[this->getSize()];
- if (this->getSize() > 1) {
- for (int i = 0; i < this->getSize(); i++) {
- switch(op) {
- case EOpNegative:
- switch (this->getType().getBasicType()) {
- case EbtFloat: tempConstArray[i].fConst = -(unionArray[i].fConst); break;
- case EbtInt: tempConstArray[i].iConst = -(unionArray[i].iConst); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", this->getLine());
- return 0;
- }
- break;
- case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
- switch (this->getType().getBasicType()) {
- case EbtBool: tempConstArray[i].bConst = !(unionArray[i].bConst); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", this->getLine());
- return 0;
- }
- break;
- default:
- return 0;
- }
- }
- newNode = new TIntermConstantUnion(tempConstArray, this->getType());
- newNode->setLine(this->getLine());
- return newNode;
- } else {
- switch(op) {
- //?? add constant intrinsics
- case EOpNegative:
- switch (this->getType().getBasicType()) {
- case EbtInt:
- tempConstArray->iConst = -(this->getUnionArrayPointer()->iConst);
- newNode = new TIntermConstantUnion(tempConstArray, TType(EbtInt, EvqConst));
- break;
- case EbtFloat:
- tempConstArray->fConst = -(this->getUnionArrayPointer()->fConst);
- newNode = new TIntermConstantUnion(tempConstArray, TType(EbtFloat, EvqConst));
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", line);
- return 0;
- }
- break;
- case EOpLogicalNot:
- switch (this->getType().getBasicType()) {
- case EbtBool:
- tempConstArray->bConst = !this->getUnionArrayPointer()->bConst;
- newNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EvqConst));
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", line);
- return 0;
- }
- break;
- default:
- return 0;
- }
- newNode->setLine(this->getLine());
- return newNode;
-
- }
- }
-
- return this;
-}
-
-TIntermConstantUnion* TIntermediate::changeAggrToTempConst(TIntermAggregate* node, TSymbolTable& symbolTable, TSourceLoc line)
-{
- constUnion* unionArray = new constUnion[node->getType().getInstanceSize()];
- bool returnVal;
-
- if (node->getSequence().size() == 1 && node->getSequence()[0]->getAsTyped()->getAsConstantUnion()) {
- returnVal = parseConstTree(line, node, unionArray, node->getOp(), symbolTable, node->getType(), true);
- }
- else {
- returnVal = parseConstTree(line, node, unionArray, node->getOp(), symbolTable, node->getType());
- }
-
- if (returnVal)
- unionArray = 0;
-
- return (addConstantUnion(unionArray, node->getType(), node->getLine()));
-}
-
-TIntermTyped* TIntermediate::copyConstUnion(TIntermConstantUnion* node)
-{
- constUnion *unionArray = node->getUnionArrayPointer();
-
- if (!unionArray)
- return 0;
-
- int size;
- if (node->getType().getBasicType() == EbtStruct)
- //?? We should actually be calling getStructSize() function and not setStructSize. This problem occurs in case
- // of nested/embedded structs.
- size = node->getType().setStructSize(node->getType().getStruct());
- //size = node->getType().getStructSize();
- else
- size = node->getType().getInstanceSize();
-
- constUnion *newSpace = new constUnion[size];
-
- for (int i = 0; i < size; i++)
- newSpace[i] = unionArray[i];
-
- node->setUnionArrayPointer(newSpace);
- return node;
-}
-
-TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
-{
- constUnion *rightUnionArray = node->getUnionArrayPointer();
- int size = node->getType().getInstanceSize();
-
- constUnion *leftUnionArray = new constUnion[size];
-
- for (int i=0; i < size; i++) {
-
- switch (promoteTo) {
- case EbtFloat:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- (leftUnionArray[i]).fConst = static_cast<float>(rightUnionArray[i].iConst);
- break;
- case EbtBool:
- (leftUnionArray[i]).fConst = static_cast<float>(rightUnionArray[i].bConst);
- break;
- case EbtFloat:
- (leftUnionArray[i]).fConst = rightUnionArray[i].fConst;
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
- break;
- case EbtInt:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- (leftUnionArray[i]).iConst = rightUnionArray[i].iConst;
- break;
- case EbtBool:
- (leftUnionArray[i]).iConst = static_cast<int>(rightUnionArray[i].bConst);
- break;
- case EbtFloat:
- (leftUnionArray[i]).iConst = static_cast<int>(rightUnionArray[i].fConst);
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
- break;
- case EbtBool:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- (leftUnionArray[i]).bConst = rightUnionArray[i].iConst != 0;
- break;
- case EbtBool:
- (leftUnionArray[i]).bConst = rightUnionArray[i].bConst;
- break;
- case EbtFloat:
- (leftUnionArray[i]).bConst = rightUnionArray[i].fConst != 0.0;
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
-
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Incorrect data type found", node->getLine());
- return 0;
- }
-
- }
-
- const TType& t = node->getType();
-
- return addConstantUnion(leftUnionArray, TType(promoteTo, t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine());
-}
-
-//
-// This method inserts the child nodes into the parent node at the given location specified
-// by parentNodeIter. offset tells the integer offset into the parent vector that points to
-// the child node. sequenceVector is the parent vector.
-// Returns reference to the last inserted child node
-// increments the offset based on the number of child nodes added
-//
-void TIntermediate::removeChildNode(TIntermSequence &parentSequence, TType& parentType, int& offset, TIntermSequence::iterator& parentNodeIter, TIntermAggregate* child)
-{
- if (!child)
- return;
-
- parentNodeIter = parentSequence.begin() + offset;
-
- TIntermSequence& childSequence = child->getSequence();
- int oldSize = static_cast<int>(parentSequence.size());
- if (childSequence.size() == 1) {
- if (!removeMatrixConstNode(parentSequence, parentType, child, offset)) {
- for (int i = 0; i < child->getType().getInstanceSize(); i++) {
- constUnion* constantUnion = new constUnion[1];
- *constantUnion = *(childSequence[0]->getAsConstantUnion()->getUnionArrayPointer());
- TIntermConstantUnion *constant = new TIntermConstantUnion(constantUnion,
- childSequence[0]->getAsConstantUnion()->getType());
- constant->setLine(child->getLine());
- parentNodeIter = parentSequence.begin() + offset;
- parentSequence.insert(parentNodeIter, constant);
- }
- }
- } else
- parentSequence.insert(parentNodeIter, childSequence.begin(), childSequence.end());
-
- int newSize = static_cast<int>(parentSequence.size());
- offset = offset + newSize - oldSize;
- parentNodeIter = parentSequence.begin() + offset;
- parentNodeIter = parentSequence.erase(parentNodeIter);
- offset--;
- parentNodeIter--;
-}
-
-//
-// The parent has only one child node. This method is not implemented
-// for parent that is a structure
-//
-TIntermTyped* TIntermediate::removeChildNode(TIntermTyped* parent, TType* parentType, TIntermAggregate* child)
-{
- TIntermTyped* resultNode = 0;
-
- if (parentType->getInstanceSize() == 1) {
- resultNode = child->getSequence()[0]->getAsTyped();
- } else {
- int size = parentType->getInstanceSize();
- TIntermSequence& parentSequence = parent->getAsAggregate()->getSequence();
- TIntermSequence& childSequence = child->getSequence();
-
- if (childSequence.size() == 1) {
- if (!removeMatrixConstNode(parentSequence, *parentType, child, 1))
- parentSequence.push_back(child->getSequence()[0]);
- } else {
- for (int i = 0; i < size; i++) {
- parentSequence.push_back(child->getSequence()[i]);
- }
- }
- parentSequence.erase(parentSequence.begin());
-
- return parent;
- }
-
- return resultNode;
-}
-
-bool TIntermediate::removeMatrixConstNode(TIntermSequence &parentSequence, TType& parentType, TIntermAggregate* child, int offset)
-{
- if (!child)
- return false;
-
- TIntermSequence::iterator parentNodeIter;
- TIntermSequence &childSequence = child->getSequence();
-
- switch (child->getOp()) {
- case EOpConstructMat2:
- case EOpConstructMat3:
- case EOpConstructMat4:
- {// support MSVC++6.0
- for (int i = 0; i < child->getType().getInstanceSize(); i++) {
- constUnion* constantUnion = new constUnion[1];
- if (i % (child->getType().getNominalSize() + 1) == 0) {
- *constantUnion = *(childSequence[0]->getAsConstantUnion()->getUnionArrayPointer());
- } else {
- switch (parentType.getBasicType()) {
- case EbtInt: constantUnion->iConst = 0; break;
- case EbtFloat: constantUnion->fConst = 0.0; break;
- case EbtBool: constantUnion->bConst = false; break;
- default: ; /* default added by BrianP */
- }
- }
- TIntermConstantUnion *constant = new TIntermConstantUnion(constantUnion,
- childSequence[0]->getAsConstantUnion()->getType());
- constant->setLine(child->getLine());
- parentNodeIter = parentSequence.begin() + offset + i;
- parentSequence.insert(parentNodeIter, constant);
- }
- }
- return true;
- default:
- return false;
- }
-}
-
-void TIntermAggregate::addToPragmaTable(const TPragmaTable& pTable)
-{
- assert (!pragmaTable);
- pragmaTable = new TPragmaTable();
- *pragmaTable = pTable;
-}
-
diff --git a/src/mesa/shader/slang/MachineIndependent/MMap.h b/src/mesa/shader/slang/MachineIndependent/MMap.h
deleted file mode 100755
index 66703cdd9be..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/MMap.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _MMAP_INCLUDED_
-#define _MMAP_INCLUDED_
-
-//
-// Encapsulate memory mapped files
-//
-
-class TMMap {
-public:
- TMMap(const char* fileName) :
- fSize(-1), // -1 is the error value returned by GetFileSize()
- fp(NULL),
- fBuff(0) // 0 is the error value returned by MapViewOfFile()
- {
- if ((fp = fopen(fileName, "r")) == NULL)
- return;
- char c = getc(fp);
- fSize = 0;
- while (c != EOF) {
- fSize++;
- c = getc(fp);
- }
- if (c == EOF)
- fSize++;
- rewind(fp);
- fBuff = (char*)malloc(sizeof(char) * fSize);
- int count = 0;
- c = getc(fp);
- while (c != EOF) {
- fBuff[count++] = c;
- c = getc(fp);
- }
- fBuff[count++] = c;
- }
-
- char* getData() { return fBuff; }
- int getSize() { return fSize; }
-
- ~TMMap() {
- if (fp != NULL)
- fclose(fp);
- }
-
-private:
- int fSize; // size of file to map in
- FILE *fp;
- char* fBuff; // the actual data;
-};
-
-#endif // _MMAP_INCLUDED_
diff --git a/src/mesa/shader/slang/MachineIndependent/ParseHelper.cpp b/src/mesa/shader/slang/MachineIndependent/ParseHelper.cpp
deleted file mode 100755
index cfc42746ae1..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/ParseHelper.cpp
+++ /dev/null
@@ -1,1452 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "ParseHelper.h"
-#include "Include/InitializeParseContext.h"
-#include "osinclude.h"
-#include <stdarg.h>
-///////////////////////////////////////////////////////////////////////
-//
-// Sub- vector and matrix fields
-//
-////////////////////////////////////////////////////////////////////////
-
-//
-// Look at a '.' field selector string and change it into offsets
-// for a vector.
-//
-bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TVectorFields& fields, int line)
-{
- fields.num = (int) compString.size();
- if (fields.num > 4) {
- error(line, "illegal vector field selection", compString.c_str(), "");
- return false;
- }
-
- enum {
- exyzw,
- ergba,
- estpq
- } fieldSet[4];
-
- for (int i = 0; i < fields.num; ++i) {
- switch (compString[i]) {
- case 'x':
- fields.offsets[i] = 0;
- fieldSet[i] = exyzw;
- break;
- case 'r':
- fields.offsets[i] = 0;
- fieldSet[i] = ergba;
- break;
- case 's':
- fields.offsets[i] = 0;
- fieldSet[i] = estpq;
- break;
- case 'y':
- fields.offsets[i] = 1;
- fieldSet[i] = exyzw;
- break;
- case 'g':
- fields.offsets[i] = 1;
- fieldSet[i] = ergba;
- break;
- case 't':
- fields.offsets[i] = 1;
- fieldSet[i] = estpq;
- break;
- case 'z':
- fields.offsets[i] = 2;
- fieldSet[i] = exyzw;
- break;
- case 'b':
- fields.offsets[i] = 2;
- fieldSet[i] = ergba;
- break;
- case 'p':
- fields.offsets[i] = 2;
- fieldSet[i] = estpq;
- break;
-
- case 'w':
- fields.offsets[i] = 3;
- fieldSet[i] = exyzw;
- break;
- case 'a':
- fields.offsets[i] = 3;
- fieldSet[i] = ergba;
- break;
- case 'q':
- fields.offsets[i] = 3;
- fieldSet[i] = estpq;
- break;
- default:
- error(line, "illegal vector field selection", compString.c_str(), "");
- return false;
- }
- }
-
- for (int i = 0; i < fields.num; ++i) {
- if (fields.offsets[i] >= vecSize) {
- error(line, "vector field selection out of range", compString.c_str(), "");
- return false;
- }
-
- if (i > 0) {
- if (fieldSet[i] != fieldSet[i-1]) {
- error(line, "illegal - vector component fields not from the same set", compString.c_str(), "");
- return false;
- }
- }
- }
-
- return true;
-}
-
-
-//
-// Look at a '.' field selector string and change it into offsets
-// for a matrix.
-//
-bool TParseContext::parseMatrixFields(const TString& compString, int matSize, TMatrixFields& fields, int line)
-{
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = -1;
- fields.col = -1;
-
- if (compString.size() != 2) {
- error(line, "illegal length of matrix field selection", compString.c_str(), "");
- return false;
- }
-
- if (compString[0] == '_') {
- if (compString[1] < '0' || compString[1] > '3') {
- error(line, "illegal matrix field selection", compString.c_str(), "");
- return false;
- }
- fields.wholeCol = true;
- fields.col = compString[1] - '0';
- } else if (compString[1] == '_') {
- if (compString[0] < '0' || compString[0] > '3') {
- error(line, "illegal matrix field selection", compString.c_str(), "");
- return false;
- }
- fields.wholeRow = true;
- fields.row = compString[0] - '0';
- } else {
- if (compString[0] < '0' || compString[0] > '3' ||
- compString[1] < '0' || compString[1] > '3') {
- error(line, "illegal matrix field selection", compString.c_str(), "");
- return false;
- }
- fields.row = compString[0] - '0';
- fields.col = compString[1] - '0';
- }
-
- if (fields.row >= matSize || fields.col >= matSize) {
- error(line, "matrix field selection out of range", compString.c_str(), "");
- return false;
- }
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////
-//
-// Errors
-//
-////////////////////////////////////////////////////////////////////////
-
-//
-// Track whether errors have occurred.
-//
-void TParseContext::recover()
-{
- recoveredFromError = true;
-}
-
-//
-// Used by flex/bison to output all syntax and parsing errors.
-//
-void C_DECL TParseContext::error(TSourceLoc nLine, const char *szReason, const char *szToken,
- const char *szExtraInfoFormat, ...)
-{
- char szExtraInfo[400];
- va_list marker;
-
- va_start(marker, szExtraInfoFormat);
-
- _vsnprintf(szExtraInfo, sizeof(szExtraInfo), szExtraInfoFormat, marker);
-
- /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
- infoSink.info.prefix(EPrefixError);
- infoSink.info.location(nLine);
- infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n";
-
- va_end(marker);
-
- ++numErrors;
-}
-
-//
-// Same error message for all places assignments don't work.
-//
-void TParseContext::assignError(int line, const char* op, TString left, TString right)
-{
- error(line, "", op, "cannot convert from '%s' to '%s'",
- right.c_str(), left.c_str());
-}
-
-//
-// Same error message for all places unary operations don't work.
-//
-void TParseContext::unaryOpError(int line, char* op, TString operand)
-{
- error(line, " wrong operand type", op,
- "no operation '%s' exists that takes an operand of type %s (or there is no acceptable conversion)",
- op, operand.c_str());
-}
-
-//
-// Same error message for all binary operations don't work.
-//
-void TParseContext::binaryOpError(int line, char* op, TString left, TString right)
-{
- error(line, " wrong operand types ", op,
- "no operation '%s' exists that takes a left-hand operand of type '%s' and "
- "a right operand of type '%s' (or there is no acceptable conversion)",
- op, left.c_str(), right.c_str());
-}
-
-//
-// Both test and if necessary, spit out an error, to see if the node is really
-// an l-value that can be operated on this way.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::lValueErrorCheck(int line, char* op, TIntermTyped* node)
-{
- TIntermSymbol* symNode = node->getAsSymbolNode();
- TIntermBinary* binaryNode = node->getAsBinaryNode();
-
- if (binaryNode) {
- bool errorReturn;
-
- switch(binaryNode->getOp()) {
- case EOpIndexDirect:
- case EOpIndexIndirect:
- case EOpIndexDirectStruct:
- return lValueErrorCheck(line, op, binaryNode->getLeft());
- case EOpVectorSwizzle:
- errorReturn = lValueErrorCheck(line, op, binaryNode->getLeft());
- if (!errorReturn) {
- int offset[4] = {0,0,0,0};
-
- TIntermTyped* rightNode = binaryNode->getRight();
- TIntermAggregate *aggrNode = rightNode->getAsAggregate();
-
- for (TIntermSequence::iterator p = aggrNode->getSequence().begin();
- p != aggrNode->getSequence().end(); p++) {
- int value = (*p)->getAsTyped()->getAsConstantUnion()->getUnionArrayPointer()->iConst;
- offset[value]++;
- if (offset[value] > 1) {
- error(line, " l-value of swizzle cannot have duplicate components", op, "", "");
-
- return true;
- }
- }
- }
-
- return errorReturn;
- default:
- break;
- }
- error(line, " l-value required", op, "", "");
-
- return true;
- }
-
-
- const char* symbol = 0;
- if (symNode != 0)
- symbol = symNode->getSymbol().c_str();
-
- char* message = 0;
- switch (node->getQualifier()) {
- case EvqConst: message = "can't modify a const"; break;
- case EvqConstReadOnly: message = "can't modify a const"; break;
- case EvqAttribute: message = "can't modify an attribute"; break;
- case EvqUniform: message = "can't modify a uniform"; break;
- case EvqVaryingIn: message = "can't modify a varying"; break;
- case EvqInput: message = "can't modify an input"; break;
- case EvqFace: message = "can't modify gl_FrontFace"; break;
- case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
- default:
-
- //
- // Type that can't be written to?
- //
- switch (node->getBasicType()) {
- case EbtSampler1D:
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSampler1DShadow:
- case EbtSampler2DShadow:
- message = "can't modify a sampler";
- break;
- case EbtVoid:
- message = "can't modify void";
- break;
- default:
- break;
- }
- }
-
- if (message == 0 && binaryNode == 0 && symNode == 0) {
- error(line, " l-value required", op, "", "");
-
- return true;
- }
-
-
- //
- // Everything else is okay, no error.
- //
- if (message == 0)
- return false;
-
- //
- // If we get here, we have an error and a message.
- //
- if (symNode)
- error(line, " l-value required", op, "\"%s\" (%s)", symbol, message);
- else
- error(line, " l-value required", op, "(%s)", message);
-
- return true;
-}
-
-//
-// Both test, and if necessary spit out an error, to see if the node is really
-// a constant.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::constErrorCheck(TIntermTyped* node)
-{
- if (node->getQualifier() == EvqConst)
- return false;
-
- error(node->getLine(), "constant expression required", "", "");
-
- return true;
-}
-
-//
-// Both test, and if necessary spit out an error, to see if the node is really
-// an integer.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::integerErrorCheck(TIntermTyped* node, char* token)
-{
- if (node->getBasicType() == EbtInt && node->getNominalSize() == 1)
- return false;
-
- error(node->getLine(), "integer expression required", token, "");
-
- return true;
-}
-
-//
-// Both test, and if necessary spit out an error, to see if we are currently
-// globally scoped.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::globalErrorCheck(int line, bool global, char* token)
-{
- if (global)
- return false;
-
- error(line, "only allowed at global scope", token, "");
-
- return true;
-}
-
-//
-// For now, keep it simple: if it starts "gl_", it's reserved, independent
-// of scope. Except, if the symbol table is at the built-in push-level,
-// which is when we are parsing built-ins.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::reservedErrorCheck(int line, const TString& identifier)
-{
- if (symbolTable.atBuiltInLevel() ||
- identifier.substr(0, 3) != TString("gl_"))
- return false;
-
- error(line, "reserved built-in name", "gl_", "");
-
- return true;
-}
-
-//
-// Make sure there is enough data provided to the constructor to build
-// something of the type of the constructor. Also returns the type of
-// the constructor.
-//
-// Returns true if there was an error in construction.
-//
-bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
-{
- switch(op) {
- case EOpConstructInt: *type = TType(EbtInt); break;
- case EOpConstructBool: *type = TType(EbtBool); break;
- case EOpConstructFloat: *type = TType(EbtFloat); break;
- case EOpConstructVec2: *type = TType(EbtFloat, EvqTemporary, 2); break;
- case EOpConstructVec3: *type = TType(EbtFloat, EvqTemporary, 3); break;
- case EOpConstructVec4: *type = TType(EbtFloat, EvqTemporary, 4); break;
- case EOpConstructBVec2: *type = TType(EbtBool, EvqTemporary, 2); break;
- case EOpConstructBVec3: *type = TType(EbtBool, EvqTemporary, 3); break;
- case EOpConstructBVec4: *type = TType(EbtBool, EvqTemporary, 4); break;
- case EOpConstructIVec2: *type = TType(EbtInt, EvqTemporary, 2); break;
- case EOpConstructIVec3: *type = TType(EbtInt, EvqTemporary, 3); break;
- case EOpConstructIVec4: *type = TType(EbtInt, EvqTemporary, 4); break;
- case EOpConstructMat2: *type = TType(EbtFloat, EvqTemporary, 2, true); break;
- case EOpConstructMat3: *type = TType(EbtFloat, EvqTemporary, 3, true); break;
- case EOpConstructMat4: *type = TType(EbtFloat, EvqTemporary, 4, true); break;
- case EOpConstructStruct: *type = TType(function.getReturnType().getStruct(), function.getReturnType().getTypeName()); break;
- default:
- error(line, "expected constructor", "Internal Error", "");
- return true;
- }
-
- bool constructingMatrix = false;
- switch(op) {
- case EOpConstructMat2:
- case EOpConstructMat3:
- case EOpConstructMat4:
- constructingMatrix = true;
- break;
- default:
- break;
- }
-
- //
- // Note: It's okay to have too many components available, but not okay to have unused
- // arguments. 'full' will go to true when enough args have been seen. If we loop
- // again, there is an extra argument, so 'overfull' will become true.
- //
-
- int size = 0;
- bool constType = true;
- bool full = false;
- bool overFull = false;
- bool matrixInMatrix = false;
- for (int i = 0; i < function.getParamCount(); ++i) {
- size += function[i].type->getInstanceSize();
- if (constructingMatrix && function[i].type->isMatrix())
- matrixInMatrix = true;
- if (full)
- overFull = true;
- if (op != EOpConstructStruct && size >= type->getInstanceSize())
- full = true;
- if (function[i].type->getQualifier() != EvqConst)
- constType = false;
- }
-
- if (constType)
- type->changeQualifier(EvqConst);
-
- if (matrixInMatrix) {
- error(line, "constructing matrix from matrix", "constructor", "(reserved)");
- return true;
- }
-
- if (overFull) {
- error(line, "too many arguments", "constructor", "");
- return true;
- }
-
- if (size != 1 && size < type->getInstanceSize() || (size < 1) && op == EOpConstructStruct) {
- error(line, "not enough data provided for construction", "constructor", "");
- return true;
- }
-
- TIntermTyped* typed = node->getAsTyped();
- if (typed == 0) {
- error(line, "constructor argument does not have a type", "constructor", "");
- return true;
- }
- if (op != EOpConstructStruct && IsSampler(typed->getBasicType())) {
- error(line, "cannot convert a sampler", "constructor", "");
- return true;
- }
- if (typed->getBasicType() == EbtVoid) {
- error(line, "cannot convert a void", "constructor", "");
- return true;
- }
-
- return false;
-}
-
-// This function checks to see if a void variable has been declared and raise an error message for such a case
-//
-// returns true in case of an error
-//
-bool TParseContext::voidErrorCheck(int line, const TString& identifier, const TPublicType& pubType)
-{
- if (pubType.type == EbtVoid) {
- error(line, "illegal use of type 'void'", identifier.c_str(), "");
- return true;
- }
-
- return false;
-}
-
-// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
-//
-// returns true in case of an error
-//
-bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type)
-{
- if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector()) {
- error(line, "boolean expression expected", "", "");
- return true;
- }
-
- return false;
-}
-
-// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
-//
-// returns true in case of an error
-//
-bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
-{
- if (pType.type != EbtBool || pType.array || pType.matrix || (pType.size > 1)) {
- error(line, "boolean expression expected", "", "");
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::samplerErrorCheck(int line, const TPublicType& pType, const char* reason)
-{
- if (pType.type == EbtStruct) {
- if (containsSampler(*pType.userDef)) {
- error(line, reason, TType::getBasicString(pType.type), "(structure contains a sampler)");
-
- return true;
- }
-
- return false;
- } else if (IsSampler(pType.type)) {
- error(line, reason, TType::getBasicString(pType.type), "");
-
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::structQualifierErrorCheck(int line, const TPublicType& pType)
-{
- if ((pType.qualifier == EvqVaryingIn || pType.qualifier == EvqVaryingOut || pType.qualifier == EvqAttribute) &&
- pType.type == EbtStruct) {
- error(line, "cannot be used with a structure", getQualifierString(pType.qualifier), "");
-
- return true;
- }
-
- if (pType.qualifier != EvqUniform && samplerErrorCheck(line, pType, "samplers must be uniform"))
- return true;
-
- return false;
-}
-
-bool TParseContext::parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type)
-{
- if ((qualifier == EvqOut || qualifier == EvqInOut) &&
- type.getBasicType() != EbtStruct && IsSampler(type.getBasicType())) {
- error(line, "samplers cannot be output parameters", type.getBasicString(), "");
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::containsSampler(TType& type)
-{
- if (IsSampler(type.getBasicType()))
- return true;
-
- if (type.getBasicType() == EbtStruct) {
- TTypeList& structure = *type.getStruct();
- for (unsigned int i = 0; i < structure.size(); ++i) {
- if (containsSampler(*structure[i].type))
- return true;
- }
- }
-
- return false;
-}
-
-bool TParseContext::insertBuiltInArrayAtGlobalLevel()
-{
- TString *name = NewPoolTString("gl_TexCoord");
- TSymbol* symbol = symbolTable.find(*name);
- if (!symbol) {
- error(0, "INTERNAL ERROR finding symbol", name->c_str(), "");
- return true;
- }
- TVariable* variable = static_cast<TVariable*>(symbol);
-
- TVariable* newVariable = new TVariable(name, variable->getType());
-
- if (! symbolTable.insert(*newVariable)) {
- delete newVariable;
- error(0, "INTERNAL ERROR inserting new symbol", name->c_str(), "");
- return true;
- }
-
- return false;
-}
-
-//
-// Do all the semantic checking for declaring an array, with and
-// without a size, and make the right changes to the symbol table.
-//
-// size == 0 means no specified size.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::arrayErrorCheck(int line, TString& identifier, TPublicType type, TIntermTyped* size)
-{
- //
- // Don't check for reserved word use until after we know it's not in the symbol table,
- // because reserved arrays can be redeclared.
- //
-
- //
- // Can the type be an array?
- //
- if (type.array || type.qualifier == EvqAttribute || type.qualifier == EvqConst) {
- error(line, "cannot declare arrays of this type", TType(type).getCompleteString().c_str(), "");
- return true;
- }
- type.array = true;
-
- //
- // size will be 0 if there is no size declared, otherwise it contains the size
- // declared.
- //
- TIntermConstantUnion* constant = 0;
- if (size) {
- constant = size->getAsConstantUnion();
- if (constant == 0 || constant->getBasicType() != EbtInt || constant->getUnionArrayPointer()->iConst <= 0) {
- error(line, "array size must be a positive integer", identifier.c_str(), "");
- return true;
- }
- }
-
- bool builtIn = false;
- bool sameScope = false;
- TSymbol* symbol = symbolTable.find(identifier, &builtIn, &sameScope);
- if (symbol == 0 || !sameScope) {
- if (reservedErrorCheck(line, identifier))
- return true;
-
- TVariable* variable = new TVariable(&identifier, TType(type));
-
- if (size)
- variable->getType().setArraySize(constant->getUnionArrayPointer()->iConst);
-
- if (! symbolTable.insert(*variable)) {
- delete variable;
- error(line, "INTERNAL ERROR inserting new symbol", identifier.c_str(), "");
- return true;
- }
- } else {
- if (! symbol->isVariable()) {
- error(line, "variable expected", identifier.c_str(), "");
- return true;
- }
-
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (! variable->getType().isArray()) {
- error(line, "redeclaring non-array as array", identifier.c_str(), "");
- return true;
- }
- if (variable->getType().getArraySize() > 0) {
- error(line, "redeclaration of array with size", identifier.c_str(), "");
- return true;
- }
-
- if (variable->getType() != TType(type)) {
- error(line, "redeclaration of array with a different type", identifier.c_str(), "");
- return true;
- }
-
- TType* t = variable->getArrayInformationType();
- while (t != 0) {
- if (t->getMaxArraySize() > constant->getUnionArrayPointer()->iConst) {
- error(line, "higher index value already used for the array", identifier.c_str(), "");
- return true;
- }
- t->setArraySize(constant->getUnionArrayPointer()->iConst);
- t = t->getArrayInformationType();
- }
-
- if (size)
- variable->getType().setArraySize(constant->getUnionArrayPointer()->iConst);
- }
-
- if (voidErrorCheck(line, identifier, type))
- return true;
-
- return false;
-}
-
-bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, TSourceLoc line)
-{
- bool builtIn = false;
- TSymbol* symbol = symbolTable.find(node->getSymbol(), &builtIn);
- if (symbol == 0) {
- error(line, " undeclared identifier", node->getSymbol().c_str(), "");
- return true;
- }
- TVariable* variable = static_cast<TVariable*>(symbol);
-
- type->setArrayInformationType(variable->getArrayInformationType());
- variable->updateArrayInformationType(type);
-
- // we dont want to update the maxArraySize when this flag is not set, we just want to include this
- // node type in the chain of node types so that its updated when a higher maxArraySize comes in.
- if (!updateFlag)
- return false;
-
- size++;
- variable->getType().setMaxArraySize(size);
- type->setMaxArraySize(size);
- TType* tt = type;
-
- while(tt->getArrayInformationType() != 0) {
- tt = tt->getArrayInformationType();
- tt->setMaxArraySize(size);
- }
-
- return false;
-}
-
-//
-// Do semantic checking for a variable declaration that has no initializer,
-// and update the symbol table.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::nonInitErrorCheck(int line, TString& identifier, TPublicType& type)
-{
- if (reservedErrorCheck(line, identifier))
- recover();
-
- //
- // Make the qualifier make sense, error is issued in a little bit.
- //
- bool constError = false;
- if (type.qualifier == EvqConst) {
- type.qualifier = EvqTemporary;
- constError = true;
- }
-
- TVariable* variable = new TVariable(&identifier, TType(type));
-
- if (! symbolTable.insert(*variable)) {
- error(line, "redefinition", variable->getName().c_str(), "");
- delete variable;
- return true;
- }
- if (constError) {
- error(line, "variables with qualifier 'const' must be initialized", identifier.c_str(), "");
- return true;
- }
-
- if (voidErrorCheck(line, identifier, type))
- return true;
-
- return false;
-}
-
-bool TParseContext::paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type)
-{
- if (qualifier != EvqConst && qualifier != EvqTemporary) {
- error(line, "qualifier not allowed on function parameter", getQualifierString(qualifier), "");
- return true;
- }
- if (qualifier == EvqConst && paramQualifier != EvqIn) {
- error(line, "qualifier not allowed with ", getQualifierString(qualifier), getQualifierString(paramQualifier));
- return true;
- }
-
- if (qualifier == EvqConst)
- type->changeQualifier(EvqConstReadOnly);
- else
- type->changeQualifier(paramQualifier);
-
- return false;
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Non-Errors.
-//
-/////////////////////////////////////////////////////////////////////////////////
-
-//
-// Look up a function name in the symbol table, and make sure it is a function.
-//
-// Return the function symbol if found, otherwise 0.
-//
-const TFunction* TParseContext::findFunction(int line, TFunction* call, bool *builtIn)
-{
- const TSymbol* symbol = symbolTable.find(call->getMangledName(), builtIn);
-
- if (symbol == 0) {
- error(line, "no matching overloaded function found", call->getName().c_str(), "");
- return 0;
- }
-
- if (! symbol->isFunction()) {
- error(line, "function name expected", call->getName().c_str(), "");
- return 0;
- }
-
- const TFunction* function = static_cast<const TFunction*>(symbol);
-
- return function;
-}
-//
-// Initializers show up in several places in the grammar. Have one set of
-// code to handle them here.
-//
-bool TParseContext::executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType,
- TIntermTyped* initializer, TIntermNode*& intermNode)
-{
- if (reservedErrorCheck(line, identifier))
- return true;
-
- if (voidErrorCheck(line, identifier, pType))
- return true;
-
- //
- // add variable to symbol table
- //
- TVariable* variable = new TVariable(&identifier, TType(pType));
- if (! symbolTable.insert(*variable)) {
- error(line, "redefinition", variable->getName().c_str(), "");
- return true;
- // don't delete variable, it's used by error recovery, and the pool
- // pop will take care of the memory
- }
-
- //
- // identifier must be of type constant, a global, or a temporary
- //
- TQualifier qualifier = variable->getType().getQualifier();
- if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal) && (qualifier != EvqConst)) {
- error(line, " cannot initialize this type of qualifier ", variable->getType().getQualifierString(), "");
- return true;
- }
- //
- // test for and propagate constant
- //
-
- if (qualifier == EvqConst) {
- if (qualifier != initializer->getType().getQualifier()) {
- error(line, " assigning non-constant to", "=", "'%s'", variable->getType().getCompleteString().c_str());
- variable->getType().changeQualifier(EvqTemporary);
- return true;
- }
- if (TType(pType) != initializer->getType()) {
- error(line, " non-matching types for const initializer ",
- variable->getType().getQualifierString(), "");
- variable->getType().changeQualifier(EvqTemporary);
- return true;
- }
- if (initializer->getAsConstantUnion()) {
- constUnion* unionArray = variable->getConstPointer();
-
- if (pType.size == 1 && TType(pType).getBasicType() != EbtStruct) {
- switch (pType.type ) {
- case EbtInt:
- unionArray->iConst = (initializer->getAsConstantUnion()->getUnionArrayPointer())[0].iConst;
- break;
- case EbtFloat:
- unionArray->fConst = (initializer->getAsConstantUnion()->getUnionArrayPointer())[0].fConst;
- break;
- case EbtBool:
- unionArray->bConst = (initializer->getAsConstantUnion()->getUnionArrayPointer())[0].bConst;
- break;
- default:
- error(line, " cannot initialize constant of this type", "", "");
- return true;
- }
- } else {
- variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
- }
- } else if (initializer->getAsAggregate()) {
- bool returnVal = false;
- constUnion* unionArray = variable->getConstPointer();
- if (initializer->getAsAggregate()->getSequence().size() == 1 && initializer->getAsAggregate()->getSequence()[0]->getAsTyped()->getAsConstantUnion()) {
- returnVal = intermediate.parseConstTree(line, initializer, unionArray, initializer->getAsAggregate()->getOp(), symbolTable, variable->getType(), true);
- }
- else {
- returnVal = intermediate.parseConstTree(line, initializer, unionArray, initializer->getAsAggregate()->getOp(), symbolTable, variable->getType());
- }
- intermNode = 0;
- constUnion *arrayUnion = unionArray;
- if (returnVal) {
- arrayUnion = 0;
- variable->getType().changeQualifier(EvqTemporary);
- }
- return returnVal;
- } else if (initializer->getAsSymbolNode()) {
- const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol());
- const TVariable* tVar = static_cast<const TVariable*>(symbol);
-
- constUnion* constArray = tVar->getConstPointer();
- variable->shareConstPointer(constArray);
- } else {
- error(line, " assigning non-constant to", "=", "'%s'", variable->getType().getCompleteString().c_str());
- variable->getType().changeQualifier(EvqTemporary);
- return true;
- }
- }
-
- if (qualifier != EvqConst) {
- TIntermSymbol* intermSymbol = intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), line);
- intermNode = intermediate.addAssign(EOpAssign, intermSymbol, initializer, line);
- if (intermNode == 0) {
- assignError(line, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
- return true;
- }
- } else
- intermNode = 0;
-
- return false;
-}
-
-//
-// This method checks to see if the given aggregate node has all its children nodes as constants
-// This method does not test if structure members are constant
-//
-bool TParseContext::canNodeBeRemoved(TIntermNode* childNode)
-{
- TIntermAggregate *aggrNode = childNode->getAsAggregate();
- if (!aggrNode)
- return false;
-
- if (!aggrNode->isConstructor() || aggrNode->getOp() == EOpConstructStruct)
- return false;
-
- bool allConstant = true;
-
- // check if all the child nodes are constants so that they can be inserted into
- // the parent node
- if (aggrNode) {
- TIntermSequence &childSequenceVector = aggrNode->getSequence() ;
- for (TIntermSequence::iterator p = childSequenceVector.begin();
- p != childSequenceVector.end(); p++) {
- if (!(*p)->getAsTyped()->getAsConstantUnion())
- return false;
- }
- }
-
- return allConstant;
-}
-
-// This function is used to test for the correctness of the parameters passed to various constructor functions
-// and also convert them to the right datatype if it is allowed and required.
-//
-// Returns 0 for an error or the constructed node (aggregate or typed) for no error.
-//
-TIntermTyped* TParseContext::addConstructor(TIntermNode* node, TType* type, TOperator op, TFunction* fnCall, TSourceLoc line)
-{
- if (node == 0)
- return 0;
-
- TIntermAggregate* aggrNode = node->getAsAggregate();
-
- TTypeList::iterator list;
- TTypeList* structure = 0; // Store the information (vector) about the return type of the structure.
- if (op == EOpConstructStruct) {
- const TType& ttype = fnCall->getReturnType();
- structure = ttype.getStruct();
- list = (*structure).begin();
- }
-
- bool singleArg;
- if (aggrNode) {
- if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1)
- singleArg = true;
- else
- singleArg = false;
- } else
- singleArg = true;
-
- TIntermTyped *newNode;
- if (singleArg) {
- if (op == EOpConstructStruct) {
- // If structure constructor is being called for only one parameter inside the structure,
- // we need to call constructStruct function once.
- if (structure->size() != 1) {
- error(line, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
-
- return 0;
- } else
- return constructStruct(node, (*list).type, 1, node->getLine(), false);
- } else {
- newNode = constructBuiltIn(type, op, node, node->getLine(), false);
- if (newNode && newNode->getAsAggregate()) {
- if (canNodeBeRemoved(newNode->getAsAggregate()->getSequence()[0])) {
- TIntermAggregate* returnAggNode = newNode->getAsAggregate()->getSequence()[0]->getAsAggregate();
- newNode = intermediate.removeChildNode(newNode, type, returnAggNode);
- }
- }
- return newNode;
- }
- }
-
- //
- // Handle list of arguments.
- //
- TIntermSequence &sequenceVector = aggrNode->getSequence() ; // Stores the information about the parameter to the constructor
- // if the structure constructor contains more than one parameter, then construct
- // each parameter
- if (op == EOpConstructStruct) {
- if (structure->size() != sequenceVector.size()) { // If the number of parameters to the constructor does not match the expected number of parameters
- error(line, "Number of constructor parameters does not match the number of structure fields", "constructor", "");
-
- return 0;
- }
- }
-
- int paramCount = 0; // keeps a track of the constructor parameter number being checked
-
- // for each parameter to the constructor call, check to see if the right type is passed or convert them
- // to the right type if possible (and allowed).
- // for structure constructors, just check if the right type is passed, no conversion is allowed.
-
- for (TIntermSequence::iterator p = sequenceVector.begin();
- p != sequenceVector.end(); p++, paramCount++) {
- bool move = false;
- if (op == EOpConstructStruct) {
- newNode = constructStruct(*p, (list[paramCount]).type, paramCount+1, node->getLine(), true);
- if (newNode)
- move = true;
- } else {
- newNode = constructBuiltIn(type, op, *p, node->getLine(), true);
-
- if (newNode) {
- if (canNodeBeRemoved(newNode))
- intermediate.removeChildNode(sequenceVector, *type, paramCount, p, newNode->getAsAggregate());
- else
- move = true;
- }
- }
- if (move) {
- sequenceVector.erase(p);
- sequenceVector.insert(p, newNode);
- }
- }
-
- return intermediate.setAggregateOperator(aggrNode, op, line);
-}
-
-// Function for constructor implementation. Calls addUnaryMath with appropriate EOp value
-// for the parameter to the constructor (passed to this function). Essentially, it converts
-// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a
-// float, then float is converted to int.
-//
-// Returns 0 for an error or the constructed node.
-//
-TIntermTyped* TParseContext::constructBuiltIn(TType* type, TOperator op, TIntermNode* node, TSourceLoc line, bool subset)
-{
- TIntermTyped* newNode;
- TOperator basicOp;
-
- //
- // First, convert types as needed.
- //
- switch (op) {
- case EOpConstructVec2:
- case EOpConstructVec3:
- case EOpConstructVec4:
- case EOpConstructMat2:
- case EOpConstructMat3:
- case EOpConstructMat4:
- case EOpConstructFloat:
- basicOp = EOpConstructFloat;
- break;
-
- case EOpConstructIVec2:
- case EOpConstructIVec3:
- case EOpConstructIVec4:
- case EOpConstructInt:
- basicOp = EOpConstructInt;
- break;
-
- case EOpConstructBVec2:
- case EOpConstructBVec3:
- case EOpConstructBVec4:
- case EOpConstructBool:
- basicOp = EOpConstructBool;
- break;
-
- default:
- error(line, "unsupported construction", "", "");
- recover();
-
- return 0;
- }
- newNode = intermediate.addUnaryMath(basicOp, node, node->getLine(), symbolTable);
- if (newNode == 0) {
- error(line, "can't convert", "constructor", "");
- return 0;
- }
-
- //
- // Now, if there still isn't an operation to do the construction, and we need one, add one.
- //
-
- // Otherwise, skip out early.
- if (subset || newNode != node && newNode->getType() == *type)
- return newNode;
-
- // setAggregateOperator will insert a new node for the constructor, as needed.
- return intermediate.setAggregateOperator(newNode, op, line);
-}
-
-// This function tests for the type of the parameters to the structures constructors. Raises
-// an error message if the expected type does not match the parameter passed to the constructor.
-//
-// Returns 0 for an error or the input node itself if the expected and the given parameter types match.
-//
-TIntermTyped* TParseContext::constructStruct(TIntermNode* node, TType* type, int paramCount, TSourceLoc line, bool subset)
-{
- if (*type == node->getAsTyped()->getType()) {
- if (subset)
- return node->getAsTyped();
- else
- return intermediate.setAggregateOperator(node->getAsTyped(), EOpConstructStruct, line);
- } else {
- error(line, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount,
- node->getAsTyped()->getType().getBasicString(), type->getBasicString());
- recover();
- }
-
- return 0;
-}
-
-//
-// This function returns the tree representation for the vector field(s) being accessed from contant vector.
-// If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is
-// returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol
-// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of
-// a constant matrix.
-//
-TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTyped* node, TSourceLoc line)
-{
- TIntermTyped* typedNode;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
- TIntermAggregate* aggregateNode = node->getAsAggregate();
-
- constUnion *unionArray;
- if (tempConstantNode) {
- unionArray = tempConstantNode->getUnionArrayPointer();
-
- if (!unionArray) { // this error message should never be raised
- infoSink.info.message(EPrefixInternalError, "constUnion not initialized in addConstVectorNode function", line);
- recover();
-
- return node;
- }
- } else if (aggregateNode) { // if an aggregate node is present, the value has to be taken from the parse tree
- // for a case like vec(4).xz
- unionArray = new constUnion[aggregateNode->getType().getInstanceSize()];
-
- bool returnVal = false;
- if (aggregateNode->getAsAggregate()->getSequence().size() == 1 && aggregateNode->getAsAggregate()->getSequence()[0]->getAsTyped()->getAsConstantUnion()) {
- returnVal = intermediate.parseConstTree(line, aggregateNode, unionArray, aggregateNode->getOp(), symbolTable, aggregateNode->getType(), true);
- }
- else {
- returnVal = intermediate.parseConstTree(line, aggregateNode, unionArray, aggregateNode->getOp(), symbolTable, aggregateNode->getType());
- }
-
- if (returnVal)
- return 0;
-
- } else { // The node has to be either a symbol node or an aggregate node or a tempConstant node, else, its an error
- error(line, "No aggregate or constant union node available", "Internal Error", "");
- recover();
-
- return 0;
- }
-
- constUnion* constArray = new constUnion[fields.num];
-
- for (int i = 0; i < fields.num; i++) {
- if (fields.offsets[i] >= node->getType().getInstanceSize()) {
- error(line, "", "[", "vector field selection out of range '%d'", fields.offsets[i]);
- recover();
- fields.offsets[i] = 0;
- }
-
- constArray[i] = unionArray[fields.offsets[i]];
-
- }
- typedNode = intermediate.addConstantUnion(constArray, node->getType(), line);
- return typedNode;
-}
-
-//
-// This function returns the column being accessed from a constant matrix. The values are retrieved from
-// the symbol table and parse-tree is built for a vector (each column of a matrix is a vector). The input
-// to the function could either be a symbol node (m[0] where m is a constant matrix)that represents a
-// constant matrix or it could be the tree representation of the constant matrix (s.m1[0] where s is a constant structure)
-//
-TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, TSourceLoc line)
-{
- TIntermTyped* typedNode;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
- TIntermAggregate* aggregateNode = node->getAsAggregate();
-
- if (index >= node->getType().getNominalSize()) {
- error(line, "", "[", "matrix field selection out of range '%d'", index);
- recover();
- index = 0;
- }
-
- if (tempConstantNode) {
- constUnion* unionArray = tempConstantNode->getUnionArrayPointer();
- int size = tempConstantNode->getType().getNominalSize();
- typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
- } else if (aggregateNode) {
- // for a case like mat4(5)[0]
- constUnion* unionArray = new constUnion[aggregateNode->getType().getInstanceSize()];
- int size = aggregateNode->getType().getNominalSize();
-
- bool returnVal = false;
- if (aggregateNode->getAsAggregate()->getSequence().size() == 1 && aggregateNode->getAsAggregate()->getSequence()[0]->getAsTyped()->getAsConstantUnion()) {
- returnVal = intermediate.parseConstTree(line, aggregateNode, unionArray, aggregateNode->getOp(), symbolTable, aggregateNode->getType(), true);
- }
- else {
- returnVal = intermediate.parseConstTree(line, aggregateNode, unionArray, aggregateNode->getOp(), symbolTable, aggregateNode->getType());
- }
-
- if (!returnVal)
- typedNode = intermediate.addConstantUnion(&unionArray[size*index], aggregateNode->getType(), line);
- else
- return 0;
-
- } else {
- error(line, "No Aggregate or Constant Union node available", "Internal Error", "");
- recover();
-
- return 0;
- }
-
- return typedNode;
-}
-
-//
-// This function returns the value of a particular field inside a constant structure from the symbol table.
-// If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr
-// function and returns the parse-tree with the values of the embedded/nested struct.
-//
-TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* node, TSourceLoc line)
-{
- TTypeList* fields = node->getType().getStruct();
- TIntermTyped *typedNode;
- int instanceSize = 0;
- unsigned int index = 0;
- TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
- TIntermAggregate* aggregateNode = node->getAsAggregate();
-
- for ( index = 0; index < fields->size(); ++index) {
- if ((*fields)[index].type->getFieldName() == identifier) {
- break;
- } else {
- if ((*fields)[index].type->getStruct())
- //?? We should actually be calling getStructSize() function and not setStructSize. This problem occurs in case
- // of nested/embedded structs.
- instanceSize += (*fields)[index].type->setStructSize((*fields)[index].type->getStruct());
- else
- instanceSize += (*fields)[index].type->getInstanceSize();
- }
- }
-
- if (tempConstantNode) {
- constUnion* constArray = tempConstantNode->getUnionArrayPointer();
-
- typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode->getType(), line); // type will be changed in the calling function
- } else if (aggregateNode) {
- // for a case like constStruct(1,v3).i where structure fields is int i and vec3 v3.
-
- constUnion* unionArray = new constUnion[aggregateNode->getType().getStructSize()];
-
- bool returnVal = false;
- if (aggregateNode->getAsAggregate()->getSequence().size() == 1 && aggregateNode->getAsAggregate()->getSequence()[0]->getAsTyped()->getAsConstantUnion()) {
- returnVal = intermediate.parseConstTree(line, aggregateNode, unionArray, aggregateNode->getOp(), symbolTable, aggregateNode->getType(), true);
- }
- else {
- returnVal = intermediate.parseConstTree(line, aggregateNode, unionArray, aggregateNode->getOp(), symbolTable, aggregateNode->getType());
- }
-
- if (!returnVal)
- typedNode = intermediate.addConstantUnion(unionArray+instanceSize, aggregateNode->getType(), line);
- else
- return 0;
-
- } else {
- error(line, "No Aggregate or Constant Union node available", "Internal Error", "");
- recover();
-
- return 0;
- }
-
- return typedNode;
-}
-
-//
-// Initialize all supported extensions to disable
-//
-void TParseContext::initializeExtensionBehavior()
-{
- //
- // example code: extensionBehavior["test"] = EDisable; // where "test" is the name of
- // supported extension
- //
-}
-
-OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
-
-bool InitializeParseContextIndex()
-{
- if (GlobalParseContextIndex != OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
- return false;
- }
-
- //
- // Allocate a TLS index.
- //
- GlobalParseContextIndex = OS_AllocTLSIndex();
-
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
- return false;
- }
-
- return true;
-}
-
-bool InitializeGlobalParseContext()
-{
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeGlobalParseContext(): Parse Context index not initalised");
- return false;
- }
-
- TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
- if (lpParseContext != 0) {
- assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
- return false;
- }
-
- TThreadParseContext *lpThreadData = new TThreadParseContext();
- if (lpThreadData == 0) {
- assert(0 && "InitializeGlobalParseContext(): Unable to create thread parse context");
- return false;
- }
-
- lpThreadData->lpGlobalParseContext = 0;
- OS_SetTLSValue(GlobalParseContextIndex, lpThreadData);
-
- return true;
-}
-
-TParseContextPointer& GetGlobalParseContext()
-{
- //
- // Minimal error checking for speed
- //
-
- TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
-
- return lpParseContext->lpGlobalParseContext;
-}
-
-bool FreeParseContext()
-{
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "FreeParseContext(): Parse Context index not initalised");
- return false;
- }
-
- TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
- if (lpParseContext)
- delete lpParseContext;
-
- return true;
-}
-
-bool FreeParseContextIndex()
-{
- OS_TLSIndex tlsiIndex = GlobalParseContextIndex;
-
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "FreeParseContextIndex(): Parse Context index not initalised");
- return false;
- }
-
- GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
-
- return OS_FreeTLSIndex(tlsiIndex);
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/ParseHelper.h b/src/mesa/shader/slang/MachineIndependent/ParseHelper.h
deleted file mode 100755
index 00552b85548..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/ParseHelper.h
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-#ifndef _PARSER_HELPER_INCLUDED_
-#define _PARSER_HELPER_INCLUDED_
-
-#include "../Include/ShHandle.h"
-#include "SymbolTable.h"
-#include "localintermediate.h"
-
-struct TMatrixFields {
- bool wholeRow;
- bool wholeCol;
- int row;
- int col;
-};
-
-typedef enum {
- EBhRequire,
- EBhEnable,
- EBhWarn,
- EBhDisable
-} TBehavior;
-
-struct TPragma {
- TPragma(bool o, bool d) : optimize(o), debug(d) { }
- bool optimize;
- bool debug;
- TPragmaTable pragmaTable;
-};
-
-//
-// The following are extra variables needed during parsing, grouped together so
-// they can be passed to the parser without needing a global.
-//
-struct TParseContext {
- TParseContext(TSymbolTable& symt, TIntermediate& interm, EShLanguage L, TInfoSink& is) :
- intermediate(interm), symbolTable(symt), infoSink(is), language(L), treeRoot(0),
- recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
- inTypeParen(false), contextPragma(true, false) { }
- TIntermediate& intermediate; // to hold and build a parse tree
- TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
- TInfoSink& infoSink;
- EShLanguage language; // vertex or fragment language (future: pack or unpack)
- TIntermNode* treeRoot; // root of parse tree being created
- bool recoveredFromError; // true if a parse error has occurred, but we continue to parse
- int numErrors;
- bool lexAfterType; // true if we've recognized a type, so can only be looking for an identifier
- int loopNestingLevel; // 0 if outside all loops
- bool inTypeParen; // true if in parentheses, looking only for an identifier
- const TType* currentFunctionType; // the return type of the function that's currently being parsed
- bool functionReturnsValue; // true if a non-void function has a return
- TMap<TString, TBehavior> extensionBehavior;
- void initializeExtensionBehavior();
-
- void C_DECL error(TSourceLoc, const char *szReason, const char *szToken,
- const char *szExtraInfoFormat, ...);
- bool reservedErrorCheck(int line, const TString& identifier);
- void recover();
-
- bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line);
- bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, int line);
- void assignError(int line, const char* op, TString left, TString right);
- void unaryOpError(int line, char* op, TString operand);
- void binaryOpError(int line, char* op, TString left, TString right);
- bool lValueErrorCheck(int line, char* op, TIntermTyped*);
- bool constErrorCheck(TIntermTyped* node);
- bool integerErrorCheck(TIntermTyped* node, char* token);
- bool globalErrorCheck(int line, bool global, char* token);
- bool constructorErrorCheck(int line, TIntermNode*, TFunction&, TOperator, TType*);
- bool arrayErrorCheck(int line, TString& identifier, TPublicType type, TIntermTyped* size);
- bool insertBuiltInArrayAtGlobalLevel();
- bool voidErrorCheck(int, const TString&, const TPublicType&);
- bool boolErrorCheck(int, const TIntermTyped*);
- bool boolErrorCheck(int, const TPublicType&);
- bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason);
- bool structQualifierErrorCheck(int line, const TPublicType& pType);
- bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type);
- bool containsSampler(TType& type);
- bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type);
- bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
- const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0);
- bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType,
- TIntermTyped* initializer, TIntermNode*& intermNode);
- bool canNodeBeRemoved(TIntermNode*);
- TIntermTyped* addConstructor(TIntermNode*, TType*, TOperator, TFunction*, TSourceLoc);
- TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset);
- TIntermTyped* constructBuiltIn(TType*, TOperator, TIntermNode*, TSourceLoc, bool subset);
- TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, TSourceLoc);
- TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc);
- TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc);
- bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
- struct TPragma contextPragma;
- TString HashErrMsg;
- bool AfterEOF;
-};
-
-int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext&);
-void PaReservedWord();
-int PaIdentOrType(TString& id, TParseContext&, TSymbol*&);
-int PaParseComment(int &lineno, TParseContext&);
-void setInitialState();
-
-typedef TParseContext* TParseContextPointer;
-extern TParseContextPointer& GetGlobalParseContext();
-#define GlobalParseContext GetGlobalParseContext()
-
-typedef struct TThreadParseContextRec
-{
- TParseContext *lpGlobalParseContext;
-} TThreadParseContext;
-
-#endif // _PARSER_HELPER_INCLUDED_
diff --git a/src/mesa/shader/slang/MachineIndependent/PoolAlloc.cpp b/src/mesa/shader/slang/MachineIndependent/PoolAlloc.cpp
deleted file mode 100755
index ba717fce12b..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/PoolAlloc.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "../Include/PoolAlloc.h"
-#include "../Include/Common.h"
-
-#include "Include/InitializeGlobals.h"
-#include "osinclude.h"
-
-OS_TLSIndex PoolIndex;
-
-void InitializeGlobalPools()
-{
- TThreadGlobalPools* globalPools= static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
- if (globalPools)
- return;
-
- TPoolAllocator *globalPoolAllocator = new TPoolAllocator(true);
-
- TThreadGlobalPools* threadData = new TThreadGlobalPools();
-
- threadData->globalPoolAllocator = globalPoolAllocator;
-
- OS_SetTLSValue(PoolIndex, threadData);
- globalPoolAllocator->push();
-}
-
-void FreeGlobalPools()
-{
- // Release the allocated memory for this thread.
- TThreadGlobalPools* globalPools= static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
- if (!globalPools)
- return;
-
- GlobalPoolAllocator.popAll();
- delete &GlobalPoolAllocator;
- delete globalPools;
-}
-
-bool InitializePoolIndex()
-{
- // Allocate a TLS index.
- if ((PoolIndex = OS_AllocTLSIndex()) == OS_INVALID_TLS_INDEX)
- return false;
-
- return true;
-}
-
-void FreePoolIndex()
-{
- // Release the TLS index.
- OS_FreeTLSIndex(PoolIndex);
-}
-
-TPoolAllocator& GetGlobalPoolAllocator()
-{
- TThreadGlobalPools* threadData = static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
-
- return *threadData->globalPoolAllocator;
-}
-
-void SetGlobalPoolAllocatorPtr(TPoolAllocator* poolAllocator)
-{
- TThreadGlobalPools* threadData = static_cast<TThreadGlobalPools*>(OS_GetTLSValue(PoolIndex));
-
- threadData->globalPoolAllocator = poolAllocator;
-}
-
-//
-// Implement the functionality of the TPoolAllocator class, which
-// is documented in PoolAlloc.h.
-//
-TPoolAllocator::TPoolAllocator(bool g, int growthIncrement, int allocationAlignment) :
- global(g),
- pageSize(growthIncrement),
- alignment(allocationAlignment),
- freeList(0),
- inUseList(0),
- numCalls(0)
-{
- //
- // Don't allow page sizes we know are smaller than all common
- // OS page sizes.
- //
- if (pageSize < 4*1024)
- pageSize = 4*1024;
-
- //
- // A large currentPageOffset indicates a new page needs to
- // be obtained to allocate memory.
- //
- currentPageOffset = pageSize;
-
- //
- // Adjust alignment to be at least pointer aligned and
- // power of 2.
- //
- size_t minAlign = sizeof(void*);
- alignment &= ~(minAlign - 1);
- if (alignment < minAlign)
- alignment = minAlign;
- size_t a = 1;
- while (a < alignment)
- a <<= 1;
- alignment = a;
- alignmentMask = a - 1;
-
- //
- // Align header skip
- //
- headerSkip = minAlign;
- if (headerSkip < sizeof(tHeader)) {
- headerSkip = (sizeof(tHeader) + alignmentMask) & ~alignmentMask;
- }
-
- //
- // Put a marker at the beginning of the stack. We won't
- // pop() past this.
- //
- tAllocState start = { currentPageOffset, 0 };
- stack.push_back(start);
-}
-
-TPoolAllocator::~TPoolAllocator()
-{
- if (!global) {
- //
- // Then we know that this object is not being
- // allocated after other, globally scoped objects
- // that depend on it. So we can delete the "in use" memory.
- //
- while (inUseList) {
- tHeader* next = inUseList->nextPage;
- inUseList->~tHeader();
- delete [] reinterpret_cast<char*>(inUseList);
- inUseList = next;
- }
- }
-
- //
- // Always delete the free list memory - it can't be being
- // (correctly) referenced, whether the pool allocator was
- // global or not. We should not check the guard blocks
- // here, because we did it already when the block was
- // placed into the free list.
- //
- while (freeList) {
- tHeader* next = freeList->nextPage;
- delete [] reinterpret_cast<char*>(freeList);
- freeList = next;
- }
-}
-
-// Support MSVC++ 6.0
-const unsigned char TAllocation::guardBlockBeginVal = 0xfb;
-const unsigned char TAllocation::guardBlockEndVal = 0xfe;
-const unsigned char TAllocation::userDataFill = 0xcd;
-
-# ifdef GUARD_BLOCKS
- const size_t TAllocation::guardBlockSize = 16;
-# else
- const size_t TAllocation::guardBlockSize = 0;
-# endif
-
-//
-// Check a single guard block for damage
-//
-void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, char* locText) const
-{
- for (int x = 0; x < guardBlockSize; x++) {
- if (blockMem[x] != val) {
- char assertMsg[80];
-
- // We don't print the assert message. It's here just to be helpful.
- sprintf(assertMsg, "PoolAlloc: Damage %s %u byte allocation at 0x%p\n",
- locText, size, data());
- assert(0 && "PoolAlloc: Damage in guard block");
- }
- }
-}
-
-
-void TPoolAllocator::push()
-{
- tAllocState state = { currentPageOffset, inUseList };
-
- stack.push_back(state);
-
- //
- // Indicate there is no current page to allocate from.
- //
- currentPageOffset = pageSize;
-}
-
-//
-// Do a mass-deallocation of all the individual allocations
-// that have occurred since the last push(), or since the
-// last pop(), or since the object's creation.
-//
-// The deallocated pages are saved for future allocations.
-//
-void TPoolAllocator::pop()
-{
- if (stack.size() < 1)
- return;
-
- tHeader* page = stack.back().page;
- currentPageOffset = stack.back().offset;
-
- while (inUseList != page) {
- // invoke destructor to free allocation list
- inUseList->~tHeader();
-
- tHeader* nextInUse = inUseList->nextPage;
- if (inUseList->pageCount > 1)
- delete [] reinterpret_cast<char*>(inUseList);
- else {
- inUseList->nextPage = freeList;
- freeList = inUseList;
- }
- inUseList = nextInUse;
- }
-
- stack.pop_back();
-}
-
-//
-// Do a mass-deallocation of all the individual allocations
-// that have occurred.
-//
-void TPoolAllocator::popAll()
-{
- while (stack.size() > 0)
- pop();
-}
-
-void* TPoolAllocator::allocate(size_t numBytes)
-{
- // If we are using guard blocks, all allocations are bracketed by
- // them: [guardblock][allocation][guardblock]. numBytes is how
- // much memory the caller asked for. allocationSize is the total
- // size including guard blocks. In release build,
- // guardBlockSize=0 and this all gets optimized away.
- size_t allocationSize = TAllocation::allocationSize(numBytes);
-
- //
- // Just keep some interesting statistics.
- //
- ++numCalls;
- totalBytes += numBytes;
-
- //
- // Do the allocation, most likely case first, for efficiency.
- // This step could be moved to be inline sometime.
- //
- if (currentPageOffset + allocationSize <= pageSize) {
- //
- // Safe to allocate from currentPageOffset.
- //
- unsigned char* memory = reinterpret_cast<unsigned char *>(inUseList) + currentPageOffset;
- currentPageOffset += allocationSize;
- currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask;
-
- return initializeAllocation(inUseList, memory, numBytes);
- }
-
- if (allocationSize + headerSkip > pageSize) {
- //
- // Do a multi-page allocation. Don't mix these with the others.
- // The OS is efficient and allocating and free-ing multiple pages.
- //
- size_t numBytesToAlloc = allocationSize + headerSkip;
- tHeader* memory = reinterpret_cast<tHeader*>(::new char[numBytesToAlloc]);
- if (memory == 0)
- return 0;
-
- // Use placement-new to initialize header
- new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize);
- inUseList = memory;
-
- currentPageOffset = pageSize; // make next allocation come from a new page
-
- // No guard blocks for multi-page allocations (yet)
- return reinterpret_cast<void*>(reinterpret_cast<UINT_PTR>(memory) + headerSkip);
- }
-
- //
- // Need a simple page to allocate from.
- //
- tHeader* memory;
- if (freeList) {
- memory = freeList;
- freeList = freeList->nextPage;
- } else {
- memory = reinterpret_cast<tHeader*>(::new char[pageSize]);
- if (memory == 0)
- return 0;
- }
-
- // Use placement-new to initialize header
- new(memory) tHeader(inUseList, 1);
- inUseList = memory;
-
- unsigned char* ret = reinterpret_cast<unsigned char *>(inUseList) + headerSkip;
- currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask;
-
- return initializeAllocation(inUseList, ret, numBytes);
-}
-
-
-//
-// Check all allocations in a list for damage by calling check on each.
-//
-void TAllocation::checkAllocList() const
-{
- for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc)
- alloc->check();
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/QualifierAlive.cpp b/src/mesa/shader/slang/MachineIndependent/QualifierAlive.cpp
deleted file mode 100755
index 2897f48b19c..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/QualifierAlive.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "../Include/intermediate.h"
-
-class TAliveTraverser : public TIntermTraverser {
-public:
- TAliveTraverser(TQualifier q) : TIntermTraverser(), found(false), qualifier(q)
- {
- visitSymbol = AliveSymbol;
- visitSelection = AliveSelection;
- rightToLeft = true;
- }
- bool wasFound() { return found; }
-protected:
- bool found;
- TQualifier qualifier;
-
- friend void AliveSymbol(TIntermSymbol*, TIntermTraverser*);
- friend bool AliveSelection(bool, TIntermSelection*, TIntermTraverser*);
-};
-
-//
-// Report whether or not a variable of the given qualifier type
-// is guaranteed written. Not always possible to determine if
-// it is written conditionally.
-//
-// ?? It does not do this well yet, this is just a place holder
-// that simply determines if it was reference at all, anywhere.
-//
-bool QualifierWritten(TIntermNode* node, TQualifier qualifier)
-{
- TAliveTraverser it(qualifier);
-
- if (node)
- node->traverse(&it);
-
- return it.wasFound();
-}
-
-void AliveSymbol(TIntermSymbol* node, TIntermTraverser* it)
-{
- TAliveTraverser* lit = static_cast<TAliveTraverser*>(it);
-
- //
- // If it's what we're looking for, record it.
- //
- if (node->getQualifier() == lit->qualifier)
- lit->found = true;
-}
-
-bool AliveSelection(bool preVisit, TIntermSelection* node, TIntermTraverser* it)
-{
- TAliveTraverser* lit = static_cast<TAliveTraverser*>(it);
-
- if (lit->wasFound())
- return false;
-
- return true;
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/QualifierAlive.h b/src/mesa/shader/slang/MachineIndependent/QualifierAlive.h
deleted file mode 100755
index 73e902cd0dd..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/QualifierAlive.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-bool QualifierWritten(TIntermNode* root, TQualifier);
diff --git a/src/mesa/shader/slang/MachineIndependent/RemoveTree.cpp b/src/mesa/shader/slang/MachineIndependent/RemoveTree.cpp
deleted file mode 100755
index 2435a485b61..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/RemoveTree.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "../Include/intermediate.h"
-#include "RemoveTree.h"
-//
-// Code to recursively delete the intermediate tree.
-//
-
-void RemoveSymbol(TIntermSymbol* node, TIntermTraverser* it)
-{
- delete node;
-}
-
-bool RemoveBinary(bool /*preVisit*/ , TIntermBinary* node, TIntermTraverser*)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveUnary(bool /*preVisit */, TIntermUnary* node, TIntermTraverser*)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveAggregate(bool /*preVisit*/ , TIntermAggregate* node, TIntermTraverser*)
-{
- delete node;
-
- return true;
-}
-
-bool RemoveSelection(bool /*preVisit*/ , TIntermSelection* node, TIntermTraverser*)
-{
- delete node;
-
- return true;
-}
-
-void RemoveConstantUnion(TIntermConstantUnion* node, TIntermTraverser*)
-{
- delete node;
-}
-
-//
-// Entry point.
-//
-void RemoveAllTreeNodes(TIntermNode* root)
-{
- TIntermTraverser it;
-
- it.visitAggregate = RemoveAggregate;
- it.visitBinary = RemoveBinary;
- it.visitConstantUnion = RemoveConstantUnion;
- it.visitSelection = RemoveSelection;
- it.visitSymbol = RemoveSymbol;
- it.visitUnary = RemoveUnary;
-
- it.preVisit = false;
- it.postVisit = true;
-
- root->traverse(&it);
-}
-
diff --git a/src/mesa/shader/slang/MachineIndependent/RemoveTree.h b/src/mesa/shader/slang/MachineIndependent/RemoveTree.h
deleted file mode 100755
index 171092f1abe..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/RemoveTree.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-void RemoveAllTreeNodes(TIntermNode*);
diff --git a/src/mesa/shader/slang/MachineIndependent/ShaderLang.cpp b/src/mesa/shader/slang/MachineIndependent/ShaderLang.cpp
deleted file mode 100755
index 3f37e15f376..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/ShaderLang.cpp
+++ /dev/null
@@ -1,607 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-//
-// Implement the top-level of interface to the compiler/linker,
-// as defined in ShaderLang.h
-//
-#include "SymbolTable.h"
-#include "ParseHelper.h"
-#include "../Include/ShHandle.h"
-#include "Initialisation.h"
-
-#define SH_EXPORTING
-#include "../Public/ShaderLangExt.h"
-
-#include "Include/ResourceLimits.h"
-#include "Initialize.h"
-
-extern "C" int InitPreprocessor(void);
-extern "C" int FinalizePreprocessor(void);
-extern void SetGlobalPoolAllocatorPtr(TPoolAllocator* poolAllocator);
-
-bool generateBuiltInSymbolTable(const TBuiltInResource* resources, TInfoSink&, TSymbolTable*, EShLanguage language = EShLangCount);
-bool initializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, const TBuiltInResource *resources, TSymbolTable*);
-
-//
-// A symbol table for each language. Each has a different
-// set of built-ins, and we want to preserve that from
-// compile to compile.
-//
-TSymbolTable SymbolTables[EShLangCount];
-
-TPoolAllocator* PerProcessGPA = 0;
-//
-// This is the platform independent interface between an OGL driver
-// and the shading language compiler/linker.
-//
-
-//
-// Driver must call this first, once, before doing any other
-// compiler/linker operations.
-//
-int ShInitialize()
-{
- TInfoSink infoSink;
- bool ret = true;
-
- if (!InitProcess())
- return 0;
-
- // This method should be called once per process. If its called by multiple threads, then
- // we need to have thread synchronization code around the initialization of per process
- // global pool allocator
- if (!PerProcessGPA) {
- TPoolAllocator *builtInPoolAllocator = new TPoolAllocator(true);
- builtInPoolAllocator->push();
- TPoolAllocator* gPoolAllocator = &GlobalPoolAllocator;
- SetGlobalPoolAllocatorPtr(builtInPoolAllocator);
-
- TSymbolTable symTables[EShLangCount];
- generateBuiltInSymbolTable(0, infoSink, symTables);
-
- PerProcessGPA = new TPoolAllocator(true);
- PerProcessGPA->push();
- SetGlobalPoolAllocatorPtr(PerProcessGPA);
-
- SymbolTables[EShLangVertex].copyTable(symTables[EShLangVertex]);
- SymbolTables[EShLangFragment].copyTable(symTables[EShLangFragment]);
-
- SetGlobalPoolAllocatorPtr(gPoolAllocator);
-
- symTables[EShLangVertex].pop();
- symTables[EShLangFragment].pop();
-
- builtInPoolAllocator->popAll();
- delete builtInPoolAllocator;
-
- }
-
- return ret ? 1 : 0;
-}
-
-//
-// Driver calls these to create and destroy compiler/linker
-// objects.
-//
-
-ShHandle ShConstructCompiler(const EShLanguage language, int debugOptions)
-{
- if (!InitThread())
- return 0;
-
- TShHandleBase* base = static_cast<TShHandleBase*>(ConstructCompiler(language, debugOptions));
-
- return reinterpret_cast<void*>(base);
-}
-
-ShHandle ShConstructLinker(const EShExecutable executable, int debugOptions)
-{
- if (!InitThread())
- return 0;
-
- TShHandleBase* base = static_cast<TShHandleBase*>(ConstructLinker(executable, debugOptions));
-
- return reinterpret_cast<void*>(base);
-}
-
-ShHandle ShConstructUniformMap()
-{
- if (!InitThread())
- return 0;
-
- TShHandleBase* base = static_cast<TShHandleBase*>(ConstructUniformMap());
-
- return reinterpret_cast<void*>(base);
-}
-
-void ShDestruct(ShHandle handle)
-{
- if (handle == 0)
- return;
-
- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
-
- if (base->getAsCompiler())
- DeleteCompiler(base->getAsCompiler());
- else if (base->getAsLinker())
- DeleteLinker(base->getAsLinker());
- else if (base->getAsUniformMap())
- DeleteUniformMap(base->getAsUniformMap());
-}
-
-//
-// Cleanup symbol tables
-//
-int __fastcall ShFinalize()
-{
- if (PerProcessGPA) {
- PerProcessGPA->popAll();
- delete PerProcessGPA;
- }
- return 1;
-}
-
-//
-// This function should be called only once by the Master Dll. Currently, this is being called for each thread
-// which is incorrect. This is required to keep the Sh interface working for now and will eventually be called
-// from master dll once.
-//
-bool generateBuiltInSymbolTable(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable* symbolTables, EShLanguage language)
-{
- TBuiltIns builtIns;
-
- if (resources) {
- builtIns.initialize(*resources);
- initializeSymbolTable(builtIns.getBuiltInStrings(), language, infoSink, resources, symbolTables);
- } else {
- builtIns.initialize();
- initializeSymbolTable(builtIns.getBuiltInStrings(), EShLangVertex, infoSink, resources, symbolTables);
- initializeSymbolTable(builtIns.getBuiltInStrings(), EShLangFragment, infoSink, resources, symbolTables);
- }
-
- return true;
-}
-
-bool initializeSymbolTable(TBuiltInStrings* BuiltInStrings, EShLanguage language, TInfoSink& infoSink, const TBuiltInResource* resources, TSymbolTable* symbolTables)
-{
- TIntermediate intermediate(infoSink);
- TSymbolTable* symbolTable;
-
- if (resources)
- symbolTable = symbolTables;
- else
- symbolTable = &symbolTables[language];
-
- TParseContext parseContext(*symbolTable, intermediate, language, infoSink);
-
- GlobalParseContext = &parseContext;
-
- setInitialState();
-
- assert (symbolTable->isEmpty() || symbolTable->atSharedBuiltInLevel());
-
- //
- // Parse the built-ins. This should only happen once per
- // language symbol table.
- //
- // Push the symbol table to give it an initial scope. This
- // push should not have a corresponding pop, so that built-ins
- // are preserved, and the test for an empty table fails.
- //
-
- symbolTable->push();
-
- //Initialize the Preprocessor
- int ret = InitPreprocessor();
- if (ret) {
- infoSink.info.message(EPrefixInternalError, "Unable to intialize the Preprocessor");
- return false;
- }
-
- for (TBuiltInStrings::iterator i = BuiltInStrings[parseContext.language].begin();
- i != BuiltInStrings[parseContext.language].end();
- ++i) {
- const char* builtInShaders[1];
- int builtInLengths[1];
-
- builtInShaders[0] = (*i).c_str();
- builtInLengths[0] = (int) (*i).size();
-
- if (PaParseStrings(const_cast<char**>(builtInShaders), builtInLengths, 1, parseContext) != 0) {
- infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
- return false;
- }
- }
-
- if (resources) {
- IdentifyBuiltIns(parseContext.language, *symbolTable, *resources);
- } else {
- IdentifyBuiltIns(parseContext.language, *symbolTable);
- }
-
- FinalizePreprocessor();
-
- return true;
-}
-
-
-//
-// Do an actual compile on the given strings. The result is left
-// in the given compile object.
-//
-// Return: The return value of ShCompile is really boolean, indicating
-// success or failure.
-//
-int ShCompile(
- const ShHandle handle,
- const char* const shaderStrings[],
- const int numStrings,
- const EShOptimizationLevel optLevel,
- const TBuiltInResource* resources,
- int debugOptions
- )
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
- TCompiler* compiler = base->getAsCompiler();
- if (compiler == 0)
- return 0;
-
- GlobalPoolAllocator.push();
- compiler->infoSink.info.erase();
- compiler->infoSink.debug.erase();
-
- if (numStrings == 0)
- return 1;
-
- TIntermediate intermediate(compiler->infoSink);
- TSymbolTable symbolTable(SymbolTables[compiler->getLanguage()]);
-
- generateBuiltInSymbolTable(resources, compiler->infoSink, &symbolTable, compiler->getLanguage());
-
- TParseContext parseContext(symbolTable, intermediate, compiler->getLanguage(), compiler->infoSink);
- parseContext.initializeExtensionBehavior();
-
- GlobalParseContext = &parseContext;
-
- setInitialState();
-
- InitPreprocessor();
- //
- // Parse the application's shaders. All the following symbol table
- // work will be throw-away, so push a new allocation scope that can
- // be thrown away, then push a scope for the current shader's globals.
- //
- bool success = true;
-
- symbolTable.push();
- if (!symbolTable.atGlobalLevel())
- parseContext.infoSink.info.message(EPrefixInternalError, "Wrong symbol table level");
-
- if (parseContext.insertBuiltInArrayAtGlobalLevel())
- success = false;
-
- int ret = PaParseStrings(const_cast<char**>(shaderStrings), 0, numStrings, parseContext);
- if (ret)
- success = false;
-
- if (success && parseContext.treeRoot) {
- if (optLevel == EShOptNoGeneration)
- parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested.");
- else {
- success = intermediate.postProcess(parseContext.treeRoot, parseContext.language);
-
- if (success) {
-
- if (debugOptions & EDebugOpIntermediate)
- intermediate.outputTree(parseContext.treeRoot);
-
- //
- // Call the machine dependent compiler
- //
- if (! compiler->compile(parseContext.treeRoot))
- success = false;
- }
- }
- } else if (!success) {
- parseContext.infoSink.info.prefix(EPrefixError);
- parseContext.infoSink.info << parseContext.numErrors << " compilation errors. No code generated.\n\n";
- success = false;
- if (debugOptions & EDebugOpIntermediate)
- intermediate.outputTree(parseContext.treeRoot);
- }
-
- intermediate.remove(parseContext.treeRoot);
-
- //
- // Ensure symbol table is returned to the built-in level,
- // throwing away all but the built-ins.
- //
- while (! symbolTable.atSharedBuiltInLevel())
- symbolTable.pop();
-
- FinalizePreprocessor();
- //
- // Throw away all the temporary memory used by the compilation process.
- //
- GlobalPoolAllocator.pop();
-
- return success ? 1 : 0;
-}
-
-//
-// Do an actual link on the given compile objects.
-//
-// Return: The return value of is really boolean, indicating
-// success or failure.
-//
-int ShLink(
- const ShHandle linkHandle,
- const ShHandle compHandles[],
- const int numHandles,
- ShHandle uniformMapHandle,
- short int** uniformsAccessed,
- int* numUniformsAccessed)
-
-{
- if (!InitThread())
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(linkHandle);
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
- if (linker == 0)
- return 0;
-
- int returnValue;
- GlobalPoolAllocator.push();
- returnValue = ShLinkExt(linkHandle, compHandles, numHandles);
- GlobalPoolAllocator.pop();
-
- if (returnValue)
- return 1;
-
- return 0;
-}
-//
-// This link method will be eventually used once the ICD supports the new linker interface
-//
-int ShLinkExt(
- const ShHandle linkHandle,
- const ShHandle compHandles[],
- const int numHandles)
-{
- if (linkHandle == 0 || numHandles == 0)
- return 0;
-
- THandleList cObjects;
-
- {// support MSVC++6.0
- for (int i = 0; i < numHandles; ++i) {
- if (compHandles[i] == 0)
- return 0;
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(compHandles[i]);
- if (base->getAsLinker()) {
- cObjects.push_back(base->getAsLinker());
- }
- if (base->getAsCompiler())
- cObjects.push_back(base->getAsCompiler());
-
-
- if (cObjects[i] == 0)
- return 0;
- }
- }
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(linkHandle);
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
-
- if (linker == 0)
- return 0;
-
- linker->infoSink.info.erase();
-
- {// support MSVC++6.0
- for (int i = 0; i < numHandles; ++i) {
- if (cObjects[i]->getAsCompiler()) {
- if (! cObjects[i]->getAsCompiler()->linkable()) {
- linker->infoSink.info.message(EPrefixError, "Not all shaders have valid object code.");
- return 0;
- }
- }
- }
- }
-
- bool ret = linker->link(cObjects);
-
- return ret ? 1 : 0;
-}
-
-//
-// ShSetEncrpytionMethod is a place-holder for specifying
-// how source code is encrypted.
-//
-void ShSetEncryptionMethod(ShHandle handle)
-{
- if (handle == 0)
- return;
-}
-
-//
-// Return any compiler/linker/uniformmap log of messages for the application.
-//
-const char* ShGetInfoLog(const ShHandle handle)
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return 0;
-
- TShHandleBase* base = static_cast<TShHandleBase*>(handle);
- TInfoSink* infoSink;
-
- if (base->getAsCompiler())
- infoSink = &(base->getAsCompiler()->getInfoSink());
- else if (base->getAsLinker())
- infoSink = &(base->getAsLinker()->getInfoSink());
-
- infoSink->info << infoSink->debug.c_str();
- return infoSink->info.c_str();
-}
-
-//
-// Return the resulting binary code from the link process. Structure
-// is machine dependent.
-//
-const void* ShGetExecutable(const ShHandle handle)
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
-
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
- if (linker == 0)
- return 0;
-
- return linker->getObjectCode();
-}
-
-//
-// Let the linker know where the application said it's attributes are bound.
-// The linker does not use these values, they are remapped by the ICD or
-// hardware. It just needs them to know what's aliased.
-//
-// Return: The return value of is really boolean, indicating
-// success or failure.
-//
-// This is to preserve the old linker API, P20 code can use the generic
-// ShConstructBinding() and ShAddBinding() APIs
-//
-int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table)
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
-
- if (linker == 0)
- return 0;
-
- linker->setAppAttributeBindings(table);
-
- return 1;
-}
-
-//
-// Let the linker know where the predefined attributes have to live.
-// This is to preserve the old linker API, P20 code can use the generic
-// ShConstructBinding() and ShAddBinding() APIs
-//
-int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* table)
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
-
- if (linker == 0)
- return 0;
-
- linker->setFixedAttributeBindings(table);
- return 1;
-}
-
-//
-// Some attribute locations are off-limits to the linker...
-//
-int ShExcludeAttributes(const ShHandle handle, int *attributes, int count)
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return 0;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
- TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
- if (linker == 0)
- return 0;
-
- linker->setExcludedAttributes(attributes, count);
-
- return 1;
-}
-
-//
-// Return the index for OpenGL to use for knowing where a uniform lives.
-//
-// Return: The return value of is really boolean, indicating
-// success or failure.
-//
-// We dont have to change this code for now since the TUniformMap being
-// passed back to ICD by the linker is the same as being used for the old P10 linker
-//
-int ShGetUniformLocation(const ShHandle handle, const char* name)
-{
- if (!InitThread())
- return 0;
-
- if (handle == 0)
- return -1;
-
- TShHandleBase* base = reinterpret_cast<TShHandleBase*>(handle);
- TUniformMap* uniformMap= base->getAsUniformMap();
- if (uniformMap == 0)
- return -1;
-
- return uniformMap->getLocation(name);
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/SymbolTable.cpp b/src/mesa/shader/slang/MachineIndependent/SymbolTable.cpp
deleted file mode 100755
index 0e052c2ea76..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/SymbolTable.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-//
-// Symbol table for parsing. Most functionaliy and main ideas
-// are documented in the header file.
-//
-
-#include "SymbolTable.h"
-
-//
-// TType helper function needs a place to live.
-//
-
-//
-// Recursively generate mangled names.
-//
-void TType::buildMangledName(TString& mangledName)
-{
- if (isMatrix())
- mangledName += 'm';
- else if (isVector())
- mangledName += 'v';
-
- switch (type) {
- case EbtFloat: mangledName += 'f'; break;
- case EbtInt: mangledName += 'i'; break;
- case EbtBool: mangledName += 'b'; break;
- case EbtSampler1D: mangledName += "s1"; break;
- case EbtSampler2D: mangledName += "s2"; break;
- case EbtSampler3D: mangledName += "s3"; break;
- case EbtSamplerCube: mangledName += "sC"; break;
- case EbtSampler1DShadow: mangledName += "sS1"; break;
- case EbtSampler2DShadow: mangledName += "sS2"; break;
- case EbtStruct:
- mangledName += "struct-";
- if (typeName)
- mangledName += *typeName;
- {// support MSVC++6.0
- for (unsigned int i = 0; i < structure->size(); ++i) {
- mangledName += '-';
- (*structure)[i].type->buildMangledName(mangledName);
- }
- }
- default:
- break;
- }
-
- mangledName += static_cast<char>('0' + getNominalSize());
- if (isArray()) {
- char buf[10];
- sprintf(buf, "%d", arraySize);
- mangledName += '[';
- mangledName += buf;
- mangledName += ']';
- }
-}
-
-//
-// Dump functions.
-//
-
-void TVariable::dump(TInfoSink& infoSink) const
-{
- infoSink.debug << getName().c_str() << ": " << type.getQualifierString() << " " << type.getBasicString();
- if (type.isArray()) {
- infoSink.debug << "[0]";
- }
- infoSink.debug << "\n";
-}
-
-void TFunction::dump(TInfoSink &infoSink) const
-{
- infoSink.debug << getName().c_str() << ": " << returnType.getBasicString() << " " << getMangledName().c_str() << "\n";
-}
-
-void TSymbolTableLevel::dump(TInfoSink &infoSink) const
-{
- tLevel::const_iterator it;
- for (it = level.begin(); it != level.end(); ++it)
- (*it).second->dump(infoSink);
-}
-
-void TSymbolTable::dump(TInfoSink &infoSink) const
-{
- for (int level = currentLevel(); level >= 0; --level) {
- infoSink.debug << "LEVEL " << level << "\n";
- table[level]->dump(infoSink);
- }
-}
-
-//
-// Functions have buried pointers to delete.
-//
-TFunction::~TFunction()
-{
- for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
- delete (*i).type;
-}
-
-//
-// Symbol table levels are a map of pointers to symbols that have to be deleted.
-//
-TSymbolTableLevel::~TSymbolTableLevel()
-{
- for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
- delete (*it).second;
-}
-
-//
-// Change all function entries in the table with the non-mangled name
-// to be related to the provided built-in operation. This is a low
-// performance operation, and only intended for symbol tables that
-// live across a large number of compiles.
-//
-void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
-{
- tLevel::iterator it;
- for (it = level.begin(); it != level.end(); ++it) {
- if ((*it).second->isFunction()) {
- TFunction* function = static_cast<TFunction*>((*it).second);
- if (function->getName() == name)
- function->relateToOperator(op);
- }
- }
-}
-
-
-TSymbol::TSymbol(const TSymbol& copyOf)
-{
- name = NewPoolTString(copyOf.name->c_str());
- uniqueId = copyOf.uniqueId;
-}
-
-TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
-{
- type.copyType(copyOf.type, remapper);
- userType = copyOf.userType;
- // for builtIn symbol table level, unionArray and arrayInformation pointers should be NULL
- assert(copyOf.arrayInformationType == 0);
- arrayInformationType = 0;
-
- if (copyOf.unionArray) {
- assert(!copyOf.type.getStruct());
- assert(copyOf.type.getInstanceSize() == 1);
- unionArray = new constUnion[1];
- switch (type.getBasicType()) {
- case EbtFloat: unionArray[0].fConst = copyOf.unionArray[0].fConst; break;
- case EbtInt: unionArray[0].iConst = copyOf.unionArray[0].iConst; break;
- case EbtBool: unionArray[0].bConst = copyOf.unionArray[0].bConst; break;
- default:
- assert (false && "Unknown type");
- }
- } else
- unionArray = 0;
-}
-
-TVariable* TVariable::clone(TStructureMap& remapper)
-{
- TVariable *variable = new TVariable(*this, remapper);
-
- return variable;
-}
-
-TFunction::TFunction(const TFunction& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
-{
- for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
- TParameter param;
- parameters.push_back(param);
- parameters.back().copyParam(copyOf.parameters[i], remapper);
- }
-
- returnType.copyType(copyOf.returnType, remapper);
- mangledName = copyOf.mangledName;
- op = copyOf.op;
- defined = copyOf.defined;
-}
-
-TFunction* TFunction::clone(TStructureMap& remapper)
-{
- TFunction *function = new TFunction(*this, remapper);
-
- return function;
-}
-
-TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)
-{
- TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
- tLevel::iterator iter;
- for (iter = level.begin(); iter != level.end(); ++iter) {
- symTableLevel->insert(*iter->second->clone(remapper));
- }
-
- return symTableLevel;
-}
-
-void TSymbolTable::copyTable(const TSymbolTable& copyOf)
-{
- TStructureMap remapper;
- uniqueId = copyOf.uniqueId;
- for (unsigned int i = 0; i < copyOf.table.size(); ++i) {
- table.push_back(copyOf.table[i]->clone(remapper));
- }
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/SymbolTable.h b/src/mesa/shader/slang/MachineIndependent/SymbolTable.h
deleted file mode 100755
index 7e4ff682478..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/SymbolTable.h
+++ /dev/null
@@ -1,320 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _SYMBOL_TABLE_INCLUDED_
-#define _SYMBOL_TABLE_INCLUDED_
-
-//
-// Symbol table for parsing. Has these design characteristics:
-//
-// * Same symbol table can be used to compile many shaders, to preserve
-// effort of creating and loading with the large numbers of built-in
-// symbols.
-//
-// * Name mangling will be used to give each function a unique name
-// so that symbol table lookups are never ambiguous. This allows
-// a simpler symbol table structure.
-//
-// * Pushing and popping of scope, so symbol table will really be a stack
-// of symbol tables. Searched from the top, with new inserts going into
-// the top.
-//
-// * Constants: Compile time constant symbols will keep their values
-// in the symbol table. The parser can substitute constants at parse
-// time, including doing constant folding and constant propagation.
-//
-// * No temporaries: Temporaries made from operations (+, --, .xy, etc.)
-// are tracked in the intermediate representation, not the symbol table.
-//
-
-#include "Include/Common.h"
-#include "Include/intermediate.h"
-#include "Include/InfoSink.h"
-
-//
-// Symbol base class. (Can build functions or variables out of these...)
-//
-class TSymbol {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- TSymbol(const TString *n) : name(n) { }
- virtual ~TSymbol() { /* don't delete name, it's from the pool */ }
- const TString& getName() const { return *name; }
- virtual const TString& getMangledName() const { return getName(); }
- virtual bool isFunction() const { return false; }
- virtual bool isVariable() const { return false; }
- void setUniqueId(int id) { uniqueId = id; }
- int getUniqueId() const { return uniqueId; }
- virtual void dump(TInfoSink &infoSink) const = 0;
- TSymbol(const TSymbol&);
- virtual TSymbol* clone(TStructureMap& remapper) = 0;
-
-protected:
- const TString *name;
- unsigned int uniqueId; // For real comparing during code generation
-};
-
-//
-// Variable class, meaning a symbol that's not a function.
-//
-// There could be a separate class heirarchy for Constant variables;
-// Only one of int, bool, or float, (or none) is correct for
-// any particular use, but it's easy to do this way, and doesn't
-// seem worth having separate classes, and "getConst" can't simply return
-// different values for different types polymorphically, so this is
-// just simple and pragmatic.
-//
-class TVariable : public TSymbol {
-public:
- TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0), arrayInformationType(0) { }
- virtual ~TVariable() { }
- virtual bool isVariable() const { return true; }
- TType& getType() { return type; }
- const TType& getType() const { return type; }
- bool isUserType() const { return userType; }
- void changeQualifier(TQualifier qualifier) { type.changeQualifier(qualifier); }
- void updateArrayInformationType(TType *t) { arrayInformationType = t; }
- TType* getArrayInformationType() { return arrayInformationType; }
-
- virtual void dump(TInfoSink &infoSink) const;
-
- constUnion* getConstPointer() {
- if (!unionArray) {
- if (!type.getStruct())
- unionArray = new constUnion[type.getInstanceSize()];
- else
- unionArray = new constUnion[type.getStructSize()];
- }
- return unionArray;
- }
-
- constUnion* getConstPointer() const { return unionArray; }
-
- void shareConstPointer( constUnion *constArray)
- {
- delete unionArray;
- unionArray = constArray;
- }
- TVariable(const TVariable&, TStructureMap& remapper); // copy constructor
- virtual TVariable* clone(TStructureMap& remapper);
-
-protected:
- TType type;
- bool userType;
- // we are assuming that Pool Allocator will free the memory allocated to unionArray
- // when this object is destroyed
- constUnion *unionArray;
- TType *arrayInformationType; // this is used for updating maxArraySize in all the references to a given symbol
-};
-
-//
-// The function sub-class of symbols and the parser will need to
-// share this definition of a function parameter.
-//
-struct TParameter {
- TString *name;
- TType* type;
- void copyParam(const TParameter& param, TStructureMap& remapper) {
- name = NewPoolTString(param.name->c_str());
- type = param.type->clone(remapper);
- }
-};
-
-//
-// The function sub-class of a symbol.
-//
-class TFunction : public TSymbol {
-public:
- TFunction(TOperator o) :
- TSymbol(0),
- returnType(TType(EbtVoid)),
- op(o),
- defined(false) { }
- TFunction(const TString *name, TType& retType, TOperator tOp = EOpNull) :
- TSymbol(name),
- returnType(retType),
- mangledName(*name + '('),
- op(tOp),
- defined(false) { }
- virtual ~TFunction();
- virtual bool isFunction() const { return true; }
-
- void addParameter(TParameter& p)
- {
- parameters.push_back(p);
- mangledName = mangledName + p.type->getMangledName();
- }
-
- const TString& getMangledName() const { return mangledName; }
- const TType& getReturnType() const { return returnType; }
- void relateToOperator(TOperator o) { op = o; }
- TOperator getBuiltInOp() const { return op; }
- void setDefined() { defined = true; }
- bool isDefined() { return defined; }
-
- int getParamCount() const { return static_cast<int>(parameters.size()); }
- TParameter& operator [](int i) { return parameters[i]; }
- const TParameter& operator [](int i) const { return parameters[i]; }
-
- virtual void dump(TInfoSink &infoSink) const;
- TFunction(const TFunction&, TStructureMap& remapper);
- virtual TFunction* clone(TStructureMap& remapper);
-
-protected:
- typedef TVector<TParameter> TParamList;
- TParamList parameters;
- TType returnType;
- TString mangledName;
- TOperator op;
- bool defined;
-};
-
-
-class TSymbolTableLevel {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
- TSymbolTableLevel() { }
- ~TSymbolTableLevel();
-
- bool insert(TSymbol& symbol)
- {
- //
- // returning true means symbol was added to the table
- //
- tInsertResult result;
- result = level.insert(tLevelPair(symbol.getMangledName(), &symbol));
-
- return result.second;
- }
-
- TSymbol* find(const TString& name) const
- {
- tLevel::const_iterator it = level.find(name);
- if (it == level.end())
- return 0;
- else
- return (*it).second;
- }
-
- void relateToOperator(const char* name, TOperator op);
- void dump(TInfoSink &infoSink) const;
- TSymbolTableLevel* clone(TStructureMap& remapper);
-
-protected:
- typedef std::map<TString, TSymbol*, std::less<TString>, pool_allocator<std::pair<const TString, TSymbol*> > > tLevel;
- typedef const tLevel::value_type tLevelPair;
- typedef std::pair<tLevel::iterator, bool> tInsertResult;
-
- tLevel level;
-};
-
-class TSymbolTable {
-public:
- TSymbolTable() : uniqueId(0)
- {
- //
- // The symbol table cannot be used until push() is called, but
- // the lack of an initial call to push() can be used to detect
- // that the symbol table has not been preloaded with built-ins.
- //
- }
-
- TSymbolTable(TSymbolTable& symTable)
- {
- table.push_back(symTable.table[0]);
- uniqueId = symTable.uniqueId;
- }
-
- ~TSymbolTable()
- {
- // level 0 is always built In symbols, so we never pop that out
- while (table.size() > 1)
- pop();
- }
-
- //
- // When the symbol table is initialized with the built-ins, there should
- // 'push' calls, so that built-ins are at level 0 and the shader
- // globals are at level 1.
- //
- bool isEmpty() { return table.size() == 0; }
- bool atBuiltInLevel() { return atSharedBuiltInLevel() || atDynamicBuiltInLevel(); }
- bool atSharedBuiltInLevel() { return table.size() == 1; }
- bool atGlobalLevel() { return table.size() <= 3; }
- void push() {
- table.push_back(new TSymbolTableLevel);
- }
-
- void pop() {
- delete table[currentLevel()];
- table.pop_back();
- }
-
- bool insert(TSymbol& symbol)
- {
- symbol.setUniqueId(++uniqueId);
- return table[currentLevel()]->insert(symbol);
- }
-
- TSymbol* find(const TString& name, bool* builtIn = 0, bool *sameScope = 0)
- {
- int level = currentLevel();
- TSymbol* symbol;
- do {
- symbol = table[level]->find(name);
- --level;
- } while (symbol == 0 && level >= 0);
- level++;
- if (builtIn)
- *builtIn = level == 0;
- if (sameScope)
- *sameScope = level == currentLevel();
- return symbol;
- }
-
- TSymbolTableLevel* getGlobalLevel() { assert (table.size() >= 3); return table[2]; }
- void relateToOperator(const char* name, TOperator op) { table[0]->relateToOperator(name, op); }
- int getMaxSymbolId() { return uniqueId; }
- void dump(TInfoSink &infoSink) const;
- void copyTable(const TSymbolTable& copyOf);
-
-protected:
- int currentLevel() const { return static_cast<int>(table.size()) - 1; }
- bool atDynamicBuiltInLevel() { return table.size() == 2; }
-
- std::vector<TSymbolTableLevel*> table;
- int uniqueId; // for unique identification in code generation
-};
-
-#endif // _SYMBOL_TABLE_INCLUDED_
diff --git a/src/mesa/shader/slang/MachineIndependent/glslang.l b/src/mesa/shader/slang/MachineIndependent/glslang.l
deleted file mode 100644
index f6cd3ca6631..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/glslang.l
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-*/
-/* Based on
-ANSI C grammar, Lex specification
-
-In 1985, Jeff Lee published this Lex specification together with a Yacc
-grammar for the April 30, 1985 ANSI C draft. Tom Stockfisch reposted
-both to net.sources in 1987; that original, as mentioned in the answer
-to question 17.25 of the comp.lang.c FAQ, can be ftp'ed from ftp.uu.net,
-file usenet/net.sources/ansi.c.grammar.Z.
-
-I intend to keep this version as close to the current C Standard grammar
-as possible; please let me know if you discover discrepancies.
-
-Jutta Degener, 1995
-*/
-
-D [0-9]
-L [a-zA-Z_]
-H [a-fA-F0-9]
-E [Ee][+-]?{D}+
-O [0-7]
-
-%option nounput
-%{
-#include <stdio.h>
-#include <stdlib.h>
-#include "ParseHelper.h"
-#include "glslang_tab.h"
-
-/* windows only pragma */
-#ifdef _MSC_VER
-#pragma warning(disable : 4102)
-#endif
-
-int yy_input(char* buf, int max_size);
-TSourceLoc yylineno;
-
-#ifdef _WIN32
- extern int yyparse(TParseContext&);
- #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
-#else
- extern int yyparse(void*);
- #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
- #define parseContext (*((TParseContext*)(parseContextLocal)))
-#endif
-
-#define YY_INPUT(buf,result,max_size) (result = yy_input(buf, max_size))
-
-%}
-
-%option noyywrap
-%option never-interactive
-%option outfile="Gen_glslang.cpp"
-%x FIELDS
-
-
-%%
-<*>"//"[^\n]*"\n" { /* ?? carriage and/or line-feed? */ };
-
-"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); }
-"const" { pyylval->lex.line = yylineno; return(CONST_QUAL); }
-"uniform" { pyylval->lex.line = yylineno; return(UNIFORM); }
-"varying" { pyylval->lex.line = yylineno; return(VARYING); }
-
-"break" { pyylval->lex.line = yylineno; return(BREAK); }
-"continue" { pyylval->lex.line = yylineno; return(CONTINUE); }
-"do" { pyylval->lex.line = yylineno; return(DO); }
-"for" { pyylval->lex.line = yylineno; return(FOR); }
-"while" { pyylval->lex.line = yylineno; return(WHILE); }
-
-"if" { pyylval->lex.line = yylineno; return(IF); }
-"else" { pyylval->lex.line = yylineno; return(ELSE); }
-
-"in" { pyylval->lex.line = yylineno; return(IN_QUAL); }
-"out" { pyylval->lex.line = yylineno; return(OUT_QUAL); }
-"inout" { pyylval->lex.line = yylineno; return(INOUT_QUAL); }
-
-"float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT_TYPE); }
-"int" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(INT_TYPE); }
-"void" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(VOID_TYPE); }
-"bool" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(BOOL_TYPE); }
-"true" { pyylval->lex.line = yylineno; pyylval->lex.b = true; return(BOOLCONSTANT); }
-"false" { pyylval->lex.line = yylineno; pyylval->lex.b = false; return(BOOLCONSTANT); }
-
-"discard" { pyylval->lex.line = yylineno; return(DISCARD); }
-"return" { pyylval->lex.line = yylineno; return(RETURN); }
-
-"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX2); }
-"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX3); }
-"mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MATRIX4); }
-
-"vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); }
-"vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); }
-"vec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC4); }
-"ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); }
-"ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); }
-"ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }
-"bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); }
-"bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); }
-"bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); }
-
-"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; }
-"sampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }
-"sampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER3D; }
-"samplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBE; }
-"sampler1DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DSHADOW; }
-"sampler2DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DSHADOW; }
-
-"struct" { pyylval->lex.line = yylineno; return(STRUCT); }
-
-"asm" { PaReservedWord(); return 0; }
-
-"class" { PaReservedWord(); return 0; }
-"union" { PaReservedWord(); return 0; }
-"enum" { PaReservedWord(); return 0; }
-"typedef" { PaReservedWord(); return 0; }
-"template" { PaReservedWord(); return 0; }
-"this" { PaReservedWord(); return 0; }
-"packed" { PaReservedWord(); return 0; }
-
-"goto" { PaReservedWord(); return 0; }
-"switch" { PaReservedWord(); return 0; }
-"default" { PaReservedWord(); return 0; }
-
-"inline" { PaReservedWord(); return 0; }
-"noinline" { PaReservedWord(); return 0; }
-"volatile" { PaReservedWord(); return 0; }
-"public" { PaReservedWord(); return 0; }
-"static" { PaReservedWord(); return 0; }
-"extern" { PaReservedWord(); return 0; }
-"external" { PaReservedWord(); return 0; }
-"interface" { PaReservedWord(); return 0; }
-
-"long" { PaReservedWord(); return 0; }
-"short" { PaReservedWord(); return 0; }
-"double" { PaReservedWord(); return 0; }
-"half" { PaReservedWord(); return 0; }
-"fixed" { PaReservedWord(); return 0; }
-"unsigned" { PaReservedWord(); return 0; }
-
-"input" { PaReservedWord(); return 0; }
-"output" { PaReservedWord(); return 0; }
-
-"hvec2" { PaReservedWord(); return 0; }
-"hvec3" { PaReservedWord(); return 0; }
-"hvec4" { PaReservedWord(); return 0; }
-"fvec2" { PaReservedWord(); return 0; }
-"fvec3" { PaReservedWord(); return 0; }
-"fvec4" { PaReservedWord(); return 0; }
-"dvec2" { PaReservedWord(); return 0; }
-"dvec3" { PaReservedWord(); return 0; }
-"dvec4" { PaReservedWord(); return 0; }
-
-"sampler2DRect" { PaReservedWord(); return 0; }
-"sampler3DRect" { PaReservedWord(); return 0; }
-"sampler2DRectShadow" { PaReservedWord(); return 0; }
-
-"sizeof" { PaReservedWord(); return 0; }
-"cast" { PaReservedWord(); return 0; }
-
-"namespace" { PaReservedWord(); return 0; }
-"using" { PaReservedWord(); return 0; }
-
-{L}({L}|{D})* {
- pyylval->lex.line = yylineno;
- pyylval->lex.string = NewPoolTString(yytext);
- return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
-}
-
-0[xX]{H}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
-0{O}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
-0{D}+ { pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;}
-{D}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtol(yytext, 0, 0); return(INTCONSTANT); }
-
-{D}+{E} { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }
-{D}+"."{D}*({E})? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }
-"."{D}+({E})? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); }
-
-"/*" { int ret = PaParseComment(pyylval->lex.line, parseContext); if (!ret) return ret; }
-
-"+=" { pyylval->lex.line = yylineno; return(ADD_ASSIGN); }
-"-=" { pyylval->lex.line = yylineno; return(SUB_ASSIGN); }
-"*=" { pyylval->lex.line = yylineno; return(MUL_ASSIGN); }
-"/=" { pyylval->lex.line = yylineno; return(DIV_ASSIGN); }
-"%=" { pyylval->lex.line = yylineno; return(MOD_ASSIGN); }
-"<<=" { pyylval->lex.line = yylineno; return(LEFT_ASSIGN); }
-">>=" { pyylval->lex.line = yylineno; return(RIGHT_ASSIGN); }
-"&=" { pyylval->lex.line = yylineno; return(AND_ASSIGN); }
-"^=" { pyylval->lex.line = yylineno; return(XOR_ASSIGN); }
-"|=" { pyylval->lex.line = yylineno; return(OR_ASSIGN); }
-
-"++" { pyylval->lex.line = yylineno; return(INC_OP); }
-"--" { pyylval->lex.line = yylineno; return(DEC_OP); }
-"&&" { pyylval->lex.line = yylineno; return(AND_OP); }
-"||" { pyylval->lex.line = yylineno; return(OR_OP); }
-"^^" { pyylval->lex.line = yylineno; return(XOR_OP); }
-"<=" { pyylval->lex.line = yylineno; return(LE_OP); }
-">=" { pyylval->lex.line = yylineno; return(GE_OP); }
-"==" { pyylval->lex.line = yylineno; return(EQ_OP); }
-"!=" { pyylval->lex.line = yylineno; return(NE_OP); }
-"<<" { pyylval->lex.line = yylineno; return(LEFT_OP); }
-">>" { pyylval->lex.line = yylineno; return(RIGHT_OP); }
-";" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(SEMICOLON); }
-("{"|"<%") { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(LEFT_BRACE); }
-("}"|"%>") { pyylval->lex.line = yylineno; return(RIGHT_BRACE); }
-"," { pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return(COMMA); }
-":" { pyylval->lex.line = yylineno; return(COLON); }
-"=" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(EQUAL); }
-"(" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; parseContext.inTypeParen = true; return(LEFT_PAREN); }
-")" { pyylval->lex.line = yylineno; parseContext.inTypeParen = false; return(RIGHT_PAREN); }
-("["|"<:") { pyylval->lex.line = yylineno; return(LEFT_BRACKET); }
-("]"|":>") { pyylval->lex.line = yylineno; return(RIGHT_BRACKET); }
-"." { BEGIN(FIELDS); return(DOT); }
-"!" { pyylval->lex.line = yylineno; return(BANG); }
-"-" { pyylval->lex.line = yylineno; return(DASH); }
-"~" { pyylval->lex.line = yylineno; return(TILDE); }
-"+" { pyylval->lex.line = yylineno; return(PLUS); }
-"*" { pyylval->lex.line = yylineno; return(STAR); }
-"/" { pyylval->lex.line = yylineno; return(SLASH); }
-"%" { pyylval->lex.line = yylineno; return(PERCENT); }
-"<" { pyylval->lex.line = yylineno; return(LEFT_ANGLE); }
-">" { pyylval->lex.line = yylineno; return(RIGHT_ANGLE); }
-"|" { pyylval->lex.line = yylineno; return(VERTICAL_BAR); }
-"^" { pyylval->lex.line = yylineno; return(CARET); }
-"&" { pyylval->lex.line = yylineno; return(AMPERSAND); }
-"?" { pyylval->lex.line = yylineno; return(QUESTION); }
-
-<FIELDS>{L}({L}|{D})* {
-BEGIN(INITIAL);
- pyylval->lex.line = yylineno;
- pyylval->lex.string = NewPoolTString(yytext);
- return FIELD_SELECTION; }
-<FIELDS>[ \t\v\f\r] {}
-
-[ \t\v\n\f\r] { }
-<*><<EOF>> { (&parseContext)->AfterEOF = true; yy_delete_buffer(YY_CURRENT_BUFFER); yyterminate();}
-<*>. { parseContext.infoSink.info << "FLEX: Unknown char " << yytext << "\n";
- return 0; }
-
-%%
-
-
-//Including Pre-processor.
-extern "C" {
- #include "./preprocessor/preprocess.h"
-}
-
-//
-// The YY_INPUT macro just calls this. Maybe this could be just put into
-// the macro directly.
-//
-
-int yy_input(char* buf, int max_size)
-{
- char *char_token =NULL;
- int len;
-
- if ((len = yylex_CPP(buf, max_size)) == 0)
- return 0;
- if (len >= max_size)
- YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-
- buf[len] = ' ';
- return len+1;
-}
-
-
-//
-// Parse an array of strings using yyparse. We set up globals used by
-// yywrap.
-//
-// Returns 0 for success, as per yyparse().
-//
-int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseContextLocal)
-{
- int argv0len;
- ScanFromString(argv[0]);
-
- //Storing the Current Compiler Parse context into the cpp structure.
- cpp->pC = (void*)&parseContextLocal;
-
- if (!argv || argc == 0 || !argv[0])
- return 1;
-
- if (!strLen) {
- argv0len = (int) strlen(argv[0]);
- strLen = &argv0len;
- }
- yyrestart(0);
- (&parseContextLocal)->AfterEOF = false;
- cpp->PaWhichStr = 0;
- cpp->PaArgv = argv;
- cpp->PaArgc = argc;
- cpp->PaStrLen = strLen;
- yylineno = 1;
-
- if (*cpp->PaStrLen >= 0) {
- int ret;
- #ifdef _WIN32
- ret = yyparse(parseContextLocal);
- #else
- ret = yyparse((void*)(&parseContextLocal));
- #endif
- if (cpp->CompileError == 1 || parseContextLocal.recoveredFromError || parseContextLocal.numErrors > 0)
- return 1;
- else
- return 0;
- }
- else
- return 0;
-}
-
-void yyerror(char *s)
-{
- if (((TParseContext *)cpp->pC)->AfterEOF) {
- if (cpp->tokensBeforeEOF == 1) {
- GlobalParseContext->error(yylineno, "syntax error", "pre-mature EOF", s, "");
- GlobalParseContext->recover();
- }
- } else {
- GlobalParseContext->error(yylineno, "syntax error", yytext, s, "");
- GlobalParseContext->recover();
- }
-}
-
-void PaReservedWord()
-{
- GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", "");
- GlobalParseContext->recover();
-}
-
-int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbol)
-{
- symbol = parseContextLocal.symbolTable.find(id);
- if (parseContextLocal.lexAfterType == false && symbol && symbol->isVariable()) {
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType()) {
- parseContextLocal.lexAfterType = true;
- return TYPE_NAME;
- }
- }
-
- return IDENTIFIER;
-}
-
-int PaParseComment(int &lineno, TParseContext& parseContextLocal)
-{
- int transitionFlag = 0;
- int nextChar;
-
- while (transitionFlag != 2) {
- nextChar = yyinput();
- if (nextChar == '\n')
- lineno++;
- switch (nextChar) {
- case '*' :
- transitionFlag = 1;
- break;
- case '/' : /* if star is the previous character, then it is the end of comment */
- if (transitionFlag == 1) {
- return 1 ;
- }
- break;
- case EOF :
- /* Raise error message here */
- parseContextLocal.error(yylineno, "End of shader found before end of comment.", "", "", "");
- GlobalParseContext->recover();
- return YY_NULL;
- default : /* Any other character will be a part of the comment */
- transitionFlag = 0;
- }
- }
- return 1;
-}
-
-extern "C" {
-
-void CPPDebugLogMsg(const char *msg)
-{
- ((TParseContext *)cpp->pC)->infoSink.debug.message(EPrefixNone, msg);
-}
-
-void CPPWarningToInfoLog(const char *msg)
-{
- ((TParseContext *)cpp->pC)->infoSink.info.message(EPrefixWarning, msg, yylineno);
-}
-
-void CPPShInfoLogMsg(const char *msg)
-{
- ((TParseContext *)cpp->pC)->error(yylineno,"", "",msg,"");
- GlobalParseContext->recover();
-}
-
-void CPPErrorToInfoLog(char *msg)
-{
- ((TParseContext *)cpp->pC)->error(yylineno,"syntax error", "",msg,"");
- GlobalParseContext->recover();
-}
-
-void SetLineNumber(int line)
-{
- yylineno &= ~SourceLocLineMask;
- yylineno |= line;
-}
-
-void SetStringNumber(int string)
-{
- yylineno = (string << SourceLocStringShift) | (yylineno & SourceLocLineMask);
-}
-
-int GetStringNumber(void)
-{
- return yylineno >> 16;
-}
-
-int GetLineNumber(void)
-{
- return yylineno & SourceLocLineMask;
-}
-
-void IncLineNumber(void)
-{
- if ((yylineno & SourceLocLineMask) <= SourceLocLineMask)
- ++yylineno;
-}
-
-void DecLineNumber(void)
-{
- if ((yylineno & SourceLocLineMask) > 0)
- --yylineno;
-}
-
-void HandlePragma(const char **tokens, int numTokens)
-{
- if (!strcmp(tokens[0], "optimize")) {
- if (numTokens != 4) {
- CPPShInfoLogMsg("optimize pragma syntax is incorrect");
- return;
- }
-
- if (strcmp(tokens[1], "(")) {
- CPPShInfoLogMsg("\"(\" expected after 'optimize' keyword");
- return;
- }
-
- if (!strcmp(tokens[2], "on"))
- ((TParseContext *)cpp->pC)->contextPragma.optimize = true;
- else if (!strcmp(tokens[2], "off"))
- ((TParseContext *)cpp->pC)->contextPragma.optimize = false;
- else {
- CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'optimize' pragma");
- return;
- }
-
- if (strcmp(tokens[3], ")")) {
- CPPShInfoLogMsg("\")\" expected to end 'optimize' pragma");
- return;
- }
- } else if (!strcmp(tokens[0], "debug")) {
- if (numTokens != 4) {
- CPPShInfoLogMsg("debug pragma syntax is incorrect");
- return;
- }
-
- if (strcmp(tokens[1], "(")) {
- CPPShInfoLogMsg("\"(\" expected after 'debug' keyword");
- return;
- }
-
- if (!strcmp(tokens[2], "on"))
- ((TParseContext *)cpp->pC)->contextPragma.debug = true;
- else if (!strcmp(tokens[2], "off"))
- ((TParseContext *)cpp->pC)->contextPragma.debug = false;
- else {
- CPPShInfoLogMsg("\"on\" or \"off\" expected after '(' for 'debug' pragma");
- return;
- }
-
- if (strcmp(tokens[3], ")")) {
- CPPShInfoLogMsg("\")\" expected to end 'debug' pragma");
- return;
- }
- } else {
- /*
- // implementation specific pragma
- // use ((TParseContext *)cpp->pC)->contextPragma.pragmaTable to store the information about pragma
- // For now, just ignore the pragma that the implementation cannot recognize
- // An Example of one such implementation for a pragma that has a syntax like
- // #pragma pragmaname(pragmavalue)
- // This implementation stores the current pragmavalue against the pragma name in pragmaTable.
- if (numTokens == 4 && !strcmp(tokens[1], "(") && !strcmp(tokens[3], ")")) {
- TPragmaTable& pragmaTable = ((TParseContext *)cpp->pC)->contextPragma.pragmaTable;
- TPragmaTable::iterator iter;
- iter = pragmaTable.find(TString(tokens[0]));
- if (iter != pragmaTable.end()) {
- iter->second = tokens[2];
- } else {
- pragmaTable[tokens[0]] = tokens[2];
- }
- }
- */
- }
-}
-
-void StoreStr(char *string)
-{
- TString strSrc;
- strSrc = TString(string);
-
- ((TParseContext *)cpp->pC)->HashErrMsg = ((TParseContext *)cpp->pC)->HashErrMsg + " " + strSrc;
-}
-
-const char* GetStrfromTStr(void)
-{
- cpp->ErrMsg = (((TParseContext *)cpp->pC)->HashErrMsg).c_str();
- return cpp->ErrMsg;
-}
-
-void ResetTString(void)
-{
- ((TParseContext *)cpp->pC)->HashErrMsg = "";
-}
-
-TBehavior GetBehavior(const char* behavior)
-{
- if (!strcmp("require", behavior))
- return EBhRequire;
- else if (!strcmp("enable", behavior))
- return EBhEnable;
- else if (!strcmp("disable", behavior))
- return EBhDisable;
- else if (!strcmp("warn", behavior))
- return EBhWarn;
- else {
- CPPShInfoLogMsg((TString("behavior '") + behavior + "' is not supported").c_str());
- return EBhDisable;
- }
-}
-
-void updateExtensionBehavior(const char* extName, const char* behavior)
-{
- TBehavior behaviorVal = GetBehavior(behavior);
- TMap<TString, TBehavior>:: iterator iter;
- TString msg;
-
- // special cased for all extension
- if (!strcmp(extName, "all")) {
- if (behaviorVal == EBhRequire || behaviorVal == EBhEnable) {
- CPPShInfoLogMsg("extension 'all' cannot have 'require' or 'enable' behavior");
- return;
- } else {
- for (iter = ((TParseContext *)cpp->pC)->extensionBehavior.begin(); iter != ((TParseContext *)cpp->pC)->extensionBehavior.end(); ++iter)
- iter->second = behaviorVal;
- }
- } else {
- iter = ((TParseContext *)cpp->pC)->extensionBehavior.find(TString(extName));
- if (iter == ((TParseContext *)cpp->pC)->extensionBehavior.end()) {
- switch (behaviorVal) {
- case EBhRequire:
- CPPShInfoLogMsg((TString("extension '") + extName + "' is not supported").c_str());
- break;
- case EBhEnable:
- case EBhWarn:
- case EBhDisable:
- msg = TString("extension '") + extName + "' is not supported";
- ((TParseContext *)cpp->pC)->infoSink.info.message(EPrefixWarning, msg.c_str(), yylineno);
- break;
- }
- return;
- } else
- iter->second = behaviorVal;
- }
-}
-
-}
-
-void setInitialState()
-{
- yy_start = 1;
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/glslang.y b/src/mesa/shader/slang/MachineIndependent/glslang.y
deleted file mode 100644
index d2dc1db3769..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/glslang.y
+++ /dev/null
@@ -1,2009 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-/**
- * This is bison grammar and production code for parsing the OpenGL 2.0 shading
- * languages.
- */
-%{
-
-/* Based on:
-ANSI C Yacc grammar
-
-In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
-matching Lex specification) for the April 30, 1985 draft version of the
-ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
-original, as mentioned in the answer to question 17.25 of the comp.lang.c
-FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
-
-I intend to keep this version as close to the current C Standard grammar as
-possible; please let me know if you discover discrepancies.
-
-Jutta Degener, 1995
-*/
-
-#include "SymbolTable.h"
-#include "ParseHelper.h"
-#include "../Public/ShaderLang.h"
-
-#ifdef _WIN32
- #define YYPARSE_PARAM parseContext
- #define YYPARSE_PARAM_DECL TParseContext&
- #define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
- #define YYLEX_PARAM parseContext
-#else
- #define YYPARSE_PARAM parseContextLocal
- #define parseContext (*((TParseContext*)(parseContextLocal)))
- #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
- #define YYLEX_PARAM (void*)(parseContextLocal)
- extern void yyerror(char*);
-#endif
-
-#define FRAG_VERT_ONLY(S, L) { \
- if (parseContext.language != EShLangFragment && \
- parseContext.language != EShLangVertex) { \
- parseContext.error(L, " supported in vertex/fragment shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define VERTEX_ONLY(S, L) { \
- if (parseContext.language != EShLangVertex) { \
- parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define FRAG_ONLY(S, L) { \
- if (parseContext.language != EShLangFragment) { \
- parseContext.error(L, " supported in fragment shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define PACK_ONLY(S, L) { \
- if (parseContext.language != EShLangPack) { \
- parseContext.error(L, " supported in pack shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define UNPACK_ONLY(S, L) { \
- if (parseContext.language != EShLangUnpack) { \
- parseContext.error(L, " supported in unpack shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-
-#define PACK_UNPACK_ONLY(S, L) { \
- if (parseContext.language != EShLangUnpack && \
- parseContext.language != EShLangPack) { \
- parseContext.error(L, " supported in pack/unpack shaders only ", S, "", ""); \
- parseContext.recover(); \
- } \
-}
-%}
-%union {
- struct {
- TSourceLoc line;
- union {
- TString *string;
- float f;
- int i;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TSourceLoc line;
- TOperator op;
- union {
- TIntermNode* intermNode;
- TIntermNodePair nodePair;
- TIntermTyped* intermTypedNode;
- TIntermAggregate* intermAggregate;
- };
- union {
- TPublicType type;
- TQualifier qualifier;
- TFunction* function;
- TParameter param;
- TTypeLine typeLine;
- TTypeList* typeList;
- };
- } interm;
-}
-
-%{
-#ifndef _WIN32
- extern int yylex(YYSTYPE*, void*);
-#endif
-%}
-
-%pure_parser /* Just in case is called from multiple threads */
-%expect 1 /* One shift reduce conflict because of if | else */
-%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE
-%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN
-%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4
-%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
-%token <lex> STRUCT VOID_TYPE WHILE
-%token <lex> SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW
-
-%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT BOOLCONSTANT
-%token <lex> FIELD_SELECTION
-%token <lex> LEFT_OP RIGHT_OP
-%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
-%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
-%token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
-%token <lex> SUB_ASSIGN
-
-%token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
-%token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
-%token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
-
-%type <interm> assignment_operator constructor_identifier unary_operator
-%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
-%type <interm.intermTypedNode> expression integer_expression assignment_expression
-%type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
-%type <interm.intermTypedNode> relational_expression equality_expression
-%type <interm.intermTypedNode> conditional_expression constant_expression
-%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
-%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
-%type <interm.intermTypedNode> function_call initializer condition conditionopt
-
-%type <interm.intermNode> translation_unit function_definition
-%type <interm.intermNode> statement simple_statement
-%type <interm.intermAggregate> statement_list compound_statement
-%type <interm.intermNode> declaration_statement selection_statement expression_statement
-%type <interm.intermNode> declaration external_declaration
-%type <interm.intermNode> for_init_statement compound_statement_no_new_scope
-%type <interm.nodePair> selection_rest_statement for_rest_statement
-%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope
-%type <interm> single_declaration init_declarator_list
-
-%type <interm> parameter_declaration parameter_declarator parameter_type_specifier
-%type <interm.qualifier> parameter_qualifier
-
-%type <interm.type> type_qualifier fully_specified_type type_specifier
-%type <interm.type> struct_specifier
-%type <interm.typeLine> struct_declarator
-%type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
-%type <interm.function> function_header function_declarator function_identifier
-%type <interm.function> function_header_with_parameters function_call_header
-%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
-
-%start translation_unit
-%%
-
-variable_identifier
- : IDENTIFIER {
- // The symbol table search was done in the lexical phase
- const TSymbol* symbol = $1.symbol;
- const TVariable* variable;
- if (symbol == 0) {
- parseContext.error($1.line, "undeclared identifier", $1.string->c_str(), "");
- parseContext.recover();
- TType type(EbtFloat);
- TVariable* fakeVariable = new TVariable($1.string, type);
- parseContext.symbolTable.insert(*fakeVariable);
- variable = fakeVariable;
- } else {
- // This identifier can only be a variable type symbol
- if (! symbol->isVariable()) {
- parseContext.error($1.line, "variable expected", $1.string->c_str(), "");
- parseContext.recover();
- }
- variable = static_cast<const TVariable*>(symbol);
- }
-
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
-
- if (variable->getType().getQualifier() == EvqConst ) {
- constUnion* constArray = variable->getConstPointer();
- TType t(variable->getType());
- $$ = parseContext.intermediate.addConstantUnion(constArray, t, $1.line);
- } else
- $$ = parseContext.intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(), $1.line);
- }
- ;
-
-primary_expression
- : variable_identifier {
- $$ = $1;
- }
- | INTCONSTANT {
- //
- // INT_TYPE is only 16-bit plus sign bit for vertex/fragment shaders,
- // check for overflow for constants
- //
- if (abs($1.i) >= (1 << 16)) {
- parseContext.error($1.line, " integer constant overflow", "", "");
- parseContext.recover();
- }
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = $1.i;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $1.line);
- }
- | FLOATCONSTANT {
- constUnion *unionArray = new constUnion[1];
- unionArray->fConst = $1.f;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), $1.line);
- }
- | BOOLCONSTANT {
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = $1.b;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $1.line);
- }
- | LEFT_PAREN expression RIGHT_PAREN {
- $$ = $2;
- }
- ;
-
-postfix_expression
- : primary_expression {
- $$ = $1;
- }
- | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
- if (!$1->isArray() && !$1->isMatrix() && !$1->isVector()) {
- if ($1->getAsSymbolNode())
- parseContext.error($2.line, " left of '[' is not of type array, matrix, or vector ", $1->getAsSymbolNode()->getSymbol().c_str(), "");
- else
- parseContext.error($2.line, " left of '[' is not of type array, matrix, or vector ", "expression", "");
- parseContext.recover();
- }
- if ($1->getType().getQualifier() == EvqConst && !$1->isArray() && $3->getQualifier() == EvqConst) {
- if ($1->isVector()) { // constant folding for vectors
- TVectorFields fields;
- fields.num = 1;
- fields.offsets[0] = $3->getAsConstantUnion()->getUnionArrayPointer()->iConst; // need to do it this way because v.xy sends fields integer array
- $$ = parseContext.addConstVectorNode(fields, $1, $2.line);
- } else if ($1->isMatrix()) { // constant folding for matrices
- $$ = parseContext.addConstMatrixNode($3->getAsConstantUnion()->getUnionArrayPointer()->iConst, $1, $2.line);
- }
- } else {
- if ($3->getQualifier() == EvqConst) {
- if (($1->isVector() || $1->isMatrix()) && $1->getType().getNominalSize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->iConst && !$1->isArray() ) {
- parseContext.error($2.line, "", "[", "field selection out of range '%d'", $3->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- parseContext.recover();
- } else {
- if ($1->isArray()) {
- if ($1->getType().getArraySize() == 0) {
- if ($1->getType().getMaxArraySize() <= $3->getAsConstantUnion()->getUnionArrayPointer()->iConst) {
- if (parseContext.arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), $3->getAsConstantUnion()->getUnionArrayPointer()->iConst, true, $2.line))
- parseContext.recover();
- } else {
- if (parseContext.arraySetMaxSize($1->getAsSymbolNode(), $1->getTypePointer(), 0, false, $2.line))
- parseContext.recover();
- }
- } else if ( $3->getAsConstantUnion()->getUnionArrayPointer()->iConst >= $1->getType().getArraySize()) {
- parseContext.error($2.line, "", "[", "array index out of range '%d'", $3->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- parseContext.recover();
- }
- }
- $$ = parseContext.intermediate.addIndex(EOpIndexDirect, $1, $3, $2.line);
- }
- } else {
- if ($1->isArray() && $1->getType().getArraySize() == 0) {
- parseContext.error($2.line, "", "[", "array must be redeclared with a size before being indexed with a variable");
- parseContext.recover();
- }
-
- $$ = parseContext.intermediate.addIndex(EOpIndexIndirect, $1, $3, $2.line);
- }
- }
- if ($$ == 0) {
- constUnion *unionArray = new constUnion[1];
- unionArray->fConst = 0.0;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), $2.line);
- } else if ($1->isArray()) {
- if ($1->getType().getStruct())
- $$->setType(TType($1->getType().getStruct(), $1->getType().getTypeName()));
- else
- $$->setType(TType($1->getBasicType(), EvqTemporary, $1->getNominalSize(), $1->isMatrix()));
- } else if ($1->isMatrix() && $1->getType().getQualifier() == EvqConst)
- $$->setType(TType($1->getBasicType(), EvqConst, $1->getNominalSize()));
- else if ($1->isMatrix())
- $$->setType(TType($1->getBasicType(), EvqTemporary, $1->getNominalSize()));
- else if ($1->isVector() && $1->getType().getQualifier() == EvqConst)
- $$->setType(TType($1->getBasicType(), EvqConst));
- else if ($1->isVector())
- $$->setType(TType($1->getBasicType(), EvqTemporary));
- else
- $$->setType($1->getType());
- }
- | function_call {
- $$ = $1;
- }
- | postfix_expression DOT FIELD_SELECTION {
- if ($1->isArray()) {
- parseContext.error($3.line, "cannot apply dot operator to an array", ".", "");
- parseContext.recover();
- }
-
- if ($1->isVector()) {
- TVectorFields fields;
- if (! parseContext.parseVectorFields(*$3.string, $1->getNominalSize(), fields, $3.line)) {
- fields.num = 1;
- fields.offsets[0] = 0;
- parseContext.recover();
- }
-
- if ($1->getType().getQualifier() == EvqConst) { // constant folding for vector fields
- $$ = parseContext.addConstVectorNode(fields, $1, $3.line);
- if ($$ == 0) {
- parseContext.recover();
- $$ = $1;
- }
- else
- $$->setType(TType($1->getBasicType(), EvqConst, (int) (*$3.string).size()));
- } else {
- if (fields.num == 1) {
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = fields.offsets[0];
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $3.line);
- $$ = parseContext.intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
- $$->setType(TType($1->getBasicType()));
- } else {
- TString vectorString = *$3.string;
- TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, $3.line);
- $$ = parseContext.intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
- $$->setType(TType($1->getBasicType(),EvqTemporary, (int) vectorString.size()));
- }
- }
- } else if ($1->isMatrix()) {
- TMatrixFields fields;
- if (! parseContext.parseMatrixFields(*$3.string, $1->getNominalSize(), fields, $3.line)) {
- fields.wholeRow = false;
- fields.wholeCol = false;
- fields.row = 0;
- fields.col = 0;
- parseContext.recover();
- }
-
- if (fields.wholeRow || fields.wholeCol) {
- parseContext.error($2.line, " non-scalar fields not implemented yet", ".", "");
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = 0;
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $3.line);
- $$ = parseContext.intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
- $$->setType(TType($1->getBasicType(), EvqTemporary, $1->getNominalSize()));
- } else {
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = fields.col * $1->getNominalSize() + fields.row;
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $3.line);
- $$ = parseContext.intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
- $$->setType(TType($1->getBasicType()));
- }
- } else if ($1->getBasicType() == EbtStruct) {
- bool fieldFound = false;
- TTypeList* fields = $1->getType().getStruct();
- if (fields == 0) {
- parseContext.error($2.line, "structure has no fields", "Internal Error", "");
- parseContext.recover();
- $$ = $1;
- } else {
- unsigned int i;
- for (i = 0; i < fields->size(); ++i) {
- if ((*fields)[i].type->getFieldName() == *$3.string) {
- fieldFound = true;
- break;
- }
- }
- if (fieldFound) {
- if ($1->getType().getQualifier() == EvqConst) {
- $$ = parseContext.addConstStruct(*$3.string, $1, $2.line);
- if ($$ == 0) {
- parseContext.recover();
- $$ = $1;
- }
- else {
- $$->setType(*(*fields)[i].type);
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- $$->getTypePointer()->changeQualifier(EvqConst);
- }
- } else {
- constUnion *unionArray = new constUnion[1];
- unionArray->iConst = i;
- TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $3.line);
- $$ = parseContext.intermediate.addIndex(EOpIndexDirectStruct, $1, index, $2.line);
- $$->setType(*(*fields)[i].type);
- }
- } else {
- parseContext.error($2.line, " no such field in structure", $3.string->c_str(), "");
- parseContext.recover();
- $$ = $1;
- }
- }
- } else {
- parseContext.error($2.line, " field selection requires structure, vector, or matrix on left hand side", $3.string->c_str(), "");
- parseContext.recover();
- $$ = $1;
- }
- // don't delete $3.string, it's from the pool
- }
- | postfix_expression INC_OP {
- if (parseContext.lValueErrorCheck($2.line, "++", $1))
- parseContext.recover();
- $$ = parseContext.intermediate.addUnaryMath(EOpPostIncrement, $1, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.unaryOpError($2.line, "++", $1->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- | postfix_expression DEC_OP {
- if (parseContext.lValueErrorCheck($2.line, "--", $1))
- parseContext.recover();
- $$ = parseContext.intermediate.addUnaryMath(EOpPostDecrement, $1, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.unaryOpError($2.line, "--", $1->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-integer_expression
- : expression {
- if (parseContext.integerErrorCheck($1, "[]"))
- parseContext.recover();
- $$ = $1;
- }
- ;
-
-function_call
- : function_call_generic {
- TFunction* fnCall = $1.function;
- TOperator op = fnCall->getBuiltInOp();
-
- if (op != EOpNull) {
- //
- // Then this should be a constructor.
- //
- TType type(EbtVoid); // use this to get the type back
- if (parseContext.constructorErrorCheck($1.line, $1.intermNode, *fnCall, op, &type)) {
- $$ = 0;
- } else {
- //
- // It's a constructor, of type 'type'.
- //
- $$ = parseContext.addConstructor($1.intermNode, &type, op, fnCall, $1.line);
- }
-
- if ($$ == 0) {
- parseContext.recover();
- $$ = parseContext.intermediate.setAggregateOperator(0, op, $1.line);
- }
- $$->setType(type);
- } else {
- //
- // Not a constructor. Find it in the symbol table.
- //
- const TFunction* fnCandidate;
- bool builtIn;
- fnCandidate = parseContext.findFunction($1.line, fnCall, &builtIn);
- if (fnCandidate) {
- //
- // A declared function. But, it might still map to a built-in
- // operation.
- //
- op = fnCandidate->getBuiltInOp();
- if (builtIn && op != EOpNull) {
- //
- // A function call mapped to a built-in operation.
- //
- if (fnCandidate->getParamCount() == 1) {
- //
- // Treat it like a built-in unary operator.
- //
- $$ = parseContext.intermediate.addUnaryMath(op, $1.intermNode, 0, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.error($1.intermNode->getLine(), " wrong operand type", "Internal Error",
- "built in unary operator function. Type: %s",
- static_cast<TIntermTyped*>($1.intermNode)->getCompleteString().c_str());
- YYERROR;
- }
- } else {
- $$ = parseContext.intermediate.setAggregateOperator($1.intermAggregate, op, $1.line);
- }
- } else {
- // This is a real function call
-
- $$ = parseContext.intermediate.setAggregateOperator($1.intermAggregate, EOpFunctionCall, $1.line);
- $$->setType(fnCandidate->getReturnType());
-
- // this is how we know whether the given function is a builtIn function or a user defined function
- // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
- // if builtIn == true, it's definitely a builtIn function with EOpNull
- if (!builtIn)
- $$->getAsAggregate()->setUserDefined();
- $$->getAsAggregate()->setName(fnCandidate->getMangledName());
-
- TQualifier qual;
- TQualifierList& qualifierList = $$->getAsAggregate()->getQualifier();
- for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
- qual = (*fnCandidate)[i].type->getQualifier();
- if (qual == EvqOut || qual == EvqInOut) {
- if (parseContext.lValueErrorCheck($$->getLine(), "assign", $$->getAsAggregate()->getSequence()[i]->getAsTyped())) {
- parseContext.error($1.intermNode->getLine(), "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error", "");
- parseContext.recover();
- }
- }
- qualifierList.push_back(qual);
- }
- }
- $$->setType(fnCandidate->getReturnType());
- } else {
- // error message was put out by PaFindFunction()
- // Put on a dummy node for error recovery
- constUnion *unionArray = new constUnion[1];
- unionArray->fConst = 0.0;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtFloat, EvqConst), $1.line);
- parseContext.recover();
- }
- }
- delete fnCall;
- }
- ;
-
-function_call_generic
- : function_call_header_with_parameters RIGHT_PAREN {
- $$ = $1;
- $$.line = $2.line;
- }
- | function_call_header_no_parameters RIGHT_PAREN {
- $$ = $1;
- $$.line = $2.line;
- }
- ;
-
-function_call_header_no_parameters
- : function_call_header VOID_TYPE {
- $$.function = $1;
- $$.intermNode = 0;
- }
- | function_call_header {
- $$.function = $1;
- $$.intermNode = 0;
- }
- ;
-
-function_call_header_with_parameters
- : function_call_header assignment_expression {
- TParameter param = { 0, new TType($2->getType()) };
- $1->addParameter(param);
- $$.function = $1;
- $$.intermNode = $2;
- }
- | function_call_header_with_parameters COMMA assignment_expression {
- TParameter param = { 0, new TType($3->getType()) };
- $1.function->addParameter(param);
- $$.function = $1.function;
- $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.line);
- }
- ;
-
-function_call_header
- : function_identifier LEFT_PAREN {
- $$ = $1;
- }
- ;
-
-function_identifier
- : constructor_identifier {
- if ($1.op == EOpConstructStruct) {
- TString tempString = "";
- TFunction *function = new TFunction(&tempString, *($1.type.userDef), $1.op);
- $$ = function;
- }
- else {
- TFunction *function = new TFunction($1.op);
- $$ = function;
- }
- }
- | IDENTIFIER {
- if (parseContext.reservedErrorCheck($1.line, *$1.string))
- parseContext.recover();
- TType type(EbtVoid);
- TFunction *function = new TFunction($1.string, type);
- $$ = function;
- }
- ;
-
-// Grammar Note: Constructors look like functions, but lexical anaylsis recognized most of them as keywords.
-
-//
-// Don't go through the symbol table for constructors.
-// Their parameters will be verified algorithmically.
-//
-constructor_identifier
- : FLOAT_TYPE { $$.line = $1.line; $$.op = EOpConstructFloat; }
- | INT_TYPE { $$.line = $1.line; $$.op = EOpConstructInt; }
- | BOOL_TYPE { $$.line = $1.line; $$.op = EOpConstructBool; }
- | VEC2 { $$.line = $1.line; $$.op = EOpConstructVec2; }
- | VEC3 { $$.line = $1.line; $$.op = EOpConstructVec3; }
- | VEC4 { $$.line = $1.line; $$.op = EOpConstructVec4; }
- | BVEC2 { FRAG_VERT_ONLY("bvec2", $1.line); $$.line = $1.line; $$.op = EOpConstructBVec2; }
- | BVEC3 { FRAG_VERT_ONLY("bvec3", $1.line); $$.line = $1.line; $$.op = EOpConstructBVec3; }
- | BVEC4 { FRAG_VERT_ONLY("bvec4", $1.line); $$.line = $1.line; $$.op = EOpConstructBVec4; }
- | IVEC2 { FRAG_VERT_ONLY("ivec2", $1.line); $$.line = $1.line; $$.op = EOpConstructIVec2; }
- | IVEC3 { FRAG_VERT_ONLY("ivec3", $1.line); $$.line = $1.line; $$.op = EOpConstructIVec3; }
- | IVEC4 { FRAG_VERT_ONLY("ivec4", $1.line); $$.line = $1.line; $$.op = EOpConstructIVec4; }
- | MATRIX2 { FRAG_VERT_ONLY("mat2", $1.line); $$.line = $1.line; $$.op = EOpConstructMat2; }
- | MATRIX3 { FRAG_VERT_ONLY("mat3", $1.line); $$.line = $1.line; $$.op = EOpConstructMat3; }
- | MATRIX4 { FRAG_VERT_ONLY("mat4", $1.line); $$.line = $1.line; $$.op = EOpConstructMat4; }
- | TYPE_NAME {
- TType& structure = static_cast<TVariable*>($1.symbol)->getType();
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtStruct, qual, 1, false, false, &structure, $1.line };
- $$.type = t;
- $$.line = $1.line;
- $$.op = EOpConstructStruct;
- }
- ;
-
-unary_expression
- : postfix_expression {
- $$ = $1;
- }
- | INC_OP unary_expression {
- if (parseContext.lValueErrorCheck($1.line, "++", $2))
- parseContext.recover();
- $$ = parseContext.intermediate.addUnaryMath(EOpPreIncrement, $2, $1.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.unaryOpError($1.line, "++", $2->getCompleteString());
- parseContext.recover();
- $$ = $2;
- }
- }
- | DEC_OP unary_expression {
- if (parseContext.lValueErrorCheck($1.line, "--", $2))
- parseContext.recover();
- $$ = parseContext.intermediate.addUnaryMath(EOpPreDecrement, $2, $1.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.unaryOpError($1.line, "--", $2->getCompleteString());
- parseContext.recover();
- $$ = $2;
- }
- }
- | unary_operator unary_expression {
- if ($1.op != EOpNull) {
- $$ = parseContext.intermediate.addUnaryMath($1.op, $2, $1.line, parseContext.symbolTable);
- if ($$ == 0) {
- char* errorOp = "";
- switch($1.op) {
- case EOpNegative: errorOp = "-"; break;
- case EOpLogicalNot: errorOp = "!"; break;
- case EOpBitwiseNot: errorOp = "~"; break;
- default: break;
- }
- parseContext.unaryOpError($1.line, errorOp, $2->getCompleteString());
- parseContext.recover();
- $$ = $2;
- }
- } else
- $$ = $2;
- }
- ;
-// Grammar Note: No traditional style type casts.
-
-unary_operator
- : PLUS { $$.line = $1.line; $$.op = EOpNull; }
- | DASH { $$.line = $1.line; $$.op = EOpNegative; }
- | BANG { $$.line = $1.line; $$.op = EOpLogicalNot; }
- | TILDE { PACK_UNPACK_ONLY("~", $1.line);
- $$.line = $1.line; $$.op = EOpBitwiseNot; }
- ;
-// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
-
-multiplicative_expression
- : unary_expression { $$ = $1; }
- | multiplicative_expression STAR unary_expression {
- FRAG_VERT_ONLY("*", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpMul, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "*", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- | multiplicative_expression SLASH unary_expression {
- FRAG_VERT_ONLY("/", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpDiv, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "/", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- | multiplicative_expression PERCENT unary_expression {
- PACK_UNPACK_ONLY("%", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpMod, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "%", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-additive_expression
- : multiplicative_expression { $$ = $1; }
- | additive_expression PLUS multiplicative_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpAdd, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "+", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- | additive_expression DASH multiplicative_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpSub, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "-", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-shift_expression
- : additive_expression { $$ = $1; }
- | shift_expression LEFT_OP additive_expression {
- PACK_UNPACK_ONLY("<<", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpLeftShift, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "<<", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- | shift_expression RIGHT_OP additive_expression {
- PACK_UNPACK_ONLY(">>", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpRightShift, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, ">>", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-relational_expression
- : shift_expression { $$ = $1; }
- | relational_expression LEFT_ANGLE shift_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpLessThan, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "<", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- | relational_expression RIGHT_ANGLE shift_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpGreaterThan, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, ">", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- | relational_expression LE_OP shift_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "<=", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- | relational_expression GE_OP shift_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, ">=", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- ;
-
-equality_expression
- : relational_expression { $$ = $1; }
- | equality_expression EQ_OP relational_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpEqual, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "==", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- | equality_expression NE_OP relational_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "!=", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- ;
-
-and_expression
- : equality_expression { $$ = $1; }
- | and_expression AMPERSAND equality_expression {
- PACK_UNPACK_ONLY("&", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpAnd, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "&", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-exclusive_or_expression
- : and_expression { $$ = $1; }
- | exclusive_or_expression CARET and_expression {
- PACK_UNPACK_ONLY("^", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "^", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-inclusive_or_expression
- : exclusive_or_expression { $$ = $1; }
- | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
- PACK_UNPACK_ONLY("|", $2.line);
- $$ = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "|", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-logical_and_expression
- : inclusive_or_expression { $$ = $1; }
- | logical_and_expression AND_OP inclusive_or_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "&&", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- ;
-
-logical_xor_expression
- : logical_and_expression { $$ = $1; }
- | logical_xor_expression XOR_OP logical_and_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpLogicalXor, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "^^", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- ;
-
-logical_or_expression
- : logical_xor_expression { $$ = $1; }
- | logical_or_expression OR_OP logical_xor_expression {
- $$ = parseContext.intermediate.addBinaryMath(EOpLogicalOr, $1, $3, $2.line, parseContext.symbolTable);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, "||", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- constUnion *unionArray = new constUnion[1];
- unionArray->bConst = false;
- $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);
- }
- }
- ;
-
-conditional_expression
- : logical_or_expression { $$ = $1; }
- | logical_or_expression QUESTION expression COLON assignment_expression {
- if (parseContext.boolErrorCheck($2.line, $1))
- parseContext.recover();
-
- $$ = parseContext.intermediate.addSelection($1, $3, $5, $2.line);
- if ($3->getType() != $5->getType())
- $$ = 0;
-
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, ":", $3->getCompleteString(), $5->getCompleteString());
- parseContext.recover();
- $$ = $5;
- }
- }
- ;
-
-assignment_expression
- : conditional_expression { $$ = $1; }
- | unary_expression assignment_operator assignment_expression {
- if (parseContext.lValueErrorCheck($2.line, "assign", $1))
- parseContext.recover();
- $$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.line);
- if ($$ == 0) {
- parseContext.assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $1;
- }
- }
- ;
-
-assignment_operator
- : EQUAL { $$.line = $1.line; $$.op = EOpAssign; }
- | MUL_ASSIGN { FRAG_VERT_ONLY("*=", $1.line); $$.line = $1.line; $$.op = EOpMulAssign; }
- | DIV_ASSIGN { FRAG_VERT_ONLY("/=", $1.line); $$.line = $1.line; $$.op = EOpDivAssign; }
- | MOD_ASSIGN { PACK_UNPACK_ONLY("%=", $1.line); $$.line = $1.line; $$.op = EOpModAssign; }
- | ADD_ASSIGN { $$.line = $1.line; $$.op = EOpAddAssign; }
- | SUB_ASSIGN { $$.line = $1.line; $$.op = EOpSubAssign; }
- | LEFT_ASSIGN { PACK_UNPACK_ONLY("<<=", $1.line); $$.line = $1.line; $$.op = EOpLeftShiftAssign; }
- | RIGHT_ASSIGN { PACK_UNPACK_ONLY("<<=", $1.line); $$.line = $1.line; $$.op = EOpRightShiftAssign; }
- | AND_ASSIGN { PACK_UNPACK_ONLY("&=", $1.line); $$.line = $1.line; $$.op = EOpAndAssign; }
- | XOR_ASSIGN { PACK_UNPACK_ONLY("^=", $1.line); $$.line = $1.line; $$.op = EOpExclusiveOrAssign; }
- | OR_ASSIGN { PACK_UNPACK_ONLY("|=", $1.line); $$.line = $1.line; $$.op = EOpInclusiveOrAssign; }
- ;
-
-expression
- : assignment_expression {
- $$ = $1;
- }
- | expression COMMA assignment_expression {
- $$ = parseContext.intermediate.addComma($1, $3, $2.line);
- if ($$ == 0) {
- parseContext.binaryOpError($2.line, ",", $1->getCompleteString(), $3->getCompleteString());
- parseContext.recover();
- $$ = $3;
- }
- }
- ;
-
-constant_expression
- : conditional_expression {
- if (parseContext.constErrorCheck($1))
- parseContext.recover();
- $$ = $1;
- }
- ;
-
-declaration
- : function_prototype SEMICOLON { $$ = 0; }
- | init_declarator_list SEMICOLON {
- if ($1.intermAggregate)
- $1.intermAggregate->setOperator(EOpSequence);
- $$ = $1.intermAggregate;
- }
- ;
-
-function_prototype
- : function_declarator RIGHT_PAREN {
- //
- // Multiple declarations of the same function are allowed.
- //
- // If this is a definition, the definition production code will check for redefinitions
- // (we don't know at this point if it's a definition or not).
- //
- // Redeclarations are allowed. But, return types and parameter qualifiers must match.
- //
- TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find($1->getMangledName()));
- if (prevDec) {
- if (prevDec->getReturnType() != $1->getReturnType()) {
- parseContext.error($2.line, "overloaded functions must have the same return type", $1->getReturnType().getBasicString(), "");
- parseContext.recover();
- }
- for (int i = 0; i < prevDec->getParamCount(); ++i) {
- if ((*prevDec)[i].type->getQualifier() != (*$1)[i].type->getQualifier()) {
- parseContext.error($2.line, "overloaded functions must have the same parameter qualifiers", (*$1)[i].type->getQualifierString(), "");
- parseContext.recover();
- }
- }
- }
-
- //
- // If this is a redeclaration, it could also be a definition,
- // in which case, we want to use the variable names from this one, and not the one that's
- // being redeclared. So, pass back up this declaration, not the one in the symbol table.
- //
- $$.function = $1;
- $$.line = $2.line;
-
- parseContext.symbolTable.insert(*$$.function);
- }
- ;
-
-function_declarator
- : function_header {
- $$ = $1;
- }
- | function_header_with_parameters {
- $$ = $1;
- }
- ;
-
-
-function_header_with_parameters
- : function_header parameter_declaration {
- // Add the parameter
- $$ = $1;
- if ($2.param.type->getBasicType() != EbtVoid)
- $1->addParameter($2.param);
- else
- delete $2.param.type;
- }
- | function_header_with_parameters COMMA parameter_declaration {
- //
- // Only first parameter of one-parameter functions can be void
- // The check for named parameters not being void is done in parameter_declarator
- //
- if ($3.param.type->getBasicType() == EbtVoid) {
- //
- // This parameter > first is void
- //
- parseContext.error($2.line, "cannot be an argument type except for '(void)'", "void", "");
- parseContext.recover();
- delete $3.param.type;
- } else {
- // Add the parameter
- $$ = $1;
- $1->addParameter($3.param);
- }
- }
- ;
-
-function_header
- : fully_specified_type IDENTIFIER LEFT_PAREN {
- if ($1.qualifier != EvqGlobal && $1.qualifier != EvqTemporary) {
- parseContext.error($2.line, "no qualifiers allowed for function return", getQualifierString($1.qualifier), "");
- parseContext.recover();
- }
- // make sure a sampler is not involved as well...
- if (parseContext.structQualifierErrorCheck($2.line, $1))
- parseContext.recover();
-
- // Add the function as a prototype after parsing it (we do not support recursion)
- TFunction *function;
- TType type($1);
- function = new TFunction($2.string, type);
- $$ = function;
- }
- ;
-
-parameter_declarator
- // Type + name
- : type_specifier IDENTIFIER {
- if ($1.type == EbtVoid) {
- parseContext.error($2.line, "illegal use of type 'void'", $2.string->c_str(), "");
- parseContext.recover();
- }
- if (parseContext.reservedErrorCheck($2.line, *$2.string))
- parseContext.recover();
- TParameter param = {$2.string, new TType($1)};
- $$.line = $2.line;
- $$.param = param;
- }
- | type_specifier IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- // Check that we can make an array out of this type
- if ($1.array) {
- parseContext.error($3.line, "cannot declare arrays of this type", TType($1).getCompleteString().c_str(), "");
- parseContext.recover();
- }
- if (parseContext.reservedErrorCheck($2.line, *$2.string))
- parseContext.recover();
- $1.array = true;
- TType* type = new TType($1);
- if ($4->getAsConstantUnion())
- type->setArraySize($4->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- TParameter param = { $2.string, type };
- $$.line = $2.line;
- $$.param = param;
- }
- ;
-
-parameter_declaration
- //
- // The only parameter qualifier a parameter can have are
- // IN_QUAL, OUT_QUAL, INOUT_QUAL, or CONST.
- //
-
- //
- // Type + name
- //
- : type_qualifier parameter_qualifier parameter_declarator {
- $$ = $3;
- if (parseContext.paramErrorCheck($3.line, $1.qualifier, $2, $$.param.type))
- parseContext.recover();
- }
- | parameter_qualifier parameter_declarator {
- $$ = $2;
- if (parseContext.parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
- parseContext.recover();
- if (parseContext.paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
- parseContext.recover();
- }
- //
- // Only type
- //
- | type_qualifier parameter_qualifier parameter_type_specifier {
- $$ = $3;
- if (parseContext.paramErrorCheck($3.line, $1.qualifier, $2, $$.param.type))
- parseContext.recover();
- }
- | parameter_qualifier parameter_type_specifier {
- $$ = $2;
- if (parseContext.parameterSamplerErrorCheck($2.line, $1, *$2.param.type))
- parseContext.recover();
- if (parseContext.paramErrorCheck($2.line, EvqTemporary, $1, $$.param.type))
- parseContext.recover();
- }
- ;
-
-parameter_qualifier
- : /* empty */ {
- $$ = EvqIn;
- }
- | IN_QUAL {
- $$ = EvqIn;
- }
- | OUT_QUAL {
- $$ = EvqOut;
- }
- | INOUT_QUAL {
- $$ = EvqInOut;
- }
- ;
-
-parameter_type_specifier
- : type_specifier {
- TParameter param = { 0, new TType($1) };
- $$.param = param;
-
- }
- | type_specifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
- // Check that we can make an array out of this type
- if ($1.array) {
- parseContext.error($2.line, "cannot declare arrays of this type", TType($1).getCompleteString().c_str(), "");
- parseContext.recover();
- }
- $1.array = true;
- TType* type = new TType($1);
- if ($3->getAsConstantUnion())
- type->setArraySize($3->getAsConstantUnion()->getUnionArrayPointer()->iConst);
-
- TParameter param = { 0, type };
- $$.line = $2.line;
- $$.param = param;
- }
- ;
-
-init_declarator_list
- : single_declaration {
- $$ = $1;
- }
- | init_declarator_list COMMA IDENTIFIER {
- $$ = $1;
- if (parseContext.structQualifierErrorCheck($3.line, $1.type))
- parseContext.recover();
-
- if (parseContext.nonInitErrorCheck($3.line, *$3.string, $$.type))
- parseContext.recover();
- }
- | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
- $$ = $1;
- if (parseContext.structQualifierErrorCheck($3.line, $1.type))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck($4.line, *$3.string, $$.type, 0))
- parseContext.recover();
- }
- | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$ = $1;
- if (parseContext.structQualifierErrorCheck($3.line, $1.type))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck($4.line, *$3.string, $$.type, $5))
- parseContext.recover();
- }
- | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
- $$ = $1;
- if (parseContext.structQualifierErrorCheck($3.line, $1.type))
- parseContext.recover();
-
- TIntermNode* intermNode;
- if (!parseContext.executeInitializer($3.line, *$3.string, $1.type, $5, intermNode)) {
- //
- // build the intermediate representation
- //
- if (intermNode)
- $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermNode, intermNode, $4.line);
- else
- $$.intermAggregate = $1.intermAggregate;
- } else {
- parseContext.recover();
- $$.intermAggregate = 0;
- }
- }
- ;
-
-single_declaration
- : fully_specified_type {
- $$.type = $1;
- $$.intermAggregate = 0;
- }
- | fully_specified_type IDENTIFIER {
- $$.intermAggregate = 0;
- $$.type = $1;
- if (parseContext.structQualifierErrorCheck($2.line, $1))
- parseContext.recover();
-
- if (parseContext.nonInitErrorCheck($2.line, *$2.string, $$.type))
- parseContext.recover();
- }
- | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET {
- $$.intermAggregate = 0;
- $$.type = $1;
- if (parseContext.structQualifierErrorCheck($2.line, $1))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck($3.line, *$2.string, $$.type, 0))
- parseContext.recover();
- }
- | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$.intermAggregate = 0;
- $$.type = $1;
- if (parseContext.structQualifierErrorCheck($2.line, $1))
- parseContext.recover();
-
- if (parseContext.arrayErrorCheck($3.line, *$2.string, $$.type, $4))
- parseContext.recover();
- }
- | fully_specified_type IDENTIFIER EQUAL initializer {
- $$.type = $1;
- if (parseContext.structQualifierErrorCheck($2.line, $1))
- parseContext.recover();
-
- TIntermNode* intermNode;
- if (!parseContext.executeInitializer($2.line, *$2.string, $1, $4, intermNode)) {
- //
- // Build intermediate representation
- //
- if (intermNode)
- $$.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, $3.line);
- else
- $$.intermAggregate = 0;
- } else {
- parseContext.recover();
- $$.intermAggregate = 0;
- }
- }
-
-//
-// Place holder for the pack/unpack languages.
-//
-// | buffer_specifier {
-// $$.intermAggregate = 0;
-// }
- ;
-
-// Grammar Note: No 'enum', or 'typedef'.
-
-//
-// Place holder for the pack/unpack languages.
-//
-//%type <interm> buffer_declaration
-//%type <interm.type> buffer_specifier input_or_output buffer_declaration_list
-//buffer_specifier
-// : input_or_output LEFT_BRACE buffer_declaration_list RIGHT_BRACE {
-// }
-// ;
-//
-//input_or_output
-// : INPUT {
-// if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "input"))
-// parseContext.recover();
-// UNPACK_ONLY("input", $1.line);
-// $$.qualifier = EvqInput;
-// }
-// | OUTPUT {
-// if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "output"))
-// parseContext.recover();
-// PACK_ONLY("output", $1.line);
-// $$.qualifier = EvqOutput;
-// }
-// ;
-
-//
-// Place holder for the pack/unpack languages.
-//
-//buffer_declaration_list
-// : buffer_declaration {
-// }
-// | buffer_declaration_list buffer_declaration {
-// }
-// ;
-
-//
-// Input/output semantics:
-// float must be 16 or 32 bits
-// float alignment restrictions?
-// check for only one input and only one output
-// sum of bitfields has to be multiple of 32
-//
-
-//
-// Place holder for the pack/unpack languages.
-//
-//buffer_declaration
-// : type_specifier IDENTIFIER COLON constant_expression SEMICOLON {
-// if (parseContext.reservedErrorCheck($2.line, *$2.string, parseContext))
-// parseContext.recover();
-// $$.variable = new TVariable($2.string, $1);
-// if (! parseContext.symbolTable.insert(*$$.variable)) {
-// parseContext.error($2.line, "redefinition", $$.variable->getName().c_str(), "");
-// parseContext.recover();
-// // don't have to delete $$.variable, the pool pop will take care of it
-// }
-// }
-// ;
-
-fully_specified_type
- : type_specifier {
- $$ = $1;
- }
- | type_qualifier type_specifier {
- TPublicType t = { $2.type, $1.qualifier, $2.size, $2.matrix, false, $2.userDef, 0 };
- if ($1.qualifier == EvqAttribute &&
- ($2.type == EbtBool || $2.type == EbtInt)) {
- parseContext.error($2.line, "cannot be bool or int", getQualifierString($1.qualifier), "");
- parseContext.recover();
- }
- if (($1.qualifier == EvqVaryingIn || $1.qualifier == EvqVaryingOut) &&
- ($2.type == EbtBool || $2.type == EbtInt)) {
- parseContext.error($2.line, "cannot be bool or int", getQualifierString($1.qualifier), "");
- parseContext.recover();
- }
- $$ = t;
- }
- ;
-
-type_qualifier
- : CONST_QUAL {
- TPublicType t = { EbtVoid, EvqConst, 1, false, false, 0 };
- $$ = t;
- }
- | ATTRIBUTE {
- VERTEX_ONLY("attribute", $1.line);
- if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
- parseContext.recover();
- TPublicType t = { EbtVoid, EvqAttribute, 1, false, false, 0 };
- $$ = t;
- }
- | VARYING {
- if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
- parseContext.recover();
- TPublicType t = { EbtVoid, EvqVaryingIn, 1, false, false, 0 };
- if (parseContext.language == EShLangVertex)
- t.qualifier = EvqVaryingOut;
- $$ = t;
- }
- | UNIFORM {
- if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "uniform"))
- parseContext.recover();
- TPublicType t = { EbtVoid, EvqUniform, 1, false, false, 0 };
- $$ = t;
- }
- ;
-
-type_specifier
- : VOID_TYPE {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtVoid, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | FLOAT_TYPE {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | INT_TYPE {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | BOOL_TYPE {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
-// | UNSIGNED INT_TYPE {
-// PACK_UNPACK_ONLY("unsigned", $1.line);
-// TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
-// TPublicType t = { EbtInt, qual, 1, false, false, 0, $1.line };
-// $$ = t;
-// }
- | VEC2 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 2, false, false, 0, $1.line };
- $$ = t;
- }
- | VEC3 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 3, false, false, 0, $1.line };
- $$ = t;
- }
- | VEC4 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 4, false, false, 0, $1.line };
- $$ = t;
- }
- | BVEC2 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 2, false, false, 0, $1.line };
- $$ = t;
- }
- | BVEC3 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 3, false, false, 0, $1.line };
- $$ = t;
- }
- | BVEC4 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtBool, qual, 4, false, false, 0, $1.line };
- $$ = t;
- }
- | IVEC2 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 2, false, false, 0, $1.line };
- $$ = t;
- }
- | IVEC3 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 3, false, false, 0, $1.line };
- $$ = t;
- }
- | IVEC4 {
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtInt, qual, 4, false, false, 0, $1.line };
- $$ = t;
- }
- | MATRIX2 {
- FRAG_VERT_ONLY("mat2", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 2, true, false, 0, $1.line };
- $$ = t;
- }
- | MATRIX3 {
- FRAG_VERT_ONLY("mat3", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 3, true, false, 0, $1.line };
- $$ = t;
- }
- | MATRIX4 {
- FRAG_VERT_ONLY("mat4", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtFloat, qual, 4, true, false, 0, $1.line };
- $$ = t;
- }
- | SAMPLER1D {
- FRAG_VERT_ONLY("sampler1D", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler1D, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | SAMPLER2D {
- FRAG_VERT_ONLY("sampler2D", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler2D, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | SAMPLER3D {
- FRAG_VERT_ONLY("sampler3D", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler3D, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | SAMPLERCUBE {
- FRAG_VERT_ONLY("samplerCube", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSamplerCube, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | SAMPLER1DSHADOW {
- FRAG_VERT_ONLY("sampler1DShadow", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler1DShadow, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | SAMPLER2DSHADOW {
- FRAG_VERT_ONLY("sampler2DShadow", $1.line);
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtSampler2DShadow, qual, 1, false, false, 0, $1.line };
- $$ = t;
- }
- | struct_specifier {
- FRAG_VERT_ONLY("struct", $1.line);
- $$ = $1;
- $$.qualifier = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- }
- | TYPE_NAME {
- //
- // This is for user defined type names. The lexical phase looked up the
- // type.
- //
- TType& structure = static_cast<TVariable*>($1.symbol)->getType();
- TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- TPublicType t = { EbtStruct, qual, 1, false, false, &structure, $1.line };
- $$ = t;
- }
- ;
-
-struct_specifier
- : STRUCT IDENTIFIER LEFT_BRACE struct_declaration_list RIGHT_BRACE {
- TType* structure = new TType($4, *$2.string);
- TVariable* userTypeDef = new TVariable($2.string, *structure, true);
- if (! parseContext.symbolTable.insert(*userTypeDef)) {
- parseContext.error($2.line, "redefinition", $2.string->c_str(), "struct");
- parseContext.recover();
- }
- TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, $1.line };
- $$ = t;
- }
- | STRUCT LEFT_BRACE struct_declaration_list RIGHT_BRACE {
- TType* structure = new TType($3, TString(""));
- TPublicType t = { EbtStruct, EvqTemporary, 1, false, false, structure, $1.line };
- $$ = t;
- }
- ;
-
-struct_declaration_list
- : struct_declaration {
- $$ = $1;
- }
- | struct_declaration_list struct_declaration {
- $$ = $1;
- for (unsigned int i = 0; i < $2->size(); ++i) {
- for (unsigned int j = 0; j < $$->size(); ++j) {
- if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) {
- parseContext.error((*$2)[i].line, "duplicate field name in structure:", "struct", (*$2)[i].type->getFieldName().c_str());
- parseContext.recover();
- }
- }
- $$->push_back((*$2)[i]);
- }
- }
- ;
-
-struct_declaration
- : type_specifier struct_declarator_list SEMICOLON {
- $$ = $2;
-
- if (parseContext.voidErrorCheck($1.line, (*$2)[0].type->getFieldName(), $1)) {
- parseContext.recover();
- }
- for (unsigned int i = 0; i < $$->size(); ++i) {
- //
- // Careful not to replace already know aspects of type, like array-ness
- //
- (*$$)[i].type->setType($1.type, $1.size, $1.matrix, $1.userDef);
- if ($1.userDef)
- (*$$)[i].type->setTypeName($1.userDef->getTypeName());
- }
- }
- ;
-
-struct_declarator_list
- : struct_declarator {
- $$ = NewPoolTTypeList();
- $$->push_back($1);
- }
- | struct_declarator_list COMMA struct_declarator {
- $$->push_back($3);
- }
- ;
-
-struct_declarator
- : IDENTIFIER {
- $$.type = new TType(EbtVoid);
- $$.line = $1.line;
- $$.type->setFieldName(*$1.string);
- }
- | IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$.type = new TType(EbtVoid);
- $$.line = $1.line;
- $$.type->setFieldName(*$1.string);
-
- if ($3->getAsConstantUnion() == 0 || $3->getAsConstantUnion()->getBasicType() != EbtInt ||
- $3->getAsConstantUnion()->getUnionArrayPointer()->iConst <= 0) {
- parseContext.error($2.line, "structure field array size must be a positive integer", $1.string->c_str(), "");
- parseContext.recover();
- } else {
- $$.type->setArraySize($3->getAsConstantUnion()->getUnionArrayPointer()->iConst);
- }
- }
- ;
-
-initializer
- : assignment_expression { $$ = $1; }
- ;
-
-declaration_statement
- : declaration { $$ = $1; }
- ;
-
-statement
- : compound_statement { $$ = $1; }
- | simple_statement { $$ = $1; }
- ;
-
-// Grammar Note: No labeled statements; 'goto' is not supported.
-
-simple_statement
- : declaration_statement { $$ = $1; }
- | expression_statement { $$ = $1; }
- | selection_statement { $$ = $1; }
- | iteration_statement { $$ = $1; }
- | jump_statement { $$ = $1; }
- ;
-
-compound_statement
- : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
- | LEFT_BRACE { parseContext.symbolTable.push(); } statement_list { parseContext.symbolTable.pop(); } RIGHT_BRACE {
- if ($3 != 0)
- $3->setOperator(EOpSequence);
- $$ = $3;
- }
- ;
-
-statement_no_new_scope
- : compound_statement_no_new_scope { $$ = $1; }
- | simple_statement { $$ = $1; }
- ;
-
-compound_statement_no_new_scope
- // Statement that doesn't create a new scope, for selection_statement, iteration_statement
- : LEFT_BRACE RIGHT_BRACE {
- $$ = 0;
- }
- | LEFT_BRACE statement_list RIGHT_BRACE {
- if ($2)
- $2->setOperator(EOpSequence);
- $$ = $2;
- }
- ;
-
-statement_list
- : statement {
- $$ = parseContext.intermediate.makeAggregate($1, 0);
- }
- | statement_list statement {
- $$ = parseContext.intermediate.growAggregate($1, $2, 0);
- }
- ;
-
-expression_statement
- : SEMICOLON { $$ = 0; }
- | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); }
- ;
-
-selection_statement
- : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
- if (parseContext.boolErrorCheck($1.line, $3))
- parseContext.recover();
- $$ = parseContext.intermediate.addSelection($3, $5, $1.line);
- }
- ;
-
-selection_rest_statement
- : statement ELSE statement {
- $$.node1 = $1;
- $$.node2 = $3;
- }
- | statement {
- $$.node1 = $1;
- $$.node2 = 0;
- }
- ;
-
-// Grammar Note: No 'switch'. Switch statements not supported.
-
-condition
- // In 1996 c++ draft, conditions can include single declarations
- : expression {
- $$ = $1;
- if (parseContext.boolErrorCheck($1->getLine(), $1))
- parseContext.recover();
- }
- | fully_specified_type IDENTIFIER EQUAL initializer {
- TIntermNode* intermNode;
- if (parseContext.structQualifierErrorCheck($2.line, $1))
- parseContext.recover();
- if (parseContext.boolErrorCheck($2.line, $1))
- parseContext.recover();
-
- if (!parseContext.executeInitializer($2.line, *$2.string, $1, $4, intermNode))
- $$ = $4;
- else {
- parseContext.recover();
- $$ = 0;
- }
- }
- ;
-
-iteration_statement
- : WHILE LEFT_PAREN { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; } condition RIGHT_PAREN statement_no_new_scope {
- parseContext.symbolTable.pop();
- $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.line);
- --parseContext.loopNestingLevel;
- }
- | DO { ++parseContext.loopNestingLevel; } statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
- if (parseContext.boolErrorCheck($8.line, $6))
- parseContext.recover();
-
- $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.line);
- --parseContext.loopNestingLevel;
- }
- | FOR LEFT_PAREN { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
- parseContext.symbolTable.pop();
- $$ = parseContext.intermediate.makeAggregate($4, $2.line);
- $$ = parseContext.intermediate.growAggregate(
- $$,
- parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.line),
- $1.line);
- $$->getAsAggregate()->setOperator(EOpSequence);
- --parseContext.loopNestingLevel;
- }
- ;
-
-for_init_statement
- : expression_statement {
- $$ = $1;
- }
- | declaration_statement {
- $$ = $1;
- }
- ;
-
-conditionopt
- : condition {
- $$ = $1;
- }
- | /* May be null */ {
- $$ = 0;
- }
- ;
-
-for_rest_statement
- : conditionopt SEMICOLON {
- $$.node1 = $1;
- $$.node2 = 0;
- }
- | conditionopt SEMICOLON expression {
- $$.node1 = $1;
- $$.node2 = $3;
- }
- ;
-
-jump_statement
- : CONTINUE SEMICOLON {
- if (parseContext.loopNestingLevel <= 0) {
- parseContext.error($1.line, "continue statement only allowed in loops", "", "");
- parseContext.recover();
- }
- $$ = parseContext.intermediate.addBranch(EOpContinue, $1.line);
- }
- | BREAK SEMICOLON {
- if (parseContext.loopNestingLevel <= 0) {
- parseContext.error($1.line, "break statement only allowed in loops", "", "");
- parseContext.recover();
- }
- $$ = parseContext.intermediate.addBranch(EOpBreak, $1.line);
- }
- | RETURN SEMICOLON {
- $$ = parseContext.intermediate.addBranch(EOpReturn, $1.line);
- if (parseContext.currentFunctionType->getBasicType() != EbtVoid) {
- parseContext.error($1.line, "non-void function must return a value", "return", "");
- parseContext.recover();
- }
- }
- | RETURN expression SEMICOLON {
- $$ = parseContext.intermediate.addBranch(EOpReturn, $2, $1.line);
- parseContext.functionReturnsValue = true;
- if (parseContext.currentFunctionType->getBasicType() == EbtVoid) {
- parseContext.error($1.line, "void function cannot return a value", "return", "");
- parseContext.recover();
- } else if (*(parseContext.currentFunctionType) != $2->getType()) {
- parseContext.error($1.line, "function return is not matching type:", "return", "");
- parseContext.recover();
- }
- }
- | DISCARD SEMICOLON {
- FRAG_ONLY("discard", $1.line);
- $$ = parseContext.intermediate.addBranch(EOpKill, $1.line);
- }
- ;
-
-// Grammar Note: No 'goto'. Gotos are not supported.
-
-translation_unit
- : external_declaration {
- $$ = $1;
- parseContext.treeRoot = $$;
- }
- | translation_unit external_declaration {
- $$ = parseContext.intermediate.growAggregate($1, $2, 0);
- parseContext.treeRoot = $$;
- }
- ;
-
-external_declaration
- : function_definition {
- $$ = $1;
- }
- | declaration {
- $$ = $1;
- }
- ;
-
-function_definition
- : function_prototype {
- TFunction& function = *($1.function);
- TFunction* prevDec = static_cast<TFunction*>(parseContext.symbolTable.find(function.getMangledName()));
- //
- // Note: 'prevDec' could be 'function' if this is the first time we've seen function
- // as it would have just been put in the symbol table. Otherwise, we're looking up
- // an earlier occurance.
- //
- if (prevDec->isDefined()) {
- //
- // Then this function already has a body.
- //
- parseContext.error($1.line, "function already has a body", function.getName().c_str(), "");
- parseContext.recover();
- }
- prevDec->setDefined();
-
- //
- // Raise error message if main function takes any parameters or return anything other than void
- //
- if (function.getName() == "main") {
- if (function.getParamCount() > 0) {
- parseContext.error($1.line, "function cannot take any parameter(s)", function.getName().c_str(), "");
- parseContext.recover();
- }
- if (function.getReturnType().getBasicType() != EbtVoid) {
- parseContext.error($1.line, "", function.getReturnType().getBasicString(), "main function cannot return a value" );
- parseContext.recover();
- }
- }
-
- //
- // New symbol table scope for body of function plus its arguments
- //
- parseContext.symbolTable.push();
-
- //
- // Remember the return type for later checking for RETURN statements.
- //
- parseContext.currentFunctionType = &(prevDec->getReturnType());
- parseContext.functionReturnsValue = false;
-
- //
- // Insert parameters into the symbol table.
- // If the parameter has no name, it's not an error, just don't insert it
- // (could be used for unused args).
- //
- // Also, accumulate the list of parameters into the HIL, so lower level code
- // knows where to find parameters.
- //
- TIntermAggregate* paramNodes = new TIntermAggregate;
- for (int i = 0; i < function.getParamCount(); i++) {
- TParameter& param = function[i];
- if (param.name != 0) {
- TVariable *variable = new TVariable(param.name, *param.type);
- //
- // Insert the parameters with name in the symbol table.
- //
- if (! parseContext.symbolTable.insert(*variable)) {
- parseContext.error($1.line, "redefinition", variable->getName().c_str(), "");
- parseContext.recover();
- delete variable;
- }
- //
- // Transfer ownership of name pointer to symbol table.
- //
- param.name = 0;
-
- //
- // Add the parameter to the HIL
- //
- paramNodes = parseContext.intermediate.growAggregate(
- paramNodes,
- parseContext.intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(), $1.line),
- $1.line);
- } else {
- paramNodes = parseContext.intermediate.growAggregate(paramNodes, parseContext.intermediate.addSymbol(0, "", *param.type, $1.line), $1.line);
- }
- }
- parseContext.intermediate.setAggregateOperator(paramNodes, EOpParameters, $1.line);
- $1.intermAggregate = paramNodes;
- parseContext.loopNestingLevel = 0;
- }
- compound_statement_no_new_scope {
- //?? Check that all paths return a value if return type != void ?
- // May be best done as post process phase on intermediate code
- if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) {
- parseContext.error($1.line, "function does not return a value:", "", $1.function->getName().c_str());
- parseContext.recover();
- }
- parseContext.symbolTable.pop();
- $$ = parseContext.intermediate.growAggregate($1.intermAggregate, $3, 0);
- parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.line);
- $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
- $$->getAsAggregate()->setType($1.function->getReturnType());
-
- // store the pragma information for debug and optimize and other vendor specific
- // information. This information can be queried from the parse tree
- $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
- $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
- $$->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable);
- }
- ;
-
-%%
diff --git a/src/mesa/shader/slang/MachineIndependent/glslang_tab.h b/src/mesa/shader/slang/MachineIndependent/glslang_tab.h
deleted file mode 100755
index 97d827fe902..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/glslang_tab.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/* A Bison parser, made by GNU Bison 1.875. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- ATTRIBUTE = 258,
- CONST_QUAL = 259,
- BOOL_TYPE = 260,
- FLOAT_TYPE = 261,
- INT_TYPE = 262,
- BREAK = 263,
- CONTINUE = 264,
- DO = 265,
- ELSE = 266,
- FOR = 267,
- IF = 268,
- DISCARD = 269,
- RETURN = 270,
- BVEC2 = 271,
- BVEC3 = 272,
- BVEC4 = 273,
- IVEC2 = 274,
- IVEC3 = 275,
- IVEC4 = 276,
- VEC2 = 277,
- VEC3 = 278,
- VEC4 = 279,
- MATRIX2 = 280,
- MATRIX3 = 281,
- MATRIX4 = 282,
- IN_QUAL = 283,
- OUT_QUAL = 284,
- INOUT_QUAL = 285,
- UNIFORM = 286,
- VARYING = 287,
- STRUCT = 288,
- VOID_TYPE = 289,
- WHILE = 290,
- SAMPLER1D = 291,
- SAMPLER2D = 292,
- SAMPLER3D = 293,
- SAMPLERCUBE = 294,
- SAMPLER1DSHADOW = 295,
- SAMPLER2DSHADOW = 296,
- IDENTIFIER = 297,
- TYPE_NAME = 298,
- FLOATCONSTANT = 299,
- INTCONSTANT = 300,
- BOOLCONSTANT = 301,
- FIELD_SELECTION = 302,
- LEFT_OP = 303,
- RIGHT_OP = 304,
- INC_OP = 305,
- DEC_OP = 306,
- LE_OP = 307,
- GE_OP = 308,
- EQ_OP = 309,
- NE_OP = 310,
- AND_OP = 311,
- OR_OP = 312,
- XOR_OP = 313,
- MUL_ASSIGN = 314,
- DIV_ASSIGN = 315,
- ADD_ASSIGN = 316,
- MOD_ASSIGN = 317,
- LEFT_ASSIGN = 318,
- RIGHT_ASSIGN = 319,
- AND_ASSIGN = 320,
- XOR_ASSIGN = 321,
- OR_ASSIGN = 322,
- SUB_ASSIGN = 323,
- LEFT_PAREN = 324,
- RIGHT_PAREN = 325,
- LEFT_BRACKET = 326,
- RIGHT_BRACKET = 327,
- LEFT_BRACE = 328,
- RIGHT_BRACE = 329,
- DOT = 330,
- COMMA = 331,
- COLON = 332,
- EQUAL = 333,
- SEMICOLON = 334,
- BANG = 335,
- DASH = 336,
- TILDE = 337,
- PLUS = 338,
- STAR = 339,
- SLASH = 340,
- PERCENT = 341,
- LEFT_ANGLE = 342,
- RIGHT_ANGLE = 343,
- VERTICAL_BAR = 344,
- CARET = 345,
- AMPERSAND = 346,
- QUESTION = 347
- };
-#endif
-#define ATTRIBUTE 258
-#define CONST_QUAL 259
-#define BOOL_TYPE 260
-#define FLOAT_TYPE 261
-#define INT_TYPE 262
-#define BREAK 263
-#define CONTINUE 264
-#define DO 265
-#define ELSE 266
-#define FOR 267
-#define IF 268
-#define DISCARD 269
-#define RETURN 270
-#define BVEC2 271
-#define BVEC3 272
-#define BVEC4 273
-#define IVEC2 274
-#define IVEC3 275
-#define IVEC4 276
-#define VEC2 277
-#define VEC3 278
-#define VEC4 279
-#define MATRIX2 280
-#define MATRIX3 281
-#define MATRIX4 282
-#define IN_QUAL 283
-#define OUT_QUAL 284
-#define INOUT_QUAL 285
-#define UNIFORM 286
-#define VARYING 287
-#define STRUCT 288
-#define VOID_TYPE 289
-#define WHILE 290
-#define SAMPLER1D 291
-#define SAMPLER2D 292
-#define SAMPLER3D 293
-#define SAMPLERCUBE 294
-#define SAMPLER1DSHADOW 295
-#define SAMPLER2DSHADOW 296
-#define IDENTIFIER 297
-#define TYPE_NAME 298
-#define FLOATCONSTANT 299
-#define INTCONSTANT 300
-#define BOOLCONSTANT 301
-#define FIELD_SELECTION 302
-#define LEFT_OP 303
-#define RIGHT_OP 304
-#define INC_OP 305
-#define DEC_OP 306
-#define LE_OP 307
-#define GE_OP 308
-#define EQ_OP 309
-#define NE_OP 310
-#define AND_OP 311
-#define OR_OP 312
-#define XOR_OP 313
-#define MUL_ASSIGN 314
-#define DIV_ASSIGN 315
-#define ADD_ASSIGN 316
-#define MOD_ASSIGN 317
-#define LEFT_ASSIGN 318
-#define RIGHT_ASSIGN 319
-#define AND_ASSIGN 320
-#define XOR_ASSIGN 321
-#define OR_ASSIGN 322
-#define SUB_ASSIGN 323
-#define LEFT_PAREN 324
-#define RIGHT_PAREN 325
-#define LEFT_BRACKET 326
-#define RIGHT_BRACKET 327
-#define LEFT_BRACE 328
-#define RIGHT_BRACE 329
-#define DOT 330
-#define COMMA 331
-#define COLON 332
-#define EQUAL 333
-#define SEMICOLON 334
-#define BANG 335
-#define DASH 336
-#define TILDE 337
-#define PLUS 338
-#define STAR 339
-#define SLASH 340
-#define PERCENT 341
-#define LEFT_ANGLE 342
-#define RIGHT_ANGLE 343
-#define VERTICAL_BAR 344
-#define CARET 345
-#define AMPERSAND 346
-#define QUESTION 347
-
-
-
-
-#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 117 "glslang.y"
-typedef union YYSTYPE {
- struct {
- TSourceLoc line;
- union {
- TString *string;
- float f;
- int i;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TSourceLoc line;
- TOperator op;
- union {
- TIntermNode* intermNode;
- TIntermNodePair nodePair;
- TIntermTyped* intermTypedNode;
- TIntermAggregate* intermAggregate;
- };
- union {
- TPublicType type;
- TQualifier qualifier;
- TFunction* function;
- TParameter param;
- TTypeLine typeLine;
- TTypeList* typeList;
- };
- } interm;
-} YYSTYPE;
-/* Line 1240 of yacc.c. */
-#line 251 "glslang.tab.h"
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-
-
diff --git a/src/mesa/shader/slang/MachineIndependent/intermOut.cpp b/src/mesa/shader/slang/MachineIndependent/intermOut.cpp
deleted file mode 100755
index e75608c45a1..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/intermOut.cpp
+++ /dev/null
@@ -1,496 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "localintermediate.h"
-#include "../Include/ShHandle.h"
-
-//
-// Two purposes:
-// 1. Show an example of how to iterate tree. Functions can
-// also directly call Traverse() on children themselves to
-// have finer grained control over the process than shown here.
-// See the last function for how to get started.
-// 2. Print out a text based description of the tree.
-//
-
-//
-// Use this class to carry along data from node to node in
-// the traversal
-//
-class TOutputTraverser : public TIntermTraverser {
-public:
- TOutputTraverser(TInfoSink& i) : infoSink(i) { }
- TInfoSink& infoSink;
-};
-
-TString TType::getCompleteString() const
-{
- char buf[100];
- char *p = &buf[0];
-
- if (qualifier != EvqTemporary && qualifier != EvqGlobal)
- p += sprintf(p, "%s ", getQualifierString());
- if (array)
- p += sprintf(p, "array of ");
- if (matrix)
- p += sprintf(p, "%dX%d matrix of ", size, size);
- else if (size > 1)
- p += sprintf(p, "%d-component vector of ", size);
-
- sprintf(p, "%s", getBasicString());
-
- return TString(buf);
-}
-
-//
-// Helper functions for printing, not part of traversing.
-//
-
-void OutputTreeText(TInfoSink& infoSink, TIntermNode* node, const int depth)
-{
- int i;
-
- infoSink.debug << FormatSourceLoc(node->getLine());
-
- for (i = 0; i < depth; ++i)
- infoSink.debug << " ";
-}
-
-//
-// The rest of the file are the traversal functions. The last one
-// is the one that starts the traversal.
-//
-// Return true from interior nodes to have the external traversal
-// continue on to children. If you process children yourself,
-// return false.
-//
-
-void OutputSymbol(TIntermSymbol* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
-
- OutputTreeText(oit->infoSink, node, oit->depth);
-
- char buf[100];
- sprintf(buf, "'%s' (%s)\n",
- node->getSymbol().c_str(),
- node->getCompleteString().c_str());
-
- oit->infoSink.debug << buf;
-}
-
-bool OutputBinary(bool /* preVisit */, TIntermBinary* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- OutputTreeText(out, node, oit->depth);
-
- switch (node->getOp()) {
- case EOpAssign: out.debug << "move second child to first child"; break;
- case EOpAddAssign: out.debug << "add second child into first child"; break;
- case EOpSubAssign: out.debug << "subtract second child into first child"; break;
- case EOpMulAssign: out.debug << "multiply second child into first child"; break;
- case EOpVectorTimesMatrixAssign: out.debug << "matrix mult second child into first child"; break;
- case EOpVectorTimesScalarAssign: out.debug << "vector scale second child into first child"; break;
- case EOpMatrixTimesScalarAssign: out.debug << "matrix scale second child into first child"; break;
- case EOpMatrixTimesMatrixAssign: out.debug << "matrix mult second child into first child"; break;
- case EOpDivAssign: out.debug << "divide second child into first child"; break;
- case EOpModAssign: out.debug << "mod second child into first child"; break;
- case EOpAndAssign: out.debug << "and second child into first child"; break;
- case EOpInclusiveOrAssign: out.debug << "or second child into first child"; break;
- case EOpExclusiveOrAssign: out.debug << "exclusive or second child into first child"; break;
- case EOpLeftShiftAssign: out.debug << "left shift second child into first child"; break;
- case EOpRightShiftAssign: out.debug << "right shift second child into first child"; break;
-
- case EOpIndexDirect: out.debug << "direct index"; break;
- case EOpIndexIndirect: out.debug << "indirect index"; break;
- case EOpIndexDirectStruct: out.debug << "direct index for structure"; break;
- case EOpVectorSwizzle: out.debug << "vector swizzle"; break;
-
- case EOpAdd: out.debug << "add"; break;
- case EOpSub: out.debug << "subtract"; break;
- case EOpMul: out.debug << "component-wise multiply"; break;
- case EOpDiv: out.debug << "divide"; break;
- case EOpMod: out.debug << "mod"; break;
- case EOpRightShift: out.debug << "right-shift"; break;
- case EOpLeftShift: out.debug << "left-shift"; break;
- case EOpAnd: out.debug << "bitwise and"; break;
- case EOpInclusiveOr: out.debug << "inclusive-or"; break;
- case EOpExclusiveOr: out.debug << "exclusive-or"; break;
- case EOpEqual: out.debug << "Compare Equal"; break;
- case EOpNotEqual: out.debug << "Compare Not Equal"; break;
- case EOpLessThan: out.debug << "Compare Less Than"; break;
- case EOpGreaterThan: out.debug << "Compare Greater Than"; break;
- case EOpLessThanEqual: out.debug << "Compare Less Than or Equal"; break;
- case EOpGreaterThanEqual: out.debug << "Compare Greater Than or Equal"; break;
-
- case EOpVectorTimesScalar: out.debug << "vector-scale"; break;
- case EOpVectorTimesMatrix: out.debug << "vector-times-matrix"; break;
- case EOpMatrixTimesVector: out.debug << "matrix-times-vector"; break;
- case EOpMatrixTimesScalar: out.debug << "matrix-scale"; break;
- case EOpMatrixTimesMatrix: out.debug << "matrix-multiply"; break;
-
- case EOpLogicalOr: out.debug << "logical-or"; break;
- case EOpLogicalXor: out.debug << "logical-xor"; break;
- case EOpLogicalAnd: out.debug << "logical-and"; break;
- default: out.debug << "<unknown op>";
- }
-
- out.debug << " (" << node->getCompleteString() << ")";
-
- out.debug << "\n";
-
- return true;
-}
-
-bool OutputUnary(bool /* preVisit */, TIntermUnary* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- OutputTreeText(out, node, oit->depth);
-
- switch (node->getOp()) {
- case EOpNegative: out.debug << "Negate value"; break;
- case EOpVectorLogicalNot:
- case EOpLogicalNot: out.debug << "Negate conditional"; break;
- case EOpBitwiseNot: out.debug << "Bitwise not"; break;
-
- case EOpPostIncrement: out.debug << "Post-Increment"; break;
- case EOpPostDecrement: out.debug << "Post-Decrement"; break;
- case EOpPreIncrement: out.debug << "Pre-Increment"; break;
- case EOpPreDecrement: out.debug << "Pre-Decrement"; break;
-
- case EOpConvIntToBool: out.debug << "Convert int to bool"; break;
- case EOpConvFloatToBool:out.debug << "Convert float to bool";break;
- case EOpConvBoolToFloat:out.debug << "Convert bool to float";break;
- case EOpConvIntToFloat: out.debug << "Convert int to float"; break;
- case EOpConvFloatToInt: out.debug << "Convert float to int"; break;
- case EOpConvBoolToInt: out.debug << "Convert bool to int"; break;
-
- case EOpRadians: out.debug << "radians"; break;
- case EOpDegrees: out.debug << "degrees"; break;
- case EOpSin: out.debug << "sine"; break;
- case EOpCos: out.debug << "cosine"; break;
- case EOpTan: out.debug << "tangent"; break;
- case EOpAsin: out.debug << "arc sine"; break;
- case EOpAcos: out.debug << "arc cosine"; break;
- case EOpAtan: out.debug << "arc tangent"; break;
-
- case EOpExp: out.debug << "exp"; break;
- case EOpLog: out.debug << "log"; break;
- case EOpExp2: out.debug << "exp2"; break;
- case EOpLog2: out.debug << "log2"; break;
- case EOpSqrt: out.debug << "sqrt"; break;
- case EOpInverseSqrt: out.debug << "inverse sqrt"; break;
-
- case EOpAbs: out.debug << "Absolute value"; break;
- case EOpSign: out.debug << "Sign"; break;
- case EOpFloor: out.debug << "Floor"; break;
- case EOpCeil: out.debug << "Ceiling"; break;
- case EOpFract: out.debug << "Fraction"; break;
-
- case EOpLength: out.debug << "length"; break;
- case EOpNormalize: out.debug << "normalize"; break;
- case EOpDPdx: out.debug << "dPdx"; break;
- case EOpDPdy: out.debug << "dPdy"; break;
- case EOpFwidth: out.debug << "fwidth"; break;
-
- case EOpAny: out.debug << "any"; break;
- case EOpAll: out.debug << "all"; break;
-
- default: out.debug.message(EPrefixError, "Bad unary op");
- }
-
- out.debug << " (" << node->getCompleteString() << ")";
-
- out.debug << "\n";
-
- return true;
-}
-
-bool OutputAggregate(bool /* preVisit */, TIntermAggregate* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- if (node->getOp() == EOpNull) {
- out.debug.message(EPrefixError, "node is still EOpNull!");
- return true;
- }
-
- OutputTreeText(out, node, oit->depth);
-
- switch (node->getOp()) {
- case EOpSequence: out.debug << "Sequence\n"; return true;
- case EOpComma: out.debug << "Comma\n"; return true;
- case EOpFunction: out.debug << "Function Definition: " << node->getName(); break;
- case EOpFunctionCall: out.debug << "Function Call: " << node->getName(); break;
- case EOpParameters: out.debug << "Function Parameters: "; break;
-
- case EOpConstructFloat: out.debug << "Construct float"; break;
- case EOpConstructVec2: out.debug << "Construct vec2"; break;
- case EOpConstructVec3: out.debug << "Construct vec3"; break;
- case EOpConstructVec4: out.debug << "Construct vec4"; break;
- case EOpConstructBool: out.debug << "Construct bool"; break;
- case EOpConstructBVec2: out.debug << "Construct bvec2"; break;
- case EOpConstructBVec3: out.debug << "Construct bvec3"; break;
- case EOpConstructBVec4: out.debug << "Construct bvec4"; break;
- case EOpConstructInt: out.debug << "Construct int"; break;
- case EOpConstructIVec2: out.debug << "Construct ivec2"; break;
- case EOpConstructIVec3: out.debug << "Construct ivec3"; break;
- case EOpConstructIVec4: out.debug << "Construct ivec4"; break;
- case EOpConstructMat2: out.debug << "Construct mat2"; break;
- case EOpConstructMat3: out.debug << "Construct mat3"; break;
- case EOpConstructMat4: out.debug << "Construct mat4"; break;
- case EOpConstructStruct: out.debug << "Construct structure"; break;
-
- case EOpLessThan: out.debug << "Compare Less Than"; break;
- case EOpGreaterThan: out.debug << "Compare Greater Than"; break;
- case EOpLessThanEqual: out.debug << "Compare Less Than or Equal"; break;
- case EOpGreaterThanEqual: out.debug << "Compare Greater Than or Equal"; break;
- case EOpVectorEqual: out.debug << "Equal"; break;
- case EOpVectorNotEqual: out.debug << "NotEqual"; break;
-
- case EOpMod: out.debug << "mod"; break;
- case EOpPow: out.debug << "pow"; break;
-
- case EOpAtan: out.debug << "arc tangent"; break;
-
- case EOpMin: out.debug << "min"; break;
- case EOpMax: out.debug << "max"; break;
- case EOpClamp: out.debug << "clamp"; break;
- case EOpMix: out.debug << "mix"; break;
- case EOpStep: out.debug << "step"; break;
- case EOpSmoothStep: out.debug << "smoothstep"; break;
-
- case EOpDistance: out.debug << "distance"; break;
- case EOpDot: out.debug << "dot-product"; break;
- case EOpCross: out.debug << "cross-product"; break;
- case EOpFaceForward: out.debug << "face-forward"; break;
- case EOpReflect: out.debug << "reflect"; break;
- case EOpRefract: out.debug << "refract"; break;
- case EOpMul: out.debug << "component-wise multiply"; break;
-
- case EOpItof: out.debug << "itof"; break;
- case EOpFtoi: out.debug << "ftoi"; break;
- case EOpSkipPixels: out.debug << "skipPixels"; break;
- case EOpReadInput: out.debug << "readInput"; break;
- case EOpWritePixel: out.debug << "writePixel"; break;
- case EOpBitmapLsb: out.debug << "bitmapLSB"; break;
- case EOpBitmapMsb: out.debug << "bitmapMSB"; break;
- case EOpWriteOutput: out.debug << "writeOutput"; break;
- case EOpReadPixel: out.debug << "readPixel"; break;
-
- default: out.debug.message(EPrefixError, "Bad aggregation op");
- }
-
- if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
- out.debug << " (" << node->getCompleteString() << ")";
-
- out.debug << "\n";
-
- return true;
-}
-
-bool OutputSelection(bool /* preVisit */, TIntermSelection* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- OutputTreeText(out, node, oit->depth);
-
- out.debug << "Test condition and select";
- out.debug << " (" << node->getCompleteString() << ")\n";
-
- ++oit->depth;
-
- OutputTreeText(oit->infoSink, node, oit->depth);
- out.debug << "Condition\n";
- node->getCondition()->traverse(it);
-
- OutputTreeText(oit->infoSink, node, oit->depth);
- if (node->getTrueBlock()) {
- out.debug << "true case\n";
- node->getTrueBlock()->traverse(it);
- } else
- out.debug << "true case is null\n";
-
- if (node->getFalseBlock()) {
- OutputTreeText(oit->infoSink, node, oit->depth);
- out.debug << "false case\n";
- node->getFalseBlock()->traverse(it);
- }
-
- --oit->depth;
-
- return false;
-}
-
-void OutputConstantUnion(TIntermConstantUnion* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- int size = 0;
- if (node->getType().getBasicType() == EbtStruct)
- size = node->getType().getStructSize();
- else
- size = node->getType().getInstanceSize();
-
- for (int i = 0; i < size; i++) {
- OutputTreeText(out, node, oit->depth);
- switch (node->getType().getBasicType()) {
- case EbtBool:
- if (node->getUnionArrayPointer()[i].bConst)
- out.debug << "true";
- else
- out.debug << "false";
-
- out.debug << " (" << "const bool" << ")";
-
- out.debug << "\n";
- break;
- case EbtFloat:
- {
- char buf[300];
- sprintf(buf, "%f (%s)", node->getUnionArrayPointer()[i].fConst, "const float");
-
- out.debug << buf << "\n";
- }
- break;
- case EbtInt:
- {
- char buf[300];
- sprintf(buf, "%d (%s)", node->getUnionArrayPointer()[i].iConst, "const int");
-
- out.debug << buf << "\n";
- break;
- }
- default:
- out.info.message(EPrefixInternalError, "Unknown constant", node->getLine());
- break;
- }
- }
-}
-
-bool OutputLoop(bool /* preVisit */, TIntermLoop* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- OutputTreeText(out, node, oit->depth);
-
- out.debug << "Loop with condition ";
- if (! node->testFirst())
- out.debug << "not ";
- out.debug << "tested first\n";
-
- ++oit->depth;
-
- OutputTreeText(oit->infoSink, node, oit->depth);
- if (node->getTest()) {
- out.debug << "Loop Condition\n";
- node->getTest()->traverse(it);
- } else
- out.debug << "No loop condition\n";
-
- OutputTreeText(oit->infoSink, node, oit->depth);
- if (node->getBody()) {
- out.debug << "Loop Body\n";
- node->getBody()->traverse(it);
- } else
- out.debug << "No loop body\n";
-
- if (node->getTerminal()) {
- OutputTreeText(oit->infoSink, node, oit->depth);
- out.debug << "Loop Terminal Expression\n";
- node->getTerminal()->traverse(it);
- }
-
- --oit->depth;
-
- return false;
-}
-
-bool OutputBranch(bool /* previsit*/, TIntermBranch* node, TIntermTraverser* it)
-{
- TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
- TInfoSink& out = oit->infoSink;
-
- OutputTreeText(out, node, oit->depth);
-
- switch (node->getFlowOp()) {
- case EOpKill: out.debug << "Branch: Kill"; break;
- case EOpBreak: out.debug << "Branch: Break"; break;
- case EOpContinue: out.debug << "Branch: Continue"; break;
- case EOpReturn: out.debug << "Branch: Return"; break;
- default: out.debug << "Branch: Unknown Branch"; break;
- }
-
- if (node->getExpression()) {
- out.debug << " with expression\n";
- ++oit->depth;
- node->getExpression()->traverse(it);
- --oit->depth;
- } else
- out.debug << "\n";
-
- return false;
-}
-
-//
-// This function is the one to call externally to start the traversal.
-// Individual functions can be initialized to 0 to skip processing of that
-// type of node. It's children will still be processed.
-//
-void TIntermediate::outputTree(TIntermNode* root)
-{
- if (root == 0)
- return;
-
- TOutputTraverser it(infoSink);
-
- it.visitAggregate = OutputAggregate;
- it.visitBinary = OutputBinary;
- it.visitConstantUnion = OutputConstantUnion;
- it.visitSelection = OutputSelection;
- it.visitSymbol = OutputSymbol;
- it.visitUnary = OutputUnary;
- it.visitLoop = OutputLoop;
- it.visitBranch = OutputBranch;
-
- root->traverse(&it);
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/localintermediate.h b/src/mesa/shader/slang/MachineIndependent/localintermediate.h
deleted file mode 100755
index 5b4e5ea118f..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/localintermediate.h
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef _LOCAL_INTERMEDIATE_INCLUDED_
-#define _LOCAL_INTERMEDIATE_INCLUDED_
-
-#include "../Include/intermediate.h"
-#include "../Public/ShaderLang.h"
-#include "SymbolTable.h"
-
-struct TVectorFields {
- int offsets[4];
- int num;
-};
-
-//
-// Set of helper functions to help parse and build the tree.
-//
-class TInfoSink;
-class TIntermediate {
-public:
- POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
-
- TIntermediate(TInfoSink& i) : infoSink(i) { }
- TIntermSymbol* addSymbol(int Id, const TString&, const TType&, TSourceLoc);
- TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
- TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc, TSymbolTable&);
- TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
- TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
- TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, TSourceLoc, TSymbolTable&);
- TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc);
- TIntermAggregate* makeAggregate(TIntermNode* node, TSourceLoc);
- TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, TSourceLoc);
- TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc);
- TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc);
- TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc);
- TIntermConstantUnion* addConstantUnion(constUnion*, const TType&, TSourceLoc);
- TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
- TIntermTyped* copyConstUnion(TIntermConstantUnion*) ;
- TIntermConstantUnion* changeAggrToTempConst(TIntermAggregate*, TSymbolTable&, TSourceLoc );
- bool parseConstTree(TSourceLoc, TIntermNode*, constUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
- TIntermNode* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, TSourceLoc);
- TIntermBranch* addBranch(TOperator, TSourceLoc);
- TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc);
- TIntermTyped* addSwizzle(TVectorFields&, TSourceLoc);
- bool postProcess(TIntermNode*, EShLanguage);
- void remove(TIntermNode*);
- void outputTree(TIntermNode*);
- void removeChildNode(TIntermSequence&, TType&, int&, TIntermSequence::iterator&, TIntermAggregate*);
- TIntermTyped* removeChildNode(TIntermTyped*, TType*, TIntermAggregate*);
- bool removeMatrixConstNode(TIntermSequence&, TType&, TIntermAggregate*, int);
-
-protected:
- TInfoSink& infoSink;
-
-private:
- void operator=(TIntermediate&); // prevent assignments
-};
-
-#endif // _LOCAL_INTERMEDIATE_INCLUDED_
diff --git a/src/mesa/shader/slang/MachineIndependent/parseConst.cpp b/src/mesa/shader/slang/MachineIndependent/parseConst.cpp
deleted file mode 100755
index 1ea91b3c52d..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/parseConst.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "ParseHelper.h"
-
-//
-// Use this class to carry along data from node to node in
-// the traversal
-//
-class TConstTraverser : public TIntermTraverser {
-public:
- TConstTraverser(constUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t) : unionArray(cUnion), type(t),
- constructorType(constructType), singleConstantParam(singleConstParam), infoSink(sink), symbolTable(symTable), error(false), isMatrix(false), matrixSize(0) { index = 0; tOp = EOpNull;}
- int index ;
- constUnion *unionArray;
- TOperator tOp;
- TType type;
- TOperator constructorType;
- bool singleConstantParam;
- TInfoSink& infoSink;
- TSymbolTable& symbolTable;
- bool error;
- int size; // size of the constructor ( 4 for vec4)
- bool isMatrix;
- int matrixSize; // dimension of the matrix (nominal size and not the instance size)
-};
-
-//
-// The rest of the file are the traversal functions. The last one
-// is the one that starts the traversal.
-//
-// Return true from interior nodes to have the external traversal
-// continue on to children. If you process children yourself,
-// return false.
-//
-
-void ParseSymbol(TIntermSymbol* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
- TQualifier qualifier = node->getType().getQualifier();
- constUnion* unionArray = oit->unionArray;
- int instanceSize;
- if (oit->type.getBasicType() == EbtStruct)
- instanceSize = oit->type.getStructSize();
- else
- instanceSize = oit->type.getInstanceSize();
-
- if (oit->index >= instanceSize)
- return;
-
- if (qualifier != EvqConst) {
- char buf[200];
- sprintf(buf, "'constructor' : assigning non-constant to %s", oit->type.getCompleteString().c_str());
- oit->infoSink.info.message(EPrefixError, buf, node->getLine());
- oit->error = true;
- return ;
- }
- TSymbol* symbol = oit->symbolTable.find(node->getSymbol());
- TVariable* tVar = static_cast<TVariable*>(symbol);
-
- constUnion* constArray = tVar->getConstPointer();
- if (!constArray) {
- char buf[200];
- sprintf(buf, "'constructor' : constant '%s' has not been initialized correctly", node->getSymbol().c_str());
- oit->infoSink.info.message(EPrefixError, buf, node->getLine());
- oit->error = true;
- return;
- }
- int symbolSize;
-
- if (tVar->getType().getBasicType() == EbtStruct)
- symbolSize = tVar->getType().getStructSize();
- else
- symbolSize = tVar->getType().getInstanceSize();
-
- // for constructors such as ivec4(vec4), if vec4 is a symbol node, then the appropriate conversion is required as the
- // types do not match
- for (int i = 0; i < symbolSize; i++) {
- if (oit->index >= instanceSize)
- return;
- if (tVar->getType().getBasicType() == oit->type.getBasicType() || oit->type.getBasicType() == EbtStruct)
- (unionArray[oit->index]) = constArray[i];
- else {
- switch (tVar->getType().getBasicType()) {
- case EbtFloat:
- switch (oit->type.getBasicType()) {
- case EbtInt: unionArray[oit->index].iConst = static_cast<int> (constArray[i].fConst); break;
- case EbtBool: unionArray[oit->index].bConst = constArray[i].fConst != 0.0; break;
- default: oit->infoSink.info.message(EPrefixInternalError, "Incorrect type, cannot parse symbol", node->getLine()); break;
- }
- break;
- case EbtInt:
- switch (oit->type.getBasicType()) {
- case EbtFloat: unionArray[oit->index].fConst = static_cast<float>(constArray[i].iConst); break;
- case EbtBool: unionArray[oit->index].bConst = constArray[i].iConst != 0 ; break;
- default: oit->infoSink.info.message(EPrefixInternalError, "Incorrect type, cannot parse symbol", node->getLine()); break;
- }
- break;
- case EbtBool:
- switch (oit->type.getBasicType()) {
- case EbtFloat: unionArray[oit->index].fConst = static_cast<float>(constArray[i].bConst); break;
- case EbtInt: unionArray[oit->index].iConst = static_cast<int> (constArray[i].bConst); break;
- default: oit->infoSink.info.message(EPrefixInternalError, "Incorrect type, cannot parse symbol", node->getLine()); break;
- }
- break;
- default: oit->infoSink.info.message(EPrefixInternalError, "Incorrect type, cannot parse symbol", node->getLine()); break;
- }
- }
- (oit->index)++;
- }
-}
-
-bool ParseBinary(bool /* preVisit */, TIntermBinary* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
-
- TQualifier qualifier = node->getType().getQualifier();
-
- if (qualifier != EvqConst) {
- char buf[200];
- sprintf(buf, "'constructor' : assigning non-constant to %s", oit->type.getCompleteString().c_str());
- oit->infoSink.info.message(EPrefixError, buf, node->getLine());
- oit->error = true;
- return false;
- }
-
- oit->infoSink.info.message(EPrefixInternalError, "Binary Node found in constant constructor", node->getLine());
-
- return false;
-}
-
-bool ParseUnary(bool /* preVisit */, TIntermUnary* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
-
- char buf[200];
- sprintf(buf, "'constructor' : assigning non-constant to '%s'", oit->type.getCompleteString().c_str());
- oit->infoSink.info.message(EPrefixError, buf, node->getLine());
- oit->error = true;
- return false;
-}
-
-bool ParseAggregate(bool /* preVisit */, TIntermAggregate* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
-
- if (!node->isConstructor() && node->getOp() != EOpComma) {
- char buf[200];
- sprintf(buf, "'constructor' : assigning non-constant to '%s'", oit->type.getCompleteString().c_str());
- oit->infoSink.info.message(EPrefixError, buf, node->getLine());
- oit->error = true;
- return false;
- }
-
- if (node->getSequence().size() == 0) {
- oit->error = true;
- return false;
- }
-
- bool flag = node->getSequence().size() == 1 && node->getSequence()[0]->getAsTyped()->getAsConstantUnion();
- if (flag)
- {
- oit->singleConstantParam = true;
- oit->constructorType = node->getOp();
- if (node->getType().getBasicType() == EbtStruct)
- oit->size = node->getType().getStructSize();
- else
- oit->size = node->getType().getInstanceSize();
- if (node->getType().isMatrix()) {
- oit->isMatrix = true;
- oit->matrixSize = node->getType().getNominalSize();
- }
- }
-
- for (TIntermSequence::iterator p = node->getSequence().begin();
- p != node->getSequence().end(); p++) {
-
- if (node->getOp() == EOpComma)
- oit->index = 0;
-
- (*p)->traverse(oit);
- }
- if (flag)
- {
- oit->singleConstantParam = false;
- oit->constructorType = EOpNull;
- oit->size = 0;
- oit->isMatrix = false;
- oit->matrixSize = 0;
- }
- return false;
-}
-
-bool ParseSelection(bool /* preVisit */, TIntermSelection* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
- oit->infoSink.info.message(EPrefixInternalError, "Selection Node found in constant constructor", node->getLine());
- oit->error = true;
- return false;
-}
-
-void ParseConstantUnion(TIntermConstantUnion* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
- constUnion* leftUnionArray = oit->unionArray;
- int instanceSize;
- if (oit->type.getBasicType() == EbtStruct)
- instanceSize = oit->type.getStructSize();
- else
- instanceSize = oit->type.getInstanceSize();
-
- if (oit->index >= instanceSize)
- return;
-
- if (!oit->singleConstantParam) {
- int size;
- if (node->getType().getBasicType() == EbtStruct)
- size = node->getType().getStructSize();
- else
- size = node->getType().getInstanceSize();
-
- constUnion *rightUnionArray = node->getUnionArrayPointer();
- for (int i=0; i < size; i++) {
- if (oit->index >= instanceSize)
- return;
- leftUnionArray[oit->index] = rightUnionArray[i];
-
- (oit->index)++;
- }
- } else {
- int size, totalSize, matrixSize;
- bool isMatrix = false;
- size = oit->size;
- matrixSize = oit->matrixSize;
- isMatrix = oit->isMatrix;
- totalSize = oit->index + size ;
- constUnion *rightUnionArray = node->getUnionArrayPointer();
- if (!isMatrix) {
- int count = 0;
- for (int i = oit->index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
-
- leftUnionArray[i] = rightUnionArray[count];
-
- (oit->index)++;
- if (node->getType().getBasicType() == EbtStruct && node->getType().getStructSize() > 1 ||
- node->getType().getBasicType() != EbtStruct && node->getType().getInstanceSize() > 1)
- count++;
- }
- } else { // for matrix constructors
- int count = 0;
- int index = oit->index;
- for (int i = index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
- if (index - i == 0 || (i - index) % (matrixSize + 1) == 0 )
- leftUnionArray[i] = rightUnionArray[count];
- else
- leftUnionArray[i].fConst = 0.0;
-
- (oit->index)++;
- if (node->getType().getBasicType() == EbtStruct && node->getType().getStructSize() > 1 ||
- node->getType().getBasicType() != EbtStruct && node->getType().getInstanceSize() > 1)
- count++;
- }
- }
- }
-}
-
-bool ParseLoop(bool /* preVisit */, TIntermLoop* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
- oit->infoSink.info.message(EPrefixInternalError, "Loop Node found in constant constructor", node->getLine());
- oit->error = true;
- return false;
-}
-
-bool ParseBranch(bool /* previsit*/, TIntermBranch* node, TIntermTraverser* it)
-{
- TConstTraverser* oit = static_cast<TConstTraverser*>(it);
- oit->infoSink.info.message(EPrefixInternalError, "Branch Node found in constant constructor", node->getLine());
- oit->error = true;
- return false;
-}
-
-//
-// This function is the one to call externally to start the traversal.
-// Individual functions can be initialized to 0 to skip processing of that
-// type of node. It's children will still be processed.
-//
-bool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, constUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
-{
- if (root == 0)
- return false;
-
- TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, symbolTable, t);
-
- it.visitAggregate = ParseAggregate;
- it.visitBinary = ParseBinary;
- it.visitConstantUnion = ParseConstantUnion;
- it.visitSelection = ParseSelection;
- it.visitSymbol = ParseSymbol;
- it.visitUnary = ParseUnary;
- it.visitLoop = ParseLoop;
- it.visitBranch = ParseBranch;
-
- root->traverse(&it);
- if (it.error)
- return true;
- else
- return false;
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/atom.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/atom.c
deleted file mode 100755
index b409c99bb74..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/atom.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-/* */
-/* atom.c */
-/* */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "slglobals.h"
-
-#undef malloc
-#undef realloc
-#undef free
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*//////////////////////////////////////// String table: ////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-static const struct {
- int val;
- const char *str;
-} tokens[] = {
- { CPP_AND_OP, "&&" },
- { CPP_AND_ASSIGN, "&=" },
- { CPP_SUB_ASSIGN, "-=" },
- { CPP_MOD_ASSIGN, "%=" },
- { CPP_ADD_ASSIGN, "+=" },
- { CPP_DIV_ASSIGN, "/=" },
- { CPP_MUL_ASSIGN, "*=" },
- { CPP_RIGHT_BRACKET, ":>" },
- { CPP_EQ_OP, "==" },
- { CPP_XOR_OP, "^^" },
- { CPP_XOR_ASSIGN, "^=" },
- { CPP_FLOATCONSTANT, "<float-const>" },
- { CPP_GE_OP, ">=" },
- { CPP_RIGHT_OP, ">>" },
- { CPP_RIGHT_ASSIGN, ">>=" },
- { CPP_IDENTIFIER, "<ident>" },
- { CPP_INTCONSTANT, "<int-const>" },
- { CPP_LE_OP, "<=" },
- { CPP_LEFT_OP, "<<" },
- { CPP_LEFT_ASSIGN, "<<=" },
- { CPP_LEFT_BRACKET, "<:" },
- { CPP_LEFT_BRACE, "<%" },
- { CPP_DEC_OP, "--" },
- { CPP_RIGHT_BRACE, "%>" },
- { CPP_NE_OP, "!=" },
- { CPP_OR_OP, "||" },
- { CPP_OR_ASSIGN, "|=" },
- { CPP_INC_OP, "++" },
- { CPP_STRCONSTANT, "<string-const>" },
- { CPP_TYPEIDENTIFIER, "<type-ident>" },
-};
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*//////////////////////////////////////// String table: ////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-#define INIT_STRING_TABLE_SIZE 16384
-
-typedef struct StringTable_Rec {
- char *strings;
- int nextFree;
- int size;
-} StringTable;
-
-/*
- * InitStringTable() - Initialize the string table.
- *
- */
-
-static int InitStringTable(StringTable *stable)
-{
- stable->strings = (char *) malloc(INIT_STRING_TABLE_SIZE);
- if (!stable->strings)
- return 0;
- /* Zero-th offset means "empty" so don't use it. */
- stable->nextFree = 1;
- stable->size = INIT_STRING_TABLE_SIZE;
- return 1;
-} /* InitStringTable */
-
-/*
- * FreeStringTable() - Free the string table.
- *
- */
-
-static void FreeStringTable(StringTable *stable)
-{
- if (stable->strings)
- free(stable->strings);
- stable->strings = NULL;
- stable->nextFree = 0;
- stable->size = 0;
-} /* FreeStringTable */
-
-/*
- * HashString() - Hash a string with the base hash function.
- *
- */
-
-static int HashString(const char *s)
-{
- int hval = 0;
-
- while (*s) {
- hval = (hval*13507 + *s*197) ^ (hval >> 2);
- s++;
- }
- return hval & 0x7fffffff;
-} /* HashString */
-
-/*
- * HashString2() - Hash a string with the incrimenting hash function.
- *
- */
-
-static int HashString2(const char *s)
-{
- int hval = 0;
-
- while (*s) {
- hval = (hval*729 + *s*37) ^ (hval >> 1);
- s++;
- }
- return hval;
-} /* HashString2 */
-
-/*
- * AddString() - Add a string to a string table. Return it's offset.
- *
- */
-
-static int AddString(StringTable *stable, const char *s)
-{
- int len, loc;
- char *str;
-
- len = (int) strlen(s);
- if (stable->nextFree + len + 1 >= stable->size) {
- assert(stable->size < 1000000);
- str = (char *) malloc(stable->size*2);
- memcpy(str, stable->strings, stable->size);
- free(stable->strings);
- stable->strings = str;
- }
- loc = stable->nextFree;
- strcpy(&stable->strings[loc], s);
- stable->nextFree += len + 1;
- return loc;
-} /* AddString */
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*///////////////////////////////////////// Hash table: /////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-#define INIT_HASH_TABLE_SIZE 2047
-#define HASH_TABLE_MAX_COLLISIONS 3
-
-typedef struct HashEntry_Rec {
- int index; /* String table offset of string representation */
- int value; /* Atom (symbol) value */
-} HashEntry;
-
-typedef struct HashTable_Rec {
- HashEntry *entry;
- int size;
- int entries;
- int counts[HASH_TABLE_MAX_COLLISIONS + 1];
-} HashTable;
-
-/*
- * InitHashTable() - Initialize the hash table.
- *
- */
-
-static int InitHashTable(HashTable *htable, int fsize)
-{
- int ii;
-
- htable->entry = (HashEntry *) malloc(sizeof(HashEntry)*fsize);
- if (!htable->entry)
- return 0;
- htable->size = fsize;
- for (ii = 0; ii < fsize; ii++) {
- htable->entry[ii].index = 0;
- htable->entry[ii].value = 0;
- }
- htable->entries = 0;
- for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++)
- htable->counts[ii] = 0;
- return 1;
-} /* InitHashTable */
-
-/*
- * FreeHashTable() - Free the hash table.
- *
- */
-
-static void FreeHashTable(HashTable *htable)
-{
- if (htable->entry)
- free(htable->entry);
- htable->entry = NULL;
- htable->size = 0;
- htable->entries = 0;
-} /* FreeHashTable */
-
-/*
- * Empty() - See if a hash table entry is empty.
- *
- */
-
-static int Empty(HashTable *htable, int hashloc)
-{
- assert(hashloc >= 0 && hashloc < htable->size);
- if (htable->entry[hashloc].index == 0) {
- return 1;
- } else {
- return 0;
- }
-} /* Empty */
-
-/*
- * Match() - See if a hash table entry is matches a string.
- *
- */
-
-static int Match(HashTable *htable, StringTable *stable, const char *s, int hashloc)
-{
- int strloc;
-
- strloc = htable->entry[hashloc].index;
- if (!strcmp(s, &stable->strings[strloc])) {
- return 1;
- } else {
- return 0;
- }
-} /* Match */
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*///////////////////////////////////////// Atom table: /////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-#define INIT_ATOM_TABLE_SIZE 1024
-
-
-struct AtomTable_Rec {
- StringTable stable; /* String table. */
- HashTable htable; /* Hashes string to atom number and token value. Multiple strings can */
- /* have the same token value but each unique string is a unique atom. */
- int *amap; /* Maps atom value to offset in string table. Atoms all map to unique */
- /* strings except for some undefined values in the lower, fixed part */
- /* of the atom table that map to "<undefined>". The lowest 256 atoms */
- /* correspond to single character ASCII values except for alphanumeric */
- /* characters and '_', which can be other tokens. Next come the */
- /* language tokens with their atom values equal to the token value. */
- /* Then come predefined atoms, followed by user specified identifiers. */
- int *arev; /* Reversed atom for symbol table use. */
- int nextFree;
- int size;
-};
-
-static AtomTable latable = { { 0 } };
-AtomTable *atable = &latable;
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom);
-
-/*
- * GrowAtomTable() - Grow the atom table to at least "size" if it's smaller.
- *
- */
-
-static int GrowAtomTable(AtomTable *atable, int size)
-{
- int *newmap, *newrev;
-
- if (atable->size < size) {
- if (atable->amap) {
- newmap = realloc(atable->amap, sizeof(int)*size);
- newrev = realloc(atable->arev, sizeof(int)*size);
- } else {
- newmap = malloc(sizeof(int)*size);
- newrev = malloc(sizeof(int)*size);
- atable->size = 0;
- }
- if (!newmap || !newrev) {
- /* failed to grow -- error */
- if (newmap)
- atable->amap = newmap;
- if (newrev)
- atable->amap = newrev;
- return -1;
- }
- memset(&newmap[atable->size], 0, (size - atable->size) * sizeof(int));
- memset(&newrev[atable->size], 0, (size - atable->size) * sizeof(int));
- atable->amap = newmap;
- atable->arev = newrev;
- atable->size = size;
- }
- return 0;
-} /* GrowAtomTable */
-
-/*
- * lReverse() - Reverse the bottom 20 bits of a 32 bit int.
- *
- */
-
-static int lReverse(int fval)
-{
- unsigned int in = fval;
- int result = 0, cnt = 0;
-
- while(in) {
- result <<= 1;
- result |= in&1;
- in >>= 1;
- cnt++;
- }
-
- /* Don't use all 31 bits. One million atoms is plenty and sometimes the */
- /* upper bits are used for other things. */
-
- if (cnt < 20)
- result <<= 20 - cnt;
- return result;
-} /* lReverse */
-
-/*
- * AllocateAtom() - Allocate a new atom. Associated with the "undefined" value of -1.
- *
- */
-
-static int AllocateAtom(AtomTable *atable)
-{
- if (atable->nextFree >= atable->size)
- GrowAtomTable(atable, atable->nextFree*2);
- atable->amap[atable->nextFree] = -1;
- atable->arev[atable->nextFree] = lReverse(atable->nextFree);
- atable->nextFree++;
- return atable->nextFree - 1;
-} /* AllocateAtom */
-
-/*
- * SetAtomValue() - Allocate a new atom associated with "hashindex".
- *
- */
-
-static void SetAtomValue(AtomTable *atable, int atomnumber, int hashindex)
-{
- atable->amap[atomnumber] = atable->htable.entry[hashindex].index;
- atable->htable.entry[hashindex].value = atomnumber;
-} /* SetAtomValue */
-
-/*
- * FindHashLoc() - Find the hash location for this string. Return -1 it hash table is full.
- *
- */
-
-static int FindHashLoc(AtomTable *atable, const char *s)
-{
- int hashloc, hashdelta, count;
- int FoundEmptySlot = 0;
- int collision[HASH_TABLE_MAX_COLLISIONS + 1];
-
- hashloc = HashString(s) % atable->htable.size;
- if (!Empty(&atable->htable, hashloc)) {
- if (Match(&atable->htable, &atable->stable, s, hashloc))
- return hashloc;
- collision[0] = hashloc;
- hashdelta = HashString2(s);
- count = 0;
- while (count < HASH_TABLE_MAX_COLLISIONS) {
- hashloc = ((hashloc + hashdelta) & 0x7fffffff) % atable->htable.size;
- if (!Empty(&atable->htable, hashloc)) {
- if (Match(&atable->htable, &atable->stable, s, hashloc)) {
- return hashloc;
- }
- } else {
- FoundEmptySlot = 1;
- break;
- }
- count++;
- collision[count] = hashloc;
- }
-
- if (!FoundEmptySlot) {
- if (cpp->options.DumpAtomTable) {
- int ii;
- char str[200];
- sprintf(str, "*** Hash failed with more than %d collisions. Must increase hash table size. ***",
- HASH_TABLE_MAX_COLLISIONS);
- CPPShInfoLogMsg(str);
-
- sprintf(str, "*** New string \"%s\", hash=%04x, delta=%04x", s, collision[0], hashdelta);
- CPPShInfoLogMsg(str);
- for (ii = 0; ii <= HASH_TABLE_MAX_COLLISIONS; ii++) {
- sprintf(str, "*** Collides on try %d at hash entry %04x with \"%s\"",
- ii + 1, collision[ii], GetAtomString(atable, atable->htable.entry[collision[ii]].value));
- CPPShInfoLogMsg(str);
- }
- }
- return -1;
- } else {
- atable->htable.counts[count]++;
- }
- }
- return hashloc;
-} /* FindHashLoc */
-
-/*
- * IncreaseHashTableSize()
- *
- */
-
-static int IncreaseHashTableSize(AtomTable *atable)
-{
- int ii, strloc, oldhashloc, value, size;
- AtomTable oldtable;
- char *s;
-
- /* Save the old atom table and create a new one: */
-
- oldtable = *atable;
- size = oldtable.htable.size*2 + 1;
- if (!InitAtomTable(atable, size))
- return 0;
-
- /* Add all the existing values to the new atom table preserving their atom values: */
-
- for (ii = atable->nextFree; ii < oldtable.nextFree; ii++) {
- strloc = oldtable.amap[ii];
- s = &oldtable.stable.strings[strloc];
- oldhashloc = FindHashLoc(&oldtable, s);
- assert(oldhashloc >= 0);
- value = oldtable.htable.entry[oldhashloc].value;
- AddAtomFixed(atable, s, value);
- }
- FreeAtomTable(&oldtable);
- return 1;
-} /* IncreaseHashTableSize */
-
-/*
- * LookUpAddStringHash() - Lookup a string in the hash table. If it's not there, add it and
- * initialize the atom value in the hash table to 0. Return the hash table index.
- */
-
-static int LookUpAddStringHash(AtomTable *atable, const char *s)
-{
- int hashloc, strloc;
-
- while(1) {
- hashloc = FindHashLoc(atable, s);
- if (hashloc >= 0)
- break;
- IncreaseHashTableSize(atable);
- }
-
- if (Empty(&atable->htable, hashloc)) {
- atable->htable.entries++;
- strloc = AddString(&atable->stable, s);
- atable->htable.entry[hashloc].index = strloc;
- atable->htable.entry[hashloc].value = 0;
- }
- return hashloc;
-} /* LookUpAddStringHash */
-
-/*
- * LookUpAddString() - Lookup a string in the hash table. If it's not there, add it and
- * initialize the atom value in the hash table to the next atom number.
- * Return the atom value of string.
- */
-
-int LookUpAddString(AtomTable *atable, const char *s)
-{
- int hashindex, atom;
-
- hashindex = LookUpAddStringHash(atable, s);
- atom = atable->htable.entry[hashindex].value;
- if (atom == 0) {
- atom = AllocateAtom(atable);
- SetAtomValue(atable, atom, hashindex);
- }
- return atom;
-} /* LookUpAddString */
-
-/*
- * GetAtomString()
- *
- */
-
-const char *GetAtomString(AtomTable *atable, int atom)
-{
- int soffset;
-
- if (atom > 0 && atom < atable->nextFree) {
- soffset = atable->amap[atom];
- if (soffset > 0 && soffset < atable->stable.nextFree) {
- return &atable->stable.strings[soffset];
- } else {
- return "<internal error: bad soffset>";
- }
- } else {
- if (atom == 0) {
- return "<null atom>";
- } else {
- if (atom == EOF) {
- return "<EOF>";
- } else {
- return "<invalid atom>";
- }
- }
- }
-} /* GetAtomString */
-
-/*
- * GetReversedAtom()
- *
- */
-
-int GetReversedAtom(AtomTable *atable, int atom)
-{
- if (atom > 0 && atom < atable->nextFree) {
- return atable->arev[atom];
- } else {
- return 0;
- }
-} /* GetReversedAtom */
-
-/*
- * AddAtom() - Add a string to the atom, hash and string tables if it isn't already there.
- * Return it's atom index.
- */
-
-int AddAtom(AtomTable *atable, const char *s)
-{
- int atom;
-
- atom = LookUpAddString(atable, s);
- return atom;
-} /* AddAtom */
-
-/*
- * AddAtomFixed() - Add an atom to the hash and string tables if it isn't already there.
- * Assign it the atom value of "atom".
- */
-
-static int AddAtomFixed(AtomTable *atable, const char *s, int atom)
-{
- int hashindex, lsize;
-
- hashindex = LookUpAddStringHash(atable, s);
- if (atable->nextFree >= atable->size || atom >= atable->size) {
- lsize = atable->size*2;
- if (lsize <= atom)
- lsize = atom + 1;
- GrowAtomTable(atable, lsize);
- }
- atable->amap[atom] = atable->htable.entry[hashindex].index;
- atable->htable.entry[hashindex].value = atom;
- /*if (atom >= atable->nextFree) */
- /* atable->nextFree = atom + 1; */
- while (atom >= atable->nextFree) {
- atable->arev[atable->nextFree] = lReverse(atable->nextFree);
- atable->nextFree++;
- }
- return atom;
-} /* AddAtomFixed */
-
-/*
- * InitAtomTable() - Initialize the atom table.
- *
- */
-
-int InitAtomTable(AtomTable *atable, int htsize)
-{
- int ii;
-
- htsize = htsize <= 0 ? INIT_HASH_TABLE_SIZE : htsize;
- if (!InitStringTable(&atable->stable))
- return 0;
- if (!InitHashTable(&atable->htable, htsize))
- return 0;
-
- atable->nextFree = 0;
- atable->amap = NULL;
- atable->size = 0;
- GrowAtomTable(atable, INIT_ATOM_TABLE_SIZE);
- if (!atable->amap)
- return 0;
-
- /* Initialize lower part of atom table to "<undefined>" atom: */
-
- AddAtomFixed(atable, "<undefined>", 0);
- for (ii = 0; ii < FIRST_USER_TOKEN_SY; ii++)
- atable->amap[ii] = atable->amap[0];
-
- /* Add single character tokens to the atom table: */
-
- {
- const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
- char t[2];
-
- t[1] = '\0';
- while (*s) {
- t[0] = *s;
- AddAtomFixed(atable, t, s[0]);
- s++;
- }
- }
-
- /* Add multiple character scanner tokens : */
-
- for (ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++)
- AddAtomFixed(atable, tokens[ii].str, tokens[ii].val);
-
- /* Add error symbol if running in error mode: */
-
- if (cpp->options.ErrorMode)
- AddAtomFixed(atable, "error", ERROR_SY);
-
- AddAtom(atable, "<*** end fixed atoms ***>");
-
- return 1;
-} /* InitAtomTable */
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*//////////////////////////////// Debug Printing Functions: ////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-/*
- * PrintAtomTable()
- *
- */
-
-void PrintAtomTable(AtomTable *atable)
-{
- int ii;
- char str[200];
-
- for (ii = 0; ii < atable->nextFree; ii++) {
- sprintf(str, "%d: \"%s\"", ii, &atable->stable.strings[atable->amap[ii]]);
- CPPDebugLogMsg(str);
- }
- sprintf(str, "Hash table: size=%d, entries=%d, collisions=",
- atable->htable.size, atable->htable.entries);
- CPPDebugLogMsg(str);
- for (ii = 0; ii < HASH_TABLE_MAX_COLLISIONS; ii++) {
- sprintf(str, " %d", atable->htable.counts[ii]);
- CPPDebugLogMsg(str);
- }
-
-} /* PrintAtomTable */
-
-
-/*
- * GetStringOfAtom()
- *
- */
-
-char* GetStringOfAtom(AtomTable *atable, int atom)
-{
- char* chr_str;
- chr_str=&atable->stable.strings[atable->amap[atom]];
- return chr_str;
-} /* GetStringOfAtom */
-
-/*
- * FreeAtomTable() - Free the atom table and associated memory
- *
- */
-
-void FreeAtomTable(AtomTable *atable)
-{
- FreeStringTable(&atable->stable);
- FreeHashTable(&atable->htable);
- if (atable->amap)
- free(atable->amap);
- if (atable->arev)
- free(atable->arev);
- atable->amap = NULL;
- atable->arev = NULL;
- atable->nextFree = 0;
- atable->size = 0;
-} /* FreeAtomTable */
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*/////////////////////////////////////// End of atom.c /////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/atom.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/atom.h
deleted file mode 100755
index 4e509d6ba4c..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/atom.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* atom.h */
-/* */
-
-#if !defined(__ATOM_H)
-#define __ATOM_H 1
-
-typedef struct AtomTable_Rec AtomTable;
-
-extern AtomTable *atable;
-
-int InitAtomTable(AtomTable *atable, int htsize);
-void FreeAtomTable(AtomTable *atable);
-int AddAtom(AtomTable *atable, const char *s);
-void PrintAtomTable(AtomTable *atable);
-int LookUpAddString(AtomTable *atable, const char *s);
-const char *GetAtomString(AtomTable *atable, int atom);
-int GetReversedAtom(AtomTable *atable, int atom);
-char* GetStringOfAtom(AtomTable *atable, int atom);
-#endif /* !defined(__ATOM_H) */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/compile.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/compile.h
deleted file mode 100755
index 24673461e68..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/compile.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* compile.h */
-/* */
-
-#if !defined(__COMPILE_H)
-#define __COMPILE_H 1
-
-int InitCPPStruct(void);
-
-typedef struct Options_Rec{
- const char *profileString;
- int ErrorMode;
- int Quiet;
-
- /* Debug The Compiler options: */
- int DumpAtomTable;
-} Options;
-
-struct CPPStruct_Rec {
- /* Public members */
- SourceLoc *pLastSourceLoc; /* Set at the start of each statement by the tree walkers */
- Options options; /* Compile options and parameters */
-
- /* Private members */
- SourceLoc lastSourceLoc;
-
- /* Scanner data: */
-
- SourceLoc *tokenLoc; /* Source location of most recent token seen by the scanner */
- int mostRecentToken; /* Most recent token seen by the scanner */
- InputSrc *currentInput;
- int previous_token;
- int notAVersionToken; /* used to make sure that #version is the first token seen in the file, if present */
-
- void *pC; /* storing the parseContext of the compile object in cpp. */
-
- /* Private members: */
- SourceLoc ltokenLoc;
- int ifdepth; /*current #if-#else-#endif nesting in the cpp.c file (pre-processor) */
- int elsedepth[64]; /*Keep a track of #if depth..Max allowed is 64. */
- int elsetracker; /*#if-#else and #endif constructs...Counter. */
- const char *ErrMsg;
- int CompileError; /*Indicate compile error when #error, #else,#elif mismatch. */
-
- /* */
- /* Globals used to communicate between PaParseStrings() and yy_input()and */
- /* also across the files.(gen_glslang.cpp and scanner.c) */
- /* */
- int PaWhichStr; /* which string we're parsing */
- int* PaStrLen; /* array of lengths of the PaArgv strings */
- int PaArgc; /* count of strings in the array */
- char** PaArgv; /* our array of strings to parse */
- unsigned int tokensBeforeEOF : 1;
-};
-
-#endif /* !defined(__COMPILE_H) */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp.c
deleted file mode 100755
index f8da59b382c..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp.c
+++ /dev/null
@@ -1,1037 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* cpp.c */
-/* */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "slglobals.h"
-
-static int CPPif(yystypepp * yylvalpp);
-
-/* Don't use memory.c's replacements, as we clean up properly here */
-#undef malloc
-#undef free
-
-static int bindAtom = 0;
-static int constAtom = 0;
-static int defaultAtom = 0;
-static int defineAtom = 0;
-static int definedAtom = 0;
-static int elseAtom = 0;
-static int elifAtom = 0;
-static int endifAtom = 0;
-static int ifAtom = 0;
-static int ifdefAtom = 0;
-static int ifndefAtom = 0;
-static int includeAtom = 0;
-static int lineAtom = 0;
-static int pragmaAtom = 0;
-static int texunitAtom = 0;
-static int undefAtom = 0;
-static int errorAtom = 0;
-static int __LINE__Atom = 0;
-static int __FILE__Atom = 0;
-static int __VERSION__Atom = 0;
-static int versionAtom = 0;
-static int extensionAtom = 0;
-
-static Scope *macros = 0;
-#define MAX_MACRO_ARGS 64
-#define MAX_IF_NESTING 64
-
-static SourceLoc ifloc; /* outermost #if */
-
-int InitCPP(void)
-{
- char buffer[64], *t;
- const char *f;
- /* Add various atoms needed by the CPP line scanner: */
- bindAtom = LookUpAddString(atable, "bind");
- constAtom = LookUpAddString(atable, "const");
- defaultAtom = LookUpAddString(atable, "default");
- defineAtom = LookUpAddString(atable, "define");
- definedAtom = LookUpAddString(atable, "defined");
- elifAtom = LookUpAddString(atable, "elif");
- elseAtom = LookUpAddString(atable, "else");
- endifAtom = LookUpAddString(atable, "endif");
- ifAtom = LookUpAddString(atable, "if");
- ifdefAtom = LookUpAddString(atable, "ifdef");
- ifndefAtom = LookUpAddString(atable, "ifndef");
- includeAtom = LookUpAddString(atable, "include");
- lineAtom = LookUpAddString(atable, "line");
- pragmaAtom = LookUpAddString(atable, "pragma");
- texunitAtom = LookUpAddString(atable, "texunit");
- undefAtom = LookUpAddString(atable, "undef");
- errorAtom = LookUpAddString(atable, "error");
- __LINE__Atom = LookUpAddString(atable, "__LINE__");
- __FILE__Atom = LookUpAddString(atable, "__FILE__");
- __VERSION__Atom = LookUpAddString(atable, "__VERSION__");
- versionAtom = LookUpAddString(atable, "version");
- extensionAtom = LookUpAddString(atable, "extension");
- macros = NewScopeInPool(mem_CreatePool(0, 0));
- strcpy(buffer, "PROFILE_");
- t = buffer + strlen(buffer);
- f = cpp->options.profileString;
- while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
- *t++ = toupper(*f++);
- *t = 0;
- return 1;
-} /* InitCPP */
-
-int FreeCPP(void)
-{
- if (macros)
- {
- mem_FreePool(macros->pool);
- macros = 0;
- }
-
- return 1;
-}
-
-int FinalCPP(void)
-{
- if (cpp->ifdepth)
- CPPErrorToInfoLog("#if mismatch");
- return 1;
-}
-
-static int CPPdefine(yystypepp * yylvalpp)
-{
- int token, name, args[MAX_MACRO_ARGS], argc;
- const char *message;
- MacroSymbol mac;
- Symbol *symb;
- SourceLoc dummyLoc;
- memset(&mac, 0, sizeof(mac));
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) {
- CPPErrorToInfoLog("#define");
- return token;
- }
- name = yylvalpp->sc_ident;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(' && !yylvalpp->sc_int) {
- /* gather arguments */
- argc = 0;
- do {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (argc == 0 && token == ')') break;
- if (token != CPP_IDENTIFIER) {
- CPPErrorToInfoLog("#define");
- return token;
- }
- if (argc < MAX_MACRO_ARGS)
- args[argc++] = yylvalpp->sc_ident;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- } while (token == ',');
- if (token != ')') {
- CPPErrorToInfoLog("#define");
- return token;
- }
- mac.argc = argc;
- mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
- memcpy(mac.args, args, argc * sizeof(int));
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- mac.body = NewTokenStream(GetAtomString(atable, name));
- while (token != '\n') {
- while (token == '\\') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- else
- RecordToken(mac.body, '\\', yylvalpp);
- }
- RecordToken(mac.body, token, yylvalpp);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- };
-
- symb = LookUpSymbol(macros, name);
- if (symb) {
- if (!symb->details.mac.undef) {
- /* already defined -- need to make sure they are identical */
- if (symb->details.mac.argc != mac.argc) goto error;
- for (argc=0; argc < mac.argc; argc++)
- if (symb->details.mac.args[argc] != mac.args[argc])
- goto error;
- RewindTokenStream(symb->details.mac.body);
- RewindTokenStream(mac.body);
- do {
- int old_lval, old_token;
- old_token = ReadToken(symb->details.mac.body, yylvalpp);
- old_lval = yylvalpp->sc_int;
- token = ReadToken(mac.body, yylvalpp);
- if (token != old_token || yylvalpp->sc_int != old_lval) {
- error:
- StoreStr("Macro Redefined");
- StoreStr(GetStringOfAtom(atable,name));
- message=GetStrfromTStr();
- DecLineNumber();
- CPPShInfoLogMsg(message);
- IncLineNumber();
- ResetTString();
- break; }
- } while (token > 0);
- }
- FreeMacro(&symb->details.mac);
- } else {
- dummyLoc.file = 0;
- dummyLoc.line = 0;
- symb = AddSymbol(&dummyLoc, macros, name, MACRO_S);
- }
- symb->details.mac = mac;
- return '\n';
-} /* CPPdefine */
-
-static int CPPundef(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- Symbol *symb;
- if(token == '\n'){
- CPPErrorToInfoLog("#undef");
- return token;
- }
- if (token != CPP_IDENTIFIER)
- goto error;
- symb = LookUpSymbol(macros, yylvalpp->sc_ident);
- if (symb) {
- symb->details.mac.undef = 1;
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- error:
- CPPErrorToInfoLog("#undef");
- }
- return token;
-} /* CPPundef */
-
-/* CPPelse -- skip forward to appropriate spot. This is actually used
-** to skip to and #endif after seeing an #else, AND to skip to a #else,
-** #elif, or #endif after a #if/#ifdef/#ifndef/#elif test was false
-*/
-
-static int CPPelse(int matchelse, yystypepp * yylvalpp)
-{
- int atom,depth=0;
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- while (token > 0) {
- if (token != '#') {
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- continue;
- }
- if ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) != CPP_IDENTIFIER)
- continue;
- atom = yylvalpp->sc_ident;
- if (atom == ifAtom || atom == ifdefAtom || atom == ifndefAtom){
- depth++; cpp->ifdepth++; cpp->elsetracker++;
- }
- else if (atom == endifAtom) {
- if(--depth<=0){
- cpp->elsedepth[cpp->elsetracker]=0;
- --cpp->elsetracker;
- if (cpp->ifdepth)
- --cpp->ifdepth;
- break;
- }
- --cpp->elsetracker;
- --cpp->ifdepth;
- }
- else if (((int)(matchelse) != 0)&& depth==0) {
- if (atom == elseAtom ) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- break;
- }
- else if (atom == elifAtom) {
- /* we decrement cpp->ifdepth here, because CPPif will increment
- * it and we really want to leave it alone */
- if (cpp->ifdepth){
- --cpp->ifdepth;
- --cpp->elsetracker;
- }
- return CPPif(yylvalpp);
- }
- }
- else if((atom==elseAtom) && (!ChkCorrectElseNesting())){
- CPPErrorToInfoLog("#else after a #else");
- cpp->CompileError=1;
- }
- };
- return token;
-}
-
-enum eval_prec {
- MIN_PREC,
- COND, LOGOR, LOGAND, OR, XOR, AND, EQUAL, RELATION, SHIFT, ADD, MUL, UNARY,
- MAX_PREC
-};
-
-static int op_logor(int a, int b) { return a || b; }
-static int op_logand(int a, int b) { return a && b; }
-static int op_or(int a, int b) { return a | b; }
-static int op_xor(int a, int b) { return a ^ b; }
-static int op_and(int a, int b) { return a & b; }
-static int op_eq(int a, int b) { return a == b; }
-static int op_ne(int a, int b) { return a != b; }
-static int op_ge(int a, int b) { return a >= b; }
-static int op_le(int a, int b) { return a <= b; }
-static int op_gt(int a, int b) { return a > b; }
-static int op_lt(int a, int b) { return a < b; }
-static int op_shl(int a, int b) { return a << b; }
-static int op_shr(int a, int b) { return a >> b; }
-static int op_add(int a, int b) { return a + b; }
-static int op_sub(int a, int b) { return a - b; }
-static int op_mul(int a, int b) { return a * b; }
-static int op_div(int a, int b) { return a / b; }
-static int op_mod(int a, int b) { return a % b; }
-static int op_pos(int a) { return a; }
-static int op_neg(int a) { return -a; }
-static int op_cmpl(int a) { return ~a; }
-static int op_not(int a) { return !a; }
-
-struct {
- int token, prec, (*op)(int, int);
-} binop[] = {
- { CPP_OR_OP, LOGOR, op_logor },
- { CPP_AND_OP, LOGAND, op_logand },
- { '|', OR, op_or },
- { '^', XOR, op_xor },
- { '&', AND, op_and },
- { CPP_EQ_OP, EQUAL, op_eq },
- { CPP_NE_OP, EQUAL, op_ne },
- { '>', RELATION, op_gt },
- { CPP_GE_OP, RELATION, op_ge },
- { '<', RELATION, op_lt },
- { CPP_LE_OP, RELATION, op_le },
- { CPP_LEFT_OP, SHIFT, op_shl },
- { CPP_RIGHT_OP, SHIFT, op_shr },
- { '+', ADD, op_add },
- { '-', ADD, op_sub },
- { '*', MUL, op_mul },
- { '/', MUL, op_div },
- { '%', MUL, op_mod },
-};
-
-struct {
- int token, (*op)(int);
-} unop[] = {
- { '+', op_pos },
- { '-', op_neg },
- { '~', op_cmpl },
- { '!', op_not },
-};
-
-#define ALEN(A) (sizeof(A)/sizeof(A[0]))
-
-static int eval(int token, int prec, int *res, int *err, yystypepp * yylvalpp)
-{
- int i, val;
- Symbol *s;
- if (token == CPP_IDENTIFIER) {
- if (yylvalpp->sc_ident == definedAtom) {
- int needclose = 0;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') {
- needclose = 1;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- if (token != CPP_IDENTIFIER)
- goto error;
- *res = (s = LookUpSymbol(macros, yylvalpp->sc_ident))
- ? !s->details.mac.undef : 0;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (needclose) {
- if (token != ')')
- goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- } else if (MacroExpand(yylvalpp->sc_ident, yylvalpp)) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- return eval(token, prec, res, err, yylvalpp);
- } else {
- goto error;
- }
- } else if (token == CPP_INTCONSTANT) {
- *res = yylvalpp->sc_int;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- } else if (token == '(') {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, MIN_PREC, res, err, yylvalpp);
- if (!*err) {
- if (token != ')')
- goto error;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- } else {
- for (i = ALEN(unop) - 1; i >= 0; i--) {
- if (unop[i].token == token)
- break;
- }
- if (i >= 0) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, UNARY, res, err, yylvalpp);
- *res = unop[i].op(*res);
- } else {
- goto error;
- }
- }
- while (!*err) {
- if (token == ')' || token == '\n') break;
- for (i = ALEN(binop) - 1; i >= 0; i--) {
- if (binop[i].token == token)
- break;
- }
- if (i < 0 || binop[i].prec <= prec)
- break;
- val = *res;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = eval(token, binop[i].prec, res, err, yylvalpp);
- *res = binop[i].op(val, *res);
- }
- return token;
-error:
- CPPErrorToInfoLog("incorrect preprocessor directive");
- *err = 1;
- *res = 0;
- return token;
-} /* eval */
-
-static int CPPif(yystypepp * yylvalpp) {
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- int res = 0, err = 0;
- cpp->elsetracker++;
- if (!cpp->ifdepth++)
- ifloc = *cpp->tokenLoc;
- if(cpp->ifdepth >MAX_IF_NESTING){
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- return 0;
- }
- token = eval(token, MIN_PREC, &res, &err, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following the preprocessor directive - expected a newline");
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- if (!res && !err) {
- token = CPPelse(1, yylvalpp);
- }
-
- return token;
-} /* CPPif */
-
-static int CPPifdef(int defined, yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- int name = yylvalpp->sc_ident;
- if(++cpp->ifdepth >MAX_IF_NESTING){
- CPPErrorToInfoLog("max #if nesting depth exceeded");
- return 0;
- }
- cpp->elsetracker++;
- if (token != CPP_IDENTIFIER) {
- defined ? CPPErrorToInfoLog("ifdef"):CPPErrorToInfoLog("ifndef");
- } else {
- Symbol *s = LookUpSymbol(macros, name);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #ifdef preprocessor directive - expected a newline");
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- if (((s && !s->details.mac.undef) ? 1 : 0) != defined)
- token = CPPelse(1, yylvalpp);
- }
- return token;
-} /* CPPifdef */
-
-static int CPPline(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#line");
- IncLineNumber();
- return token;
- }
- else if (token == CPP_INTCONSTANT) {
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- SetLineNumber(yylvalpp->sc_int);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token == CPP_INTCONSTANT) {
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- SetStringNumber(yylvalpp->sc_int);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if(token!='\n')
- CPPErrorToInfoLog("#line");
- }
- else if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#line");
- }
- }
- else{
- CPPErrorToInfoLog("#line");
- }
- return token;
-}
-
-static int CPPerror(yystypepp * yylvalpp) {
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- const char *message;
-
- while (token != '\n') {
- if (token == CPP_FLOATCONSTANT || token == CPP_INTCONSTANT){
- StoreStr(yylvalpp->symbol_name);
- }else if(token == CPP_IDENTIFIER || token == CPP_STRCONSTANT){
- StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
- }else {
- StoreStr(GetStringOfAtom(atable,token));
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- DecLineNumber();
- /*store this msg into the shader's information log..set the Compile Error flag!!!! */
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- cpp->CompileError=1;
- IncLineNumber();
- return '\n';
-}/*CPPerror */
-
-static int CPPpragma(yystypepp * yylvalpp)
-{
- char SrcStrName[2];
- char** allTokens;
- int tokenCount = 0;
- int maxTokenCount = 10;
- const char* SrcStr;
- int i;
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token=='\n') {
- DecLineNumber();
- CPPErrorToInfoLog("#pragma");
- IncLineNumber();
- return token;
- }
-
- allTokens = (char**)malloc(sizeof(char*) * maxTokenCount);
-
- while (token != '\n') {
- if (tokenCount >= maxTokenCount) {
- maxTokenCount *= 2;
- allTokens = (char**)realloc((char**)allTokens, sizeof(char*) * maxTokenCount);
- }
- switch (token) {
- case CPP_IDENTIFIER:
- SrcStr = GetAtomString(atable, yylvalpp->sc_ident);
- allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
- strcpy(allTokens[tokenCount++], SrcStr);
- break;
- case CPP_INTCONSTANT:
- SrcStr = yylvalpp->symbol_name;
- allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
- strcpy(allTokens[tokenCount++], SrcStr);
- break;
- case CPP_FLOATCONSTANT:
- SrcStr = yylvalpp->symbol_name;
- allTokens[tokenCount] = (char*)malloc(strlen(SrcStr) + 1);
- strcpy(allTokens[tokenCount++], SrcStr);
- break;
- case -1:
- /* EOF */
- CPPShInfoLogMsg("#pragma directive must end with a newline");
- return token;
- default:
- SrcStrName[0] = token;
- SrcStrName[1] = '\0';
- allTokens[tokenCount] = (char*)malloc(2);
- strcpy(allTokens[tokenCount++], SrcStrName);
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
-
- cpp->currentInput->ungetch(cpp->currentInput, token, yylvalpp);
- HandlePragma(allTokens, tokenCount);
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- for (i = 0; i < tokenCount; ++i) {
- free (allTokens[i]);
- }
- free (allTokens);
-
- return token;
-} /* CPPpragma */
-
-#define GL2_VERSION_NUMBER 110
-
-static int CPPversion(yystypepp * yylvalpp)
-{
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (cpp->notAVersionToken == 1)
- CPPShInfoLogMsg("#version must occur before any other statement in the program");
-
- if(token=='\n'){
- DecLineNumber();
- CPPErrorToInfoLog("#version");
- IncLineNumber();
- return token;
- }
- if (token != CPP_INTCONSTANT)
- CPPErrorToInfoLog("#version");
-
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- /*SetVersionNumber(yylvalpp->sc_int); */
-
- if (yylvalpp->sc_int != GL2_VERSION_NUMBER)
- CPPShInfoLogMsg("Version number not supported by GL2");
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-
- if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#version");
- }
- return token;
-} /* CPPversion */
-
-static int CPPextension(yystypepp * yylvalpp)
-{
-
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- char extensionName[80];
-
- if(token=='\n'){
- DecLineNumber();
- CPPShInfoLogMsg("extension name not specified");
- IncLineNumber();
- return token;
- }
-
- if (token != CPP_IDENTIFIER)
- CPPErrorToInfoLog("#extension");
-
- strcpy(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != ':') {
- CPPShInfoLogMsg("':' missing after extension name");
- return token;
- }
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != CPP_IDENTIFIER) {
- CPPShInfoLogMsg("behavior for extension not specified");
- return token;
- }
-
- updateExtensionBehavior(extensionName, GetAtomString(atable, yylvalpp->sc_ident));
-
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '\n'){
- return token;
- }
- else{
- CPPErrorToInfoLog("#extension");
- }
- return token;
-} /* CPPextension */
-
-int readCPPline(yystypepp * yylvalpp)
-{
- int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- const char *message;
- int isVersion = 0;
-
- if (token == CPP_IDENTIFIER) {
- if (yylvalpp->sc_ident == defineAtom) {
- token = CPPdefine(yylvalpp);
- } else if (yylvalpp->sc_ident == elseAtom) {
- if(ChkCorrectElseNesting()){
- if (!cpp->ifdepth ){
- CPPErrorToInfoLog("#else mismatch");
- cpp->CompileError=1;
- }
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '\n') {
- CPPWarningToInfoLog("unexpected tokens following #else preprocessor directive - expected a newline");
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- token = CPPelse(0, yylvalpp);
- }else{
- CPPErrorToInfoLog("#else after a #else");
- cpp->ifdepth=0;
- cpp->notAVersionToken = 1;
- return 0;
- }
- } else if (yylvalpp->sc_ident == elifAtom) {
- if (!cpp->ifdepth){
- CPPErrorToInfoLog("#elif mismatch");
- cpp->CompileError=1;
- }
- /* this token is really a dont care, but we still need to eat the tokens */
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- while (token != '\n')
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- token = CPPelse(0, yylvalpp);
- } else if (yylvalpp->sc_ident == endifAtom) {
- cpp->elsedepth[cpp->elsetracker]=0;
- --cpp->elsetracker;
- if (!cpp->ifdepth){
- CPPErrorToInfoLog("#endif mismatch");
- cpp->CompileError=1;
- }
- else
- --cpp->ifdepth;
- } else if (yylvalpp->sc_ident == ifAtom) {
- token = CPPif(yylvalpp);
- } else if (yylvalpp->sc_ident == ifdefAtom) {
- token = CPPifdef(1, yylvalpp);
- } else if (yylvalpp->sc_ident == ifndefAtom) {
- token = CPPifdef(0, yylvalpp);
- } else if (yylvalpp->sc_ident == lineAtom) {
- token = CPPline(yylvalpp);
- } else if (yylvalpp->sc_ident == pragmaAtom) {
- token = CPPpragma(yylvalpp);
- } else if (yylvalpp->sc_ident == undefAtom) {
- token = CPPundef(yylvalpp);
- } else if (yylvalpp->sc_ident == errorAtom) {
- token = CPPerror(yylvalpp);
- } else if (yylvalpp->sc_ident == versionAtom) {
- token = CPPversion(yylvalpp);
- isVersion = 1;
- } else if (yylvalpp->sc_ident == extensionAtom) {
- token = CPPextension(yylvalpp);
- } else {
- StoreStr("Invalid Directive");
- StoreStr(GetStringOfAtom(atable,yylvalpp->sc_ident));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- }
- }
- while (token != '\n' && token != 0 && token != EOF) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
-
- cpp->notAVersionToken = !isVersion;
-
- return token;
-} /* readCPPline */
-
-void FreeMacro(MacroSymbol *s) {
- DeleteTokenStream(s->body);
-}
-
-static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }
-
-static void PushEofSrc() {
- InputSrc *in = malloc(sizeof(InputSrc));
- memset(in, 0, sizeof(InputSrc));
- in->scan = eof_scan;
- in->getch = eof_scan;
- in->ungetch = noop;
- in->prev = cpp->currentInput;
- cpp->currentInput = in;
-}
-
-static void PopEofSrc() {
- if (cpp->currentInput->scan == eof_scan) {
- InputSrc *in = cpp->currentInput;
- cpp->currentInput = in->prev;
- free(in);
- }
-}
-
-static TokenStream *PrescanMacroArg(TokenStream *a, yystypepp * yylvalpp) {
- int token;
- TokenStream *n;
- RewindTokenStream(a);
- do {
- token = ReadToken(a, yylvalpp);
- if (token == CPP_IDENTIFIER && LookUpSymbol(macros, yylvalpp->sc_ident))
- break;
- } while (token > 0);
- if (token <= 0) return a;
- n = NewTokenStream("macro arg");
- PushEofSrc();
- ReadFromTokenStream(a, 0, 0);
- while ((token = cpp->currentInput->scan(cpp->currentInput, yylvalpp)) > 0) {
- if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp->sc_ident, yylvalpp))
- continue;
- RecordToken(n, token, yylvalpp);
- }
- PopEofSrc();
- DeleteTokenStream(a);
- return n;
-} /* PrescanMacroArg */
-
-typedef struct MacroInputSrc {
- InputSrc base;
- MacroSymbol *mac;
- TokenStream **args;
-} MacroInputSrc;
-
-/* macro_scan ---
-** return the next token for a macro expanion, handling macro args
-*/
-static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {
- int i;
- int token = ReadToken(in->mac->body, yylvalpp);
- if (token == CPP_IDENTIFIER) {
- for (i = in->mac->argc-1; i>=0; i--)
- if (in->mac->args[i] == yylvalpp->sc_ident) break;
- if (i >= 0) {
- ReadFromTokenStream(in->args[i], yylvalpp->sc_ident, 0);
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- }
- }
- if (token > 0) return token;
- in->mac->busy = 0;
- cpp->currentInput = in->base.prev;
- if (in->args) {
- for (i=in->mac->argc-1; i>=0; i--)
- DeleteTokenStream(in->args[i]);
- free(in->args);
- }
- free(in);
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-} /* macro_scan */
-
-/* MacroExpand
-** check an identifier (atom) to see if it a macro that should be expanded.
-** If it is, push an InputSrc that will produce the appropriate expansion
-** and return TRUE. If not, return FALSE.
-*/
-
-int MacroExpand(int atom, yystypepp * yylvalpp)
-{
- Symbol *sym = LookUpSymbol(macros, atom);
- MacroInputSrc *in;
- int i,j, token, depth=0;
- const char *message;
- if (atom == __LINE__Atom) {
- yylvalpp->sc_int = GetLineNumber();
- sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (atom == __FILE__Atom) {
- yylvalpp->sc_int = GetStringNumber();
- sprintf(yylvalpp->symbol_name,"%d",yylvalpp->sc_int);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (atom == __VERSION__Atom) {
- strcpy(yylvalpp->symbol_name,"100");
- yylvalpp->sc_int = atoi(yylvalpp->symbol_name);
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
- if (!sym || sym->details.mac.undef) return 0;
- if (sym->details.mac.busy) return 0; /* no recursive expansions */
- in = malloc(sizeof(*in));
- memset(in, 0, sizeof(*in));
- in->base.scan = (void *)macro_scan;
- in->base.line = cpp->currentInput->line;
- in->base.name = cpp->currentInput->name;
- in->mac = &sym->details.mac;
- if (sym->details.mac.args) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token != '(') {
- UngetToken(token, yylvalpp);
- yylvalpp->sc_ident = atom;
- return 0;
- }
- in->args = malloc(in->mac->argc * sizeof(TokenStream *));
- for (i=0; i<in->mac->argc; i++)
- in->args[i] = NewTokenStream("macro arg");
- i=0;j=0;
- do{
- depth = 0;
- while(1) {
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token <= 0) {
- StoreStr("EOF in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- return 1;
- }
- if((in->mac->argc==0) && (token!=')')) break;
- if (depth == 0 && (token == ',' || token == ')')) break;
- if (token == '(') depth++;
- if (token == ')') depth--;
- RecordToken(in->args[i], token, yylvalpp);
- j=1;
- }
- if (token == ')') {
- if((in->mac->argc==1) &&j==0)
- break;
- i++;
- break;
- }
- i++;
- }while(i < in->mac->argc);
-
- if (i < in->mac->argc) {
- StoreStr("Too few args in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- } else if (token != ')') {
- depth=0;
- while (token >= 0 && (depth > 0 || token != ')')) {
- if (token == ')') depth--;
- token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
- if (token == '(') depth++;
- }
-
- if (token <= 0) {
- StoreStr("EOF in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- return 1;
- }
- StoreStr("Too many args in Macro ");
- StoreStr(GetStringOfAtom(atable,atom));
- message=GetStrfromTStr();
- CPPShInfoLogMsg(message);
- ResetTString();
- }
- for (i=0; i<in->mac->argc; i++) {
- in->args[i] = PrescanMacroArg(in->args[i], yylvalpp);
- }
- }
-#if 0
- printf(" <%s:%d>found macro %s\n", GetAtomString(atable, loc.file),
- loc.line, GetAtomString(atable, atom));
- for (i=0; i<in->mac->argc; i++) {
- printf("\targ %s = '", GetAtomString(atable, in->mac->args[i]));
- DumpTokenStream(stdout, in->args[i]);
- printf("'\n");
- }
-#endif
- /*retain the input source*/
- in->base.prev = cpp->currentInput;
- sym->details.mac.busy = 1;
- RewindTokenStream(sym->details.mac.body);
- cpp->currentInput = &in->base;
- return 1;
-} /* MacroExpand */
-
-int ChkCorrectElseNesting(void)
-{
- if(cpp->elsedepth[cpp->elsetracker]==0){
- cpp->elsedepth[cpp->elsetracker]=1;
- return 1;
- }
- return 0;
-}
-
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp.h
deleted file mode 100755
index 03449a17a98..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* cpp.h */
-/* */
-
-#if !defined(__CPP_H)
-#define __CPP_H 1
-
-#include "parser.h"
-#include "tokens.h"
-
-int InitCPP(void);
-int FinalCPP(void);
-int readCPPline(yystypepp * yylvalpp);
-int MacroExpand(int atom, yystypepp * yylvalpp);
-int ChkCorrectElseNesting(void);
-
-typedef struct MacroSymbol {
- int argc;
- int *args;
- TokenStream *body;
- unsigned busy:1;
- unsigned undef:1;
-} MacroSymbol;
-
-void FreeMacro(MacroSymbol *);
-int PredefineMacro(char *);
-
-void CPPDebugLogMsg(const char *msg); /* Prints information into debug log */
-void CPPShInfoLogMsg(const char*); /* Store cpp Err Msg into Sh.Info.Log */
-void CPPWarningToInfoLog(const char *msg); /* Prints warning messages into info log */
-void HandlePragma(const char**, int numTokens); /* #pragma directive container. */
-void ResetTString(void); /* #error Message as TString. */
-void CPPErrorToInfoLog(char*); /* Stick all cpp errors into Sh.Info.log . */
-void StoreStr(char*); /* Store the TString in Parse Context. */
-void SetLineNumber(int); /* Set line number. */
-void SetStringNumber(int); /* Set string number. */
-int GetLineNumber(void); /* Get the current String Number. */
-int GetStringNumber(void); /* Get the current String Number. */
-const char* GetStrfromTStr(void); /* Convert TString to String. */
-void updateExtensionBehavior(const char* extName, const char* behavior);
-int FreeCPP(void);
-
-#endif /* !(defined(__CPP_H) */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp_comment_fix.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp_comment_fix.c
deleted file mode 100644
index 0c3073590df..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/cpp_comment_fix.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* converts c++ to c comments */
-/* usage: ./cpp_comment_fix source */
-
-#include <stdio.h>
-
-int main (int argc, char *argv[])
-{
- FILE *f;
- int c;
- char *buf = NULL;
- int size = 0, i = 0;
-
- f = fopen (argv[1], "r");
- while ((c = fgetc (f)) != EOF)
- {
- buf = (void *) realloc (buf, size + 1);
- buf[size] = c;
- size++;
- }
- fclose (f);
-
- f = fopen (argv[1], "w");
-
- while (i < size)
- {
- if (buf[i] == '/')
- {
- if (buf[i+1] == '/')
- {
- fprintf (f, "/*");
- i+=2;
- while (buf[i] != '\n' && buf[i] != '\r' && i < size)
- fprintf (f, "%c", buf[i++]);
- fprintf (f, " */\n");
- if (i < size && buf[i] == '\n')
- i++;
- else if (i < size && buf[i] == '\r')
- i+=2;
- }
- else
- {
- fprintf (f, "/");
- i++;
-
- if (buf[i] == '*')
- {
- fprintf (f, "*");
- i++;
-
- for (;;)
- {
- if (buf[i] == '*' && buf[i+1] == '/')
- {
- fprintf (f, "*/");
- i+=2;
- break;
- }
- else
- {
- fprintf (f, "%c", buf[i]);
- i++;
- }
- }
- }
- }
- }
- else
- {
- fprintf (f, "%c", buf[i]);
- i++;
- }
- }
- fclose (f);
- return 0;
-}
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/cppstruct.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/cppstruct.c
deleted file mode 100755
index c55b3f7c709..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/cppstruct.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* cppstruct.c */
-/* */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "slglobals.h"
-
-CPPStruct *cpp = NULL;
-static int refCount = 0;
-
-int InitPreprocessor(void);
-int ResetPreprocessor(void);
-int FreeCPPStruct(void);
-int FinalizePreprocessor(void);
-
-/*
- * InitCPPStruct() - Initilaize the CPP structure.
- *
- */
-
-int InitCPPStruct(void)
-{
- int len;
- char *p;
-
- cpp = (CPPStruct *) malloc(sizeof(CPPStruct));
- if (cpp == NULL)
- return 0;
-
- refCount++;
-
- /* Initialize public members: */
- cpp->pLastSourceLoc = &cpp->lastSourceLoc;
-
- p = (char *) &cpp->options;
- len = sizeof(cpp->options);
- while (--len >= 0)
- p[len] = 0;
-
- ResetPreprocessor();
- return 1;
-} /* InitCPPStruct */
-
-int ResetPreprocessor(void)
-{
- /* Initialize private members: */
-
- cpp->lastSourceLoc.file = 0;
- cpp->lastSourceLoc.line = 0;
- cpp->pC=0;
- cpp->CompileError=0;
- cpp->ifdepth=0;
- for(cpp->elsetracker=0; cpp->elsetracker<64; cpp->elsetracker++)
- cpp->elsedepth[cpp->elsetracker]=0;
- cpp->elsetracker=0;
- cpp->tokensBeforeEOF = 0;
- return 1;
-}
-
-/*Intializing the Preprocessor. */
-
-int InitPreprocessor(void)
-{
- # define CPP_STUFF true
- # ifdef CPP_STUFF
- FreeCPPStruct();
- InitCPPStruct();
- cpp->options.Quiet = 1;
- cpp->options.profileString = "generic";
- if (!InitAtomTable(atable, 0))
- return 1;
- if (!InitScanner(cpp))
- return 1;
- # endif
- return 0;
-}
-
-/*FreeCPPStruct() - Free the CPP structure. */
-
-int FreeCPPStruct(void)
-{
- if (refCount)
- {
- free(cpp);
- refCount--;
- }
-
- return 1;
-}
-
-/*Finalizing the Preprocessor. */
-
-int FinalizePreprocessor(void)
-{
- # define CPP_STUFF true
- # ifdef CPP_STUFF
- FreeAtomTable(atable);
- FreeCPPStruct();
- FreeScanner();
- # endif
- return 0;
-}
-
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*//////////////////////////////////// End of cppstruct.c ////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/memory.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/memory.c
deleted file mode 100755
index ed0f4fb4b93..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/memory.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __STDC99__
-#include <stdint.h>
-#elif defined (_WIN64)
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-
-#include "memory.h"
-
-/* default alignment and chunksize, if called with 0 arguments */
-#define CHUNKSIZE (64*1024)
-#define ALIGN 8
-
-/* we need to call the `real' malloc and free, not our replacements */
-#undef malloc
-#undef free
-
-struct chunk {
- struct chunk *next;
-};
-
-struct cleanup {
- struct cleanup *next;
- void (*fn)(void *);
- void *arg;
-};
-
-struct MemoryPool_rec {
- struct chunk *next;
- uintptr_t free, end;
- size_t chunksize;
- uintptr_t alignmask;
- struct cleanup *cleanup;
-};
-
-MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)
-{
- MemoryPool *pool;
-
- if (align == 0) align = ALIGN;
- if (chunksize == 0) chunksize = CHUNKSIZE;
- if (align & (align-1)) return 0;
- if (chunksize < sizeof(MemoryPool)) return 0;
- if (chunksize & (align-1)) return 0;
- if (!(pool = malloc(chunksize))) return 0;
- pool->next = 0;
- pool->chunksize = chunksize;
- pool->alignmask = (uintptr_t)(align)-1;
- pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;
- pool->end = (uintptr_t)pool + chunksize;
- pool->cleanup = 0;
- return pool;
-}
-
-void mem_FreePool(MemoryPool *pool)
-{
- struct cleanup *cleanup;
- struct chunk *p, *next;
-
- for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {
- cleanup->fn(cleanup->arg);
- }
- for (p = (struct chunk *)pool; p; p = next) {
- next = p->next;
- free(p);
- }
-}
-
-void *mem_Alloc(MemoryPool *pool, size_t size)
-{
- struct chunk *ch;
- void *rv = (void *)pool->free;
- size = (size + pool->alignmask) & ~pool->alignmask;
- if (size <= 0) size = pool->alignmask;
- pool->free += size;
- if (pool->free > pool->end || pool->free < (uintptr_t)rv) {
- size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)
- & ~pool->alignmask;
- pool->free = (uintptr_t)rv;
- if (minreq >= pool->chunksize) {
- /* request size is too big for the chunksize, so allocate it as */
- /* a single chunk of the right size */
- ch = malloc(minreq);
- if (!ch) return 0;
- } else {
- ch = malloc(pool->chunksize);
- if (!ch) return 0;
- pool->free = (uintptr_t)ch + minreq;
- pool->end = (uintptr_t)ch + pool->chunksize;
- }
- ch->next = pool->next;
- pool->next = ch;
- rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);
- }
- return rv;
-}
-
-int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
- struct cleanup *cleanup;
-
- pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
- cleanup = mem_Alloc(pool, sizeof(struct cleanup));
- if (!cleanup) return -1;
- cleanup->next = pool->cleanup;
- cleanup->fn = fn;
- cleanup->arg = arg;
- pool->cleanup = cleanup;
- return 0;
-}
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/memory.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/memory.h
deleted file mode 100755
index 89a57e24c9c..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/memory.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-#ifndef __MEMORY_H
-#define __MEMORY_H
-
-typedef struct MemoryPool_rec MemoryPool;
-
-extern MemoryPool *mem_CreatePool(size_t chunksize, unsigned align);
-extern void mem_FreePool(MemoryPool *);
-extern void *mem_Alloc(MemoryPool *p, size_t size);
-extern void *mem_Realloc(MemoryPool *p, void *old, size_t oldsize, size_t newsize);
-extern int mem_AddCleanup(MemoryPool *p, void (*fn)(void *), void *arg);
-
-#endif /* __MEMORY_H */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/parser.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/parser.h
deleted file mode 100755
index 5f70bdd1ac7..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/parser.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-#ifndef BISON_PARSER_H
-# define BISON_PARSER_H
-
-#ifndef yystypepp
-typedef struct {
- int sc_int;
- float sc_fval;
- int sc_ident;
- char symbol_name[MAX_SYMBOL_NAME_LEN+1];
-} yystypepp;
-
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-# define CPP_AND_OP 257
-# define CPP_SUB_ASSIGN 259
-# define CPP_MOD_ASSIGN 260
-# define CPP_ADD_ASSIGN 261
-# define CPP_DIV_ASSIGN 262
-# define CPP_MUL_ASSIGN 263
-# define CPP_EQ_OP 264
-# define CPP_XOR_OP 265
-# define ERROR_SY 266
-# define CPP_FLOATCONSTANT 267
-# define CPP_GE_OP 268
-# define CPP_RIGHT_OP 269
-# define CPP_IDENTIFIER 270
-# define CPP_INTCONSTANT 271
-# define CPP_LE_OP 272
-# define CPP_LEFT_OP 273
-# define CPP_DEC_OP 274
-# define CPP_NE_OP 275
-# define CPP_OR_OP 276
-# define CPP_INC_OP 277
-# define CPP_STRCONSTANT 278
-# define CPP_TYPEIDENTIFIER 279
-
-# define FIRST_USER_TOKEN_SY 289
-
-# define CPP_RIGHT_ASSIGN 280
-# define CPP_LEFT_ASSIGN 281
-# define CPP_AND_ASSIGN 282
-# define CPP_OR_ASSIGN 283
-# define CPP_XOR_ASSIGN 284
-# define CPP_LEFT_BRACKET 285
-# define CPP_RIGHT_BRACKET 286
-# define CPP_LEFT_BRACE 287
-# define CPP_RIGHT_BRACE 288
-
-#endif /* not BISON_PARSER_H */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/preprocess.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/preprocess.h
deleted file mode 100755
index 63996d6695c..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/preprocess.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-
-# include "slglobals.h"
-extern CPPStruct *cpp;
-int InitCPPStruct(void);
-int InitScanner(CPPStruct *cpp);
-int InitAtomTable(AtomTable *atable, int htsize);
-int ScanFromString(char *s);
-char* GetStringOfAtom(AtomTable *atable, int atom);
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/scanner.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/scanner.c
deleted file mode 100755
index d80e37b8e9b..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/scanner.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* scanner.c */
-/* */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if 0
- #include <ieeefp.h>
- #else
- #define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
- ((*(long *)&(x) & 0x007fffffL)==0000000000L))
-#endif
-
-#include "slglobals.h"
-
-
-typedef struct StringInputSrc {
- InputSrc base;
- char *p;
-} StringInputSrc;
-
-static int eof_scan(InputSrc *is, yystypepp * yylvalpp)
-{
- return EOF;
-} /* eof_scan */
-
-static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) {}
-
-static InputSrc eof_inputsrc = { 0, &eof_scan, &eof_scan, &noop };
-
-static int byte_scan(InputSrc *, yystypepp * yylvalpp);
-
-#define EOL_SY '\n'
-
-#if defined(_WIN32)
- #define DBG_BREAKPOINT() __asm int 3
- #elif defined(_M_AMD64)
- #define DBG_BREAKPOINT() assert(!"Dbg_Breakpoint");
- #else
- #define DBG_BREAKPOINT()
- #endif
-
- #if defined(_WIN32) && !defined(_M_AMD64)
- __int64 RDTSC ( void ) {
-
- __int64 v;
-
- __asm __emit 0x0f
- __asm __emit 0x31
- __asm mov dword ptr v, eax
- __asm mov dword ptr v+4, edx
-
- return v;
- }
-#endif
-
-
-int InitScanner(CPPStruct *cpp)
-{
- /* Add various atoms needed by the CPP line scanner: */
- if (!InitCPP())
- return 0;
-
- cpp->mostRecentToken = 0;
- cpp->tokenLoc = &cpp->ltokenLoc;
-
- cpp->ltokenLoc.file = 0;
- cpp->ltokenLoc.line = 0;
-
- cpp->currentInput = &eof_inputsrc;
- cpp->previous_token = '\n';
- cpp->notAVersionToken = 0;
-
- return 1;
-} /* InitScanner */
-
-int FreeScanner(void)
-{
- return (FreeCPP());
-}
-
-/*
- * str_getch()
- * takes care of reading from multiple strings.
- * returns the next-char from the input stream.
- * returns EOF when the complete shader is parsed.
- */
-static int str_getch(StringInputSrc *in)
-{
- for(;;){
- if (*in->p){
- if (*in->p == '\n') {
- in->base.line++;
- IncLineNumber();
- }
- return *in->p++;
- }
- if(++(cpp->PaWhichStr) < cpp->PaArgc){
- free(in);
- SetStringNumber(cpp->PaWhichStr);
- SetLineNumber(1);
- ScanFromString(cpp->PaArgv[cpp->PaWhichStr]);
- in=(StringInputSrc*)cpp->currentInput;
- continue;
- }
- else{
- cpp->currentInput = in->base.prev;
- cpp->PaWhichStr=0;
- free(in);
- return EOF;
- }
- }
-} /* str_getch */
-
-static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {
- if (in->p[-1] == ch)in->p--;
- else {
- *(in->p)='\0'; /*this would take care of shifting to the previous string. */
- cpp->PaWhichStr--;
- }
- if (ch == '\n') {
- in->base.line--;
- DecLineNumber();
- }
-} /* str_ungetch */
-
-int ScanFromString(char *s)
-{
-
- StringInputSrc *in = malloc(sizeof(StringInputSrc));
- memset(in, 0, sizeof(StringInputSrc));
- in->p = s;
- in->base.line = 1;
- in->base.scan = byte_scan;
- in->base.getch = (int (*)(InputSrc *, yystypepp *))str_getch;
- in->base.ungetch = (void (*)(InputSrc *, int, yystypepp *))str_ungetch;
- in->base.prev = cpp->currentInput;
- cpp->currentInput = &in->base;
-
- return 1;
-} /* ScanFromString; */
-
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*///////////////////////////////// Floating point constants: ///////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*
- * lBuildFloatValue() - Quick and dirty conversion to floating point. Since all
- * we need is single precision this should be quite precise.
- */
-
-static float lBuildFloatValue(const char *str, int len, int exp)
-{
- double val, expval, ten;
- int ii, llen, absexp;
- float rv;
-
- val = 0.0;
- llen = len;
- for (ii = 0; ii < len; ii++)
- val = val*10.0 + (str[ii] - '0');
- if (exp != 0) {
- absexp = exp > 0 ? exp : -exp;
- expval = 1.0f;
- ten = 10.0;
- while (absexp) {
- if (absexp & 1)
- expval *= ten;
- ten *= ten;
- absexp >>= 1;
- }
- if (exp >= 0) {
- val *= expval;
- } else {
- val /= expval;
- }
- }
- rv = (float)val;
- if (isinff(rv)) {
- CPPErrorToInfoLog(" ERROR___FP_CONST_OVERFLOW");
- }
- return rv;
-} /* lBuildFloatValue */
-
-
-/*
- * lFloatConst() - Scan a floating point constant. Assumes that the scanner
- * has seen at least one digit, followed by either a decimal '.' or the
- * letter 'e'.
- */
-
-static int lFloatConst(char *str, int len, int ch, yystypepp * yylvalpp)
-{
- int HasDecimal, declen, exp, ExpSign;
- int str_len;
- float lval;
-
- HasDecimal = 0;
- declen = 0;
- exp = 0;
-
- str_len=len;
- if (ch == '.') {
- str[len++]=ch;
- HasDecimal = 1;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- while (ch >= '0' && ch <= '9') {
- if (len < MAX_SYMBOL_NAME_LEN) {
- declen++;
- if (len > 0 || ch != '0') {
- str[len] = ch;
- len++;str_len++;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else {
- CPPErrorToInfoLog("ERROR___FP_CONST_TOO_LONG");
- len = 1,str_len=1;
- }
- }
- }
-
- /* Exponent: */
-
- if (ch == 'e' || ch == 'E') {
- ExpSign = 1;
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '+') {
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else if (ch == '-') {
- ExpSign = -1;
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- if (ch >= '0' && ch <= '9') {
- while (ch >= '0' && ch <= '9') {
- exp = exp*10 + ch - '0';
- str[len++]=ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } else {
- CPPErrorToInfoLog("ERROR___ERROR_IN_EXPONENT");
- }
- exp *= ExpSign;
- }
-
- if (len == 0) {
- lval = 0.0f;
- strcpy(str,"0.0");
- } else {
- str[len]='\0';
- lval = lBuildFloatValue(str, str_len, exp - declen);
- }
- /* Suffix: */
-
- yylvalpp->sc_fval = lval;
- strcpy(yylvalpp->symbol_name,str);
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_FLOATCONSTANT;
-} /* lFloatConst */
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*/////////////////////////////////////// Normal Scanner ////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-static int byte_scan(InputSrc *in, yystypepp * yylvalpp)
-{
- char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
- char string_val[MAX_STRING_LEN + 1];
- int AlreadyComplained;
- int len, ch, ii, ival = 0;
-
- for (;;) {
- yylvalpp->sc_int = 0;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
-
- while (ch == ' ' || ch == '\t' || ch == '\r') {
- yylvalpp->sc_int = 1;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
-
- cpp->ltokenLoc.file = cpp->currentInput->name;
- cpp->ltokenLoc.line = cpp->currentInput->line;
- len = 0;
- switch (ch) {
- default:
- return ch; /* Single character token */
- case EOF:
- return -1;
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F': case 'G': case 'H': case 'I': case 'J':
- case 'K': case 'L': case 'M': case 'N': case 'O':
- case 'P': case 'Q': case 'R': case 'S': case 'T':
- case 'U': case 'V': case 'W': case 'X': case 'Y':
- case 'Z': case '_':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f': case 'g': case 'h': case 'i': case 'j':
- case 'k': case 'l': case 'm': case 'n': case 'o':
- case 'p': case 'q': case 'r': case 's': case 't':
- case 'u': case 'v': case 'w': case 'x': case 'y':
- case 'z':
- do {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } else {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } while ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '_');
- if (len >= MAX_SYMBOL_NAME_LEN)
- len = MAX_SYMBOL_NAME_LEN - 1;
- symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
- return CPP_IDENTIFIER;
- break;
- case '0':
- yylvalpp->symbol_name[len++] = ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == 'x' || ch == 'X') {
- yylvalpp->symbol_name[len++] = ch;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if ((ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'))
- {
- AlreadyComplained = 0;
- ival = 0;
- do {
- yylvalpp->symbol_name[len++] = ch;
- if (ival <= 0x0fffffff) {
- if (ch >= '0' && ch <= '9') {
- ii = ch - '0';
- } else if (ch >= 'A' && ch <= 'F') {
- ii = ch - 'A' + 10;
- } else {
- ii = ch - 'a' + 10;
- }
- ival = (ival << 4) | ii;
- } else {
- if (!AlreadyComplained)
- CPPErrorToInfoLog("ERROR___HEX_CONST_OVERFLOW");
- AlreadyComplained = 1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while ((ch >= '0' && ch <= '9') ||
- (ch >= 'A' && ch <= 'F') ||
- (ch >= 'a' && ch <= 'f'));
- } else {
- CPPErrorToInfoLog("ERROR___ERROR_IN_HEX_CONSTANT");
- }
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_int = ival;
- return CPP_INTCONSTANT;
- } else if (ch >= '0' && ch <= '7') { /* octal integer constants */
- AlreadyComplained = 0;
- ival = 0;
- do {
- yylvalpp->symbol_name[len++] = ch;
- if (ival <= 0x1fffffff) {
- ii = ch - '0';
- ival = (ival << 3) | ii;
- } else {
- if (!AlreadyComplained)
- CPPErrorToInfoLog("ERROR___OCT_CONST_OVERFLOW");
- AlreadyComplained = 1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch >= '0' && ch <= '7');
- if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E')
- return lFloatConst(yylvalpp->symbol_name, len, ch, yylvalpp);
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- yylvalpp->sc_int = ival;
- return CPP_INTCONSTANT;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- ch = '0';
- }
- /* Fall through... */
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- do {
- if (len < MAX_SYMBOL_NAME_LEN) {
- if (len > 0 || ch != '0') {
- yylvalpp->symbol_name[len] = ch;
- len++;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- } while (ch >= '0' && ch <= '9');
- if (ch == '.' || ch == 'e' || ch == 'f' || ch == 'h' || ch == 'x'|| ch == 'E') {
- return lFloatConst(yylvalpp->symbol_name, len, ch, yylvalpp);
- } else {
- yylvalpp->symbol_name[len] = '\0';
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- ival = 0;
- AlreadyComplained = 0;
- for (ii = 0; ii < len; ii++) {
- ch = yylvalpp->symbol_name[ii] - '0';
- if ((ival > 214748364) || (ival == 214748364 && ch >= 8)) {
- if (!AlreadyComplained)
- CPPErrorToInfoLog("ERROR___INTEGER_CONST_OVERFLOW");
- AlreadyComplained = 1;
- }
- ival = ival*10 + ch;
- }
- yylvalpp->sc_int = ival;
- if(ival==0)
- strcpy(yylvalpp->symbol_name,"0");
- return CPP_INTCONSTANT;
- }
- break;
- case '-':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '-') {
- return CPP_DEC_OP;
- } else if (ch == '=') {
- return CPP_SUB_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '-';
- }
- case '+':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '+') {
- return CPP_INC_OP;
- } else if (ch == '=') {
- return CPP_ADD_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '+';
- }
- case '*':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_MUL_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '*';
- }
- case '%':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_MOD_ASSIGN;
- } else if (ch == '>'){
- return CPP_RIGHT_BRACE;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '%';
- }
- case ':':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '>') {
- return CPP_RIGHT_BRACKET;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return ':';
- }
- case '^':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '^') {
- return CPP_XOR_OP;
- } else {
- if (ch == '=')
- return CPP_XOR_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '^';
- }
- }
-
- case '=':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_EQ_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '=';
- }
- case '!':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '=') {
- return CPP_NE_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '!';
- }
- case '|':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '|') {
- return CPP_OR_OP;
- } else {
- if (ch == '=')
- return CPP_OR_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '|';
- }
- }
- case '&':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '&') {
- return CPP_AND_OP;
- } else {
- if (ch == '=')
- return CPP_AND_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '&';
- }
- }
- case '<':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '<') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if(ch == '=')
- return CPP_LEFT_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_LEFT_OP;
- }
- } else {
- if (ch == '=') {
- return CPP_LE_OP;
- } else {
- if (ch == '%')
- return CPP_LEFT_BRACE;
- else if (ch == ':')
- return CPP_LEFT_BRACKET;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '<';
- }
- }
- }
- case '>':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '>') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if(ch == '=')
- return CPP_RIGHT_ASSIGN;
- else{
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return CPP_RIGHT_OP;
- }
- } else {
- if (ch == '=') {
- return CPP_GE_OP;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '>';
- }
- }
- case '.':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch >= '0' && ch <= '9') {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return lFloatConst(yylvalpp->symbol_name, 0, '.', yylvalpp);
- } else {
- if (ch == '.') {
- return -1; /* Special EOF hack */
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '.';
- }
- }
- case '/':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '/') {
- do {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- } while (ch != '\n' && ch != EOF);
- if (ch == EOF)
- return -1;
- return '\n';
- } else if (ch == '*') {
- int nlcount = 0;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- do {
- while (ch != '*') {
- if (ch == '\n') nlcount++;
- if (ch == EOF) {
- CPPErrorToInfoLog("ERROR___EOF_IN_COMMENT");
- return -1;
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == EOF) {
- CPPErrorToInfoLog("ERROR___EOF_IN_COMMENT");
- return -1;
- }
- } while (ch != '/');
- if (nlcount) {
- return '\n';
- }
- /* Go try it again... */
- } else if (ch == '=') {
- return CPP_DIV_ASSIGN;
- } else {
- cpp->currentInput->ungetch(cpp->currentInput, ch, yylvalpp);
- return '/';
- }
- break;
- case '"':
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- while (ch != '"' && ch != '\n' && ch != EOF) {
- if (ch == '\\') {
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- if (ch == '\n' || ch == EOF) {
- break;
- }
- }
- if (len < MAX_STRING_LEN) {
- string_val[len] = ch;
- len++;
- ch = cpp->currentInput->getch(cpp->currentInput, yylvalpp);
- }
- };
- string_val[len] = '\0';
- if (ch == '"') {
- yylvalpp->sc_ident = LookUpAddString(atable, string_val);
- return CPP_STRCONSTANT;
- } else {
- CPPErrorToInfoLog("ERROR___CPP_EOL_IN_STRING");
- return ERROR_SY;
- }
- }
- }
-} /* byte_scan */
-
-int yylex_CPP(char* buf, int maxSize)
-{
- yystypepp yylvalpp;
- int token = '\n';
-
- for(;;) {
-
- char* tokenString = 0;
- token = cpp->currentInput->scan(cpp->currentInput, &yylvalpp);
- if(check_EOF(token))
- return 0;
- if (token == '#' && (cpp->previous_token == '\n'||cpp->previous_token==0)) {
- token = readCPPline(&yylvalpp);
- if(check_EOF(token))
- return 0;
- continue;
- }
- cpp->previous_token = token;
- /* expand macros */
- if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {
- cpp->notAVersionToken = 1;
- continue;
- }
-
- if (token == '\n')
- continue;
-
- if (token == CPP_IDENTIFIER) {
- cpp->notAVersionToken = 1;
- tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);
- } else if (token == CPP_FLOATCONSTANT||token == CPP_INTCONSTANT){
- cpp->notAVersionToken = 1;
- tokenString = yylvalpp.symbol_name;
- } else {
- cpp->notAVersionToken = 1;
- tokenString = GetStringOfAtom(atable,token);
- }
-
- if (tokenString) {
- if ((signed)strlen(tokenString) >= maxSize) {
- cpp->tokensBeforeEOF = 1;
- return maxSize;
- } else if (strlen(tokenString) > 0) {
- strcpy(buf, tokenString);
- cpp->tokensBeforeEOF = 1;
- return (int)strlen(tokenString);
- }
-
- return 0;
- }
- }
-
- return 0;
-} /* yylex */
-
-/*Checks if the token just read is EOF or not. */
-int check_EOF(int token)
-{
- if(token==-1){
- if(cpp->ifdepth >0){
- CPPErrorToInfoLog("#endif missing!! Compilation stopped");
- cpp->CompileError=1;
- }
- return 1;
- }
- return 0;
-}
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*///////////////////////////////////// End of scanner.c ////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/scanner.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/scanner.h
deleted file mode 100755
index 15472b5bf18..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/scanner.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* scanner.h */
-/* */
-
-#if !defined(__SCANNER_H)
-#define __SCANNER_H 1
-
-#define MAX_SYMBOL_NAME_LEN 128
-#define MAX_STRING_LEN 512
-
-#include "parser.h"
-
-/* Not really atom table stuff but needed first... */
-
-typedef struct SourceLoc_Rec {
- unsigned short file, line;
-} SourceLoc;
-
-int yyparse (void);
-
-int yylex_CPP(char* buf, int maxSize);
-
-typedef struct InputSrc {
- struct InputSrc *prev;
- int (*scan)(struct InputSrc *, yystypepp *);
- int (*getch)(struct InputSrc *, yystypepp *);
- void (*ungetch)(struct InputSrc *, int, yystypepp *);
- int name; /* atom */
- int line;
-} InputSrc;
-
-int InitScanner(CPPStruct *cpp); /* Intialise the cpp scanner. */
-int ScanFromString(char *); /* Start scanning the input from the string mentioned. */
-int check_EOF(int); /* check if we hit a EOF abruptly */
-void CPPErrorToInfoLog(char *); /* sticking the msg,line into the Shader's.Info.log */
-void SetLineNumber(int);
-void SetStringNumber(int);
-void IncLineNumber(void);
-void DecLineNumber(void);
-int FreeScanner(void); /* Free the cpp scanner */
-#endif /* !(defined(__SCANNER_H) */
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/slglobals.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/slglobals.h
deleted file mode 100755
index 667ada6a293..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/slglobals.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* slglobals.h */
-/* */
-
-#if !defined(__SLGLOBALS_H)
-#define __SLGLOBALS_H 1
-
-typedef struct CPPStruct_Rec CPPStruct;
-
-extern CPPStruct *cpp;
-
-#undef CPPC_DEBUG_THE_COMPILER
-#if defined(_DEBUG)
-#define CPPC_DEBUG_THE_COMPILER 1
-#endif
-
-#undef CPPC_ENABLE_TOOLS
-#define CPPC_ENABLE_TOOLS 1
-
-#include "memory.h"
-#include "atom.h"
-#include "scanner.h"
-#include "cpp.h"
-#include "tokens.h"
-#include "symbols.h"
-#include "compile.h"
-#if !defined(NO_PARSER)
-#include "parser.h"
-#endif
-
-#if !defined(NULL)
-#define NULL 0
-#endif
-
-#endif /* !(defined(__SLGLOBALS_H) */
-
-
-
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/symbols.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/symbols.c
deleted file mode 100755
index e807fe34346..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/symbols.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* symbols.c */
-/* */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "slglobals.h"
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*///////////////////////////////// Symbol Table Variables: /////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-Scope *ScopeList = NULL;
-Scope *CurrentScope = NULL;
-Scope *GlobalScope = NULL;
-
-static void unlinkScope(void *_scope) {
- Scope *scope = _scope;
-
- if (scope->next)
- scope->next->prev = scope->prev;
- if (scope->prev)
- scope->prev->next = scope->next;
- else
- ScopeList = scope->next;
-}
-
-/*
- * NewScope()
- *
- */
-Scope *NewScopeInPool(MemoryPool *pool)
-{
- Scope *lScope;
-
- lScope = mem_Alloc(pool, sizeof(Scope));
- lScope->pool = pool;
- lScope->parent = NULL;
- lScope->funScope = NULL;
- lScope->symbols = NULL;
-
- lScope->level = 0;
-
- lScope->programs = NULL;
- if ((lScope->next = ScopeList))
- ScopeList->prev = lScope;
- lScope->prev = 0;
- ScopeList = lScope;
- mem_AddCleanup(pool, unlinkScope, lScope);
- return lScope;
-} /* NewScope */
-
-/*
- * PushScope()
- *
- */
-
-void PushScope(Scope *fScope)
-{
- Scope *lScope;
-
- if (CurrentScope) {
- fScope->level = CurrentScope->level + 1;
- if (fScope->level == 1) {
- if (!GlobalScope) {
- /* HACK - CTD -- if GlobalScope==NULL and level==1, we're
- * defining a function in the superglobal scope. Things
- * will break if we leave the level as 1, so we arbitrarily
- * set it to 2 */
- fScope->level = 2;
- }
- }
- if (fScope->level >= 2) {
- lScope = fScope;
- while (lScope->level > 2)
- lScope = lScope->next;
- fScope->funScope = lScope;
- }
- } else {
- fScope->level = 0;
- }
- fScope->parent = CurrentScope;
- CurrentScope = fScope;
-} /* PushScope */
-
-/*
- * PopScope()
- *
- */
-
-Scope *PopScope(void)
-{
- Scope *lScope;
-
- lScope = CurrentScope;
- if (CurrentScope)
- CurrentScope = CurrentScope->parent;
- return lScope;
-} /* PopScope */
-
-/*
- * NewSymbol() - Allocate a new symbol node;
- *
- */
-
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind)
-{
- Symbol *lSymb;
- char *pch;
- int ii;
-
- lSymb = (Symbol *) mem_Alloc(fScope->pool, sizeof(Symbol));
- lSymb->left = NULL;
- lSymb->right = NULL;
- lSymb->next = NULL;
- lSymb->name = name;
- lSymb->loc = *loc;
- lSymb->kind = kind;
-
- /* Clear union area: */
-
- pch = (char *) &lSymb->details;
- for (ii = 0; ii < sizeof(lSymb->details); ii++)
- *pch++ = 0;
- return lSymb;
-} /* NewSymbol */
-
-/*
- * lAddToTree() - Using a binary tree is not a good idea for basic atom values because they
- * are generated in order. We'll fix this later (by reversing the bit pattern).
- */
-
-static void lAddToTree(Symbol **fSymbols, Symbol *fSymb)
-{
- Symbol *lSymb;
- int lrev, frev;
-
- lSymb = *fSymbols;
- if (lSymb) {
- frev = GetReversedAtom(atable, fSymb->name);
- while (lSymb) {
- lrev = GetReversedAtom(atable, lSymb->name);
- if (lrev == frev) {
- CPPErrorToInfoLog("GetAtomString(atable, fSymb->name)");
- break;
- } else {
- if (lrev > frev) {
- if (lSymb->left) {
- lSymb = lSymb->left;
- } else {
- lSymb->left = fSymb;
- break;
- }
- } else {
- if (lSymb->right) {
- lSymb = lSymb->right;
- } else {
- lSymb->right = fSymb;
- break;
- }
- }
- }
- }
- } else {
- *fSymbols = fSymb;
- }
-} /* lAddToTree */
-
-
-/*
- * AddSymbol() - Add a variable, type, or function name to a scope.
- *
- */
-
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind)
-{
- Symbol *lSymb;
-
- if (!fScope)
- fScope = CurrentScope;
- lSymb = NewSymbol(loc, fScope, atom, kind);
- lAddToTree(&fScope->symbols, lSymb);
- return lSymb;
-} /* AddSymbol */
-
-
-/*********************************************************************************************/
-/************************************ Symbol Semantic Functions ******************************/
-/*********************************************************************************************/
-
-/*
- * LookUpLocalSymbol()
- *
- */
-
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom)
-{
- Symbol *lSymb;
- int rname, ratom;
-
- ratom = GetReversedAtom(atable, atom);
- if (!fScope)
- fScope = CurrentScope;
- lSymb = fScope->symbols;
- while (lSymb) {
- rname = GetReversedAtom(atable, lSymb->name);
- if (rname == ratom) {
- return lSymb;
- } else {
- if (rname > ratom) {
- lSymb = lSymb->left;
- } else {
- lSymb = lSymb->right;
- }
- }
- }
- return NULL;
-} /* LookUpLocalSymbol */
-
-/*
- * LookUpSymbol()
- *
- */
-
-Symbol *LookUpSymbol(Scope *fScope, int atom)
-{
- Symbol *lSymb;
-
- if (!fScope)
- fScope = CurrentScope;
- while (fScope) {
- lSymb = LookUpLocalSymbol(fScope, atom);
- if (lSymb)
- return lSymb;
- fScope = fScope->parent;
- }
- return NULL;
-} /* LookUpSymbol */
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/symbols.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/symbols.h
deleted file mode 100755
index 65cba9d6c9f..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/symbols.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* symbols.h */
-/* */
-
-#if !defined(__SYMBOLS_H)
-#define __SYMBOLS_H 1
-
-#include "memory.h"
-
-typedef enum symbolkind {
- MACRO_S
-} symbolkind;
-
-/* Typedefs for things defined here in "symbols.h": */
-
-typedef struct Scope_Rec Scope;
-typedef struct Symbol_Rec Symbol;
-
-typedef struct SymbolList_Rec {
- struct SymbolList_Rec *next;
- Symbol *symb;
-} SymbolList;
-
-struct Scope_Rec {
- Scope *next, *prev; /* doubly-linked list of all scopes */
- Scope *parent;
- Scope *funScope; /* Points to base scope of enclosing function */
- MemoryPool *pool; /* pool used for allocation in this scope */
- Symbol *symbols;
-
- int level; /* 0 = super globals, 1 = globals, etc. */
-
- /* Only used at global scope (level 1): */
- SymbolList *programs; /* List of programs for this compilation. */
-};
-
-
-/* Symbol table is a simple binary tree. */
-
-#include "cpp.h" /* to get MacroSymbol def */
-
-struct Symbol_Rec {
- Symbol *left, *right;
- Symbol *next;
- int name; /* Name atom */
- SourceLoc loc;
- symbolkind kind;
- union {
- MacroSymbol mac;
- } details;
-};
-
-extern Scope *CurrentScope;
-extern Scope *GlobalScope;
-extern Scope *ScopeList;
-
-Scope *NewScopeInPool(MemoryPool *);
-#define NewScope() NewScopeInPool(CurrentScope->pool)
-void PushScope(Scope *fScope);
-Scope *PopScope(void);
-Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);
-Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);
-Symbol *LookUpLocalSymbol(Scope *fScope, int atom);
-Symbol *LookUpSymbol(Scope *fScope, int atom);
-void CPPErrorToInfoLog(char *);
-
-
-#endif /* !defined(__SYMBOLS_H) */
-
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/tokens.c b/src/mesa/shader/slang/MachineIndependent/preprocessor/tokens.c
deleted file mode 100755
index 815277db553..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/tokens.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* tokens.c */
-/* */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "slglobals.h"
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*////////////////////// Preprocessor and Token Recorder and Playback: //////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-
-/*
- * idstr()
- * Copy a string to a malloc'ed block and convert it into something suitable
- * for an ID
- *
- */
-
-static char *idstr(const char *fstr)
-{
- size_t len;
- char *str, *t;
- const char *f;
-
- len = strlen(fstr);
- str = (char *) malloc(len + 1);
- for (f=fstr, t=str; *f; f++) {
- if (isalnum(*f)) *t++ = *f;
- else if (*f == '.' || *f == '/') *t++ = '_';
- }
- *t = 0;
- return str;
-} /* idstr */
-
-
-/*
- * lNewBlock()
- *
- */
-
-static TokenBlock *lNewBlock(TokenStream *fTok)
-{
- TokenBlock *lBlock;
-
- lBlock = (TokenBlock *) malloc(sizeof(TokenBlock) + 256);
- lBlock->count = 0;
- lBlock->current = 0;
- lBlock->data = (unsigned char *) lBlock + sizeof(TokenBlock);
- lBlock->max = 256;
- lBlock->next = NULL;
- if (fTok->head) {
- fTok->current->next = lBlock;
- } else {
- fTok->head = lBlock;
- }
- fTok->current = lBlock;
- return lBlock;
-} /* lNewBlock */
-
-/*
- * lAddByte()
- *
- */
-
-static void lAddByte(TokenStream *fTok, unsigned char fVal)
-{
- TokenBlock *lBlock;
- lBlock = fTok->current;
- if (lBlock->count >= lBlock->max)
- lBlock = lNewBlock(fTok);
- lBlock->data[lBlock->count++] = fVal;
-} /* lAddByte */
-
-
-
-/*
- * lReadByte() - Get the next byte from a stream.
- *
- */
-
-static int lReadByte(TokenStream *pTok)
-{
- TokenBlock *lBlock;
- int lval = -1;
-
- lBlock = pTok->current;
- if (lBlock) {
- if (lBlock->current >= lBlock->count) {
- lBlock = lBlock->next;
- if (lBlock)
- lBlock->current = 0;
- pTok->current = lBlock;
- }
- if (lBlock)
- lval = lBlock->data[lBlock->current++];
- }
- return lval;
-} /* lReadByte */
-
-/*///////////////////////////////////// Global Functions:////////////////////////////////////// */
-
-/*
- * NewTokenStream()
- *
- */
-
-TokenStream *NewTokenStream(const char *name)
-{
- TokenStream *pTok;
-
- pTok = (TokenStream *) malloc(sizeof(TokenStream));
- pTok->next = NULL;
- pTok->name = idstr(name);
- pTok->head = NULL;
- pTok->current = NULL;
- lNewBlock(pTok);
- return pTok;
-} /* NewTokenStream */
-
-/*
- * DeleteTokenStream()
- *
- */
-
-void DeleteTokenStream(TokenStream *pTok)
-{
- TokenBlock *pBlock, *nBlock;
-
- if (pTok) {
- pBlock = pTok->head;
- while (pBlock) {
- nBlock = pBlock->next;
- free(pBlock);
- pBlock = nBlock;
- }
- if (pTok->name)
- free(pTok->name);
- free(pTok);
- }
-} /* DeleteTokenStream */
-
-/*
- * RecordToken() - Add a token to the end of a list for later playback or printout.
- *
- */
-
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
-{
- const char *s;
- unsigned char *str=NULL;
-
- if (token > 256)
- lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
- else
- lAddByte(pTok, (unsigned char)(token & 0x7f));
- switch (token) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- case CPP_STRCONSTANT:
- s = GetAtomString(atable, yylvalpp->sc_ident);
- while (*s)
- lAddByte(pTok, (unsigned char) *s++);
- lAddByte(pTok, 0);
- break;
- case CPP_FLOATCONSTANT:
- case CPP_INTCONSTANT:
- str=yylvalpp->symbol_name;
- while (*str){
- lAddByte(pTok,(unsigned char) *str);
- *str++;
- }
- lAddByte(pTok, 0);
- break;
- case '(':
- lAddByte(pTok, (unsigned char)(yylvalpp->sc_int ? 1 : 0));
- default:
- break;
- }
-} /* RecordToken */
-
-/*
- * RewindTokenStream() - Reset a token stream in preperation for reading.
- *
- */
-
-void RewindTokenStream(TokenStream *pTok)
-{
- if (pTok->head) {
- pTok->current = pTok->head;
- pTok->current->current = 0;
- }
-} /* RewindTokenStream */
-
-/*
- * ReadToken() - Read the next token from a stream.
- *
- */
-
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp)
-{
- char symbol_name[MAX_SYMBOL_NAME_LEN + 1];
- char string_val[MAX_STRING_LEN + 1];
- int ltoken, len;
- char ch;
-
- ltoken = lReadByte(pTok);
- if (ltoken >= 0) {
- if (ltoken > 127)
- ltoken += 128;
- switch (ltoken) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '_')
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- yylvalpp->sc_ident = LookUpAddString(atable, symbol_name);
- return CPP_IDENTIFIER;
- break;
- case CPP_STRCONSTANT:
- len = 0;
- while ((ch = lReadByte(pTok)) != 0)
- if (len < MAX_STRING_LEN)
- string_val[len++] = ch;
- string_val[len] = 0;
- yylvalpp->sc_ident = LookUpAddString(atable, string_val);
- break;
- case CPP_FLOATCONSTANT:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= '0' && ch <= '9')||(ch=='e'||ch=='E'||ch=='.')||(ch=='+'||ch=='-'))
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- strcpy(yylvalpp->symbol_name,symbol_name);
- yylvalpp->sc_fval=(float)atof(yylvalpp->symbol_name);
- break;
- case CPP_INTCONSTANT:
- len = 0;
- ch = lReadByte(pTok);
- while ((ch >= '0' && ch <= '9'))
- {
- if (len < MAX_SYMBOL_NAME_LEN) {
- symbol_name[len] = ch;
- len++;
- ch = lReadByte(pTok);
- }
- }
- symbol_name[len] = '\0';
- assert(ch == '\0');
- strcpy(yylvalpp->symbol_name,symbol_name);
- yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
- break;
- case '(':
- yylvalpp->sc_int = lReadByte(pTok);
- break;
- }
- return ltoken;
- }
- return EOF_SY;
-} /* ReadToken */
-
-typedef struct TokenInputSrc {
- InputSrc base;
- TokenStream *tokens;
- int (*final)(CPPStruct *);
-} TokenInputSrc;
-
-static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)
-{
- int token = ReadToken(in->tokens, yylvalpp);
- int (*final)(CPPStruct *);
- cpp->tokenLoc->file = cpp->currentInput->name;
- cpp->tokenLoc->line = cpp->currentInput->line;
- if (token == '\n') {
- in->base.line++;
- return token;
- }
- if (token > 0) return token;
- cpp->currentInput = in->base.prev;
- final = in->final;
- free(in);
- if (final && !final(cpp)) return -1;
- return cpp->currentInput->scan(cpp->currentInput, yylvalpp);
-}
-
-int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))
-{
- TokenInputSrc *in = malloc(sizeof(TokenInputSrc));
- memset(in, 0, sizeof(TokenInputSrc));
- in->base.name = name;
- in->base.prev = cpp->currentInput;
- in->base.scan = (int (*)(InputSrc *, yystypepp *))scan_token;
- in->base.line = 1;
- in->tokens = ts;
- in->final = final;
- RewindTokenStream(ts);
- cpp->currentInput = &in->base;
- return 1;
-}
-
-typedef struct UngotToken {
- InputSrc base;
- int token;
- yystypepp lval;
-} UngotToken;
-
-static int reget_token(UngotToken *t, yystypepp * yylvalpp)
-{
- int token = t->token;
- *yylvalpp = t->lval;
- cpp->currentInput = t->base.prev;
- free(t);
- return token;
-}
-
-void UngetToken(int token, yystypepp * yylvalpp) {
- UngotToken *t = malloc(sizeof(UngotToken));
- memset(t, 0, sizeof(UngotToken));
- t->token = token;
- t->lval = *yylvalpp;
- t->base.scan = (void *)reget_token;
- t->base.prev = cpp->currentInput;
- t->base.name = cpp->currentInput->name;
- t->base.line = cpp->currentInput->line;
- cpp->currentInput = &t->base;
-}
-
-
-void DumpTokenStream(FILE *fp, TokenStream *s, yystypepp * yylvalpp) {
- int token;
- char str[100];
-
- if (fp == 0) fp = stdout;
- RewindTokenStream(s);
- while ((token = ReadToken(s, yylvalpp)) > 0) {
- switch (token) {
- case CPP_IDENTIFIER:
- case CPP_TYPEIDENTIFIER:
- sprintf(str, "%s ", GetAtomString(atable, yylvalpp->sc_ident));
- break;
- case CPP_STRCONSTANT:
- sprintf(str, "\"%s\"", GetAtomString(atable, yylvalpp->sc_ident));
- break;
- case CPP_FLOATCONSTANT:
- /*printf("%g9.6 ", yylvalpp->sc_fval); */
- break;
- case CPP_INTCONSTANT:
- /*printf("%d ", yylvalpp->sc_int); */
- break;
- default:
- if (token >= 127)
- sprintf(str, "%s ", GetAtomString(atable, token));
- else
- sprintf(str, "%c", token);
- break;
- }
- CPPDebugLogMsg(str);
- }
-}
-
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
-/*///////////////////////////////////// End of tokens.c /////////////////////////////////////// */
-/*///////////////////////////////////////////////////////////////////////////////////////////// */
diff --git a/src/mesa/shader/slang/MachineIndependent/preprocessor/tokens.h b/src/mesa/shader/slang/MachineIndependent/preprocessor/tokens.h
deleted file mode 100755
index 0a25bf7c883..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/preprocessor/tokens.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* */
-/*Copyright (C) 2002-2005 3Dlabs Inc. Ltd. */
-/*All rights reserved. */
-/* */
-/*Redistribution and use in source and binary forms, with or without */
-/*modification, are permitted provided that the following conditions */
-/*are met: */
-/* */
-/* Redistributions of source code must retain the above copyright */
-/* notice, this list of conditions and the following disclaimer. */
-/* */
-/* Redistributions in binary form must reproduce the above */
-/* copyright notice, this list of conditions and the following */
-/* disclaimer in the documentation and/or other materials provided */
-/* with the distribution. */
-/* */
-/* Neither the name of 3Dlabs Inc. Ltd. nor the names of its */
-/* contributors may be used to endorse or promote products derived */
-/* from this software without specific prior written permission. */
-/* */
-/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
-/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
-/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
-/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE */
-/*COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
-/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, */
-/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
-/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER */
-/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT */
-/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
-/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
-/*POSSIBILITY OF SUCH DAMAGE. */
-/* */
-/****************************************************************************\
-Copyright (c) 2002, NVIDIA Corporation.
-
-NVIDIA Corporation("NVIDIA") supplies this software to you in
-consideration of your agreement to the following terms, and your use,
-installation, modification or redistribution of this NVIDIA software
-constitutes acceptance of these terms. If you do not agree with these
-terms, please do not use, install, modify or redistribute this NVIDIA
-software.
-
-In consideration of your agreement to abide by the following terms, and
-subject to these terms, NVIDIA grants you a personal, non-exclusive
-license, under NVIDIA's copyrights in this original NVIDIA software (the
-"NVIDIA Software"), to use, reproduce, modify and redistribute the
-NVIDIA Software, with or without modifications, in source and/or binary
-forms; provided that if you redistribute the NVIDIA Software, you must
-retain the copyright notice of NVIDIA, this notice and the following
-text and disclaimers in all such redistributions of the NVIDIA Software.
-Neither the name, trademarks, service marks nor logos of NVIDIA
-Corporation may be used to endorse or promote products derived from the
-NVIDIA Software without specific prior written permission from NVIDIA.
-Except as expressly stated in this notice, no other rights or licenses
-express or implied, are granted by NVIDIA herein, including but not
-limited to any patent rights that may be infringed by your derivative
-works or by other works in which the NVIDIA Software may be
-incorporated. No hardware is licensed hereunder.
-
-THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
-INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
-ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
-PRODUCTS.
-
-IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
-INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
-OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
-NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
-TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
-NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-\****************************************************************************/
-/* */
-/* tokens.h */
-/* */
-
-#if !defined(__TOKENS_H)
-#define __TOKENS_H 1
-
-#include "parser.h"
-
-#define EOF_SY (-1)
-
-typedef struct TokenBlock_Rec TokenBlock;
-
-typedef struct TokenStream_Rec {
- struct TokenStream_Rec *next;
- char *name;
- TokenBlock *head;
- TokenBlock *current;
-} TokenStream;
-
-struct TokenBlock_Rec {
- TokenBlock *next;
- int current;
- int count;
- int max;
- unsigned char *data;
-};
-
-extern TokenStream stdlib_cpp_stream;
-
-
-TokenStream *NewTokenStream(const char *name);
-void DeleteTokenStream(TokenStream *pTok);
-void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp);
-void RewindTokenStream(TokenStream *pTok);
-int ReadToken(TokenStream *pTok, yystypepp * yylvalpp);
-int ReadFromTokenStream(TokenStream *pTok, int name, int (*final)(CPPStruct *));
-void UngetToken(int, yystypepp * yylvalpp);
-
-#if defined(CPPC_ENABLE_TOOLS)
-
-void DumpTokenStream(FILE *, TokenStream *, yystypepp * yylvalpp);
-
-#endif /* defined(CPPC_ENABLE_TOOLS) */
-
-#endif /* !defined(__TOKENS_H) */
diff --git a/src/mesa/shader/slang/MachineIndependent/unistd.h b/src/mesa/shader/slang/MachineIndependent/unistd.h
deleted file mode 100755
index efadd63fd9e..00000000000
--- a/src/mesa/shader/slang/MachineIndependent/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-// This is a NULL file and is meant to be empty
diff --git a/src/mesa/shader/slang/OGLCompilersDLL/Initialisation.cpp b/src/mesa/shader/slang/OGLCompilersDLL/Initialisation.cpp
deleted file mode 100755
index 2e6f8c69ba7..00000000000
--- a/src/mesa/shader/slang/OGLCompilersDLL/Initialisation.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#define SH_EXPORTING
-#include "Initialisation.h"
-#include "Include/InitializeGlobals.h"
-#include "Include/InitializeParseContext.h"
-#include "Public/ShaderLang.h"
-
-OS_TLSIndex GlobalProcessFlag = OS_INVALID_TLS_INDEX;
-
-bool InitProcess()
-{
- if (GlobalProcessFlag != OS_INVALID_TLS_INDEX) {
- //
- // Function is re-entrant.
- //
- return true;
- }
-
- GlobalProcessFlag = OS_AllocTLSIndex();
-
- if (GlobalProcessFlag == OS_INVALID_TLS_INDEX) {
- assert (0 && "InitProcess(): Failed to allocate TLS area for init flag");
- return false;
- }
-
- if (!InitializePoolIndex()) {
- assert (0 && "InitProcess(): Failed to initalize global pool");
- return false;
- }
-
- if (!InitializeParseContextIndex()) {
- assert (0 && "InitProcess(): Failed to initalize parse context");
- return false;
- }
-
- InitThread();
- return true;
-}
-
-
-bool InitThread()
-{
- //
- // This function is re-entrant
- //
- if (GlobalProcessFlag == OS_INVALID_TLS_INDEX) {
- assert(0 && "InitThread(): Process hasn't been initalised.");
- return false;
- }
-
- if (OS_GetTLSValue(GlobalProcessFlag) != 0) {
- return true;
- }
-
- InitializeGlobalPools();
-
- if(!InitializeGlobalParseContext())
- return false;
-
- if(!OS_SetTLSValue(GlobalProcessFlag, (void *)1)) {
- assert(0 && "InitThread(): Unable to set init flag.");
- return false;
- }
-
- return true;
-}
-
-
-bool DetachThread()
-{
- bool retFlag = true;
-
- if (GlobalProcessFlag == OS_INVALID_TLS_INDEX) {
- assert(0 && "DetachThread(): Process hasn't been initalised.");
- return false;
- }
-
- //
- // Function is re-entrant and this thread may not have been initalised.
- //
- if (OS_GetTLSValue(GlobalProcessFlag) != 0)
- {
- if(!OS_SetTLSValue(GlobalProcessFlag, (void *)0)) {
- assert(0 && "DetachThread(): Unable to clear init flag.");
- retFlag = false;
- }
-
- FreeGlobalPools();
-
- if (!FreeParseContext())
- retFlag = false;
- }
-
- return retFlag;
-}
-
-bool DetachProcess()
-{
- bool retFlag = true;
-
- if (GlobalProcessFlag == OS_INVALID_TLS_INDEX)
- return true;
-
- ShFinalize();
-
- retFlag = DetachThread();
-
- FreePoolIndex();
-
- if(!FreeParseContextIndex())
- retFlag = false;
-
- OS_FreeTLSIndex(GlobalProcessFlag);
- GlobalProcessFlag = OS_INVALID_TLS_INDEX;
-
- return retFlag;
-}
-
diff --git a/src/mesa/shader/slang/OGLCompilersDLL/Initialisation.h b/src/mesa/shader/slang/OGLCompilersDLL/Initialisation.h
deleted file mode 100755
index 1cfd97eeb32..00000000000
--- a/src/mesa/shader/slang/OGLCompilersDLL/Initialisation.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-#ifndef __INITIALISATION_H
-#define __INITIALISATION_H
-
-
-#include "osinclude.h"
-
-
-bool InitProcess();
-bool InitThread();
-bool DetachThread();
-bool DetachProcess();
-
-#endif // __INITIALISATION_H
-
diff --git a/src/mesa/shader/slang/OSDependent/Linux/osinclude.h b/src/mesa/shader/slang/OSDependent/Linux/osinclude.h
deleted file mode 100755
index 8b20b961c05..00000000000
--- a/src/mesa/shader/slang/OSDependent/Linux/osinclude.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef __OSINCLUDE_H
-#define __OSINCLUDE_H
-
-//
-// This file contains any Linux specific functions.
-//
-
-/* WORKAROUND: linux builds seem not to define "linux" */
-/*#if !(defined(linux))
-#error Trying to include a Linux specific file in a non-Linux build.
-#endif*/
-
-#include <pthread.h>
-#include <semaphore.h>
-#include <assert.h>
-#include <errno.h>
-#include "Include/InitializeGlobals.h"
-#include "Include/PoolAlloc.h"
-
-#define _vsnprintf vsnprintf
-
-void DetachThreadLinux(void *);
-
-//
-// Thread Local Storage Operations
-//
-typedef unsigned int OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX 0xFFFFFFFF
-
-OS_TLSIndex OS_AllocTLSIndex();
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
-
-
-inline void * OS_GetTLSValue(OS_TLSIndex nIndex)
-{
- //
- // This function should return 0 if nIndex is invalid.
- //
- assert(nIndex != OS_INVALID_TLS_INDEX);
- return (pthread_getspecific(nIndex));
-}
-
-#endif // __OSINCLUDE_H
diff --git a/src/mesa/shader/slang/OSDependent/Linux/ossource.cpp b/src/mesa/shader/slang/OSDependent/Linux/ossource.cpp
deleted file mode 100755
index 4bcd66a3151..00000000000
--- a/src/mesa/shader/slang/OSDependent/Linux/ossource.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-//
-// This file contains the Linux specific functions
-//
-#include "osinclude.h"
-#include "Initialisation.h"
-
-/*#if !(defined(linux))
-#error Trying to build a Linux specific file in a non-Linux build.
-#endif*/
-
-//
-// Thread cleanup
-//
-
-//
-// Wrapper for Linux call to DetachThread. This is required as pthread_cleanup_push() expects
-// the cleanup routine to return void.
-//
-void DetachThreadLinux(void *)
-{
- DetachThread();
-}
-
-
-//
-// Registers cleanup handler, sets cancel type and state, and excecutes the thread specific
-// cleanup handler. This function will be called in the Standalone.cpp for regression
-// testing. When OpenGL applications are run with the driver code, Linux OS does the
-// thread cleanup.
-//
-void OS_CleanupThreadData(void)
-{
- int old_cancel_state, old_cancel_type;
- void *cleanupArg = NULL;
-
- //
- // Set thread cancel state and push cleanup handler.
- //
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancel_state);
- pthread_cleanup_push(DetachThreadLinux, (void *) cleanupArg);
-
- //
- // Put the thread in deferred cancellation mode.
- //
- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &old_cancel_type);
-
- //
- // Pop cleanup handler and execute it prior to unregistering the cleanup handler.
- //
- pthread_cleanup_pop(1);
-
- //
- // Restore the thread's previous cancellation mode.
- //
- pthread_setcanceltype(old_cancel_state, NULL);
-}
-
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
- pthread_key_t pPoolIndex;
-
- //
- // Create global pool key.
- //
- if ((pthread_key_create(&pPoolIndex, NULL)) != 0) {
- assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
- return false;
- }
- else
- return pPoolIndex;
-}
-
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- if (pthread_setspecific(nIndex, lpvValue) == 0)
- return true;
- else
- return false;
-}
-
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- //
- // Delete the global pool key.
- //
- if (pthread_key_delete(nIndex) == 0)
- return true;
- else
- return false;
-}
diff --git a/src/mesa/shader/slang/OSDependent/Windows/osinclude.h b/src/mesa/shader/slang/OSDependent/Windows/osinclude.h
deleted file mode 100755
index 97a9e9f3dfb..00000000000
--- a/src/mesa/shader/slang/OSDependent/Windows/osinclude.h
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#ifndef __OSINCLUDE_H
-#define __OSINCLUDE_H
-
-//
-// This file contains contains the window's specific datatypes and
-// declares any windows specific functions.
-//
-
-#if !(defined(_WIN32) || defined(_WIN64))
-#error Trying to include a windows specific file in a non windows build.
-#endif
-
-#define STRICT
-#define VC_EXTRALEAN 1
-#include <windows.h>
-#include <assert.h>
-
-//
-// Thread Local Storage Operations
-//
-typedef DWORD OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
-
-OS_TLSIndex OS_AllocTLSIndex();
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
-
-inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
-{
- assert(nIndex != OS_INVALID_TLS_INDEX);
- return TlsGetValue(nIndex);
-}
-
-#endif // __OSINCLUDE_H
diff --git a/src/mesa/shader/slang/OSDependent/Windows/ossource.cpp b/src/mesa/shader/slang/OSDependent/Windows/ossource.cpp
deleted file mode 100755
index 35d086614c0..00000000000
--- a/src/mesa/shader/slang/OSDependent/Windows/ossource.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-
-#include "Initialisation.h"
-
-//
-// This file contains contains the window's specific functions
-//
-
-#if !(defined(_WIN32) || defined(_WIN64))
-#error Trying to build a windows specific file in a non windows build.
-#endif
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- if (!InitProcess())
- return false;
- break;
- case DLL_THREAD_ATTACH:
- if (!InitThread())
- return false;
- break;
-
- case DLL_THREAD_DETACH:
-
- if (!DetachThread())
- return false;
- break;
-
- case DLL_PROCESS_DETACH:
-
- DetachProcess();
- break;
-
- default:
- assert(0 && "DllMain(): Reason for calling DLL Main is unknown");
- return false;
- }
-
- return true;
-}
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
- DWORD dwIndex = TlsAlloc();
- if (dwIndex == TLS_OUT_OF_INDEXES) {
- assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
- return (OS_INVALID_TLS_INDEX);
- }
-
- return dwIndex;
-}
-
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
- if (nIndex == OS_INVALID_TLS_INDEX)
- {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- if (TlsSetValue(nIndex, lpvValue))
- return true;
- else
- return false;
-}
-
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- if (TlsFree(nIndex))
- return true;
- else
- return false;
-}
-
diff --git a/src/mesa/shader/slang/Public/ShaderLang.h b/src/mesa/shader/slang/Public/ShaderLang.h
deleted file mode 100755
index 34b1688e877..00000000000
--- a/src/mesa/shader/slang/Public/ShaderLang.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
-//Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-*/
-#ifndef _COMPILER_INTERFACE_INCLUDED_
-#define _COMPILER_INTERFACE_INCLUDED_
-
-#include "../Include/ResourceLimits.h"
-
-#ifdef _WIN32
-#define C_DECL __cdecl
-/*#ifdef SH_EXPORTING
- #define SH_IMPORT_EXPORT __declspec(dllexport)
-#else
- #define SH_IMPORT_EXPORT __declspec(dllimport)
-#endif*/
-/* disable DLL linking */
-#define SH_IMPORT_EXPORT
-#else
-#define SH_IMPORT_EXPORT
-#define __fastcall
-#define C_DECL
-#endif
-
-/*
-// This is the platform independent interface between an OGL driver
-// and the shading language compiler/linker.
-*/
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/*
-// Driver must call this first, once, before doing any other
-// compiler/linker operations.
-*/
-SH_IMPORT_EXPORT int ShInitialize();
-/*
-// Driver should call this at shutdown.
-*/
-SH_IMPORT_EXPORT int __fastcall ShFinalize();
-
-/*
-// Types of languages the compiler can consume.
-*/
-typedef enum {
- EShLangVertex,
- EShLangFragment,
- EShLangPack,
- EShLangUnpack,
- EShLangCount
-} EShLanguage;
-
-/*
-// Types of output the linker will create.
-*/
-typedef enum {
- EShExVertexFragment,
- EShExPackFragment,
- EShExUnpackFragment,
- EShExFragment
-} EShExecutable;
-
-/*
-// Optimization level for the compiler.
-*/
-typedef enum {
- EShOptNoGeneration,
- EShOptNone,
- EShOptSimple, /* Optimizations that can be done quickly */
- EShOptFull /* Optimizations that will take more time */
-} EShOptimizationLevel;
-
-/*
-// Build a table for bindings. This can be used for locating
-// attributes, uniforms, globals, etc., as needed.
-*/
-typedef struct {
- char* name;
- int binding;
-} ShBinding;
-
-typedef struct {
- int numBindings;
- ShBinding* bindings; /* array of bindings */
-} ShBindingTable;
-
-/*
-// ShHandle held by but opaque to the driver. It is allocated,
-// managed, and de-allocated by the compiler/linker. It's contents
-// are defined by and used by the compiler and linker. For example,
-// symbol table information and object code passed from the compiler
-// to the linker can be stored where ShHandle points.
-//
-// If handle creation fails, 0 will be returned.
-*/
-typedef void* ShHandle;
-
-/*
-// Driver calls these to create and destroy compiler/linker
-// objects.
-*/
-SH_IMPORT_EXPORT ShHandle ShConstructCompiler(const EShLanguage, int debugOptions); /* one per shader */
-SH_IMPORT_EXPORT ShHandle ShConstructLinker(const EShExecutable, int debugOptions); /* one per shader pair */
-SH_IMPORT_EXPORT ShHandle ShConstructUniformMap(); /* one per uniform namespace (currently entire program object) */
-SH_IMPORT_EXPORT void ShDestruct(ShHandle);
-
-/*
-// The return value of ShCompile is boolean, indicating
-// success or failure.
-//
-// The info-log should be written by ShCompile into
-// ShHandle, so it can answer future queries.
-*/
-SH_IMPORT_EXPORT int ShCompile(
- const ShHandle,
- const char* const shaderStrings[],
- const int numStrings,
- const EShOptimizationLevel,
- const TBuiltInResource *resources,
- int debugOptions
- );
-
-
-/*
-// Similar to ShCompile, but accepts an opaque handle to an
-// intermediate language structure.
-*/
-SH_IMPORT_EXPORT int ShCompileIntermediate(
- ShHandle compiler,
- ShHandle intermediate,
- const EShOptimizationLevel,
- int debuggable /* boolean */
- );
-
-SH_IMPORT_EXPORT int ShLink(
- const ShHandle, /* linker object */
- const ShHandle h[], /* compiler objects to link together */
- const int numHandles,
- ShHandle uniformMap, /* updated with new uniforms */
- short int** uniformsAccessed, /* returned with indexes of uniforms accessed */
- int* numUniformsAccessed);
-
-/*
-// ShSetEncrpytionMethod is a place-holder for specifying
-// how source code is encrypted.
-*/
-SH_IMPORT_EXPORT void ShSetEncryptionMethod(ShHandle);
-
-/*
-// All the following return 0 if the information is not
-// available in the object passed down, or the object is bad.
-*/
-SH_IMPORT_EXPORT const char* ShGetInfoLog(const ShHandle);
-SH_IMPORT_EXPORT const void* ShGetExecutable(const ShHandle);
-SH_IMPORT_EXPORT int ShSetVirtualAttributeBindings(const ShHandle, const ShBindingTable*); /* to detect user aliasing */
-SH_IMPORT_EXPORT int ShSetFixedAttributeBindings(const ShHandle, const ShBindingTable*); /* to force any physical mappings */
-SH_IMPORT_EXPORT int ShGetPhysicalAttributeBindings(const ShHandle, const ShBindingTable**); /* for all attributes */
-/*
-// Tell the linker to never assign a vertex attribute to this list of physical attributes
-*/
-SH_IMPORT_EXPORT int ShExcludeAttributes(const ShHandle, int *attributes, int count);
-
-/*
-// Returns the location ID of the named uniform.
-// Returns -1 if error.
-*/
-SH_IMPORT_EXPORT int ShGetUniformLocation(const ShHandle uniformMap, const char* name);
-
-enum TDebugOptions {
- EDebugOpNone = 0x000,
- EDebugOpIntermediate = 0x001,
- EDebugOpAssembly = 0x002,
- EDebugOpObjectCode = 0x004,
- EDebugOpLinkMaps = 0x008
-};
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _COMPILER_INTERFACE_INCLUDED_ */
diff --git a/src/mesa/shader/slang/Public/ShaderLangExt.h b/src/mesa/shader/slang/Public/ShaderLangExt.h
deleted file mode 100755
index e44b5f99af8..00000000000
--- a/src/mesa/shader/slang/Public/ShaderLangExt.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-//Copyright (C) 2002-2004 3Dlabs Inc. Ltd.
-//All rights reserved.
-//
-//Redistribution and use in source and binary forms, with or without
-//modification, are permitted provided that the following conditions
-//are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//POSSIBILITY OF SUCH DAMAGE.
-//
-#ifndef _SHADERLANG_EXTENSION_INCLUDED_
-#define _SHADERLANG_EXTENSION_INCLUDED_
-
-#include "ShaderLang.h"
-
-//
-// This is the platform independent interface between an OGL driver
-// and the shading language compiler/linker.
-//
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-SH_IMPORT_EXPORT int ShLinkExt(
- const ShHandle, // linker object
- const ShHandle h[], // compiler objects to link together
- const int numHandles);
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif // _SHADERLANG_EXTENSION_INCLUDED_
diff --git a/src/mesa/shader/slang/dummy.c b/src/mesa/shader/slang/dummy.c
deleted file mode 100644
index a056e47fcc7..00000000000
--- a/src/mesa/shader/slang/dummy.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * This file is only serves as a placeholder when we omit the shading
- * language compiler (probably because we don't have C++ or one of the
- * needed C++ libraries/templates.
- */
-
-extern void _slang_dummy(void);
-
-void
-_slang_dummy(void)
-{
-}
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
deleted file mode 100755
index 768cef54748..00000000000
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ /dev/null
@@ -1,1469 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//
-// From Shader Spec, ver. 1.10, rev. 59
-//
-
-const int gl_MaxLights = 8;
-const int gl_MaxClipPlanes = 6;
-const int gl_MaxTextureUnits = 8;
-const int gl_MaxTextureCoords = 8;
-const int gl_MaxVertexAttribs = 16;
-const int gl_MaxVertexUniformComponents = 512;
-const int gl_MaxVaryingFloats = 32;
-const int gl_MaxVertexTextureImageUnits = 0;
-const int gl_MaxCombinedTextureImageUnits = 2;
-const int gl_MaxTextureImageUnits = 2;
-const int gl_MaxFragmentUniformComponents = 64;
-const int gl_MaxDrawBuffers = 1;
-
-uniform mat4 gl_ModelViewMatrix;
-uniform mat4 gl_ProjectionMatrix;
-uniform mat4 gl_ModelViewProjectionMatrix;
-uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];
-
-uniform mat3 gl_NormalMatrix;
-
-uniform mat4 gl_ModelViewMatrixInverse;
-uniform mat4 gl_ProjectionMatrixInverse;
-uniform mat4 gl_ModelViewProjectionMatrixInverse;
-uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];
-
-uniform mat4 gl_ModelViewMatrixTranspose;
-uniform mat4 gl_ProjectionMatrixTranspose;
-uniform mat4 gl_ModelViewProjectionMatrixTranspose;
-uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];
-
-uniform mat4 gl_ModelViewMatrixInverseTranspose;
-uniform mat4 gl_ProjectionMatrixInverseTranspose;
-uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;
-uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];
-
-uniform float gl_NormalScale;
-
-struct gl_DepthRangeParameters {
- float near;
- float far;
- float diff;
-};
-
-uniform gl_DepthRangeParameters gl_DepthRange;
-
-uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];
-
-struct gl_PointParameters {
- float size;
- float sizeMin;
- float sizeMax;
- float fadeThresholdSize;
- float distanceConstantAttenuation;
- float distanceLinearAttenuation;
- float distanceQuadraticAttenuation;
-};
-
-uniform gl_PointParameters gl_Point;
-
-struct gl_MaterialParameters {
- vec4 emission;
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
- float shininess;
-};
-
-uniform gl_MaterialParameters gl_FrontMaterial;
-uniform gl_MaterialParameters gl_BackMaterial;
-
-struct gl_LightSourceParameters {
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
- vec4 position;
- vec4 halfVector;
- vec3 spotDirection;
- float spotExponent;
- float spotCutoff;
- float spotCosCutoff;
- float constantAttenuation;
- float linearAttenuation;
- float quadraticAttenuation;
-};
-
-uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];
-
-struct gl_LightModelParameters {
- vec4 ambient;
-};
-
-uniform gl_LightModelParameters gl_LightModel;
-
-struct gl_LightModelProducts {
- vec4 sceneColor;
-};
-
-uniform gl_LightModelProducts gl_FrontLightModelProduct;
-uniform gl_LightModelProducts gl_BackLightModelProduct;
-
-struct gl_LightProducts {
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
-};
-
-uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];
-uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];
-
-uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];
-uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];
-uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];
-uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];
-uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];
-uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];
-uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];
-uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];
-uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];
-
-struct gl_FogParameters {
- vec4 color;
- float density;
- float start;
- float end;
- float scale;
-};
-
-uniform gl_FogParameters gl_Fog;
-
-//
-// 8.1 Angle and Trigonometry Functions
-//
-
-float radians (float deg) {
- return 3.141593 * deg / 180.0;
-}
-
-vec2 radians (vec2 deg) {
- return vec2 (3.141593) * deg / vec2 (180.0);
-}
-
-vec3 radians (vec3 deg) {
- return vec3 (3.141593) * deg / vec3 (180.0);
-}
-
-vec4 radians (vec4 deg) {
- return vec4 (3.141593) * deg / vec4 (180.0);
-}
-
-float degrees (float rad) {
- return 180.0 * rad / 3.141593;
-}
-
-vec2 degrees (vec2 rad) {
- return vec2 (180.0) * rad / vec2 (3.141593);
-}
-
-vec3 degrees (vec3 rad) {
- return vec3 (180.0) * rad / vec3 (3.141593);
-}
-
-vec4 degrees (vec4 rad) {
- return vec4 (180.0) * rad / vec4 (3.141593);
-}
-
-float sin (float angle) {
- float x;
- __asm float_sine x, angle;
- return x;
-}
-
-vec2 sin (vec2 angle) {
- return vec2 (
- sin (angle.x),
- sin (angle.y)
- );
-}
-
-vec3 sin (vec3 angle) {
- return vec3 (
- sin (angle.x),
- sin (angle.y),
- sin (angle.z)
- );
-}
-
-vec4 sin (vec4 angle) {
- return vec4 (
- sin (angle.x),
- sin (angle.y),
- sin (angle.z),
- sin (angle.w)
- );
-}
-
-float cos (float angle) {
- return sin (angle + 1.5708);
-}
-
-vec2 cos (vec2 angle) {
- return vec2 (
- cos (angle.x),
- cos (angle.y)
- );
-}
-
-vec3 cos (vec3 angle) {
- return vec3 (
- cos (angle.x),
- cos (angle.y),
- cos (angle.z)
- );
-}
-
-vec4 cos (vec4 angle) {
- return vec4 (
- cos (angle.x),
- cos (angle.y),
- cos (angle.z),
- cos (angle.w)
- );
-}
-
-float tan (float angle) {
- return sin (angle) / cos (angle);
-}
-
-vec2 tan (vec2 angle) {
- return vec2 (
- tan (angle.x),
- tan (angle.y)
- );
-}
-
-vec3 tan (vec3 angle) {
- return vec3 (
- tan (angle.x),
- tan (angle.y),
- tan (angle.z)
- );
-}
-
-vec4 tan (vec4 angle) {
- return vec4 (
- tan (angle.x),
- tan (angle.y),
- tan (angle.z),
- tan (angle.w)
- );
-}
-
-float asin (float x) {
- float y;
- __asm float_arcsine y, x;
- return y;
-}
-
-vec2 asin (vec2 v) {
- return vec2 (
- asin (v.x),
- asin (v.y)
- );
-}
-
-vec3 asin (vec3 v) {
- return vec3 (
- asin (v.x),
- asin (v.y),
- asin (v.z)
- );
-}
-
-vec4 asin (vec4 v) {
- return vec4 (
- asin (v.x),
- asin (v.y),
- asin (v.z),
- asin (v.w)
- );
-}
-
-float acos (float x) {
- return 1.5708 - asin (x);
-}
-
-vec2 acos (vec2 v) {
- return vec2 (
- acos (v.x),
- acos (v.y)
- );
-}
-
-vec3 acos (vec3 v) {
- return vec3 (
- acos (v.x),
- acos (v.y),
- acos (v.z)
- );
-}
-
-vec4 acos (vec4 v) {
- return vec4 (
- acos (v.x),
- acos (v.y),
- acos (v.z),
- acos (v.w)
- );
-}
-
-float atan (float y_over_x) {
- float z;
- __asm float_arctan z, y_over_x;
- return z;
-}
-
-vec2 atan (vec2 y_over_x) {
- return vec2 (
- atan (y_over_x.x),
- atan (y_over_x.y)
- );
-}
-
-vec3 atan (vec3 y_over_x) {
- return vec3 (
- atan (y_over_x.x),
- atan (y_over_x.y),
- atan (y_over_x.z)
- );
-}
-
-vec4 atan (vec4 y_over_x) {
- return vec4 (
- atan (y_over_x.x),
- atan (y_over_x.y),
- atan (y_over_x.z),
- atan (y_over_x.w)
- );
-}
-
-float atan (float y, float x) {
- float z = atan (y / x);
- if (x < 0.0)
- {
- if (y < 0.0)
- return z - 3.141593;
- return z + 3.141593;
- }
- return z;
-}
-
-vec2 atan (vec2 u, vec2 v) {
- return vec2 (
- atan (u.x, v.x),
- atan (u.y, v.y)
- );
-}
-
-vec3 atan (vec3 u, vec3 v) {
- return vec3 (
- atan (u.x, v.x),
- atan (u.y, v.y),
- atan (u.z, v.z)
- );
-}
-
-vec4 atan (vec4 u, vec4 v) {
- return vec4 (
- atan (u.x, v.x),
- atan (u.y, v.y),
- atan (u.z, v.z),
- atan (u.w, v.w)
- );
-}
-
-//
-// 8.2 Exponential Functions
-//
-
-float pow (float x, float y) {
- float p;
- __asm float_power p, x, y;
- return p;
-}
-
-vec2 pow (vec2 v, vec2 u) {
- return vec2 (
- pow (v.x, u.x),
- pow (v.y, u.y)
- );
-}
-
-vec3 pow (vec3 v, vec3 u) {
- return vec3 (
- pow (v.x, u.x),
- pow (v.y, u.y),
- pow (v.z, u.z)
- );
-}
-
-vec4 pow (vec4 v, vec4 u) {
- return vec4 (
- pow (v.x, u.x),
- pow (v.y, u.y),
- pow (v.z, u.z),
- pow (v.w, u.w)
- );
-}
-
-float exp (float x) {
- return pow (2.71828183, x);
-}
-
-vec2 exp (vec2 v) {
- return pow (vec2 (2.71828183), v);
-}
-
-vec3 exp (vec3 v) {
- return pow (vec3 (2.71828183), v);
-}
-
-vec4 exp (vec4 v) {
- return pow (vec4 (2.71828183), v);
-}
-
-float log2 (float x) {
- float y;
- __asm float_log2 y, x;
- return y;
-}
-
-vec2 log2 (vec2 v) {
- return vec2 (
- log2 (v.x),
- log2 (v.y)
- );
-}
-
-vec3 log2 (vec3 v) {
- return vec3 (
- log2 (v.x),
- log2 (v.y),
- log2 (v.z)
- );
-}
-
-vec4 log2 (vec4 v) {
- return vec4 (
- log2 (v.x),
- log2 (v.y),
- log2 (v.z),
- log2 (v.w)
- );
-}
-
-float log (float x) {
- return log2 (x) / log2 (2.71828183);
-}
-
-vec2 log (vec2 v) {
- return log2 (v) / log2 (vec2 (2.71828183));
-}
-
-vec3 log (vec3 v) {
- return log2 (v) / log2 (vec3 (2.71828183));
-}
-
-vec4 log (vec4 v) {
- return log2 (v) / log2 (vec4 (2.71828183));
-}
-
-float exp2 (float x) {
- return pow (2.0, x);
-}
-
-vec2 exp2 (vec2 v) {
- return pow (vec2 (2.0), v);
-}
-
-vec3 exp2 (vec3 v) {
- return pow (vec3 (2.0), v);
-}
-
-vec4 exp2 (vec4 v) {
- return pow (vec4 (2.0), v);
-}
-
-float sqrt (float x) {
- return pow (x, 0.5);
-}
-
-vec2 sqrt (vec2 v) {
- return pow (v, vec2 (0.5));
-}
-
-vec3 sqrt (vec3 v) {
- return pow (v, vec3 (0.5));
-}
-
-vec4 sqrt (vec4 v) {
- return pow (v, vec4 (0.5));
-}
-
-float inversesqrt (float x) {
- return 1.0 / sqrt (x);
-}
-
-vec2 inversesqrt (vec2 v) {
- return vec2 (1.0) / sqrt (v);
-}
-
-vec3 inversesqrt (vec3 v) {
- return vec3 (1.0) / sqrt (v);
-}
-
-vec4 inversesqrt (vec4 v) {
- return vec4 (1.0) / sqrt (v);
-}
-
-//
-// 8.3 Common Functions
-//
-
-float abs (float x) {
- return x >= 0.0 ? x : -x;
-}
-
-vec2 abs (vec2 v) {
- return vec2 (
- abs (v.x),
- abs (v.y)
- );
-}
-
-vec3 abs (vec3 v) {
- return vec3 (
- abs (v.x),
- abs (v.y),
- abs (v.z)
- );
-}
-
-vec4 abs (vec4 v) {
- return vec4 (
- abs (v.x),
- abs (v.y),
- abs (v.z),
- abs (v.w)
- );
-}
-
-float sign (float x) {
- return x > 0.0 ? 1.0 : x < 0.0 ? -1.0 : 0.0;
-}
-
-vec2 sign (vec2 v) {
- return vec2 (
- sign (v.x),
- sign (v.y)
- );
-}
-
-vec3 sign (vec3 v) {
- return vec3 (
- sign (v.x),
- sign (v.y),
- sign (v.z)
- );
-}
-
-vec4 sign (vec4 v) {
- return vec4 (
- sign (v.x),
- sign (v.y),
- sign (v.z),
- sign (v.w)
- );
-}
-
-float floor (float x) {
- float y;
- __asm float_floor y, x;
- return y;
-}
-
-vec2 floor (vec2 v) {
- return vec2 (
- floor (v.x),
- floor (v.y)
- );
-}
-
-vec3 floor (vec3 v) {
- return vec3 (
- floor (v.x),
- floor (v.y),
- floor (v.z)
- );
-}
-
-vec4 floor (vec4 v) {
- return vec4 (
- floor (v.x),
- floor (v.y),
- floor (v.z),
- floor (v.w)
- );
-}
-
-float ceil (float x) {
- float y;
- __asm float_ceil y, x;
- return y;
-}
-
-vec2 ceil (vec2 v) {
- return vec2 (
- ceil (v.x),
- ceil (v.y)
- );
-}
-
-vec3 ceil (vec3 v) {
- return vec3 (
- ceil (v.x),
- ceil (v.y),
- ceil (v.z)
- );
-}
-
-vec4 ceil (vec4 v) {
- return vec4 (
- ceil (v.x),
- ceil (v.y),
- ceil (v.z),
- ceil (v.w)
- );
-}
-
-float fract (float x) {
- return x - floor (x);
-}
-
-vec2 fract (vec2 v) {
- return v - floor (v);
-}
-
-vec3 fract (vec3 v) {
- return v - floor (v);
-}
-
-vec4 fract (vec4 v) {
- return v - floor (v);
-}
-
-float mod (float x, float y) {
- return x - y * floor (x / y);
-}
-
-vec2 mod (vec2 v, float u) {
- return v - u * floor (v / u);
-}
-
-vec3 mod (vec3 v, float u) {
- return v - u * floor (v / u);
-}
-
-vec4 mod (vec4 v, float u) {
- return v - u * floor (v / u);
-}
-
-vec2 mod (vec2 v, vec2 u) {
- return v - u * floor (v / u);
-}
-
-vec3 mod (vec3 v, vec3 u) {
- return v - u * floor (v / u);
-}
-
-vec4 mod (vec4 v, vec4 u) {
- return v - u * floor (v / u);
-}
-
-float min (float x, float y) {
- return x < y ? x : y;
-}
-
-vec2 min (vec2 v, vec2 u) {
- return vec2 (
- min (v.x, u.x),
- min (v.y, u.y)
- );
-}
-
-vec3 min (vec3 v, vec3 u) {
- return vec3 (
- min (v.x, u.x),
- min (v.y, u.y),
- min (v.z, u.z)
- );
-}
-
-vec4 min (vec4 v, vec4 u) {
- return vec4 (
- min (v.x, u.x),
- min (v.y, u.y),
- min (v.z, u.z),
- min (v.w, u.w)
- );
-}
-
-vec2 min (vec2 v, float y) {
- return min (v, vec2 (y));
-}
-
-vec3 min (vec3 v, float y) {
- return min (v, vec3 (y));
-}
-
-vec4 min (vec4 v, float y) {
- return min (v, vec4 (y));
-}
-
-float max (float x, float y) {
- return x < y ? y : x;
-}
-
-vec2 max (vec2 v, vec2 u) {
- return vec2 (
- max (v.x, u.x),
- max (v.y, u.y)
- );
-}
-
-vec3 max (vec3 v, vec3 u) {
- return vec3 (
- max (v.x, u.x),
- max (v.y, u.y),
- max (v.z, u.z)
- );
-}
-
-vec4 max (vec4 v, vec4 u) {
- return vec4 (
- max (v.x, u.x),
- max (v.y, u.y),
- max (v.z, u.z),
- max (v.w, u.w)
- );
-}
-
-vec2 max (vec2 v, float y) {
- return max (v, vec2 (y));
-}
-
-vec3 max (vec3 v, float y) {
- return max (v, vec3 (y));
-}
-
-vec4 max (vec4 v, float y) {
- return max (v, vec4 (y));
-}
-
-float clamp (float x, float minVal, float maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-vec2 clamp (vec2 x, float minVal, float maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-vec3 clamp (vec3 x, float minVal, float maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-vec4 clamp (vec4 x, float minVal, float maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-vec2 clamp (vec2 x, vec2 minVal, vec2 maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-vec3 clamp (vec3 x, vec3 minVal, vec3 maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-vec4 clamp (vec4 x, vec4 minVal, vec4 maxVal) {
- return min (max (x, minVal), maxVal);
-}
-
-float mix (float x, float y, float a) {
- return x * (1.0 - a) + y * a;
-}
-
-vec2 mix (vec2 x, vec2 y, float a) {
- return x * (1.0 - a) + y * a;
-}
-
-vec3 mix (vec3 x, vec3 y, float a) {
- return x * (1.0 - a) + y * a;
-}
-
-vec4 mix (vec4 x, vec4 y, float a) {
- return x * (1.0 - a) + y * a;
-}
-
-vec2 mix (vec2 x, vec2 y, vec2 a) {
- return x * (1.0 - a) + y * a;
-}
-
-vec3 mix (vec3 x, vec3 y, vec3 a) {
- return x * (1.0 - a) + y * a;
-}
-
-vec4 mix (vec4 x, vec4 y, vec4 a) {
- return x * (1.0 - a) + y * a;
-}
-
-float step (float edge, float x) {
- return x < edge ? 0.0 : 1.0;
-}
-
-vec2 step (vec2 edge, vec2 v) {
- return vec2 (
- step (edge.x, v.x),
- step (edge.y, v.y)
- );
-}
-
-vec3 step (vec3 edge, vec3 v) {
- return vec3 (
- step (edge.x, v.x),
- step (edge.y, v.y),
- step (edge.z, v.z)
- );
-}
-
-vec4 step (vec4 edge, vec4 v) {
- return vec4 (
- step (edge.x, v.x),
- step (edge.y, v.y),
- step (edge.z, v.z),
- step (edge.w, v.w)
- );
-}
-
-vec2 step (float edge, vec2 v) {
- return step (vec2 (edge), v);
-}
-
-vec3 step (float edge, vec3 v) {
- return step (vec3 (edge), v);
-}
-
-vec4 step (float edge, vec4 v) {
- return step (vec4 (edge), v);
-}
-
-float smoothstep (float edge0, float edge1, float x) {
- float t = clamp ((x - edge0) / (edge1 - edge0), 0.0, 1.0);
- return t * t * (3.0 - 2.0 * t);
-}
-
-vec2 smoothstep (vec2 edge0, vec2 edge1, vec2 v) {
- return vec2 (
- smoothstep (edge0.x, edge1.x, v.x),
- smoothstep (edge0.y, edge1.y, v.y)
- );
-}
-
-vec3 smoothstep (vec3 edge0, vec3 edge1, vec3 v) {
- return vec3 (
- smoothstep (edge0.x, edge1.x, v.x),
- smoothstep (edge0.y, edge1.y, v.y),
- smoothstep (edge0.z, edge1.z, v.z)
- );
-}
-
-vec4 smoothstep (vec4 edge0, vec4 edge1, vec4 v) {
- return vec4 (
- smoothstep (edge0.x, edge1.x, v.x),
- smoothstep (edge0.y, edge1.y, v.y),
- smoothstep (edge0.z, edge1.z, v.z),
- smoothstep (edge0.w, edge1.w, v.w)
- );
-}
-
-vec2 smoothstep (float edge0, float edge1, vec2 v) {
- return vec2 (
- smoothstep (edge0, edge1, v.x),
- smoothstep (edge0, edge1, v.y)
- );
-}
-
-vec3 smoothstep (float edge0, float edge1, vec3 v) {
- return vec3 (
- smoothstep (edge0, edge1, v.x),
- smoothstep (edge0, edge1, v.y),
- smoothstep (edge0, edge1, v.z)
- );
-}
-
-vec4 smoothstep (float edge0, float edge1, vec4 v) {
- return vec4 (
- smoothstep (edge0, edge1, v.x),
- smoothstep (edge0, edge1, v.y),
- smoothstep (edge0, edge1, v.z),
- smoothstep (edge0, edge1, v.w)
- );
-}
-
-//
-// 8.4 Geometric Functions
-//
-
-float dot (float x, float y) {
- return x * y;
-}
-
-float dot (vec2 v, vec2 u) {
- return v.x * u.x + v.y * u.y;
-}
-
-float dot (vec3 v, vec3 u) {
- return v.x * u.x + v.y * u.y + v.z * u.z;
-}
-
-float dot (vec4 v, vec4 u) {
- return v.x * u.x + v.y * u.y + v.z * u.z + v.w * u.w;
-}
-
-float length (float x) {
- return sqrt (dot (x, x));
-}
-
-float length (vec2 v) {
- return sqrt (dot (v, v));
-}
-
-float length (vec3 v) {
- return sqrt (dot (v, v));
-}
-
-float length (vec4 v) {
- return sqrt (dot (v, v));
-}
-
-float distance (float x, float y) {
- return length (x - y);
-}
-
-float distance (vec2 v, vec2 u) {
- return length (v - u);
-}
-
-float distance (vec3 v, vec3 u) {
- return length (v - u);
-}
-
-float distance (vec4 v, vec4 u) {
- return length (v - u);
-}
-
-vec3 cross (vec3 v, vec3 u) {
- return vec3 (
- v.y * u.z - u.y * v.z,
- v.z * u.x - u.z * v.x,
- v.x * u.y - u.x * v.y
- );
-}
-
-float normalize (float x) {
- return 1.0;
-}
-
-vec2 normalize (vec2 v) {
- return v / length (v);
-}
-
-vec3 normalize (vec3 v) {
- return v / length (v);
-}
-
-vec4 normalize (vec4 v) {
- return v / length (v);
-}
-
-float faceforward (float N, float I, float Nref) {
- return dot (Nref, I) < 0.0 ? N : -N;
-}
-
-vec2 faceforward (vec2 N, vec2 I, vec2 Nref) {
- return dot (Nref, I) < 0.0 ? N : -N;
-}
-
-vec3 faceforward (vec3 N, vec3 I, vec3 Nref) {
- return dot (Nref, I) < 0.0 ? N : -N;
-}
-
-vec4 faceforward (vec4 N, vec4 I, vec4 Nref) {
- return dot (Nref, I) < 0.0 ? N : -N;
-}
-
-float reflect (float I, float N) {
- return I - 2.0 * dot (N, I) * N;
-}
-
-vec2 reflect (vec2 I, vec2 N) {
- return I - 2.0 * dot (N, I) * N;
-}
-
-vec3 reflect (vec3 I, vec3 N) {
- return I - 2.0 * dot (N, I) * N;
-}
-
-vec4 reflect (vec4 I, vec4 N) {
- return I - 2.0 * dot (N, I) * N;
-}
-
-float refract (float I, float N, float eta) {
- float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
- if (k < 0.0)
- return 0.0;
- return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
-}
-
-vec2 refract (vec2 I, vec2 N, float eta) {
- float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
- if (k < 0.0)
- return 0.0;
- return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
-}
-
-vec3 refract (vec3 I, vec3 N, float eta) {
- float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
- if (k < 0.0)
- return 0.0;
- return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
-}
-
-vec4 refract (vec4 I, vec4 N, float eta) {
- float k = 1.0 - eta * eta * (1.0 - dot (N, I) * dot (N, I));
- if (k < 0.0)
- return 0.0;
- return eta * I - (eta * dot (N, I) + sqrt (k)) * N;
-}
-
-//
-// 8.5 Matrix Functions
-//
-
-mat2 matrixCompMult (mat2 m, mat2 n) {
- return mat2 (m[0] * n[0], m[1] * n[1]);
-}
-
-mat3 matrixCompMult (mat3 m, mat3 n) {
- return mat3 (m[0] * n[0], m[1] * n[1], m[2] * n[2]);
-}
-
-mat4 matrixCompMult (mat4 m, mat4 n) {
- return mat4 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]);
-}
-
-//
-// 8.6 Vector Relational Functions
-//
-
-bvec2 lessThan (vec2 v, vec2 u) {
- return bvec2 (v.x < u.x, v.y < u.y);
-}
-
-bvec3 lessThan (vec3 v, vec3 u) {
- return bvec3 (v.x < u.x, v.y < u.y, v.z < u.z);
-}
-
-bvec4 lessThan (vec4 v, vec4 u) {
- return bvec4 (v.x < u.x, v.y < u.y, v.z < u.z, v.w < u.w);
-}
-
-bvec2 lessThan (ivec2 v, ivec2 u) {
- return bvec2 (v.x < u.x, v.y < u.y);
-}
-
-bvec3 lessThan (ivec3 v, ivec3 u) {
- return bvec3 (v.x < u.x, v.y < u.y, v.z < u.z);
-}
-
-bvec4 lessThan (ivec4 v, ivec4 u) {
- return bvec4 (v.x < u.x, v.y < u.y, v.z < u.z, v.w < u.w);
-}
-
-bvec2 lessThanEqual (vec2 v, vec2 u) {
- return bvec2 (v.x <= u.x, v.y <= u.y);
-}
-
-bvec3 lessThanEqual (vec3 v, vec3 u) {
- return bvec3 (v.x <= u.x, v.y <= u.y, v.z <= u.z);
-}
-
-bvec4 lessThanEqual (vec4 v, vec4 u) {
- return bvec4 (v.x <= u.x, v.y <= u.y, v.z <= u.z, v.w <= u.w);
-}
-
-bvec2 lessThanEqual (ivec2 v, ivec2 u) {
- return bvec2 (v.x <= u.x, v.y <= u.y);
-}
-
-bvec3 lessThanEqual (ivec3 v, ivec3 u) {
- return bvec3 (v.x <= u.x, v.y <= u.y, v.z <= u.z);
-}
-
-bvec4 lessThanEqual (ivec4 v, ivec4 u) {
- return bvec4 (v.x <= u.x, v.y <= u.y, v.z <= u.z, v.w <= u.w);
-}
-
-bvec2 greaterThan (vec2 v, vec2 u) {
- return bvec2 (v.x > u.x, v.y > u.y);
-}
-
-bvec3 greaterThan (vec3 v, vec3 u) {
- return bvec3 (v.x > u.x, v.y > u.y, v.z > u.z);
-}
-
-bvec4 greaterThan (vec4 v, vec4 u) {
- return bvec4 (v.x > u.x, v.y > u.y, v.z > u.z, v.w > u.w);
-}
-
-bvec2 greaterThan (ivec2 v, ivec2 u) {
- return bvec2 (v.x > u.x, v.y > u.y);
-}
-
-bvec3 greaterThan (ivec3 v, ivec3 u) {
- return bvec3 (v.x > u.x, v.y > u.y, v.z > u.z);
-}
-
-bvec4 greaterThan (ivec4 v, ivec4 u) {
- return bvec4 (v.x > u.x, v.y > u.y, v.z > u.z, v.w > u.w);
-}
-
-bvec2 greaterThanEqual (vec2 v, vec2 u) {
- return bvec2 (v.x >= u.x, v.y >= u.y);
-}
-
-bvec3 greaterThanEqual (vec3 v, vec3 u) {
- return bvec3 (v.x >= u.x, v.y >= u.y, v.z >= u.z);
-}
-
-bvec4 greaterThanEqual (vec4 v, vec4 u) {
- return bvec4 (v.x >= u.x, v.y >= u.y, v.z >= u.z, v.w >= u.w);
-}
-
-bvec2 greaterThanEqual (ivec2 v, ivec2 u) {
- return bvec2 (v.x >= u.x, v.y >= u.y);
-}
-
-bvec3 greaterThanEqual (ivec3 v, ivec3 u) {
- return bvec3 (v.x >= u.x, v.y >= u.y, v.z >= u.z);
-}
-
-bvec4 greaterThanEqual (ivec4 v, ivec4 u) {
- return bvec4 (v.x >= u.x, v.y >= u.y, v.z >= u.z, v.w >= u.w);
-}
-
-bvec2 equal (vec2 v, vec2 u) {
- return bvec2 (v.x == u.x, v.y == u.y);
-}
-
-bvec3 equal (vec3 v, vec3 u) {
- return bvec3 (v.x == u.x, v.y == u.y, v.z == u.z);
-}
-
-bvec4 equal (vec4 v, vec4 u) {
- return bvec4 (v.x == u.x, v.y == u.y, v.z == u.z, v.w == u.w);
-}
-
-bvec2 equal (ivec2 v, ivec2 u) {
- return bvec2 (v.x == u.x, v.y == u.y);
-}
-
-bvec3 equal (ivec3 v, ivec3 u) {
- return bvec3 (v.x == u.x, v.y == u.y, v.z == u.z);
-}
-
-bvec4 equal (ivec4 v, ivec4 u) {
- return bvec4 (v.x == u.x, v.y == u.y, v.z == u.z, v.w == u.w);
-}
-
-bvec2 notEqual (vec2 v, vec2 u) {
- return bvec2 (v.x != u.x, v.y != u.y);
-}
-
-bvec3 notEqual (vec3 v, vec3 u) {
- return bvec3 (v.x != u.x, v.y != u.y, v.z != u.z);
-}
-
-bvec4 notEqual (vec4 v, vec4 u) {
- return bvec4 (v.x != u.x, v.y != u.y, v.z != u.z, v.w != u.w);
-}
-
-bvec2 notEqual (ivec2 v, ivec2 u) {
- return bvec2 (v.x != u.x, v.y != u.y);
-}
-
-bvec3 notEqual (ivec3 v, ivec3 u) {
- return bvec3 (v.x != u.x, v.y != u.y, v.z != u.z);
-}
-
-bvec4 notEqual (ivec4 v, ivec4 u) {
- return bvec4 (v.x != u.x, v.y != u.y, v.z != u.z, v.w != u.w);
-}
-
-bool any (bvec2 v) {
- return v.x || v.y;
-}
-
-bool any (bvec3 v) {
- return v.x || v.y || v.z;
-}
-
-bool any (bvec4 v) {
- return v.x || v.y || v.z || v.w;
-}
-
-bool all (bvec2 v) {
- return v.x && v.y;
-}
-
-bool all (bvec3 v) {
- return v.x && v.y && v.z;
-}
-
-bool all (bvec4 v) {
- return v.x && v.y && v.z && v.w;
-}
-
-bvec2 not (bvec2 v) {
- return bvec2 (!v.x, !v.y);
-}
-
-bvec3 not (bvec3 v) {
- return bvec3 (!v.x, !v.y, !v.z);
-}
-
-bvec4 not (bvec4 v) {
- return bvec4 (!v.x, !v.y, !v.z, !v.w);
-}
-
-//
-// 8.7 Texture Lookup Functions
-//
-
-vec4 texture1D (sampler1D sampler, float coord) {
- vec4 texel;
- __asm vec4_tex1d texel, sampler, coord, 0.0;
- return texel;
-}
-
-vec4 texture1DProj (sampler1D sampler, vec2 coord) {
- return texture1D (sampler, coord.s / coord.t);
-}
-
-vec4 texture1DProj (sampler1D sampler, vec4 coord) {
- return texture1D (sampler, coord.s / coord.q);
-}
-
-vec4 texture2D (sampler2D sampler, vec2 coord) {
- vec4 texel;
- __asm vec4_tex2d texel, sampler, coord, 0.0;
- return texel;
-}
-
-vec4 texture2DProj (sampler2D sampler, vec3 coord) {
- return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p));
-}
-
-vec4 texture2DProj (sampler2D sampler, vec4 coord) {
- return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q));
-}
-
-vec4 texture3D (sampler3D sampler, vec3 coord) {
- vec4 texel;
- __asm vec4_tex3d texel, sampler, coord, 0.0;
- return texel;
-}
-
-vec4 texture3DProj (sampler3D sampler, vec4 coord) {
- return texture3D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));
-}
-
-vec4 textureCube (samplerCube sampler, vec3 coord) {
- vec4 texel;
- __asm vec4_texcube texel, sampler, coord, 0.0;
- return texel;
-}
-
-vec4 shadow1D (sampler1DShadow sampler, vec3 coord) {
- vec4 texel;
- __asm vec4_shad1d texel, sampler, coord, 0.0;
- return texel;
-}
-
-vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord) {
- return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q));
-}
-
-vec4 shadow2D (sampler2DShadow sampler, vec3 coord) {
- vec4 texel;
- __asm vec4_shad2d texel, sampler, coord, 0.0;
- return texel;
-}
-
-vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {
- return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q));
-}
-
-//
-// 8.9 Noise Functions
-//
-// AUTHOR: Stefan Gustavson (stegu@itn.liu.se), Nov 26, 2005
-//
-
-float noise1 (float x) {
- float a;
- __asm float_noise1 a, x;
- return a;
-}
-
-float noise1 (vec2 x) {
- float a;
- __asm float_noise2 a, x;
- return a;
-}
-
-float noise1 (vec3 x) {
- float a;
- __asm float_noise3 a, x;
- return a;
-}
-
-float noise1 (vec4 x) {
- float a;
- __asm float_noise4 a, x;
- return a;
-}
-
-vec2 noise2 (float x) {
- return vec2 (
- noise1 (x),
- noise1 (x + 19.34)
- );
-}
-
-vec2 noise2 (vec2 x) {
- return vec2 (
- noise1 (x),
- noise1 (x + vec2 (19.34, 7.66))
- );
-}
-
-vec2 noise2 (vec3 x) {
- return vec2 (
- noise1 (x),
- noise1 (x + vec3 (19.34, 7.66, 3.23))
- );
-}
-
-vec2 noise2 (vec4 x) {
- return vec2 (
- noise1 (x),
- noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77))
- );
-}
-
-vec3 noise3 (float x) {
- return vec3 (
- noise1 (x),
- noise1 (x + 19.34),
- noise1 (x + 5.47)
- );
-}
-
-vec3 noise3 (vec2 x) {
- return vec3 (
- noise1 (x),
- noise1 (x + vec2 (19.34, 7.66)),
- noise1 (x + vec2 (5.47, 17.85))
- );
-}
-
-vec3 noise3 (vec3 x) {
- return vec3 (
- noise1 (x),
- noise1 (x + vec3 (19.34, 7.66, 3.23)),
- noise1 (x + vec3 (5.47, 17.85, 11.04))
- );
-}
-
-vec3 noise3 (vec4 x) {
- return vec3 (
- noise1 (x),
- noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77)),
- noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19))
- );
-}
-
-vec4 noise4 (float x) {
- return vec4 (
- noise1 (x),
- noise1 (x + 19.34),
- noise1 (x + 5.47),
- noise1 (x + 23.54)
- );
-}
-
-vec4 noise4 (vec2 x) {
- return vec4 (
- noise1 (x),
- noise1 (x + vec2 (19.34, 7.66)),
- noise1 (x + vec2 (5.47, 17.85)),
- noise1 (x + vec2 (23.54, 29.11))
- );
-}
-
-vec4 noise4 (vec3 x) {
- return vec4 (
- noise1 (x),
- noise1 (x + vec3 (19.34, 7.66, 3.23)),
- noise1 (x + vec3 (5.47, 17.85, 11.04)),
- noise1 (x + vec3 (23.54, 29.11, 31.91))
- );
-}
-
-vec4 noise4 (vec4 x) {
- return vec4 (
- noise1 (x),
- noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77)),
- noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19)),
- noise1 (x + vec4 (23.54, 29.11, 31.91, 37.48))
- );
-}
-
diff --git a/src/mesa/shader/slang/library/slang_core.gc b/src/mesa/shader/slang/library/slang_core.gc
deleted file mode 100755
index 7a721a5a1d0..00000000000
--- a/src/mesa/shader/slang/library/slang_core.gc
+++ /dev/null
@@ -1,1679 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//
-// This file defines nearly all constructors and operators for built-in data types, using
-// extended language syntax. In general, compiler treats constructors and operators as
-// ordinary functions with some exceptions. For example, the language does not allow
-// functions to be called in constant expressions - here the exception is made to allow it.
-//
-// Each implementation provides its own version of this file. Each implementation can define
-// the required set of operators and constructors in its own fashion.
-//
-// The extended language syntax is only present when compiling this file. It is implicitly
-// included at the very beginning of the compiled shader, so no built-in functions can be
-// used.
-//
-// To communicate with the implementation, a special extended "__asm" keyword is used, followed
-// by an instruction name (any valid identifier), a destination variable identifier and a
-// a list of zero or more source variable identifiers. A variable identifier is a variable name
-// declared earlier in the code (as a function parameter, local or global variable).
-// An instruction name designates an instruction that must be exported by the implementation.
-// Each instruction receives data from source variable identifiers and returns data in the
-// destination variable identifier.
-//
-// It is up to the implementation how to define a particular operator or constructor. If it is
-// expected to being used rarely, it can be defined in terms of other operators and constructors,
-// for example:
-//
-// ivec2 __operator + (const ivec2 x, const ivec2 y) {
-// return ivec2 (x[0] + y[0], x[1] + y[1]);
-// }
-//
-// If a particular operator or constructor is expected to be used very often or is an atomic
-// operation (that is, an operation that cannot be expressed in terms of other operations or
-// would create a dependency cycle) it must be defined using one or more __asm constructs.
-//
-// Each implementation must define constructors for all scalar types (bool, float, int).
-// There are 9 scalar-to-scalar constructors (including identity constructors). However,
-// since the language introduces special constructors (like matrix constructor with a single
-// scalar value), implementations must also implement these cases.
-// The compiler provides the following algorithm when resolving a constructor:
-// - try to find a constructor with a prototype matching ours,
-// - if no constructor is found and this is a scalar-to-scalar constructor, raise an error,
-// - if a constructor is found, execute it and return,
-// - count the size of the constructor parameter list - if it is less than the size of
-// our constructor's type, raise an error,
-// - for each parameter in the list do a recursive constructor matching for appropriate
-// scalar fields in the constructed variable,
-//
-// Each implementation must also define a set of operators that deal with built-in data types.
-// There are four kinds of operators:
-// 1) Operators that are implemented only by the compiler: "()" (function call), "," (sequence)
-// and "?:" (selection).
-// 2) Operators that are implemented by the compiler by expressing it in terms of other operators:
-// - "." (field selection) - translated to subscript access,
-// - "&&" (logical and) - translated to "<left_expr> ? <right_expr> : false",
-// - "||" (logical or) - translated to "<left_expr> ? true : <right_expr>",
-// 3) Operators that can be defined by the implementation and if the required prototype is not
-// found, standard behaviour is used:
-// - "==", "!=", "=" (equality, assignment) - compare or assign matching fields one-by-one;
-// note that at least operators for scalar data types must be defined by the implementation
-// to get it work,
-// 4) All other operators not mentioned above. If no required prototype is found, an error is
-// raised. An implementation must follow the language specification to provide all valid
-// operator prototypes.
-//
-
-int __constructor (const float f) {
- int i;
- __asm float_to_int i, f;
- return i;
-}
-
-bool __constructor (const int i) {
- return i != 0;
-}
-
-bool __constructor (const float f) {
- return f != 0.0;
-}
-
-int __constructor (const bool b) {
- return b ? 1 : 0;
-}
-
-float __constructor (const bool b) {
- return b ? 1.0 : 0.0;
-}
-
-float __constructor (const int i) {
- float f;
- __asm int_to_float f, i;
- return f;
-}
-
-bool __constructor (const bool b) {
- return b;
-}
-
-int __constructor (const int i) {
- return i;
-}
-
-float __constructor (const float f) {
- return f;
-}
-
-vec2 __constructor (const float f) {
- return vec2 (f, f);
-}
-
-vec2 __constructor (const int i) {
- float x;
- __asm int_to_float x, i;
- return vec2 (x);
-}
-
-vec2 __constructor (const bool b) {
- return vec2 (b ? 1.0 : 0.0);
-}
-
-vec3 __constructor (const float f) {
- return vec3 (f, f, f);
-}
-
-vec3 __constructor (const int i) {
- float x;
- __asm int_to_float x, i;
- return vec3 (x);
-}
-
-vec3 __constructor (const bool b) {
- return vec3 (b ? 1.0 : 0.0);
-}
-
-vec4 __constructor (const float f) {
- return vec4 (f, f, f, f);
-}
-
-vec4 __constructor (const int i) {
- float x;
- __asm int_to_float x, i;
- return vec4 (x);
-}
-
-vec4 __constructor (const bool b) {
- return vec4 (b ? 1.0 : 0.0);
-}
-
-ivec2 __constructor (const int i) {
- return ivec2 (i, i);
-}
-
-ivec2 __constructor (const float f) {
- return ivec2 (int (f));
-}
-
-ivec2 __constructor (const bool b) {
- return ivec2 (int (b));
-}
-
-ivec3 __constructor (const int i) {
- return ivec3 (i, i, i);
-}
-
-ivec3 __constructor (const float f) {
- return ivec3 (int (f));
-}
-
-ivec3 __constructor (const bool b) {
- return ivec3 (int (b));
-}
-
-ivec4 __constructor (const int i) {
- return ivec4 (i, i, i, i);
-}
-
-ivec4 __constructor (const float f) {
- return ivec4 (int (f));
-}
-
-ivec4 __constructor (const bool b) {
- return ivec4 (int (b));
-}
-
-bvec2 __constructor (const bool b) {
- return bvec2 (b, b);
-}
-
-bvec2 __constructor (const float f) {
- return bvec2 (bool (f));
-}
-
-bvec2 __constructor (const int i) {
- return bvec2 (bool (i));
-}
-
-bvec3 __constructor (const bool b) {
- return bvec3 (b, b, b);
-}
-
-bvec3 __constructor (const float f) {
- return bvec3 (bool (f));
-}
-
-bvec3 __constructor (const int i) {
- return bvec3 (bool (i));
-}
-
-bvec4 __constructor (const bool b) {
- return bvec4 (b, b, b, b);
-}
-
-bvec4 __constructor (const float f) {
- return bvec4 (bool (f));
-}
-
-bvec4 __constructor (const int i) {
- return bvec4 (bool (i));
-}
-
-mat2 __constructor (const float f) {
- return mat2 (f, 0.0, 0.0, f);
-}
-
-mat2 __constructor (const int i) {
- float x;
- __asm int_to_float x, i;
- return mat2 (x);
-}
-
-mat2 __constructor (const bool b) {
- return mat2 (b ? 1.0 : 0.0);
-}
-
-mat3 __constructor (const float f) {
- return mat3 (f, 0.0, 0.0, 0.0, f, 0.0, 0.0, 0.0, f);
-}
-
-mat3 __constructor (const int i) {
- float x;
- __asm int_to_float x, i;
- return mat3 (x);
-}
-
-mat3 __constructor (const bool b) {
- return mat3 (b ? 1.0 : 0.0);
-}
-
-mat4 __constructor (const float f) {
- return mat4 (f, 0.0, 0.0, 0.0, 0.0, f, 0.0, 0.0, 0.0, 0.0, f, 0.0, 0.0, 0.0, 0.0, f);
-}
-
-mat4 __constructor (const int i) {
- float x;
- __asm int_to_float x, i;
- return mat4 (x);
-}
-
-mat4 __constructor (const bool b) {
- return mat4 (b ? 1.0 : 0.0);
-}
-
-void __operator += (inout float a, const float b) {
- __asm float_add a, a, b;
-}
-
-float __operator - (const float a) {
- float b;
- __asm float_negate b, a;
- return b;
-}
-
-void __operator -= (inout float a, const float b) {
- float c;
- __asm float_negate c, b;
- __asm float_add a, a, c;
-}
-
-void __operator *= (inout float a, const float b) {
- __asm float_multiply a, a, b;
-}
-
-void __operator /= (inout float a, const float b) {
- __asm float_divide a, a, b;
-}
-
-float __operator + (const float a, const float b) {
- float c;
- __asm float_add c, a, b;
- return c;
-}
-
-void __operator += (inout int a, const int b) {
- a = int (float (a) + float (b));
-}
-
-int __operator - (const int a) {
- float x;
- int b;
- __asm int_to_float x, a;
- __asm float_negate x, x;
- __asm float_to_int b, x;
- return b;
-}
-
-void __operator -= (inout int a, const int b) {
- a += -b;
-}
-
-float __operator * (const float a, const float b) {
- float c;
- __asm float_multiply c, a, b;
- return c;
-}
-
-void __operator *= (inout int a, const int b) {
- a = int (float (a) * float (b));
-}
-
-float __operator / (const float a, const float b) {
- float c;
- __asm float_divide c, a, b;
- return c;
-}
-
-void __operator /= (inout int a, const int b) {
- a = int (float (a) / float (b));
-}
-
-void __operator += (inout vec2 v, const vec2 u) {
- v.x += u.x;
- v.y += u.y;
-}
-
-void __operator -= (inout vec2 v, const vec2 u) {
- v.x -= u.x;
- v.y -= u.y;
-}
-
-void __operator *= (inout vec2 v, const vec2 u) {
- v.x *= u.x;
- v.y *= u.y;
-}
-
-void __operator /= (inout vec2 v, const vec2 u) {
- v.x /= u.x;
- v.y /= u.y;
-}
-
-void __operator += (inout vec3 v, const vec3 u) {
- v.x += u.x;
- v.y += u.y;
- v.z += u.z;
-}
-
-void __operator -= (inout vec3 v, const vec3 u) {
- v.x -= u.x;
- v.y -= u.y;
- v.z -= u.z;
-}
-
-void __operator *= (inout vec3 v, const vec3 u) {
- v.x *= u.x;
- v.y *= u.y;
- v.z *= u.z;
-}
-
-void __operator /= (inout vec3 v, const vec3 u) {
- v.x /= u.x;
- v.y /= u.y;
- v.z /= u.z;
-}
-
-void __operator += (inout vec4 v, const vec4 u) {
- v.x += u.x;
- v.y += u.y;
- v.z += u.z;
- v.w += u.w;
-}
-
-void __operator -= (inout vec4 v, const vec4 u) {
- v.x -= u.x;
- v.y -= u.y;
- v.z -= u.z;
- v.w -= u.w;
-}
-
-void __operator *= (inout vec4 v, const vec4 u) {
- v.x *= u.x;
- v.y *= u.y;
- v.z *= u.z;
- v.w *= u.w;
-}
-
-void __operator /= (inout vec4 v, const vec4 u) {
- v.x /= u.x;
- v.y /= u.y;
- v.z /= u.z;
- v.w /= u.w;
-}
-
-void __operator += (inout ivec2 v, const ivec2 u) {
- v.x += u.x;
- v.y += u.y;
-}
-
-void __operator -= (inout ivec2 v, const ivec2 u) {
- v.x -= u.x;
- v.y -= u.y;
-}
-
-void __operator *= (inout ivec2 v, const ivec2 u) {
- v.x *= u.x;
- v.y *= u.y;
-}
-
-void __operator /= (inout ivec2 v, const ivec2 u) {
- v.x /= u.x;
- v.y /= u.y;
-}
-
-void __operator += (inout ivec3 v, const ivec3 u) {
- v.x += u.x;
- v.y += u.y;
- v.z += u.z;
-}
-
-void __operator -= (inout ivec3 v, const ivec3 u) {
- v.x -= u.x;
- v.y -= u.y;
- v.z -= u.z;
-}
-
-void __operator *= (inout ivec3 v, const ivec3 u) {
- v.x *= u.x;
- v.y *= u.y;
- v.z *= u.z;
-}
-
-void __operator /= (inout ivec3 v, const ivec3 u) {
- v.x /= u.x;
- v.y /= u.y;
- v.z /= u.z;
-}
-
-void __operator += (inout ivec4 v, const ivec4 u) {
- v.x += u.x;
- v.y += u.y;
- v.z += u.z;
- v.w += u.w;
-}
-
-void __operator -= (inout ivec4 v, const ivec4 u) {
- v.x -= u.x;
- v.y -= u.y;
- v.z -= u.z;
- v.w -= u.w;
-}
-
-void __operator *= (inout ivec4 v, const ivec4 u) {
- v.x *= u.x;
- v.y *= u.y;
- v.z *= u.z;
- v.w *= u.w;
-}
-
-void __operator /= (inout ivec4 v, const ivec4 u) {
- v.x /= u.x;
- v.y /= u.y;
- v.z /= u.z;
- v.w /= u.w;
-}
-
-void __operator += (inout mat2 m, const mat2 n) {
- m[0] += n[0];
- m[1] += n[1];
-}
-
-void __operator -= (inout mat2 m, const mat2 n) {
- m[0] -= n[0];
- m[1] -= n[1];
-}
-
-vec2 __operator * (const mat2 m, const vec2 v) {
- return vec2 (
- v.x * m[0].x + v.y * m[1].x,
- v.x * m[0].y + v.y * m[1].y
- );
-}
-
-mat2 __operator * (const mat2 m, const mat2 n) {
- return mat2 (m * n[0], m * n[1]);
-}
-
-void __operator *= (inout mat2 m, const mat2 n) {
- m = m * n;
-}
-
-void __operator /= (inout mat2 m, const mat2 n) {
- m[0] /= n[0];
- m[1] /= n[1];
-}
-
-void __operator += (inout mat3 m, const mat3 n) {
- m[0] += n[0];
- m[1] += n[1];
- m[2] += n[2];
-}
-
-void __operator -= (inout mat3 m, const mat3 n) {
- m[0] -= n[0];
- m[1] -= n[1];
- m[2] -= n[2];
-}
-
-vec3 __operator * (const mat3 m, const vec3 v) {
- return vec3 (
- v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,
- v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,
- v.x * m[0].z + v.y * m[1].z + v.z * m[2].z
- );
-}
-
-mat3 __operator * (const mat3 m, const mat3 n) {
- return mat3 (m * n[0], m * n[1], m * n[2]);
-}
-
-void __operator *= (inout mat3 m, const mat3 n) {
- m = m * n;
-}
-
-void __operator /= (inout mat3 m, const mat3 n) {
- m[0] /= n[0];
- m[1] /= n[1];
- m[2] /= n[2];
-}
-
-void __operator += (inout mat4 m, const mat4 n) {
- m[0] += n[0];
- m[1] += n[1];
- m[2] += n[2];
- m[3] += n[3];
-}
-
-void __operator -= (inout mat4 m, const mat4 n) {
- m[0] -= n[0];
- m[1] -= n[1];
- m[2] -= n[2];
- m[3] -= n[3];
-}
-
-vec4 __operator * (const mat4 m, const vec4 v) {
- return vec4 (
- v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,
- v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,
- v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,
- v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w
- );
-}
-
-mat4 __operator * (const mat4 m, const mat4 n) {
- return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);
-}
-
-void __operator *= (inout mat4 m, const mat4 n) {
- m = m * n;
-}
-
-void __operator /= (inout mat4 m, const mat4 n) {
- m[0] /= n[0];
- m[1] /= n[1];
- m[2] /= n[2];
- m[3] /= n[3];
-}
-
-void __operator += (inout vec2 v, const float a) {
- v.x += a;
- v.y += a;
-}
-
-void __operator -= (inout vec2 v, const float a) {
- v.x -= a;
- v.y -= a;
-}
-
-void __operator *= (inout vec2 v, const float a) {
- v.x *= a;
- v.y *= a;
-}
-
-void __operator /= (inout vec2 v, const float a) {
- v.x /= a;
- v.y /= a;
-}
-
-void __operator += (inout vec3 v, const float a) {
- v.x += a;
- v.y += a;
- v.z += a;
-}
-
-void __operator -= (inout vec3 v, const float a) {
- v.x -= a;
- v.y -= a;
- v.z -= a;
-}
-
-void __operator *= (inout vec3 v, const float a) {
- v.x *= a;
- v.y *= a;
- v.z *= a;
-}
-
-void __operator /= (inout vec3 v, const float a) {
- v.x /= a;
- v.y /= a;
- v.z /= a;
-}
-
-void __operator += (inout vec4 v, const float a) {
- v.x += a;
- v.y += a;
- v.z += a;
- v.w += a;
-}
-
-void __operator -= (inout vec4 v, const float a) {
- v.x -= a;
- v.y -= a;
- v.z -= a;
- v.w -= a;
-}
-
-void __operator *= (inout vec4 v, const float a) {
- v.x *= a;
- v.y *= a;
- v.z *= a;
- v.w *= a;
-}
-
-void __operator /= (inout vec4 v, const float a) {
- v.x /= a;
- v.y /= a;
- v.z /= a;
- v.w /= a;
-}
-
-void __operator += (inout mat2 m, const float a) {
- m[0] += a;
- m[1] += a;
-}
-
-void __operator -= (inout mat2 m, const float a) {
- m[0] -= a;
- m[1] -= a;
-}
-
-void __operator *= (inout mat2 m, const float a) {
- m[0] *= a;
- m[1] *= a;
-}
-
-void __operator /= (inout mat2 m, const float a) {
- m[0] /= a;
- m[1] /= a;
-}
-
-void __operator += (inout mat3 m, const float a) {
- m[0] += a;
- m[1] += a;
- m[2] += a;
-}
-
-void __operator -= (inout mat3 m, const float a) {
- m[0] -= a;
- m[1] -= a;
- m[2] -= a;
-}
-
-void __operator *= (inout mat3 m, const float a) {
- m[0] *= a;
- m[1] *= a;
- m[2] *= a;
-}
-
-void __operator /= (inout mat3 m, const float a) {
- m[0] /= a;
- m[1] /= a;
- m[2] /= a;
-}
-
-void __operator += (inout mat4 m, const float a) {
- m[0] += a;
- m[1] += a;
- m[2] += a;
- m[3] += a;
-}
-
-void __operator -= (inout mat4 m, const float a) {
- m[0] -= a;
- m[1] -= a;
- m[2] -= a;
- m[3] -= a;
-}
-
-void __operator *= (inout mat4 m, const float a) {
- m[0] *= a;
- m[1] *= a;
- m[2] *= a;
- m[3] *= a;
-}
-
-void __operator /= (inout mat4 m, const float a) {
- m[0] /= a;
- m[1] /= a;
- m[2] /= a;
- m[3] /= a;
-}
-
-vec2 __operator * (const vec2 v, const mat2 m) {
- return vec2 (
- v.x * m[0].x + v.y * m[0].y,
- v.x * m[1].x + v.y * m[1].y
- );
-}
-
-void __operator *= (inout vec2 v, const mat2 m) {
- v = v * m;
-}
-
-vec3 __operator * (const vec3 v, const mat3 m) {
- return vec3 (
- v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,
- v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,
- v.x * m[2].x + v.y * m[2].y + v.z * m[2].z
- );
-}
-
-void __operator *= (inout vec3 v, const mat3 m) {
- v = v * m;
-}
-
-vec4 __operator * (const vec4 v, const mat4 m) {
- return vec4 (
- v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,
- v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,
- v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,
- v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w
- );
-}
-
-void __operator *= (inout vec4 v, const mat4 m) {
- v = v * m;
-}
-
-float __operator - (const float a, const float b) {
- float c;
- __asm float_negate c, b;
- __asm float_add c, a, c;
- return c;
-}
-
-int __operator + (const int a, const int b) {
- float x, y;
- int c;
- __asm int_to_float x, a;
- __asm int_to_float y, b;
- __asm float_add x, x, y;
- __asm float_to_int c, x;
- return c;
-}
-
-int __operator - (const int a, const int b) {
- float x, y;
- int c;
- __asm int_to_float x, a;
- __asm int_to_float y, b;
- __asm float_negate y, y;
- __asm float_add x, x, y;
- __asm float_to_int c, x;
- return c;
-}
-
-int __operator * (const int a, const int b) {
- float x, y;
- int c;
- __asm int_to_float x, a;
- __asm int_to_float y, b;
- __asm float_multiply x, x, y;
- __asm float_to_int c, x;
- return c;
-}
-
-int __operator / (const int a, const int b) {
- float x, y;
- int c;
- __asm int_to_float x, a;
- __asm int_to_float y, b;
- __asm float_divide x, x, y;
- __asm float_to_int c, x;
- return c;
-}
-
-vec2 __operator + (const vec2 v, const vec2 u) {
- return vec2 (v.x + u.x, v.y + u.y);
-}
-
-vec2 __operator - (const vec2 v, const vec2 u) {
- return vec2 (v.x - u.x, v.y - u.y);
-}
-
-vec2 __operator * (const vec2 v, const vec2 u) {
- return vec2 (v.x * u.x, v.y * u.y);
-}
-
-vec2 __operator / (const vec2 v, const vec2 u) {
- return vec2 (v.x / u.x, v.y / u.y);
-}
-
-vec3 __operator + (const vec3 v, const vec3 u) {
- return vec3 (v.x + u.x, v.y + u.y, v.z + u.z);
-}
-
-vec3 __operator - (const vec3 v, const vec3 u) {
- return vec3 (v.x - u.x, v.y - u.y, v.z - u.z);
-}
-
-vec3 __operator * (const vec3 v, const vec3 u) {
- return vec3 (v.x * u.x, v.y * u.y, v.z * u.z);
-}
-
-vec3 __operator / (const vec3 v, const vec3 u) {
- return vec3 (v.x / u.x, v.y / u.y, v.z / u.z);
-}
-
-vec4 __operator + (const vec4 v, const vec4 u) {
- return vec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);
-}
-
-vec4 __operator - (const vec4 v, const vec4 u) {
- return vec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);
-}
-
-vec4 __operator * (const vec4 v, const vec4 u) {
- return vec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);
-}
-
-vec4 __operator / (const vec4 v, const vec4 u) {
- return vec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);
-}
-
-ivec2 __operator + (const ivec2 v, const ivec2 u) {
- return ivec2 (v.x + u.x, v.y + u.y);
-}
-
-ivec2 __operator - (const ivec2 v, const ivec2 u) {
- return ivec2 (v.x - u.x, v.y - u.y);
-}
-
-ivec2 __operator * (const ivec2 v, const ivec2 u) {
- return ivec2 (v.x * u.x, v.y * u.y);
-}
-
-ivec2 __operator / (const ivec2 v, const ivec2 u) {
- return ivec2 (v.x / u.x, v.y / u.y);
-}
-
-ivec3 __operator + (const ivec3 v, const ivec3 u) {
- return ivec3 (v.x + u.x, v.y + u.y, v.z + u.z);
-}
-
-ivec3 __operator - (const ivec3 v, const ivec3 u) {
- return ivec3 (v.x - u.x, v.y - u.y, v.z - u.z);
-}
-
-ivec3 __operator * (const ivec3 v, const ivec3 u) {
- return ivec3 (v.x * u.x, v.y * u.y, v.z * u.z);
-}
-
-ivec3 __operator / (const ivec3 v, const ivec3 u) {
- return ivec3 (v.x / u.x, v.y / u.y, v.z / u.z);
-}
-
-ivec4 __operator + (const ivec4 v, const ivec4 u) {
- return ivec4 (v.x + u.x, v.y + u.y, v.z + u.z, v.w + u.w);
-}
-
-ivec4 __operator - (const ivec4 v, const ivec4 u) {
- return ivec4 (v.x - u.x, v.y - u.y, v.z - u.z, v.w - u.w);
-}
-
-ivec4 __operator * (const ivec4 v, const ivec4 u) {
- return ivec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);
-}
-
-ivec4 __operator / (const ivec4 v, const ivec4 u) {
- return ivec4 (v.x / u.x, v.y / u.y, v.z / u.z, v.w / u.w);
-}
-
-mat2 __operator + (const mat2 m, const mat2 n) {
- return mat2 (m[0] + n[0], m[1] + n[1]);
-}
-
-mat2 __operator - (const mat2 m, const mat2 n) {
- return mat2 (m[0] - n[0], m[1] - n[1]);
-}
-
-mat2 __operator / (const mat2 m, const mat2 n) {
- return mat2 (m[0] / n[0], m[1] / n[1]);
-}
-
-mat3 __operator + (const mat3 m, const mat3 n) {
- return mat3 (m[0] + n[0], m[1] + n[1], m[2] + n[2]);
-}
-
-mat3 __operator - (const mat3 m, const mat3 n) {
- return mat3 (m[0] - n[0], m[1] - n[1], m[2] - n[2]);
-}
-
-mat3 __operator / (const mat3 m, const mat3 n) {
- return mat3 (m[0] / n[0], m[1] / n[1], m[2] / n[2]);
-}
-
-mat4 __operator + (const mat4 m, const mat4 n) {
- return mat4 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]);
-}
-
-mat4 __operator - (const mat4 m, const mat4 n) {
- return mat4 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);
-}
-
-mat4 __operator / (const mat4 m, const mat4 n) {
- return mat4 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);
-}
-
-vec2 __operator + (const float a, const vec2 u) {
- return vec2 (a + u.x, a + u.y);
-}
-
-vec2 __operator + (const vec2 v, const float b) {
- return vec2 (v.x + b, v.y + b);
-}
-
-vec2 __operator - (const float a, const vec2 u) {
- return vec2 (a - u.x, a - u.y);
-}
-
-vec2 __operator - (const vec2 v, const float b) {
- return vec2 (v.x - b, v.y - b);
-}
-
-vec2 __operator * (const float a, const vec2 u) {
- return vec2 (a * u.x, a * u.y);
-}
-
-vec2 __operator * (const vec2 v, const float b) {
- return vec2 (v.x * b, v.y * b);
-}
-
-vec2 __operator / (const float a, const vec2 u) {
- return vec2 (a / u.x, a / u.y);
-}
-
-vec2 __operator / (const vec2 v, const float b) {
- return vec2 (v.x / b, v.y / b);
-}
-
-vec3 __operator + (const float a, const vec3 u) {
- return vec3 (a + u.x, a + u.y, a + u.z);
-}
-
-vec3 __operator + (const vec3 v, const float b) {
- return vec3 (v.x + b, v.y + b, v.z + b);
-}
-
-vec3 __operator - (const float a, const vec3 u) {
- return vec3 (a - u.x, a - u.y, a - u.z);
-}
-
-vec3 __operator - (const vec3 v, const float b) {
- return vec3 (v.x - b, v.y - b, v.z - b);
-}
-
-vec3 __operator * (const float a, const vec3 u) {
- return vec3 (a * u.x, a * u.y, a * u.z);
-}
-
-vec3 __operator * (const vec3 v, const float b) {
- return vec3 (v.x * b, v.y * b, v.z * b);
-}
-
-vec3 __operator / (const float a, const vec3 u) {
- return vec3 (a / u.x, a / u.y, a / u.z);
-}
-
-vec3 __operator / (const vec3 v, const float b) {
- return vec3 (v.x / b, v.y / b, v.z / b);
-}
-
-vec4 __operator + (const float a, const vec4 u) {
- return vec4 (a + u.x, a + u.y, a + u.z, a + u.w);
-}
-
-vec4 __operator + (const vec4 v, const float b) {
- return vec4 (v.x + b, v.y + b, v.z + b, v.w + b);
-}
-
-vec4 __operator - (const float a, const vec4 u) {
- return vec4 (a - u.x, a - u.y, a - u.z, a - u.w);
-}
-
-vec4 __operator - (const vec4 v, const float b) {
- return vec4 (v.x - b, v.y - b, v.z - b, v.w - b);
-}
-
-vec4 __operator * (const float a, const vec4 u) {
- return vec4 (a * u.x, a * u.y, a * u.z, a * u.w);
-}
-
-vec4 __operator * (const vec4 v, const float b) {
- return vec4 (v.x * b, v.y * b, v.z * b, v.w * b);
-}
-
-vec4 __operator / (const float a, const vec4 u) {
- return vec4 (a / u.x, a / u.y, a / u.z, a / u.w);
-}
-
-vec4 __operator / (const vec4 v, const float b) {
- return vec4 (v.x / b, v.y / b, v.z / b, v.w / b);
-}
-
-mat2 __operator + (const float a, const mat2 n) {
- return mat2 (a + n[0], a + n[1]);
-}
-
-mat2 __operator + (const mat2 m, const float b) {
- return mat2 (m[0] + b, m[1] + b);
-}
-
-mat2 __operator - (const float a, const mat2 n) {
- return mat2 (a - n[0], a - n[1]);
-}
-
-mat2 __operator - (const mat2 m, const float b) {
- return mat2 (m[0] - b, m[1] - b);
-}
-
-mat2 __operator * (const float a, const mat2 n) {
- return mat2 (a * n[0], a * n[1]);
-}
-
-mat2 __operator * (const mat2 m, const float b) {
- return mat2 (m[0] * b, m[1] * b);
-}
-
-mat2 __operator / (const float a, const mat2 n) {
- return mat2 (a / n[0], a / n[1]);
-}
-
-mat2 __operator / (const mat2 m, const float b) {
- return mat2 (m[0] / b, m[1] / b);
-}
-
-mat3 __operator + (const float a, const mat3 n) {
- return mat3 (a + n[0], a + n[1], a + n[2]);
-}
-
-mat3 __operator + (const mat3 m, const float b) {
- return mat3 (m[0] + b, m[1] + b, m[2] + b);
-}
-
-mat3 __operator - (const float a, const mat3 n) {
- return mat3 (a - n[0], a - n[1], a - n[2]);
-}
-
-mat3 __operator - (const mat3 m, const float b) {
- return mat3 (m[0] - b, m[1] - b, m[2] - b);
-}
-
-mat3 __operator * (const float a, const mat3 n) {
- return mat3 (a * n[0], a * n[1], a * n[2]);
-}
-
-mat3 __operator * (const mat3 m, const float b) {
- return mat3 (m[0] * b, m[1] * b, m[2] * b);
-}
-
-mat3 __operator / (const float a, const mat3 n) {
- return mat3 (a / n[0], a / n[1], a / n[2]);
-}
-
-mat3 __operator / (const mat3 m, const float b) {
- return mat3 (m[0] / b, m[1] / b, m[2] / b);
-}
-
-mat4 __operator + (const float a, const mat4 n) {
- return mat4 (a + n[0], a + n[1], a + n[2], a + n[3]);
-}
-
-mat4 __operator + (const mat4 m, const float b) {
- return mat4 (m[0] + b, m[1] + b, m[2] + b, m[3] + b);
-}
-
-mat4 __operator - (const float a, const mat4 n) {
- return mat4 (a - n[0], a - n[1], a - n[2], a - n[3]);
-}
-
-mat4 __operator - (const mat4 m, const float b) {
- return mat4 (m[0] - b, m[1] - b, m[2] - b, m[3] - b);
-}
-
-mat4 __operator * (const float a, const mat4 n) {
- return mat4 (a * n[0], a * n[1], a * n[2], a * n[3]);
-}
-
-mat4 __operator * (const mat4 m, const float b) {
- return mat4 (m[0] * b, m[1] * b, m[2] * b, m[3] * b);
-}
-
-mat4 __operator / (const float a, const mat4 n) {
- return mat4 (a / n[0], a / n[1], a / n[2], a / n[3]);
-}
-
-mat4 __operator / (const mat4 m, const float b) {
- return mat4 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);
-}
-
-ivec2 __operator + (const int a, const ivec2 u) {
- return ivec2 (a) + u;
-}
-
-ivec2 __operator + (const ivec2 v, const int b) {
- return v + ivec2 (b);
-}
-
-ivec2 __operator - (const int a, const ivec2 u) {
- return ivec2 (a) - u;
-}
-
-ivec2 __operator - (const ivec2 v, const int b) {
- return v - ivec2 (b);
-}
-
-ivec2 __operator * (const int a, const ivec2 u) {
- return ivec2 (a) * u;
-}
-
-ivec2 __operator * (const ivec2 v, const int b) {
- return v * ivec2 (b);
-}
-
-ivec2 __operator / (const int a, const ivec2 u) {
- return ivec2 (a) / u;
-}
-
-ivec2 __operator / (const ivec2 v, const int b) {
- return v / ivec2 (b);
-}
-
-ivec3 __operator + (const int a, const ivec3 u) {
- return ivec3 (a) + u;
-}
-
-ivec3 __operator + (const ivec3 v, const int b) {
- return v + ivec3 (b);
-}
-
-ivec3 __operator - (const int a, const ivec3 u) {
- return ivec3 (a) - u;
-}
-
-ivec3 __operator - (const ivec3 v, const int b) {
- return v - ivec3 (b);
-}
-
-ivec3 __operator * (const int a, const ivec3 u) {
- return ivec3 (a) * u;
-}
-
-ivec3 __operator * (const ivec3 v, const int b) {
- return v * ivec3 (b);
-}
-
-ivec3 __operator / (const int a, const ivec3 u) {
- return ivec3 (a) / u;
-}
-
-ivec3 __operator / (const ivec3 v, const int b) {
- return v / ivec3 (b);
-}
-
-ivec4 __operator + (const int a, const ivec4 u) {
- return ivec4 (a) + u;
-}
-
-ivec4 __operator + (const ivec4 v, const int b) {
- return v + ivec4 (b);
-}
-
-ivec4 __operator - (const int a, const ivec4 u) {
- return ivec4 (a) - u;
-}
-
-ivec4 __operator - (const ivec4 v, const int b) {
- return v - ivec4 (b);
-}
-
-ivec4 __operator * (const int a, const ivec4 u) {
- return ivec4 (a) * u;
-}
-
-ivec4 __operator * (const ivec4 v, const int b) {
- return v * ivec4 (b);
-}
-
-ivec4 __operator / (const int a, const ivec4 u) {
- return ivec4 (a) / u;
-}
-
-ivec4 __operator / (const ivec4 v, const int b) {
- return v / ivec4 (b);
-}
-
-vec2 __operator - (const vec2 v) {
- return vec2 (-v.x, -v.y);
-}
-
-vec3 __operator - (const vec3 v) {
- return vec3 (-v.x, -v.y, -v.z);
-}
-
-vec4 __operator - (const vec4 v) {
- return vec4 (-v.x, -v.y, -v.z, -v.w);
-}
-
-ivec2 __operator - (const ivec2 v) {
- return ivec2 (-v.x, -v.y);
-}
-
-ivec3 __operator - (const ivec3 v) {
- return ivec3 (-v.x, -v.y, -v.z);
-}
-
-ivec4 __operator - (const ivec4 v) {
- return ivec4 (-v.x, -v.y, -v.z, -v.w);
-}
-
-mat2 __operator - (const mat2 m) {
- return mat2 (-m[0], -m[1]);
-}
-
-mat3 __operator - (const mat3 m) {
- return mat3 (-m[0], -m[1], -m[2]);
-}
-
-mat4 __operator - (const mat4 m) {
- return mat4 (-m[0], -m[1], -m[2], -m[3]);
-}
-
-void __operator -- (inout float a) {
- a -= 1.0;
-}
-
-void __operator -- (inout int a) {
- a -= 1;
-}
-
-void __operator -- (inout vec2 v) {
- --v.x;
- --v.y;
-}
-
-void __operator -- (inout vec3 v) {
- --v.x;
- --v.y;
- --v.z;
-}
-
-void __operator -- (inout vec4 v) {
- --v.x;
- --v.y;
- --v.z;
- --v.w;
-}
-
-void __operator -- (inout ivec2 v) {
- --v.x;
- --v.y;
-}
-
-void __operator -- (inout ivec3 v) {
- --v.x;
- --v.y;
- --v.z;
-}
-
-void __operator -- (inout ivec4 v) {
- --v.x;
- --v.y;
- --v.z;
- --v.w;
-}
-
-void __operator -- (inout mat2 m) {
- --m[0];
- --m[1];
-}
-
-void __operator -- (inout mat3 m) {
- --m[0];
- --m[1];
- --m[2];
-}
-
-void __operator -- (inout mat4 m) {
- --m[0];
- --m[1];
- --m[2];
- --m[3];
-}
-
-void __operator ++ (inout float a) {
- a += 1.0;
-}
-
-void __operator ++ (inout int a) {
- a += 1;
-}
-
-void __operator ++ (inout vec2 v) {
- ++v.x;
- ++v.y;
-}
-
-void __operator ++ (inout vec3 v) {
- ++v.x;
- ++v.y;
- ++v.z;
-}
-
-void __operator ++ (inout vec4 v) {
- ++v.x;
- ++v.y;
- ++v.z;
- ++v.w;
-}
-
-void __operator ++ (inout ivec2 v) {
- ++v.x;
- ++v.y;
-}
-
-void __operator ++ (inout ivec3 v) {
- ++v.x;
- ++v.y;
- ++v.z;
-}
-
-void __operator ++ (inout ivec4 v) {
- ++v.x;
- ++v.y;
- ++v.z;
- ++v.w;
-}
-
-void __operator ++ (inout mat2 m) {
- ++m[0];
- ++m[1];
-}
-
-void __operator ++ (inout mat3 m) {
- ++m[0];
- ++m[1];
- ++m[2];
-}
-
-void __operator ++ (inout mat4 m) {
- ++m[0];
- ++m[1];
- ++m[2];
- ++m[3];
-}
-
-//
-// NOTE: postfix increment and decrement operators take additional dummy int parameter to
-// distinguish their prototypes from prefix ones.
-//
-
-float __operator -- (inout float a, const int) {
- float b = a;
- --a;
- return b;
-}
-
-int __operator -- (inout int a, const int) {
- int b = a;
- --a;
- return b;
-}
-
-vec2 __operator -- (inout vec2 v, const int) {
- return vec2 (v.x--, v.y--);
-}
-
-vec3 __operator -- (inout vec3 v, const int) {
- return vec3 (v.x--, v.y--, v.z--);
-}
-
-vec4 __operator -- (inout vec4 v, const int) {
- return vec4 (v.x--, v.y--, v.z--, v.w--);
-}
-
-ivec2 __operator -- (inout ivec2 v, const int) {
- return ivec2 (v.x--, v.y--);
-}
-
-ivec3 __operator -- (inout ivec3 v, const int) {
- return ivec3 (v.x--, v.y--, v.z--);
-}
-
-ivec4 __operator -- (inout ivec4 v, const int) {
- return ivec4 (v.x--, v.y--, v.z--, v.w--);
-}
-
-mat2 __operator -- (inout mat2 m, const int) {
- return mat2 (m[0]--, m[1]--);
-}
-
-mat3 __operator -- (inout mat3 m, const int) {
- return mat3 (m[0]--, m[1]--, m[2]--);
-}
-
-mat4 __operator -- (inout mat4 m, const int) {
- return mat4 (m[0]--, m[1]--, m[2]--, m[3]--);
-}
-
-float __operator ++ (inout float a, const int) {
- float b = a;
- ++a;
- return b;
-}
-
-int __operator ++ (inout int a, const int) {
- int b = a;
- ++a;
- return b;
-}
-
-vec2 __operator ++ (inout vec2 v, const int) {
- return vec2 (v.x++, v.y++);
-}
-
-vec3 __operator ++ (inout vec3 v, const int) {
- return vec3 (v.x++, v.y++, v.z++);
-}
-
-vec4 __operator ++ (inout vec4 v, const int) {
- return vec4 (v.x++, v.y++, v.z++, v.w++);
-}
-
-ivec2 __operator ++ (inout ivec2 v, const int) {
- return ivec2 (v.x++, v.y++);
-}
-
-ivec3 __operator ++ (inout ivec3 v, const int) {
- return ivec3 (v.x++, v.y++, v.z++);
-}
-
-ivec4 __operator ++ (inout ivec4 v, const int) {
- return ivec4 (v.x++, v.y++, v.z++, v.w++);
-}
-
-mat2 __operator ++ (inout mat2 m, const int) {
- return mat2 (m[0]++, m[1]++);
-}
-
-mat3 __operator ++ (inout mat3 m, const int) {
- return mat3 (m[0]++, m[1]++, m[2]++);
-}
-
-mat4 __operator ++ (inout mat4 m, const int) {
- return mat4 (m[0]++, m[1]++, m[2]++, m[3]++);
-}
-
-bool __operator < (const float a, const float b) {
- bool c;
- __asm float_less c, a, b;
- return c;
-}
-
-bool __operator < (const int a, const int b) {
- return float (a) < float (b);
-}
-
-bool __operator > (const float a, const float b) {
- bool c;
- __asm float_less c, b, a;
- return c;
-}
-
-bool __operator > (const int a, const int b) {
- return float (a) > float (b);
-}
-
-bool __operator >= (const float a, const float b) {
- bool g, e;
- __asm float_less g, b, a;
- __asm float_equal e, a, b;
- return g || e;
-}
-
-bool __operator >= (const int a, const int b) {
- return float (a) >= float (b);
-}
-
-bool __operator <= (const float a, const float b) {
- bool g, e;
- __asm float_less g, a, b;
- __asm float_equal e, a, b;
- return g || e;
-}
-
-bool __operator <= (const int a, const int b) {
- return float (a) <= float (b);
-}
-
-bool __operator ^^ (const bool a, const bool b) {
- return a != b;
-}
-
-//
-// These operators are handled internally by the compiler:
-//
-// bool __operator && (bool a, bool b) {
-// return a ? b : false;
-// }
-// bool __operator || (bool a, bool b) {
-// return a ? true : b;
-// }
-//
-
-bool __operator ! (const bool a) {
- return a == false;
-}
-
-//
-// MESA-specific extension functions.
-//
-
-void printMESA (const float f) {
- __asm float_print f;
-}
-
-void printMESA (const int i) {
- __asm int_print i;
-}
-
-void printMESA (const bool b) {
- __asm bool_print b;
-}
-
-void printMESA (const vec2 v) {
- printMESA (v.x);
- printMESA (v.y);
-}
-
-void printMESA (const vec3 v) {
- printMESA (v.x);
- printMESA (v.y);
- printMESA (v.z);
-}
-
-void printMESA (const vec4 v) {
- printMESA (v.x);
- printMESA (v.y);
- printMESA (v.z);
- printMESA (v.w);
-}
-
-void printMESA (const ivec2 v) {
- printMESA (v.x);
- printMESA (v.y);
-}
-
-void printMESA (const ivec3 v) {
- printMESA (v.x);
- printMESA (v.y);
- printMESA (v.z);
-}
-
-void printMESA (const ivec4 v) {
- printMESA (v.x);
- printMESA (v.y);
- printMESA (v.z);
- printMESA (v.w);
-}
-
-void printMESA (const bvec2 v) {
- printMESA (v.x);
- printMESA (v.y);
-}
-
-void printMESA (const bvec3 v) {
- printMESA (v.x);
- printMESA (v.y);
- printMESA (v.z);
-}
-
-void printMESA (const bvec4 v) {
- printMESA (v.x);
- printMESA (v.y);
- printMESA (v.z);
- printMESA (v.w);
-}
-
-void printMESA (const mat2 m) {
- printMESA (m[0]);
- printMESA (m[1]);
-}
-
-void printMESA (const mat3 m) {
- printMESA (m[0]);
- printMESA (m[1]);
- printMESA (m[2]);
-}
-
-void printMESA (const mat4 m) {
- printMESA (m[0]);
- printMESA (m[1]);
- printMESA (m[2]);
- printMESA (m[3]);
-}
-
-void printMESA (const sampler1D e) {
- __asm int_print e;
-}
-
-void printMESA (const sampler2D e) {
- __asm int_print e;
-}
-
-void printMESA (const sampler3D e) {
- __asm int_print e;
-}
-
-void printMESA (const samplerCube e) {
- __asm int_print e;
-}
-
-void printMESA (const sampler1DShadow e) {
- __asm int_print e;
-}
-
-void printMESA (const sampler2DShadow e) {
- __asm int_print e;
-}
-
diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/src/mesa/shader/slang/library/slang_fragment_builtin.gc
deleted file mode 100755
index 373b42de1d5..00000000000
--- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//
-// TODO:
-// - implement dFdx, dFdy,
-//
-
-//
-// From Shader Spec, ver. 1.10, rev. 59
-//
-
-__fixed_input vec4 gl_FragCoord;
-__fixed_input bool gl_FrontFacing;
-__fixed_output vec4 gl_FragColor;
-__fixed_output vec4 gl_FragData[gl_MaxDrawBuffers];
-__fixed_output float gl_FragDepth;
-
-varying vec4 gl_Color;
-varying vec4 gl_SecondaryColor;
-varying vec4 gl_TexCoord[gl_MaxTextureCoords];
-varying float gl_FogFragCoord;
-
-//
-// 8.7 Texture Lookup Functions
-//
-
-vec4 texture1D (sampler1D sampler, float coord, float bias) {
- vec4 texel;
- __asm vec4_tex1d texel, sampler, coord, bias;
- return texel;
-}
-
-vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias) {
- return texture1D (sampler, coord.s / coord.t, bias);
-}
-
-vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias) {
- return texture1D (sampler, coord.s / coord.q, bias);
-}
-
-vec4 texture2D (sampler2D sampler, vec2 coord, float bias) {
- vec4 texel;
- __asm vec4_tex2d texel, sampler, coord, bias;
- return texel;
-}
-
-vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias) {
- return texture2D (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), bias);
-}
-
-vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias) {
- return texture2D (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), bias);
-}
-
-vec4 texture3D (sampler3D sampler, vec3 coord, float bias) {
- vec4 texel;
- __asm vec4_tex3d texel, sampler, coord, bias;
- return texel;
-}
-
-vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias) {
- return texture3D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q), bias);
-}
-
-vec4 textureCube (samplerCube sampler, vec3 coord, float bias) {
- vec4 texel;
- __asm vec4_texcube texel, sampler, coord, bias;
- return texel;
-}
-
-vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias) {
- vec4 texel;
- __asm vec4_shad1d texel, sampler, coord, bias;
- return texel;
-}
-
-vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias) {
- return shadow1D (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q), bias);
-}
-
-vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias) {
- vec4 texel;
- __asm vec4_shad2d texel, sampler, coord, bias;
- return texel;
-}
-
-vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias) {
- return shadow2D (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q), bias);
-}
-
-//
-// 8.8 Fragment Processing Functions
-//
-
-float dFdx (float p) {
- // XXX:
- return 0.001;
-}
-
-vec2 dFdx (vec2 p) {
- // XXX:
- return vec2 (0.001);
-}
-
-vec3 dFdx (vec3 p) {
- // XXX:
- return vec3 (0.001);
-}
-
-vec4 dFdx (vec4 p) {
- // XXX:
- return vec4 (0.001);
-}
-
-float dFdy (float p) {
- // XXX:
- return 0.001;
-}
-
-vec2 dFdy (vec2 p) {
- // XXX:
- return vec2 (0.001);
-}
-
-vec3 dFdy (vec3 p) {
- // XXX:
- return vec3 (0.001);
-}
-
-vec4 dFdy (vec4 p) {
- // XXX:
- return vec4 (0.001);
-}
-
-float fwidth (float p) {
- return abs (dFdx (p)) + abs (dFdy (p));
-}
-
-vec2 fwidth (vec2 p) {
- return abs (dFdx (p)) + abs (dFdy (p));
-}
-
-vec3 fwidth (vec3 p) {
- return abs (dFdx (p)) + abs (dFdy (p));
-}
-
-vec4 fwidth (vec4 p) {
- return abs (dFdx (p)) + abs (dFdy (p));
-}
-
diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn
deleted file mode 100644
index 149bb15c442..00000000000
--- a/src/mesa/shader/slang/library/slang_shader.syn
+++ /dev/null
@@ -1,1517 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2004-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * \file slang_shader.syn
- * slang vertex/fragment shader syntax
- * \author Michal Krol
- */
-
-/*
- * usage:
- * syn2c slang_shader.syn > slang_shader_syn.h
- *
- * when modifying or extending this file, several things must be taken into consideration:
- * - when adding new operators that were marked as reserved in the initial specification,
- * one must only uncomment particular lines of code that refer to operators being added;
- * - when adding new shader target, one must reserve new value for shader_type register and
- * use it in .if constructs for symbols that are exclusive for that shader;
- * - some symbols mimic output of other symbols - the best example is the "for" construct:
- * expression "for (foo(); ; bar())" is seen as "for (foo(); true; bar())" by the output
- * processor - hence, special care must be taken when rearranging output of essential symbols;
- * - order of single-quoted tokens does matter in alternatives - so do not parse "<" operator
- * before "<<" and "<<" before "<<=";
- * - all double-quoted tokens are internally preprocessed to eliminate problems with parsing
- * strings that are prefixes of other strings, like "sampler1D" and "sampler1DShadow";
- */
-
-.syntax translation_unit;
-
-/* revision number - increment after each change affecting emitted output */
-.emtcode REVISION 3
-
-/* external declaration */
-.emtcode EXTERNAL_NULL 0
-.emtcode EXTERNAL_FUNCTION_DEFINITION 1
-.emtcode EXTERNAL_DECLARATION 2
-
-/* declaration */
-.emtcode DECLARATION_FUNCTION_PROTOTYPE 1
-.emtcode DECLARATION_INIT_DECLARATOR_LIST 2
-
-/* function type */
-.emtcode FUNCTION_ORDINARY 0
-.emtcode FUNCTION_CONSTRUCTOR 1
-.emtcode FUNCTION_OPERATOR 2
-
-/* operator type */
-.emtcode OPERATOR_ADDASSIGN 1
-.emtcode OPERATOR_SUBASSIGN 2
-.emtcode OPERATOR_MULASSIGN 3
-.emtcode OPERATOR_DIVASSIGN 4
-/*.emtcode OPERATOR_MODASSIGN 5*/
-/*.emtcode OPERATOR_LSHASSIGN 6*/
-/*.emtcode OPERATOR_RSHASSIGN 7*/
-/*.emtcode OPERATOR_ORASSIGN 8*/
-/*.emtcode OPERATOR_XORASSIGN 9*/
-/*.emtcode OPERATOR_ANDASSIGN 10*/
-.emtcode OPERATOR_LOGICALXOR 11
-/*.emtcode OPERATOR_BITOR 12*/
-/*.emtcode OPERATOR_BITXOR 13*/
-/*.emtcode OPERATOR_BITAND 14*/
-.emtcode OPERATOR_LESS 15
-.emtcode OPERATOR_GREATER 16
-.emtcode OPERATOR_LESSEQUAL 17
-.emtcode OPERATOR_GREATEREQUAL 18
-/*.emtcode OPERATOR_LSHIFT 19*/
-/*.emtcode OPERATOR_RSHIFT 20*/
-.emtcode OPERATOR_MULTIPLY 21
-.emtcode OPERATOR_DIVIDE 22
-/*.emtcode OPERATOR_MODULUS 23*/
-.emtcode OPERATOR_INCREMENT 24
-.emtcode OPERATOR_DECREMENT 25
-.emtcode OPERATOR_PLUS 26
-.emtcode OPERATOR_MINUS 27
-/*.emtcode OPERATOR_COMPLEMENT 28*/
-.emtcode OPERATOR_NOT 29
-
-/* init declarator list */
-.emtcode DECLARATOR_NONE 0
-.emtcode DECLARATOR_NEXT 1
-
-/* variable declaration */
-.emtcode VARIABLE_NONE 0
-.emtcode VARIABLE_IDENTIFIER 1
-.emtcode VARIABLE_INITIALIZER 2
-.emtcode VARIABLE_ARRAY_EXPLICIT 3
-.emtcode VARIABLE_ARRAY_UNKNOWN 4
-
-/* type qualifier */
-.emtcode TYPE_QUALIFIER_NONE 0
-.emtcode TYPE_QUALIFIER_CONST 1
-.emtcode TYPE_QUALIFIER_ATTRIBUTE 2
-.emtcode TYPE_QUALIFIER_VARYING 3
-.emtcode TYPE_QUALIFIER_UNIFORM 4
-.emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5
-.emtcode TYPE_QUALIFIER_FIXEDINPUT 6
-
-/* type specifier */
-.emtcode TYPE_SPECIFIER_VOID 0
-.emtcode TYPE_SPECIFIER_BOOL 1
-.emtcode TYPE_SPECIFIER_BVEC2 2
-.emtcode TYPE_SPECIFIER_BVEC3 3
-.emtcode TYPE_SPECIFIER_BVEC4 4
-.emtcode TYPE_SPECIFIER_INT 5
-.emtcode TYPE_SPECIFIER_IVEC2 6
-.emtcode TYPE_SPECIFIER_IVEC3 7
-.emtcode TYPE_SPECIFIER_IVEC4 8
-.emtcode TYPE_SPECIFIER_FLOAT 9
-.emtcode TYPE_SPECIFIER_VEC2 10
-.emtcode TYPE_SPECIFIER_VEC3 11
-.emtcode TYPE_SPECIFIER_VEC4 12
-.emtcode TYPE_SPECIFIER_MAT2 13
-.emtcode TYPE_SPECIFIER_MAT3 14
-.emtcode TYPE_SPECIFIER_MAT4 15
-.emtcode TYPE_SPECIFIER_SAMPLER1D 16
-.emtcode TYPE_SPECIFIER_SAMPLER2D 17
-.emtcode TYPE_SPECIFIER_SAMPLER3D 18
-.emtcode TYPE_SPECIFIER_SAMPLERCUBE 19
-.emtcode TYPE_SPECIFIER_SAMPLER1DSHADOW 20
-.emtcode TYPE_SPECIFIER_SAMPLER2DSHADOW 21
-.emtcode TYPE_SPECIFIER_STRUCT 22
-.emtcode TYPE_SPECIFIER_TYPENAME 23
-
-/* structure field */
-.emtcode FIELD_NONE 0
-.emtcode FIELD_NEXT 1
-.emtcode FIELD_ARRAY 2
-
-/* operation */
-.emtcode OP_END 0
-.emtcode OP_BLOCK_BEGIN_NO_NEW_SCOPE 1
-.emtcode OP_BLOCK_BEGIN_NEW_SCOPE 2
-.emtcode OP_DECLARE 3
-.emtcode OP_ASM 4
-.emtcode OP_BREAK 5
-.emtcode OP_CONTINUE 6
-.emtcode OP_DISCARD 7
-.emtcode OP_RETURN 8
-.emtcode OP_EXPRESSION 9
-.emtcode OP_IF 10
-.emtcode OP_WHILE 11
-.emtcode OP_DO 12
-.emtcode OP_FOR 13
-.emtcode OP_PUSH_VOID 14
-.emtcode OP_PUSH_BOOL 15
-.emtcode OP_PUSH_INT 16
-.emtcode OP_PUSH_FLOAT 17
-.emtcode OP_PUSH_IDENTIFIER 18
-.emtcode OP_SEQUENCE 19
-.emtcode OP_ASSIGN 20
-.emtcode OP_ADDASSIGN 21
-.emtcode OP_SUBASSIGN 22
-.emtcode OP_MULASSIGN 23
-.emtcode OP_DIVASSIGN 24
-/*.emtcode OP_MODASSIGN 25*/
-/*.emtcode OP_LSHASSIGN 26*/
-/*.emtcode OP_RSHASSIGN 27*/
-/*.emtcode OP_ORASSIGN 28*/
-/*.emtcode OP_XORASSIGN 29*/
-/*.emtcode OP_ANDASSIGN 30*/
-.emtcode OP_SELECT 31
-.emtcode OP_LOGICALOR 32
-.emtcode OP_LOGICALXOR 33
-.emtcode OP_LOGICALAND 34
-/*.emtcode OP_BITOR 35*/
-/*.emtcode OP_BITXOR 36*/
-/*.emtcode OP_BITAND 37*/
-.emtcode OP_EQUAL 38
-.emtcode OP_NOTEQUAL 39
-.emtcode OP_LESS 40
-.emtcode OP_GREATER 41
-.emtcode OP_LESSEQUAL 42
-.emtcode OP_GREATEREQUAL 43
-/*.emtcode OP_LSHIFT 44*/
-/*.emtcode OP_RSHIFT 45*/
-.emtcode OP_ADD 46
-.emtcode OP_SUBTRACT 47
-.emtcode OP_MULTIPLY 48
-.emtcode OP_DIVIDE 49
-/*.emtcode OP_MODULUS 50*/
-.emtcode OP_PREINCREMENT 51
-.emtcode OP_PREDECREMENT 52
-.emtcode OP_PLUS 53
-.emtcode OP_MINUS 54
-/*.emtcode OP_COMPLEMENT 55*/
-.emtcode OP_NOT 56
-.emtcode OP_SUBSCRIPT 57
-.emtcode OP_CALL 58
-.emtcode OP_FIELD 59
-.emtcode OP_POSTINCREMENT 60
-.emtcode OP_POSTDECREMENT 61
-
-/* parameter qualifier */
-.emtcode PARAM_QUALIFIER_IN 0
-.emtcode PARAM_QUALIFIER_OUT 1
-.emtcode PARAM_QUALIFIER_INOUT 2
-
-/* function parameter */
-.emtcode PARAMETER_NONE 0
-.emtcode PARAMETER_NEXT 1
-
-/* function parameter array presence */
-.emtcode PARAMETER_ARRAY_NOT_PRESENT 0
-.emtcode PARAMETER_ARRAY_PRESENT 1
-
-.errtext INVALID_EXTERNAL_DECLARATION "2001: Invalid external declaration."
-.errtext INVALID_OPERATOR_OVERRIDE "2002: Invalid operator override."
-.errtext LBRACE_EXPECTED "2003: '{' expected but '$err_token$' found."
-.errtext LPAREN_EXPECTED "2004: '(' expected but '$err_token$' found."
-.errtext RPAREN_EXPECTED "2005: ')' expected but '$err_token$' found."
-
-/* tells whether the shader that is being parsed is a built-in shader or not */
-/* 0 - normal behaviour */
-/* 1 - accepts constructor and operator definitions and __asm statements */
-/* the implementation will set it to 1 when compiling internal built-in shaders */
-.regbyte parsing_builtin 0
-
-/* holds the type of the shader being parsed; possible values are listed below */
-/* FRAGMENT_SHADER 1 */
-/* VERTEX_SHADER 2 */
-/* shader type is set by the caller before parsing */
-.regbyte shader_type 0
-
-/*
- <variable_identifier> ::= <identifier>
-*/
-variable_identifier
- identifier .emit OP_PUSH_IDENTIFIER;
-
-/*
- <primary_expression> ::= <variable_identifier>
- | <intconstant>
- | <floatconstant>
- | <boolconstant>
- | "(" <expression> ")"
-*/
-primary_expression
- floatconstant .or boolconstant .or intconstant .or variable_identifier .or primary_expression_1;
-primary_expression_1
- lparen .and expression .and rparen;
-
-/*
- <postfix_expression> ::= <primary_expression>
- | <postfix_expression> "[" <integer_expression> "]"
- | <function_call>
- | <postfix_expression> "." <field_selection>
- | <postfix_expression> "++"
- | <postfix_expression> "--"
-*/
-postfix_expression
- postfix_expression_1 .and .loop postfix_expression_2;
-postfix_expression_1
- function_call .or primary_expression;
-postfix_expression_2
- postfix_expression_3 .or postfix_expression_4 .or
- plusplus .emit OP_POSTINCREMENT .or
- minusminus .emit OP_POSTDECREMENT;
-postfix_expression_3
- lbracket .and integer_expression .and rbracket .emit OP_SUBSCRIPT;
-postfix_expression_4
- dot .and field_selection .emit OP_FIELD;
-
-/*
- <integer_expression> ::= <expression>
-*/
-integer_expression
- expression;
-
-/*
- <function_call> ::= <function_call_generic>
-*/
-function_call
- function_call_generic .emit OP_CALL .and .true .emit OP_END;
-
-/*
- <function_call_generic> ::= <function_call_header_with_parameters> ")"
- | <function_call_header_no_parameters> ")"
-*/
-function_call_generic
- function_call_generic_1 .or function_call_generic_2;
-function_call_generic_1
- function_call_header_with_parameters .and rparen .error RPAREN_EXPECTED;
-function_call_generic_2
- function_call_header_no_parameters .and rparen .error RPAREN_EXPECTED;
-
-/*
- <function_call_header_no_parameters>::= <function_call_header> "void"
- | <function_call_header>
-*/
-function_call_header_no_parameters
- function_call_header .and function_call_header_no_parameters_1;
-function_call_header_no_parameters_1
- "void" .or .true;
-
-/*
- <function_call_header_with_parameters>::= <function_call_header> <assignment_expression>
- | <function_call_header_with_parameters> ","
- <assignment_expression>
-*/
-function_call_header_with_parameters
- function_call_header .and assignment_expression .and .true .emit OP_END .and
- .loop function_call_header_with_parameters_1;
-function_call_header_with_parameters_1
- comma .and assignment_expression .and .true .emit OP_END;
-
-/*
- <function_call_header> ::= <function_identifier> "("
-*/
-function_call_header
- function_identifier .and lparen;
-
-/*
- <function_identifier> ::= <constructor_identifier>
- | <identifier>
-
-note: <constructor_identifier> has been deleted
-*/
-function_identifier
- identifier;
-
-/*
- <unary_expression> ::= <postfix_expression>
- | "++" <unary_expression>
- | "--" <unary_expression>
- | <unary_operator> <unary_expression>
-
- <unary_operator> ::= "+"
- | "-"
- | "!"
- | "~" // reserved
-*/
-unary_expression
- postfix_expression .or unary_expression_1 .or unary_expression_2 .or unary_expression_3 .or
- unary_expression_4 .or unary_expression_5/* .or unary_expression_6*/;
-unary_expression_1
- plusplus .and unary_expression .and .true .emit OP_PREINCREMENT;
-unary_expression_2
- minusminus .and unary_expression .and .true .emit OP_PREDECREMENT;
-unary_expression_3
- plus .and unary_expression .and .true .emit OP_PLUS;
-unary_expression_4
- minus .and unary_expression .and .true .emit OP_MINUS;
-unary_expression_5
- bang .and unary_expression .and .true .emit OP_NOT;
-/*unary_expression_6
- tilde .and unary_expression .and .true .emit OP_COMPLEMENT;*/
-
-/*
- <multiplicative_expression> ::= <unary_expression>
- | <multiplicative_expression> "*" <unary_expression>
- | <multiplicative_expression> "/" <unary_expression>
- | <multiplicative_expression> "%" <unary_expression> // reserved
-*/
-multiplicative_expression
- unary_expression .and .loop multiplicative_expression_1;
-multiplicative_expression_1
- multiplicative_expression_2 .or multiplicative_expression_3/* .or multiplicative_expression_4*/;
-multiplicative_expression_2
- star .and unary_expression .and .true .emit OP_MULTIPLY;
-multiplicative_expression_3
- slash .and unary_expression .and .true .emit OP_DIVIDE;
-/*multiplicative_expression_4
- percent .and unary_expression .and .true .emit OP_MODULUS;*/
-
-/*
- <additive_expression> ::= <multiplicative_expression>
- | <additive_expression> "+" <multiplicative_expression>
- | <additive_expression> "-" <multiplicative_expression>
-*/
-additive_expression
- multiplicative_expression .and .loop additive_expression_1;
-additive_expression_1
- additive_expression_2 .or additive_expression_3;
-additive_expression_2
- plus .and multiplicative_expression .and .true .emit OP_ADD;
-additive_expression_3
- minus .and multiplicative_expression .and .true .emit OP_SUBTRACT;
-
-/*
- <shift_expression> ::= <additive_expression>
- | <shift_expression> "<<" <additive_expression> // reserved
- | <shift_expression> ">>" <additive_expression> // reserved
-*/
-shift_expression
- additive_expression/* .and .loop shift_expression_1*/;
-/*shift_expression_1
- shift_expression_2 .or shift_expression_3;*/
-/*shift_expression_2
- lessless .and additive_expression .and .true .emit OP_LSHIFT;*/
-/*shift_expression_3
- greatergreater .and additive_expression .and .true .emit OP_RSHIFT;*/
-
-/*
- <relational_expression> ::= <shift_expression>
- | <relational_expression> "<" <shift_expression>
- | <relational_expression> ">" <shift_expression>
- | <relational_expression> "<=" <shift_expression>
- | <relational_expression> ">=" <shift_expression>
-*/
-relational_expression
- shift_expression .and .loop relational_expression_1;
-relational_expression_1
- relational_expression_2 .or relational_expression_3 .or relational_expression_4 .or
- relational_expression_5;
-relational_expression_2
- lessequals .and shift_expression .and .true .emit OP_LESSEQUAL;
-relational_expression_3
- greaterequals .and shift_expression .and .true .emit OP_GREATEREQUAL;
-relational_expression_4
- less .and shift_expression .and .true .emit OP_LESS;
-relational_expression_5
- greater .and shift_expression .and .true .emit OP_GREATER;
-
-/*
- <equality_expression> ::= <relational_expression>
- | <equality_expression> "==" <relational_expression>
- | <equality_expression> "!=" <relational_expression>
-*/
-equality_expression
- relational_expression .and .loop equality_expression_1;
-equality_expression_1
- equality_expression_2 .or equality_expression_3;
-equality_expression_2
- equalsequals .and relational_expression .and .true .emit OP_EQUAL;
-equality_expression_3
- bangequals .and relational_expression .and .true .emit OP_NOTEQUAL;
-
-/*
- <and_expression> ::= <equality_expression>
- | <and_expression> "&" <equality_expression> // reserved
-*/
-and_expression
- equality_expression/* .and .loop and_expression_1*/;
-/*and_expression_1
- ampersand .and equality_expression .and .true .emit OP_BITAND;*/
-
-/*
- <exclusive_or_expression> ::= <and_expression>
- | <exclusive_or_expression> "^" <and_expression> // reserved
-*/
-exclusive_or_expression
- and_expression/* .and .loop exclusive_or_expression_1*/;
-/*exclusive_or_expression_1
- caret .and and_expression .and .true .emit OP_BITXOR;*/
-
-/*
- <inclusive_or_expression> ::= <exclusive_or_expression>
- | <inclusive_or_expression> "|" <exclusive_or_expression> // reserved
-*/
-inclusive_or_expression
- exclusive_or_expression/* .and .loop inclusive_or_expression_1*/;
-/*inclusive_or_expression_1
- bar .and exclusive_or_expression .and .true .emit OP_BITOR;*/
-
-/*
- <logical_and_expression> ::= <inclusive_or_expression>
- | <logical_and_expression> "&&" <inclusive_or_expression>
-*/
-logical_and_expression
- inclusive_or_expression .and .loop logical_and_expression_1;
-logical_and_expression_1
- ampersandampersand .and inclusive_or_expression .and .true .emit OP_LOGICALAND;
-
-/*
- <logical_xor_expression> ::= <logical_and_expression>
- | <logical_xor_expression> "^^" <logical_and_expression>
-*/
-logical_xor_expression
- logical_and_expression .and .loop logical_xor_expression_1;
-logical_xor_expression_1
- caretcaret .and logical_and_expression .and .true .emit OP_LOGICALXOR;
-
-/*
- <logical_or_expression> ::= <logical_xor_expression>
- | <logical_or_expression> "||" <logical_xor_expression>
-*/
-logical_or_expression
- logical_xor_expression .and .loop logical_or_expression_1;
-logical_or_expression_1
- barbar .and logical_xor_expression .and .true .emit OP_LOGICALOR;
-
-/*
- <conditional_expression> ::= <logical_or_expression>
- | <logical_or_expression> "?" <expression> ":"
- <conditional_expression>
-*/
-conditional_expression
- logical_or_expression .and .loop conditional_expression_1;
-conditional_expression_1
- question .and expression .and colon .and conditional_expression .and .true .emit OP_SELECT;
-
-/*
- <assignment_expression> ::= <conditional_expression>
- | <unary_expression> <assignment_operator>
- <assignment_expression>
-
- <assignment_operator> ::= "="
- | "*="
- | "/="
- | "+="
- | "-="
- | "%=" // reserved
- | "<<=" // reserved
- | ">>=" // reserved
- | "&=" // reserved
- | "^=" // reserved
- | "|=" // reserved
-*/
-assignment_expression
- assignment_expression_1 .or assignment_expression_2 .or assignment_expression_3 .or
- assignment_expression_4 .or assignment_expression_5/* .or assignment_expression_6 .or
- assignment_expression_7 .or assignment_expression_8 .or assignment_expression_9 .or
- assignment_expression_10 .or assignment_expression_11*/ .or conditional_expression;
-assignment_expression_1
- unary_expression .and equals .and assignment_expression .and .true .emit OP_ASSIGN;
-assignment_expression_2
- unary_expression .and starequals .and assignment_expression .and .true .emit OP_MULASSIGN;
-assignment_expression_3
- unary_expression .and slashequals .and assignment_expression .and .true .emit OP_DIVASSIGN;
-assignment_expression_4
- unary_expression .and plusequals .and assignment_expression .and .true .emit OP_ADDASSIGN;
-assignment_expression_5
- unary_expression .and minusequals .and assignment_expression .and .true .emit OP_SUBASSIGN;
-/*assignment_expression_6
- unary_expression .and percentequals .and assignment_expression .and .true .emit OP_MODASSIGN;*/
-/*assignment_expression_7
- unary_expression .and lesslessequals .and assignment_expression .and .true .emit OP_LSHASSIGN;*/
-/*assignment_expression_8
- unary_expression .and greatergreaterequals .and assignment_expression .and
- .true .emit OP_RSHASSIGN;*/
-/*assignment_expression_9
- unary_expression .and ampersandequals .and assignment_expression .and .true .emit OP_ANDASSIGN;*/
-/*assignment_expression_10
- unary_expression .and caretequals .and assignment_expression .and .true .emit OP_XORASSIGN;*/
-/*assignment_expression_11
- unary_expression .and barequals .and assignment_expression .and .true .emit OP_ORASSIGN;*/
-
-/*
- <expression> ::= <assignment_expression>
- | <expression> "," <assignment_expression>
-*/
-expression
- assignment_expression .and .loop expression_1;
-expression_1
- comma .and assignment_expression .and .true .emit OP_SEQUENCE;
-
-/*
- <constant_expression> ::= <conditional_expression>
-*/
-constant_expression
- conditional_expression .and .true .emit OP_END;
-
-/*
- <declaration> ::= <function_prototype> ";"
- | <init_declarator_list> ";"
-*/
-declaration
- declaration_1 .or declaration_2;
-declaration_1
- function_prototype .emit DECLARATION_FUNCTION_PROTOTYPE .and semicolon;
-declaration_2
- init_declarator_list .emit DECLARATION_INIT_DECLARATOR_LIST .and semicolon;
-
-/*
- <function_prototype> ::= <function_header> "void" ")"
- | <function_declarator> ")"
-*/
-function_prototype
- function_prototype_1 .or function_prototype_2;
-function_prototype_1
- function_header .and "void" .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;
-function_prototype_2
- function_declarator .and rparen .error RPAREN_EXPECTED .emit PARAMETER_NONE;
-
-/*
- <function_declarator> ::= <function_header>
- | <function_header_with_parameters>
-*/
-function_declarator
- function_header_with_parameters .or function_header;
-
-/*
- <function_header_with_parameters> ::= <function_header> <parameter_declaration>
- | <function_header_with_parameters> ","
- <parameter_declaration>
-*/
-function_header_with_parameters
- function_header .and parameter_declaration .and .loop function_header_with_parameters_1;
-function_header_with_parameters_1
- comma .and parameter_declaration;
-
-/*
- <function_header> ::= <fully_specified_type> <identifier> "("
-*/
-function_header
- function_header_nospace .or function_header_space;
-function_header_space
- fully_specified_type_space .and space .and function_decl_identifier .and lparen;
-function_header_nospace
- fully_specified_type_nospace .and function_decl_identifier .and lparen;
-
-/*
- <function_decl_identifier> ::= "__constructor"
- | <__operator>
- | <identifier>
-
-note: this is an extension to the standard language specification - normally slang disallows
- operator and constructor prototypes and definitions
-*/
-function_decl_identifier
- .if (parsing_builtin != 0) __operator .emit FUNCTION_OPERATOR .or
- .if (parsing_builtin != 0) "__constructor" .emit FUNCTION_CONSTRUCTOR .or
- identifier .emit FUNCTION_ORDINARY;
-
-/*
- <__operator> ::= "__operator" <overriden_op>
-
-note: this is an extension to the standard language specification - normally slang disallows
- operator prototypes and definitions
-*/
-__operator
- "__operator" .and overriden_operator .error INVALID_OPERATOR_OVERRIDE;
-
-/*
- <overriden_op> ::= "="
- | "+="
- | "-="
- | "*="
- | "/="
- | "%=" // reserved
- | "<<=" // reserved
- | ">>=" // reserved
- | "&=" // reserved
- | "^=" // reserved
- | "|=" // reserved
- | "^^"
- | "|" // reserved
- | "^" // reserved
- | "&" // reserved
- | "=="
- | "!="
- | "<"
- | ">"
- | "<="
- | ">="
- | "<<" // reserved
- | ">>" // reserved
- | "*"
- | "/"
- | "%" // reserved
- | "++"
- | "--"
- | "+"
- | "-"
- | "~" // reserved
- | "!"
-
-note: this is an extension to the standard language specification - normally slang disallows
- operator prototypes and definitions
-*/
-overriden_operator
- plusplus .emit OPERATOR_INCREMENT .or
- plusequals .emit OPERATOR_ADDASSIGN .or
- plus .emit OPERATOR_PLUS .or
- minusminus .emit OPERATOR_DECREMENT .or
- minusequals .emit OPERATOR_SUBASSIGN .or
- minus .emit OPERATOR_MINUS .or
- bang .emit OPERATOR_NOT .or
- starequals .emit OPERATOR_MULASSIGN .or
- star .emit OPERATOR_MULTIPLY .or
- slashequals .emit OPERATOR_DIVASSIGN .or
- slash .emit OPERATOR_DIVIDE .or
- lessequals .emit OPERATOR_LESSEQUAL .or
- /*lesslessequals .emit OPERATOR_LSHASSIGN .or*/
- /*lessless .emit OPERATOR_LSHIFT .or*/
- less .emit OPERATOR_LESS .or
- greaterequals .emit OPERATOR_GREATEREQUAL .or
- /*greatergreaterequals .emit OPERATOR_RSHASSIGN .or*/
- /*greatergreater .emit OPERATOR_RSHIFT .or*/
- greater .emit OPERATOR_GREATER .or
- /*percentequals .emit OPERATOR_MODASSIGN .or*/
- /*percent .emit OPERATOR_MODULUS .or*/
- /*ampersandequals .emit OPERATOR_ANDASSIGN */
- /*ampersand .emit OPERATOR_BITAND .or*/
- /*barequals .emit OPERATOR_ORASSIGN .or*/
- /*bar .emit OPERATOR_BITOR .or*/
- /*tilde .emit OPERATOR_COMPLEMENT .or*/
- /*caretequals .emit OPERATOR_XORASSIGN .or*/
- caretcaret .emit OPERATOR_LOGICALXOR /*.or
- caret .emit OPERATOR_BITXOR*/;
-
-/*
- <parameter_declarator> ::= <type_specifier> <identifier>
- | <type_specifier> <identifier> "[" <constant_expression>
- "]"
-*/
-parameter_declarator
- parameter_declarator_nospace .or parameter_declarator_space;
-parameter_declarator_nospace
- type_specifier_nospace .and identifier .and parameter_declarator_1;
-parameter_declarator_space
- type_specifier_space .and space .and identifier .and parameter_declarator_1;
-parameter_declarator_1
- parameter_declarator_2 .emit PARAMETER_ARRAY_PRESENT .or
- .true .emit PARAMETER_ARRAY_NOT_PRESENT;
-parameter_declarator_2
- lbracket .and constant_expression .and rbracket;
-
-/*
- <parameter_declaration> ::= <type_qualifier> <parameter_qualifier>
- <parameter_declarator>
- | <type_qualifier> <parameter_qualifier>
- <parameter_type_specifier>
- | <parameter_qualifier> <parameter_declarator>
- | <parameter_qualifier> <parameter_type_specifier>
-*/
-parameter_declaration
- parameter_declaration_1 .emit PARAMETER_NEXT;
-parameter_declaration_1
- parameter_declaration_2 .or parameter_declaration_3;
-parameter_declaration_2
- type_qualifier .and space .and parameter_qualifier .and parameter_declaration_4;
-parameter_declaration_3
- parameter_qualifier .emit TYPE_QUALIFIER_NONE .and parameter_declaration_4;
-parameter_declaration_4
- parameter_declarator .or parameter_type_specifier;
-
-/*
- <parameter_qualifier> ::= "in"
- | "out"
- | "inout"
- | ""
-*/
-parameter_qualifier
- parameter_qualifier_1 .or .true .emit PARAM_QUALIFIER_IN;
-parameter_qualifier_1
- parameter_qualifier_2 .and space;
-parameter_qualifier_2
- "in" .emit PARAM_QUALIFIER_IN .or
- "out" .emit PARAM_QUALIFIER_OUT .or
- "inout" .emit PARAM_QUALIFIER_INOUT;
-
-/*
- <parameter_type_specifier> ::= <type_specifier>
- | <type_specifier> "[" <constant_expression> "]"
-*/
-parameter_type_specifier
- parameter_type_specifier_1 .and .true .emit '\0' .and parameter_type_specifier_2;
-parameter_type_specifier_1
- type_specifier_nospace .or type_specifier_space;
-parameter_type_specifier_2
- parameter_type_specifier_3 .emit PARAMETER_ARRAY_PRESENT .or
- .true .emit PARAMETER_ARRAY_NOT_PRESENT;
-parameter_type_specifier_3
- lbracket .and constant_expression .and rbracket;
-
-/*
- <init_declarator_list> ::= <single_declaration>
- | <init_declarator_list> "," <identifier>
- | <init_declarator_list> "," <identifier> "[" "]"
- | <init_declarator_list> "," <identifier> "["
- <constant_expression> "]"
- | <init_declarator_list> "," <identifier> "="
- <initializer>
-*/
-init_declarator_list
- single_declaration .and .loop init_declarator_list_1 .emit DECLARATOR_NEXT .and
- .true .emit DECLARATOR_NONE;
-init_declarator_list_1
- comma .and identifier .emit VARIABLE_IDENTIFIER .and init_declarator_list_2;
-init_declarator_list_2
- init_declarator_list_3 .or init_declarator_list_4 .or .true .emit VARIABLE_NONE;
-init_declarator_list_3
- equals .and initializer .emit VARIABLE_INITIALIZER;
-init_declarator_list_4
- lbracket .and init_declarator_list_5 .and rbracket;
-init_declarator_list_5
- constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;
-
-/*
- <single_declaration> ::= <fully_specified_type>
- | <fully_specified_type> <identifier>
- | <fully_specified_type> <identifier> "[" "]"
- | <fully_specified_type> <identifier> "["
- <constant_expression> "]"
- | <fully_specified_type> <identifier> "=" <initializer>
-*/
-single_declaration
- single_declaration_nospace .or single_declaration_space;
-single_declaration_space
- fully_specified_type_space .and single_declaration_space_1;
-single_declaration_nospace
- fully_specified_type_nospace .and single_declaration_nospace_1;
-single_declaration_space_1
- single_declaration_space_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
-single_declaration_nospace_1
- single_declaration_nospace_2 .emit VARIABLE_IDENTIFIER .or .true .emit VARIABLE_NONE;
-single_declaration_space_2
- space .and identifier .and single_declaration_3;
-single_declaration_nospace_2
- identifier .and single_declaration_3;
-single_declaration_3
- single_declaration_4 .or single_declaration_5 .or .true .emit VARIABLE_NONE;
-single_declaration_4
- equals .and initializer .emit VARIABLE_INITIALIZER;
-single_declaration_5
- lbracket .and single_declaration_6 .and rbracket;
-single_declaration_6
- constant_expression .emit VARIABLE_ARRAY_EXPLICIT .or .true .emit VARIABLE_ARRAY_UNKNOWN;
-
-/*
- <fully_specified_type> ::= <type_specifier>
- | <type_qualifier> <type_specifier>
-*/
-fully_specified_type_space
- fully_specified_type_1 .and type_specifier_space;
-fully_specified_type_nospace
- fully_specified_type_1 .and type_specifier_nospace;
-fully_specified_type_1
- fully_specified_type_2 .or .true .emit TYPE_QUALIFIER_NONE;
-fully_specified_type_2
- type_qualifier .and space;
-
-/*
- <type_qualifier> ::= "const"
- | "attribute" // Vertex only.
- | "varying"
- | "uniform"
- | "__fixed_output"
- | "__fixed_input"
-
-note: this is an extension to the standard language specification - normally slang disallows
- __fixed_output and __fixed_input type qualifiers
-*/
-type_qualifier
- "const" .emit TYPE_QUALIFIER_CONST .or
- .if (shader_type == 2) "attribute" .emit TYPE_QUALIFIER_ATTRIBUTE .or
- "varying" .emit TYPE_QUALIFIER_VARYING .or
- "uniform" .emit TYPE_QUALIFIER_UNIFORM .or
- .if (parsing_builtin != 0) "__fixed_output" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or
- .if (parsing_builtin != 0) "__fixed_input" .emit TYPE_QUALIFIER_FIXEDINPUT;
-
-/*
- <type_specifier> ::= "void"
- | "float"
- | "int"
- | "bool"
- | "vec2"
- | "vec3"
- | "vec4"
- | "bvec2"
- | "bvec3"
- | "bvec4"
- | "ivec2"
- | "ivec3"
- | "ivec4"
- | "mat2"
- | "mat3"
- | "mat4"
- | "sampler1D"
- | "sampler2D"
- | "sampler3D"
- | "samplerCube"
- | "sampler1DShadow"
- | "sampler2DShadow"
- | <struct_specifier>
- | <type_name>
-*/
-type_specifier_space
- "void" .emit TYPE_SPECIFIER_VOID .or
- "float" .emit TYPE_SPECIFIER_FLOAT .or
- "int" .emit TYPE_SPECIFIER_INT .or
- "bool" .emit TYPE_SPECIFIER_BOOL .or
- "vec2" .emit TYPE_SPECIFIER_VEC2 .or
- "vec3" .emit TYPE_SPECIFIER_VEC3 .or
- "vec4" .emit TYPE_SPECIFIER_VEC4 .or
- "bvec2" .emit TYPE_SPECIFIER_BVEC2 .or
- "bvec3" .emit TYPE_SPECIFIER_BVEC3 .or
- "bvec4" .emit TYPE_SPECIFIER_BVEC4 .or
- "ivec2" .emit TYPE_SPECIFIER_IVEC2 .or
- "ivec3" .emit TYPE_SPECIFIER_IVEC3 .or
- "ivec4" .emit TYPE_SPECIFIER_IVEC4 .or
- "mat2" .emit TYPE_SPECIFIER_MAT2 .or
- "mat3" .emit TYPE_SPECIFIER_MAT3 .or
- "mat4" .emit TYPE_SPECIFIER_MAT4 .or
- "sampler1D" .emit TYPE_SPECIFIER_SAMPLER1D .or
- "sampler2D" .emit TYPE_SPECIFIER_SAMPLER2D .or
- "sampler3D" .emit TYPE_SPECIFIER_SAMPLER3D .or
- "samplerCube" .emit TYPE_SPECIFIER_SAMPLERCUBE .or
- "sampler1DShadow" .emit TYPE_SPECIFIER_SAMPLER1DSHADOW .or
- "sampler2DShadow" .emit TYPE_SPECIFIER_SAMPLER2DSHADOW .or
- type_name .emit TYPE_SPECIFIER_TYPENAME;
-type_specifier_nospace
- struct_specifier .emit TYPE_SPECIFIER_STRUCT;
-
-/*
- <struct_specifier> ::= "struct" <identifier> "{" <struct_declaration_list> "}"
- | "struct" "{" <struct_declaration_list> "}"
-*/
-struct_specifier
- "struct" .and struct_specifier_1 .and optional_space .and lbrace .error LBRACE_EXPECTED .and
- struct_declaration_list .and rbrace .emit FIELD_NONE;
-struct_specifier_1
- struct_specifier_2 .or .true .emit '\0';
-struct_specifier_2
- space .and identifier;
-
-/*
- <struct_declaration_list> ::= <struct_declaration>
- | <struct_declaration_list> <struct_declaration>
-*/
-struct_declaration_list
- struct_declaration .and .loop struct_declaration .emit FIELD_NEXT;
-
-/*
- <struct_declaration> ::= <type_specifier> <struct_declarator_list> ";"
-*/
-struct_declaration
- struct_declaration_nospace .or struct_declaration_space;
-struct_declaration_space
- type_specifier_space .and space .and struct_declarator_list .and semicolon .emit FIELD_NONE;
-struct_declaration_nospace
- type_specifier_nospace .and struct_declarator_list .and semicolon .emit FIELD_NONE;
-
-/*
- <struct_declarator_list> ::= <struct_declarator>
- | <struct_declarator_list> "," <struct_declarator>
-*/
-struct_declarator_list
- struct_declarator .and .loop struct_declarator_list_1 .emit FIELD_NEXT;
-struct_declarator_list_1
- comma .and struct_declarator;
-
-/*
- <struct_declarator> ::= <identifier>
- | <identifier> "[" <constant_expression> "]"
-*/
-struct_declarator
- identifier .and struct_declarator_1;
-struct_declarator_1
- struct_declarator_2 .emit FIELD_ARRAY .or .true .emit FIELD_NONE;
-struct_declarator_2
- lbracket .and constant_expression .and rbracket;
-
-/*
- <initializer> ::= <assignment_expression>
-*/
-initializer
- assignment_expression .and .true .emit OP_END;
-
-/*
- <declaration_statement> ::= <declaration>
-*/
-declaration_statement
- declaration;
-
-/*
- <statement> ::= <compound_statement>
- | <simple_statement>
-*/
-statement
- compound_statement .or simple_statement;
-statement_space
- compound_statement .or statement_space_1;
-statement_space_1
- space .and simple_statement;
-
-/*
- <simple_statement> ::= <__asm_statement>
- | <selection_statement>
- | <iteration_statement>
- | <jump_statement>
- | <expression_statement>
- | <declaration_statement>
-
-note: this is an extension to the standard language specification - normally slang disallows
- use of __asm statements
-*/
-simple_statement
- .if (parsing_builtin != 0) __asm_statement .emit OP_ASM .or
- selection_statement .or
- iteration_statement .or
- jump_statement .or
- expression_statement .emit OP_EXPRESSION .or
- declaration_statement .emit OP_DECLARE;
-
-/*
- <compound_statement> ::= "{" "}"
- | "{" <statement_list> "}"
-*/
-compound_statement
- compound_statement_1 .emit OP_BLOCK_BEGIN_NEW_SCOPE .and .true .emit OP_END;
-compound_statement_1
- compound_statement_2 .or compound_statement_3;
-compound_statement_2
- lbrace .and rbrace;
-compound_statement_3
- lbrace .and statement_list .and rbrace;
-
-/*
- <statement_no_new_scope> ::= <compound_statement_no_new_scope>
- | <simple_statement>
-*/
-statement_no_new_scope
- compound_statement_no_new_scope .or simple_statement;
-
-/*
- <compound_statement_no_new_scope> ::= "{" "}"
- | "{" <statement_list> "}"
-*/
-compound_statement_no_new_scope
- compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;
-compound_statement_no_new_scope_1
- compound_statement_no_new_scope_2 .or compound_statement_no_new_scope_3;
-compound_statement_no_new_scope_2
- lbrace .and rbrace;
-compound_statement_no_new_scope_3
- lbrace .and statement_list .and rbrace;
-
-/*
- <statement_list> ::= <statement>
- | <statement_list> <statement>
-*/
-statement_list
- statement .and .loop statement;
-
-/*
- <expression_statement> ::= ";"
- | <expression> ";"
-*/
-expression_statement
- expression_statement_1 .or expression_statement_2;
-expression_statement_1
- semicolon .emit OP_PUSH_VOID .emit OP_END;
-expression_statement_2
- expression .and semicolon .emit OP_END;
-
-/*
- <selection_statement> ::= "if" "(" <expression> ")" <selection_rest_statement>
-*/
-selection_statement
- "if" .emit OP_IF .and lparen .error LPAREN_EXPECTED .and expression .and
- rparen .error RPAREN_EXPECTED .emit OP_END .and selection_rest_statement;
-
-/*
- <selection_rest_statement> ::= <statement> "else" <statement>
- | <statement>
-*/
-selection_rest_statement
- statement .and selection_rest_statement_1;
-selection_rest_statement_1
- selection_rest_statement_2 .or .true .emit OP_EXPRESSION .emit OP_PUSH_VOID .emit OP_END;
-selection_rest_statement_2
- "else" .and optional_space .and statement;
-
-/*
- <condition> ::= <expression>
- | <fully_specified_type> <identifier> "=" <initializer>
-
-note: if <condition_1> is executed, the emit format must match <declaration> emit format
-*/
-condition
- condition_1 .emit OP_DECLARE .emit DECLARATION_INIT_DECLARATOR_LIST .or
- condition_3 .emit OP_EXPRESSION;
-condition_1
- condition_1_nospace .or condition_1_space;
-condition_1_nospace
- fully_specified_type_nospace .and condition_2;
-condition_1_space
- fully_specified_type_space .and space .and condition_2;
-condition_2
- identifier .emit VARIABLE_IDENTIFIER .and equals .emit VARIABLE_INITIALIZER .and
- initializer .and .true .emit DECLARATOR_NONE;
-condition_3
- expression .and .true .emit OP_END;
-
-/*
- <iteration_statement> ::= "while" "(" <condition> ")" <statement_no_new_scope>
- | "do" <statement> "while" "(" <expression> ")" ";"
- | "for" "(" <for_init_statement> <for_rest_statement> ")"
- <statement_no_new_scope>
-*/
-iteration_statement
- iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;
-iteration_statement_1
- "while" .emit OP_WHILE .and lparen .error LPAREN_EXPECTED .and condition .and
- rparen .error RPAREN_EXPECTED .and statement_no_new_scope;
-iteration_statement_2
- "do" .emit OP_DO .and statement_space .and "while" .and lparen .error LPAREN_EXPECTED .and
- expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;
-iteration_statement_3
- "for" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and
- for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;
-
-/*
- <for_init_statement> ::= <expression_statement>
- | <declaration_statement>
-*/
-for_init_statement
- expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;
-
-/*
- <conditionopt> ::= <condition>
- | ""
-
-note: <conditionopt> is used only by "for" statement - if <condition> is ommitted, parser
- simulates default behaviour, that is simulates "true" expression
-*/
-conditionopt
- condition .or
- .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\0' .emit OP_END;
-
-/*
- <for_rest_statement> ::= <conditionopt> ";"
- | <conditionopt> ";" <expression>
-*/
-for_rest_statement
- conditionopt .and semicolon .and for_rest_statement_1;
-for_rest_statement_1
- for_rest_statement_2 .or .true .emit OP_PUSH_VOID .emit OP_END;
-for_rest_statement_2
- expression .and .true .emit OP_END;
-
-/*
- <jump_statement> ::= "continue" ";"
- | "break" ";"
- | "return" ";"
- | "return" <expression> ";"
- | "discard" ";" // Fragment shader only.
-*/
-jump_statement
- jump_statement_1 .or jump_statement_2 .or jump_statement_3 .or jump_statement_4 .or
- .if (shader_type == 1) jump_statement_5;
-jump_statement_1
- "continue" .and semicolon .emit OP_CONTINUE;
-jump_statement_2
- "break" .and semicolon .emit OP_BREAK;
-jump_statement_3
- "return" .emit OP_RETURN .and optional_space .and expression .and semicolon .emit OP_END;
-jump_statement_4
- "return" .emit OP_RETURN .and semicolon .emit OP_PUSH_VOID .emit OP_END;
-jump_statement_5
- "discard" .and semicolon .emit OP_DISCARD;
-
-/*
- <__asm_statement> ::= "__asm" <identifier> <asm_arguments> ";"
-
-note: this is an extension to the standard language specification - normally slang disallows
- __asm statements
-*/
-__asm_statement
- "__asm" .and space .and identifier .and space .and asm_arguments .and semicolon .emit OP_END;
-
-/*
- <asm_arguments> ::= <asm_argument>
- | <asm_arguments> "," <asm_argument>
-
-note: this is an extension to the standard language specification - normally slang disallows
- __asm statements
-*/
-asm_arguments
- asm_argument .and .true .emit OP_END .and .loop asm_arguments_1;
-asm_arguments_1
- comma .and asm_argument .and .true .emit OP_END;
-
-/*
- <asm_argument> ::= <variable_identifier>
- | <floatconstant>
-
-note: this is an extension to the standard language specification - normally slang disallows
- __asm statements
-*/
-asm_argument
- variable_identifier .or floatconstant;
-
-/*
- <translation_unit> ::= <external_declaration>
- | <translation_unit> <external_declaration>
-*/
-translation_unit
- optional_space .emit REVISION .and external_declaration .error INVALID_EXTERNAL_DECLARATION .and
- .loop external_declaration .and optional_space .and
- '\0' .error INVALID_EXTERNAL_DECLARATION .emit EXTERNAL_NULL;
-
-/*
- <external_declaration> ::= <function_definition>
- | <declaration>
-*/
-external_declaration
- function_definition .emit EXTERNAL_FUNCTION_DEFINITION .or
- declaration .emit EXTERNAL_DECLARATION;
-
-/*
- <function_definition> :: <function_prototype> <compound_statement_no_new_scope>
-*/
-function_definition
- function_prototype .and compound_statement_no_new_scope;
-
-/* helper rulez, not part of the official language syntax */
-
-digit_oct
- '0'-'7';
-
-digit_dec
- '0'-'9';
-
-digit_hex
- '0'-'9' .or 'A'-'F' .or 'a'-'f';
-
-id_character_first
- 'a'-'z' .or 'A'-'Z' .or '_';
-
-id_character_next
- id_character_first .or digit_dec;
-
-identifier
- id_character_first .emit * .and .loop id_character_next .emit * .and .true .emit '\0';
-
-float
- float_1 .or float_2;
-float_1
- float_fractional_constant .and float_optional_exponent_part;
-float_2
- float_digit_sequence .and .true .emit '\0' .and float_exponent_part;
-
-float_fractional_constant
- float_fractional_constant_1 .or float_fractional_constant_2 .or float_fractional_constant_3;
-float_fractional_constant_1
- float_digit_sequence .and '.' .and float_digit_sequence;
-float_fractional_constant_2
- float_digit_sequence .and '.' .and .true .emit '\0';
-float_fractional_constant_3
- '.' .emit '\0' .and float_digit_sequence;
-
-float_optional_exponent_part
- float_exponent_part .or .true .emit '\0';
-
-float_digit_sequence
- digit_dec .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
-
-float_exponent_part
- float_exponent_part_1 .or float_exponent_part_2;
-float_exponent_part_1
- 'e' .and float_optional_sign .and float_digit_sequence;
-float_exponent_part_2
- 'E' .and float_optional_sign .and float_digit_sequence;
-
-float_optional_sign
- float_sign .or .true;
-
-float_sign
- '+' .or '-' .emit '-';
-
-integer
- integer_hex .or integer_oct .or integer_dec;
-
-integer_hex
- '0' .and integer_hex_1 .emit 0x10 .and digit_hex .emit * .and .loop digit_hex .emit * .and
- .true .emit '\0';
-integer_hex_1
- 'x' .or 'X';
-
-integer_oct
- '0' .emit 8 .emit * .and .loop digit_oct .emit * .and .true .emit '\0';
-
-integer_dec
- digit_dec .emit 10 .emit * .and .loop digit_dec .emit * .and .true .emit '\0';
-
-boolean
- "true" .emit 2 .emit '1' .emit '\0' .or
- "false" .emit 2 .emit '0' .emit '\0';
-
-type_name
- identifier;
-
-field_selection
- identifier;
-
-floatconstant
- float .emit OP_PUSH_FLOAT;
-
-intconstant
- integer .emit OP_PUSH_INT;
-
-boolconstant
- boolean .emit OP_PUSH_BOOL;
-
-optional_space
- .loop single_space;
-
-space
- single_space .and .loop single_space;
-
-single_space
- white_char .or c_style_comment_block .or cpp_style_comment_block;
-
-white_char
- ' ' .or '\t' .or new_line .or '\v' .or '\f';
-
-new_line
- cr_lf .or lf_cr .or '\n' .or '\r';
-
-cr_lf
- '\r' .and '\n';
-
-lf_cr
- '\n' .and '\r';
-
-c_style_comment_block
- '/' .and '*' .and c_style_comment_rest;
-
-c_style_comment_rest
- .loop c_style_comment_char_no_star .and c_style_comment_rest_1;
-c_style_comment_rest_1
- c_style_comment_end .or c_style_comment_rest_2;
-c_style_comment_rest_2
- '*' .and c_style_comment_rest;
-
-c_style_comment_char_no_star
- '\x2B'-'\xFF' .or '\x01'-'\x29';
-
-c_style_comment_end
- '*' .and '/';
-
-cpp_style_comment_block
- '/' .and '/' .and cpp_style_comment_block_1;
-cpp_style_comment_block_1
- cpp_style_comment_block_2 .or cpp_style_comment_block_3;
-cpp_style_comment_block_2
- .loop cpp_style_comment_char .and new_line;
-cpp_style_comment_block_3
- .loop cpp_style_comment_char;
-
-cpp_style_comment_char
- '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
-
-/* lexical rulez */
-
-/*ampersand
- optional_space .and '&' .and optional_space;*/
-
-ampersandampersand
- optional_space .and '&' .and '&' .and optional_space;
-
-/*ampersandequals
- optional_space .and '&' .and '=' .and optional_space;*/
-
-/*bar
- optional_space .and '|' .and optional_space;*/
-
-barbar
- optional_space .and '|' .and '|' .and optional_space;
-
-/*barequals
- optional_space .and '|' .and '=' .and optional_space;*/
-
-bang
- optional_space .and '!' .and optional_space;
-
-bangequals
- optional_space .and '!' .and '=' .and optional_space;
-
-/*caret
- optional_space .and '^' .and optional_space;*/
-
-caretcaret
- optional_space .and '^' .and '^' .and optional_space;
-
-/*caretequals
- optional_space .and '^' .and '=' .and optional_space;*/
-
-colon
- optional_space .and ':' .and optional_space;
-
-comma
- optional_space .and ',' .and optional_space;
-
-dot
- optional_space .and '.' .and optional_space;
-
-equals
- optional_space .and '=' .and optional_space;
-
-equalsequals
- optional_space .and '=' .and '=' .and optional_space;
-
-greater
- optional_space .and '>' .and optional_space;
-
-greaterequals
- optional_space .and '>' .and '=' .and optional_space;
-
-/*greatergreater
- optional_space .and '>' .and '>' .and optional_space;*/
-
-/*greatergreaterequals
- optional_space .and '>' .and '>' .and '=' .and optional_space;*/
-
-lbrace
- optional_space .and '{' .and optional_space;
-
-lbracket
- optional_space .and '[' .and optional_space;
-
-less
- optional_space .and '<' .and optional_space;
-
-lessequals
- optional_space .and '<' .and '=' .and optional_space;
-
-/*lessless
- optional_space .and '<' .and '<' .and optional_space;*/
-
-/*lesslessequals
- optional_space .and '<' .and '<' .and '=' .and optional_space;*/
-
-lparen
- optional_space .and '(' .and optional_space;
-
-minus
- optional_space .and '-' .and optional_space;
-
-minusequals
- optional_space .and '-' .and '=' .and optional_space;
-
-minusminus
- optional_space .and '-' .and '-' .and optional_space;
-
-/*percent
- optional_space .and '%' .and optional_space;*/
-
-/*percentequals
- optional_space .and '%' .and '=' .and optional_space;*/
-
-plus
- optional_space .and '+' .and optional_space;
-
-plusequals
- optional_space .and '+' .and '=' .and optional_space;
-
-plusplus
- optional_space .and '+' .and '+' .and optional_space;
-
-question
- optional_space .and '?' .and optional_space;
-
-rbrace
- optional_space .and '}' .and optional_space;
-
-rbracket
- optional_space .and ']' .and optional_space;
-
-rparen
- optional_space .and ')' .and optional_space;
-
-semicolon
- optional_space .and ';' .and optional_space;
-
-slash
- optional_space .and '/' .and optional_space;
-
-slashequals
- optional_space .and '/' .and '=' .and optional_space;
-
-star
- optional_space .and '*' .and optional_space;
-
-starequals
- optional_space .and '*' .and '=' .and optional_space;
-
-/*tilde
- optional_space .and '~' .and optional_space;*/
-
-/* string rulez - these are used internally by the parser when parsing quoted strings */
-
-.string string_lexer;
-
-string_lexer
- lex_first_identifier_character .and .loop lex_next_identifier_character;
-
-lex_first_identifier_character
- 'a'-'z' .or 'A'-'Z' .or '_';
-
-lex_next_identifier_character
- 'a'-'z' .or 'A'-'Z' .or '0'-'9' .or '_';
-
-/* error rulez - these are used by error messages */
-
-err_token
- '~' .or '`' .or '!' .or '@' .or '#' .or '$' .or '%' .or '^' .or '&' .or '*' .or '(' .or ')' .or
- '-' .or '+' .or '=' .or '|' .or '\\' .or '[' .or ']' .or '{' .or '}' .or ':' .or ';' .or '"' .or
- '\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;
-
-err_identifier
- id_character_first .and .loop id_character_next;
-
diff --git a/src/mesa/shader/slang/library/slang_version.syn b/src/mesa/shader/slang/library/slang_version.syn
deleted file mode 100755
index aaf8bef342f..00000000000
--- a/src/mesa/shader/slang/library/slang_version.syn
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_version.syn
- * slang #version directive syntax
- * \author Michal Krol
- */
-
-.syntax version_directive;
-
-version_directive
- version_directive_1 .and .loop version_directive_2;
-version_directive_1
- prior_optional_spaces .and optional_version_directive .and .true .emit $;
-version_directive_2
- prior_optional_spaces .and version_directive_body .and .true .emit $;
-
-optional_version_directive
- version_directive_body .or .true .emit 10 .emit 1;
-
-version_directive_body
- '#' .and optional_space .and "version" .and space .and version_number .and optional_space .and
- new_line;
-
-version_number
- version_number_110;
-
-version_number_110
- leading_zeroes .and "110" .emit 10 .emit 1;
-
-leading_zeroes
- .loop zero;
-
-zero
- '0';
-
-space
- single_space .and .loop single_space;
-
-optional_space
- .loop single_space;
-
-single_space
- ' ' .or '\t';
-
-prior_optional_spaces
- .loop prior_space;
-
-prior_space
- c_style_comment_block .or cpp_style_comment_block .or space .or new_line;
-
-c_style_comment_block
- '/' .and '*' .and c_style_comment_rest;
-
-c_style_comment_rest
- .loop c_style_comment_char_no_star .and c_style_comment_rest_1;
-c_style_comment_rest_1
- c_style_comment_end .or c_style_comment_rest_2;
-c_style_comment_rest_2
- '*' .and c_style_comment_rest;
-
-c_style_comment_char_no_star
- '\x2B'-'\xFF' .or '\x01'-'\x29';
-
-c_style_comment_end
- '*' .and '/';
-
-cpp_style_comment_block
- '/' .and '/' .and cpp_style_comment_block_1;
-cpp_style_comment_block_1
- cpp_style_comment_block_2 .or cpp_style_comment_block_3;
-cpp_style_comment_block_2
- .loop cpp_style_comment_char .and new_line;
-cpp_style_comment_block_3
- .loop cpp_style_comment_char;
-
-cpp_style_comment_char
- '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
-
-new_line
- cr_lf .or lf_cr .or '\n' .or '\r';
-
-cr_lf
- '\r' .and '\n';
-
-lf_cr
- '\n' .and '\r';
-
-.string __string_filter;
-
-__string_filter
- .loop __identifier_char;
-
-__identifier_char
- 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';
-
diff --git a/src/mesa/shader/slang/library/slang_version_syn.h b/src/mesa/shader/slang/library/slang_version_syn.h
deleted file mode 100755
index 3b94d85927a..00000000000
--- a/src/mesa/shader/slang/library/slang_version_syn.h
+++ /dev/null
@@ -1,64 +0,0 @@
-".syntax version_directive;\n"
-"version_directive\n"
-" version_directive_1 .and .loop version_directive_2;\n"
-"version_directive_1\n"
-" prior_optional_spaces .and optional_version_directive .and .true .emit $;\n"
-"version_directive_2\n"
-" prior_optional_spaces .and version_directive_body .and .true .emit $;\n"
-"optional_version_directive\n"
-" version_directive_body .or .true .emit 10 .emit 1;\n"
-"version_directive_body\n"
-" '#' .and optional_space .and \"version\" .and space .and version_number .and optional_space .and\n"
-" new_line;\n"
-"version_number\n"
-" version_number_110;\n"
-"version_number_110\n"
-" leading_zeroes .and \"110\" .emit 10 .emit 1;\n"
-"leading_zeroes\n"
-" .loop zero;\n"
-"zero\n"
-" '0';\n"
-"space\n"
-" single_space .and .loop single_space;\n"
-"optional_space\n"
-" .loop single_space;\n"
-"single_space\n"
-" ' ' .or '\\t';\n"
-"prior_optional_spaces\n"
-" .loop prior_space;\n"
-"prior_space\n"
-" c_style_comment_block .or cpp_style_comment_block .or space .or new_line;\n"
-"c_style_comment_block\n"
-" '/' .and '*' .and c_style_comment_rest;\n"
-"c_style_comment_rest\n"
-" .loop c_style_comment_char_no_star .and c_style_comment_rest_1;\n"
-"c_style_comment_rest_1\n"
-" c_style_comment_end .or c_style_comment_rest_2;\n"
-"c_style_comment_rest_2\n"
-" '*' .and c_style_comment_rest;\n"
-"c_style_comment_char_no_star\n"
-" '\\x2B'-'\\xFF' .or '\\x01'-'\\x29';\n"
-"c_style_comment_end\n"
-" '*' .and '/';\n"
-"cpp_style_comment_block\n"
-" '/' .and '/' .and cpp_style_comment_block_1;\n"
-"cpp_style_comment_block_1\n"
-" cpp_style_comment_block_2 .or cpp_style_comment_block_3;\n"
-"cpp_style_comment_block_2\n"
-" .loop cpp_style_comment_char .and new_line;\n"
-"cpp_style_comment_block_3\n"
-" .loop cpp_style_comment_char;\n"
-"cpp_style_comment_char\n"
-" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n"
-"new_line\n"
-" cr_lf .or lf_cr .or '\\n' .or '\\r';\n"
-"cr_lf\n"
-" '\\r' .and '\\n';\n"
-"lf_cr\n"
-" '\\n' .and '\\r';\n"
-".string __string_filter;\n"
-"__string_filter\n"
-" .loop __identifier_char;\n"
-"__identifier_char\n"
-" 'a'-'z' .or 'A'-'Z' .or '_' .or '0'-'9';\n"
-""
diff --git a/src/mesa/shader/slang/library/slang_vertex_builtin.gc b/src/mesa/shader/slang/library/slang_vertex_builtin.gc
deleted file mode 100755
index 8afb723ee2c..00000000000
--- a/src/mesa/shader/slang/library/slang_vertex_builtin.gc
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//
-// From Shader Spec, ver. 1.10, rev. 59
-//
-
-__fixed_output vec4 gl_Position;
-__fixed_output float gl_PointSize;
-__fixed_output vec4 gl_ClipVertex;
-
-attribute vec4 gl_Color;
-attribute vec4 gl_SecondaryColor;
-attribute vec3 gl_Normal;
-attribute vec4 gl_Vertex;
-attribute vec4 gl_MultiTexCoord0;
-attribute vec4 gl_MultiTexCoord1;
-attribute vec4 gl_MultiTexCoord2;
-attribute vec4 gl_MultiTexCoord3;
-attribute vec4 gl_MultiTexCoord4;
-attribute vec4 gl_MultiTexCoord5;
-attribute vec4 gl_MultiTexCoord6;
-attribute vec4 gl_MultiTexCoord7;
-attribute float gl_FogCoord;
-
-varying vec4 gl_FrontColor;
-varying vec4 gl_BackColor;
-varying vec4 gl_FrontSecondaryColor;
-varying vec4 gl_BackSecondaryColor;
-varying vec4 gl_TexCoord[gl_MaxTextureCoords];
-varying float gl_FogFragCoord;
-
-//
-// Geometric Functions
-//
-
-vec4 ftransform () {
- return gl_ModelViewProjectionMatrix * gl_Vertex;
-}
-
-//
-// 8.7 Texture Lookup Functions
-//
-
-vec4 texture1DLod (sampler1D sampler, float coord, float lod) {
- vec4 texel;
- __asm vec4_tex1d texel, sampler, coord, lod;
- return texel;
-}
-
-vec4 texture1DProjLod (sampler1D sampler, vec2 coord, float lod) {
- return texture1DLod (sampler, coord.s / coord.t, lod);
-}
-
-vec4 texture1DProjLod (sampler1D sampler, vec4 coord, float lod) {
- return texture1DLod (sampler, coord.s / coord.q, lod);
-}
-
-vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod) {
- vec4 texel;
- __asm vec4_tex2d texel, sampler, coord, lod;
- return texel;
-}
-
-vec4 texture2DProjLod (sampler2D sampler, vec3 coord, float lod) {
- return texture2DLod (sampler, vec2 (coord.s / coord.p, coord.t / coord.p), lod);
-}
-
-vec4 texture2DProjLod (sampler2D sampler, vec4 coord, float lod) {
- return texture2DLod (sampler, vec2 (coord.s / coord.q, coord.t / coord.q), lod);
-}
-
-vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod) {
- vec4 texel;
- __asm vec4_tex3d texel, sampler, coord, lod;
- return texel;
-}
-vec4 texture3DProjLod (sampler3D sampler, vec4 coord, float lod) {
- return texture3DLod (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q), lod);
-}
-
-vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod) {
- vec4 texel;
- __asm vec4_texcube texel, sampler, coord, lod;
- return texel;
-}
-
-vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod) {
- vec4 texel;
- __asm vec4_shad1d texel, sampler, coord, lod;
- return texel;
-}
-
-vec4 shadow1DProjLod (sampler1DShadow sampler, vec4 coord, float lod) {
- return shadow1DLod (sampler, vec3 (coord.s / coord.q, 0.0, coord.p / coord.q), lod);
-}
-
-vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod) {
- vec4 texel;
- __asm vec4_shad2d texel, sampler, coord, lod;
- return texel;
-}
-
-vec4 shadow2DProjLod (sampler2DShadow sampler, vec4 coord, float lod) {
- return shadow2DLod (sampler, vec3 (coord.s / coord.q, coord.t / coord.q, coord.p / coord.q), lod);
-}
-
diff --git a/src/mesa/shader/slang/slang_mesa.cpp b/src/mesa/shader/slang/slang_mesa.cpp
deleted file mode 100644
index 3f437ee7df2..00000000000
--- a/src/mesa/shader/slang/slang_mesa.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "slang_mesa.h"
-#include "Initialisation.h"
-#include "Include/Common.h"
-#include "Include/ShHandle.h"
-#include "Public/ShaderLang.h"
-
-
-class TGenericCompiler: public TCompiler
-{
-public:
- TGenericCompiler (EShLanguage l, int dOptions): TCompiler(l, infoSink), debugOptions(dOptions)
- {
- }
-public:
- virtual bool compile (TIntermNode *root)
- {
- haveValidObjectCode = true;
- return haveValidObjectCode;
- }
- TInfoSink infoSink;
- int debugOptions;
-};
-
-TCompiler *ConstructCompiler (EShLanguage language, int debugOptions)
-{
- return new TGenericCompiler (language, debugOptions);
-}
-
-void DeleteCompiler (TCompiler *compiler)
-{
- delete compiler;
-}
-
-class TGenericLinker: public TLinker
-{
-public:
- TGenericLinker (EShExecutable e, int dOptions): TLinker(e, infoSink), debugOptions(dOptions)
- {
- }
-public:
- bool link (TCompilerList &, TUniformMap *)
- {
- return true;
- }
- void getAttributeBindings (ShBindingTable const **t) const
- {
- }
- TInfoSink infoSink;
- int debugOptions;
-};
-
-TShHandleBase *ConstructLinker (EShExecutable executable, int debugOptions)
-{
- return new TGenericLinker (executable, debugOptions);
-}
-
-void DeleteLinker (TShHandleBase *linker)
-{
- delete linker;
-}
-
-class TUniformLinkedMap: public TUniformMap
-{
-public:
- TUniformLinkedMap()
- {
- }
-public:
- virtual int getLocation (const char *name)
- {
- return 0;
- }
-};
-
-TUniformMap *ConstructUniformMap ()
-{
- return new TUniformLinkedMap;
-}
-
-void DeleteUniformMap (TUniformMap *map)
-{
- delete map;
-}
-
-
-namespace std
-{
-
-void _Xran ()
-{
- /* XXX fix this under Linux */
- /*_THROW(out_of_range, "invalid string position");*/
-}
-
-void _Xlen ()
-{
- /* XXX fix this under Linux */
- /*_THROW(length_error, "string too long");*/
-}
-
-}
-
-
-/* these functions link with extern "C" */
-
-int _mesa_isalnum (char c)
-{
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
-}
-
-int _glslang_3dlabs_InitProcess ()
-{
- return InitProcess () ? 1 : 0;
-}
-
-int _glslang_3dlabs_ShInitialize ()
-{
- return ShInitialize () ? 1 : 0;
-}
-
diff --git a/src/mesa/swrast/NOTES b/src/mesa/swrast/NOTES
deleted file mode 100644
index f906e41b955..00000000000
--- a/src/mesa/swrast/NOTES
+++ /dev/null
@@ -1,55 +0,0 @@
-INTRODUCTION
-
-Mesa's native software rasterizer. This module provides the fallback
-paths for rasterization operations and states that aren't accelerated
-in hardware drivers, and as the full rasterization engine in software
-drivers.
-
-The swrast module 'stands alone', relying only on interfaces to core
-mesa and it's own driver interface. It knows nothing about the tnl or
-other modules, allowing it to be used for fallback paths in future tnl
-schemes without modification.
-
-As well as providing triangle/line/point rasterization functionality,
-the module provides implementations of the pixel operations
-(ReadPixels, etc), and texture operations (CopyTexSubImage) which may
-be plugged in to the core Mesa driver interface where accelerated
-versions of these operations are unavailable.
-
-
-STATE
-
-To create and destroy the module:
-
- GLboolean _swrast_CreateContext( GLcontext *ctx );
- void _swrast_DestroyContext( GLcontext *ctx );
-
-This module tracks state changes internally and maintains derived
-values based on the current state. For this to work, the driver
-ensure the following funciton is called whenever the state changes and
-the swsetup module is 'awake':
-
- void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state );
-
-There is no explicit call to put the swrast module to sleep.
-
-
-CUSTOMIZATION
-
- void (*choose_point)( GLcontext * );
- void (*choose_line)( GLcontext * );
- void (*choose_triangle)( GLcontext * );
-
-Drivers may add additional triangle/line/point functions to swrast by
-overriding these functions. It is necessary for the driver to be very
-careful that it doesn't return an inappropriate function, eg a
-rasterization function in feedback mode. See the X11 driver for
-examples.
-
-DRIVER INTERFACE
-
-The swrast device driver provides swrast primarily with span- and
-pixel- level interfaces to a framebuffer, with a few additional hooks
-for locking and setting the read buffer.
-
-See the definition of struct swrast_device_driver in swrast.h. \ No newline at end of file
diff --git a/src/mesa/swrast/s_texsample.h b/src/mesa/swrast/s_texsample.h
deleted file mode 100644
index 10143943419..00000000000
--- a/src/mesa/swrast/s_texsample.h
+++ /dev/null
@@ -1,700 +0,0 @@
-
-
-
-
-/*
- * These values are used in the fixed-point arithmetic used
- * for linear filtering.
- */
-#define WEIGHT_SCALE 65536.0F
-#define WEIGHT_SHIFT 16
-
-
-/*
- * Compute the remainder of a divided by b, but be careful with
- * negative values so that GL_REPEAT mode works right.
- */
-static INLINE GLint
-repeat_remainder(GLint a, GLint b)
-{
- if (a >= 0)
- return a % b;
- else
- return (a + 1) % b + b - 1;
-}
-
-
-/*
- * Used to compute texel locations for linear sampling.
- * Input:
- * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER
- * S = texcoord in [0,1]
- * SIZE = width (or height or depth) of texture
- * Output:
- * U = texcoord in [0, width]
- * I0, I1 = two nearest texel indexes
- */
-#define COMPUTE_LINEAR_TEXEL_LOCATIONS(wrapMode, S, U, SIZE, I0, I1) \
-{ \
- if (wrapMode == GL_REPEAT) { \
- U = S * SIZE - 0.5F; \
- if (tObj->_IsPowerOfTwo) { \
- I0 = IFLOOR(U) & (SIZE - 1); \
- I1 = (I0 + 1) & (SIZE - 1); \
- } \
- else { \
- I0 = repeat_remainder(IFLOOR(U), SIZE); \
- I1 = repeat_remainder(I0 + 1, SIZE); \
- } \
- } \
- else if (wrapMode == GL_CLAMP_TO_EDGE) { \
- if (S <= 0.0F) \
- U = 0.0F; \
- else if (S >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U = S * SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- if (I0 < 0) \
- I0 = 0; \
- if (I1 >= (GLint) SIZE) \
- I1 = SIZE - 1; \
- } \
- else if (wrapMode == GL_CLAMP_TO_BORDER) { \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- if (S <= min) \
- U = min * SIZE; \
- else if (S >= max) \
- U = max * SIZE; \
- else \
- U = S * SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- } \
- else if (wrapMode == GL_MIRRORED_REPEAT) { \
- const GLint flr = IFLOOR(S); \
- if (flr & 1) \
- U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \
- else \
- U = S - (GLfloat) flr; /* flr is even */ \
- U = (U * SIZE) - 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- if (I0 < 0) \
- I0 = 0; \
- if (I1 >= (GLint) SIZE) \
- I1 = SIZE - 1; \
- } \
- else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \
- U = (GLfloat) fabs(S); \
- if (U >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U *= SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- } \
- else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \
- U = (GLfloat) fabs(S); \
- if (U >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U *= SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- if (I0 < 0) \
- I0 = 0; \
- if (I1 >= (GLint) SIZE) \
- I1 = SIZE - 1; \
- } \
- else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- U = (GLfloat) fabs(S); \
- if (U <= min) \
- U = min * SIZE; \
- else if (U >= max) \
- U = max * SIZE; \
- else \
- U *= SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- } \
- else { \
- ASSERT(wrapMode == GL_CLAMP); \
- if (S <= 0.0F) \
- U = 0.0F; \
- else if (S >= 1.0F) \
- U = (GLfloat) SIZE; \
- else \
- U = S * SIZE; \
- U -= 0.5F; \
- I0 = IFLOOR(U); \
- I1 = I0 + 1; \
- } \
-}
-
-
-/*
- * Used to compute texel location for nearest sampling.
- */
-#define COMPUTE_NEAREST_TEXEL_LOCATION(wrapMode, S, SIZE, I) \
-{ \
- if (wrapMode == GL_REPEAT) { \
- /* s limited to [0,1) */ \
- /* i limited to [0,size-1] */ \
- I = IFLOOR(S * SIZE); \
- if (tObj->_IsPowerOfTwo) \
- I &= (SIZE - 1); \
- else \
- I = repeat_remainder(I, SIZE); \
- } \
- else if (wrapMode == GL_CLAMP_TO_EDGE) { \
- /* s limited to [min,max] */ \
- /* i limited to [0, size-1] */ \
- const GLfloat min = 1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- if (S < min) \
- I = 0; \
- else if (S > max) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(S * SIZE); \
- } \
- else if (wrapMode == GL_CLAMP_TO_BORDER) { \
- /* s limited to [min,max] */ \
- /* i limited to [-1, size] */ \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- if (S <= min) \
- I = -1; \
- else if (S >= max) \
- I = SIZE; \
- else \
- I = IFLOOR(S * SIZE); \
- } \
- else if (wrapMode == GL_MIRRORED_REPEAT) { \
- const GLfloat min = 1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- const GLint flr = IFLOOR(S); \
- GLfloat u; \
- if (flr & 1) \
- u = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \
- else \
- u = S - (GLfloat) flr; /* flr is even */ \
- if (u < min) \
- I = 0; \
- else if (u > max) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \
- /* s limited to [0,1] */ \
- /* i limited to [0,size-1] */ \
- const GLfloat u = (GLfloat) fabs(S); \
- if (u <= 0.0F) \
- I = 0; \
- else if (u >= 1.0F) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \
- /* s limited to [min,max] */ \
- /* i limited to [0, size-1] */ \
- const GLfloat min = 1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- const GLfloat u = (GLfloat) fabs(S); \
- if (u < min) \
- I = 0; \
- else if (u > max) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \
- /* s limited to [min,max] */ \
- /* i limited to [0, size-1] */ \
- const GLfloat min = -1.0F / (2.0F * SIZE); \
- const GLfloat max = 1.0F - min; \
- const GLfloat u = (GLfloat) fabs(S); \
- if (u < min) \
- I = -1; \
- else if (u > max) \
- I = SIZE; \
- else \
- I = IFLOOR(u * SIZE); \
- } \
- else { \
- ASSERT(wrapMode == GL_CLAMP); \
- /* s limited to [0,1] */ \
- /* i limited to [0,size-1] */ \
- if (S <= 0.0F) \
- I = 0; \
- else if (S >= 1.0F) \
- I = SIZE - 1; \
- else \
- I = IFLOOR(S * SIZE); \
- } \
-}
-
-
-/* Power of two image sizes only */
-#define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \
-{ \
- U = S * SIZE - 0.5F; \
- I0 = IFLOOR(U) & (SIZE - 1); \
- I1 = (I0 + 1) & (SIZE - 1); \
-}
-
-
-/*
- * Compute linear mipmap levels for given lambda.
- */
-#define COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level) \
-{ \
- if (lambda < 0.0F) \
- level = tObj->BaseLevel; \
- else if (lambda > tObj->_MaxLambda) \
- level = (GLint) (tObj->BaseLevel + tObj->_MaxLambda); \
- else \
- level = (GLint) (tObj->BaseLevel + lambda); \
-}
-
-
-/*
- * Compute nearest mipmap level for given lambda.
- */
-#define COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level) \
-{ \
- GLfloat l; \
- if (lambda <= 0.5F) \
- l = 0.0F; \
- else if (lambda > tObj->_MaxLambda + 0.4999F) \
- l = tObj->_MaxLambda + 0.4999F; \
- else \
- l = lambda; \
- level = (GLint) (tObj->BaseLevel + l + 0.5F); \
- if (level > tObj->_MaxLevel) \
- level = tObj->_MaxLevel; \
-}
-
-
-
-/*
- * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes
- * see 1-pixel bands of improperly weighted linear-sampled texels. The
- * tests/texwrap.c demo is a good test.
- * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0.
- * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x).
- */
-#define FRAC(f) ((f) - IFLOOR(f))
-
-
-
-/*
- * Bitflags for texture border color sampling.
- */
-#define I0BIT 1
-#define I1BIT 2
-#define J0BIT 4
-#define J1BIT 8
-#define K0BIT 16
-#define K1BIT 32
-
-
-
-#if 000
-/*
- * Get texture palette entry.
- */
-static void
-palette_sample(const GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLint index, GLchan rgba[4] )
-{
- const GLchan *palette;
- GLenum format;
-
- if (ctx->Texture.SharedPalette) {
- ASSERT(ctx->Texture.Palette.Type != GL_FLOAT);
- palette = (const GLchan *) ctx->Texture.Palette.Table;
- format = ctx->Texture.Palette.Format;
- }
- else {
- ASSERT(tObj->Palette.Type != GL_FLOAT);
- palette = (const GLchan *) tObj->Palette.Table;
- format = tObj->Palette.Format;
- }
-
- switch (format) {
- case GL_ALPHA:
- rgba[ACOMP] = palette[index];
- return;
- case GL_LUMINANCE:
- case GL_INTENSITY:
- rgba[RCOMP] = palette[index];
- return;
- case GL_LUMINANCE_ALPHA:
- rgba[RCOMP] = palette[(index << 1) + 0];
- rgba[ACOMP] = palette[(index << 1) + 1];
- return;
- case GL_RGB:
- rgba[RCOMP] = palette[index * 3 + 0];
- rgba[GCOMP] = palette[index * 3 + 1];
- rgba[BCOMP] = palette[index * 3 + 2];
- return;
- case GL_RGBA:
- rgba[RCOMP] = palette[(index << 2) + 0];
- rgba[GCOMP] = palette[(index << 2) + 1];
- rgba[BCOMP] = palette[(index << 2) + 2];
- rgba[ACOMP] = palette[(index << 2) + 3];
- return;
- default:
- _mesa_problem(ctx, "Bad palette format in palette_sample");
- }
-}
-#endif
-
-
-
-/**********************************************************************/
-/* 1-D Texture Sampling Functions */
-/**********************************************************************/
-
-/*
- * Return the texture sample for coordinate (s) using GL_NEAREST filter.
- */
-static void
-sample_1d_nearest(GLcontext *ctx,
- const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- const GLfloat texcoord[4], TYPE rgba[4])
-{
- const GLint width = img->Width2; /* without border */
- GLint i;
-
- COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i);
-
- /* skip over the border, if any */
- i += img->Border;
-
- if (i < 0 || i >= (GLint) img->Width) {
- /* Need this test for GL_CLAMP_TO_BORDER mode */
-#if TYPE_ENUM == GL_FLOAT
- COPY_4V(rgba, tObj->BorderColor);
-#else
- COPY_CHAN4(rgba, tObj->_BorderChan);
-#endif
- }
- else {
-#if TYPE_ENUM == GL_FLOAT
- img->FetchTexelf(img, i, 0, 0, rgba);
-#else
- img->FetchTexelc(img, i, 0, 0, rgba);
-#endif
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, rgba[0], rgba);
- }
- }
-}
-
-
-
-/*
- * Return the texture sample for coordinate (s) using GL_LINEAR filter.
- */
-static void
-sample_1d_linear(GLcontext *ctx,
- const struct gl_texture_object *tObj,
- const struct gl_texture_image *img,
- const GLfloat texcoord[4], GLchan rgba[4])
-{
- const GLint width = img->Width2;
- GLint i0, i1;
- GLfloat u;
- GLuint useBorderColor;
-
- COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1);
-
- useBorderColor = 0;
- if (img->Border) {
- i0 += img->Border;
- i1 += img->Border;
- }
- else {
- if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
- if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
- }
-
- {
- const GLfloat a = FRAC(u);
-
-#if CHAN_TYPE == GL_FLOAT || CHAN_TYPE == GL_UNSIGNED_SHORT
- const GLfloat w0 = (1.0F-a);
- const GLfloat w1 = a ;
-#else /* CHAN_BITS == 8 */
- /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */
- const GLint w0 = IROUND_POS((1.0F - a) * WEIGHT_SCALE);
- const GLint w1 = IROUND_POS( a * WEIGHT_SCALE);
-#endif
- GLchan t0[4], t1[4]; /* texels */
-
- if (useBorderColor & I0BIT) {
- COPY_CHAN4(t0, tObj->_BorderChan);
- }
- else {
- img->FetchTexelc(img, i0, 0, 0, t0);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t0[0], t0);
- }
- }
- if (useBorderColor & I1BIT) {
- COPY_CHAN4(t1, tObj->_BorderChan);
- }
- else {
- img->FetchTexelc(img, i1, 0, 0, t1);
- if (img->Format == GL_COLOR_INDEX) {
- palette_sample(ctx, tObj, t1[0], t1);
- }
- }
-
-#if CHAN_TYPE == GL_FLOAT
- rgba[0] = w0 * t0[0] + w1 * t1[0];
- rgba[1] = w0 * t0[1] + w1 * t1[1];
- rgba[2] = w0 * t0[2] + w1 * t1[2];
- rgba[3] = w0 * t0[3] + w1 * t1[3];
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
- rgba[0] = (GLchan) (w0 * t0[0] + w1 * t1[0] + 0.5);
- rgba[1] = (GLchan) (w0 * t0[1] + w1 * t1[1] + 0.5);
- rgba[2] = (GLchan) (w0 * t0[2] + w1 * t1[2] + 0.5);
- rgba[3] = (GLchan) (w0 * t0[3] + w1 * t1[3] + 0.5);
-#else /* CHAN_BITS == 8 */
- rgba[0] = (GLchan) ((w0 * t0[0] + w1 * t1[0]) >> WEIGHT_SHIFT);
- rgba[1] = (GLchan) ((w0 * t0[1] + w1 * t1[1]) >> WEIGHT_SHIFT);
- rgba[2] = (GLchan) ((w0 * t0[2] + w1 * t1[2]) >> WEIGHT_SHIFT);
- rgba[3] = (GLchan) ((w0 * t0[3] + w1 * t1[3]) >> WEIGHT_SHIFT);
-#endif
-
- }
-}
-
-
-static void
-sample_1d_nearest_mipmap_nearest(GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoord[][4],
- const GLfloat lambda[], GLchan rgba[][4])
-{
- GLuint i;
- ASSERT(lambda != NULL);
- for (i = 0; i < n; i++) {
- GLint level;
- COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level);
- sample_1d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]);
- }
-}
-
-
-static void
-sample_1d_linear_mipmap_nearest(GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoord[][4],
- const GLfloat lambda[], GLchan rgba[][4])
-{
- GLuint i;
- ASSERT(lambda != NULL);
- for (i = 0; i < n; i++) {
- GLint level;
- COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level);
- sample_1d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]);
- }
-}
-
-
-
-/*
- * This is really just needed in order to prevent warnings with some compilers.
- */
-#if CHAN_TYPE == GL_FLOAT
-#define CHAN_CAST
-#else
-#define CHAN_CAST (GLchan) (GLint)
-#endif
-
-
-static void
-sample_1d_nearest_mipmap_linear(GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoord[][4],
- const GLfloat lambda[], GLchan rgba[][4])
-{
- GLuint i;
- ASSERT(lambda != NULL);
- for (i = 0; i < n; i++) {
- GLint level;
- COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level);
- if (level >= tObj->_MaxLevel) {
- sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel],
- texcoord[i], rgba[i]);
- }
- else {
- GLchan t0[4], t1[4];
- const GLfloat f = FRAC(lambda[i]);
- sample_1d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
- sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
- rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
- }
- }
-}
-
-
-
-static void
-sample_1d_linear_mipmap_linear(GLcontext *ctx,
- const struct gl_texture_object *tObj,
- GLuint n, const GLfloat texcoord[][4],
- const GLfloat lambda[], GLchan rgba[][4])
-{
- GLuint i;
- ASSERT(lambda != NULL);
- for (i = 0; i < n; i++) {
- GLint level;
- COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level);
- if (level >= tObj->_MaxLevel) {
- sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel],
- texcoord[i], rgba[i]);
- }
- else {
- GLchan t0[4], t1[4];
- const GLfloat f = FRAC(lambda[i]);
- sample_1d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
- sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
- rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]);
- rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]);
- rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]);
- rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]);
- }
- }
-}
-
-
-
-static void
-sample_nearest_1d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat texcoords[][4], const GLfloat lambda[],
- GLchan rgba[][4] )
-{
- GLuint i;
- struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) lambda;
- for (i=0;i<n;i++) {
- sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
- }
-}
-
-
-
-static void
-sample_linear_1d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat texcoords[][4], const GLfloat lambda[],
- GLchan rgba[][4] )
-{
- GLuint i;
- struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
- (void) lambda;
- for (i=0;i<n;i++) {
- sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
- }
-}
-
-
-/*
- * Given an (s) texture coordinate and lambda (level of detail) value,
- * return a texture sample.
- *
- */
-static void
-sample_lambda_1d( GLcontext *ctx, GLuint texUnit,
- const struct gl_texture_object *tObj, GLuint n,
- const GLfloat texcoords[][4],
- const GLfloat lambda[], GLchan rgba[][4] )
-{
- GLuint minStart, minEnd; /* texels with minification */
- GLuint magStart, magEnd; /* texels with magnification */
- GLuint i;
-
- ASSERT(lambda != NULL);
- compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit],
- n, lambda, &minStart, &minEnd, &magStart, &magEnd);
-
- if (minStart < minEnd) {
- /* do the minified texels */
- const GLuint m = minEnd - minStart;
- switch (tObj->MinFilter) {
- case GL_NEAREST:
- for (i = minStart; i < minEnd; i++)
- sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
- texcoords[i], rgba[i]);
- break;
- case GL_LINEAR:
- for (i = minStart; i < minEnd; i++)
- sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
- texcoords[i], rgba[i]);
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- sample_1d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
- lambda + minStart, rgba + minStart);
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- sample_1d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
- lambda + minStart, rgba + minStart);
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- sample_1d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart,
- lambda + minStart, rgba + minStart);
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- sample_1d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart,
- lambda + minStart, rgba + minStart);
- break;
- default:
- _mesa_problem(ctx, "Bad min filter in sample_1d_texture");
- return;
- }
- }
-
- if (magStart < magEnd) {
- /* do the magnified texels */
- switch (tObj->MagFilter) {
- case GL_NEAREST:
- for (i = magStart; i < magEnd; i++)
- sample_1d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
- texcoords[i], rgba[i]);
- break;
- case GL_LINEAR:
- for (i = magStart; i < magEnd; i++)
- sample_1d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
- texcoords[i], rgba[i]);
- break;
- default:
- _mesa_problem(ctx, "Bad mag filter in sample_1d_texture");
- return;
- }
- }
-}
-
-
diff --git a/src/mesa/swrast_setup/NOTES b/src/mesa/swrast_setup/NOTES
deleted file mode 100644
index c6cb4ab3484..00000000000
--- a/src/mesa/swrast_setup/NOTES
+++ /dev/null
@@ -1,65 +0,0 @@
-INTRODUCTION
-
-A helper module which provides glue to bind the software rasterizer to
-the software t&l module. The main task of this module is to build
-swrast vertices from the t&l vertex_buffer structs, and to use them to
-perform triangle setup functions not implemented in the software
-rasterizer.
-
-The module implements a full set of functions to plug into the
-t_vb_render.c driver interface (tnl->Driver.Render.*).
-
-There are strong advantages to decoupling the software rasterizer from
-the t&l module, primarily allowing hardware drivers better control
-over fallbacks, the removal of implicit knowledge about the software
-rasterizer in the t&l module, allowing the two modules to evolve
-independently and allowing either to be substituted with equivalent
-functionality from another codebase.
-
-This module implements triangle/quad setup for offset, unfilled and
-twoside-lit triangles. The software rasterizer doesn't handle these
-primitives directly.
-
-Hardware rasterization drivers typically use this module in situations
-where no hardware rasterization is possible, ie during total
-fallbacks.
-
-STATE
-
-To create and destroy the module:
-
- GLboolean _swsetup_CreateContext( GLcontext *ctx );
- void _swsetup_DestroyContext( GLcontext *ctx );
-
-The module is not active by default, and must be installed by calling
-_swrast_Wakeup(). This function installs internal swrast_setup
-functions into all the tnl->Driver.Render driver hooks, thus taking
-over the task of rasterization entirely:
-
- void _swrast_Wakeup( GLcontext *ctx );
-
-
-This module tracks state changes internally and maintains derived
-values based on the current state. For this to work, the driver
-ensure the following funciton is called whenever the state changes and
-the swsetup module is 'awake':
-
- void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
-
-There is no explicit call to put the swsetup module to sleep. Simply
-install other function pointers into all the tnl->Driver.Render.*
-hooks, and (optionally) cease calling _swsetup_InvalidateState().
-
-DRIVER INTERFACE
-
-The module offers a minimal driver interface:
-
- void (*Start)( GLcontext *ctx );
- void (*Finish)( GLcontext *ctx );
-
-These are called before and after the completion of all swrast drawing
-activity. As swrast doesn't call callbacks during triangle, line or
-point rasterization, these are necessary to provide locking hooks for
-some drivers. They may otherwise be left null.
-
-
diff --git a/src/mesa/tnl/NOTES b/src/mesa/tnl/NOTES
deleted file mode 100644
index c39b43485eb..00000000000
--- a/src/mesa/tnl/NOTES
+++ /dev/null
@@ -1,102 +0,0 @@
-INTRODUCTION
-
-A generic, configurable software implementation of GL transformation &
-lighting.
-
-This module provides an implementation of the routines required by the
-'vtxfmt' mechanism of core mesa for tnl functionality in all
-combinations of compile and execute modes.
-
-Most current drivers use the tnl module exclusively to provide this
-functionality, though there is an experimental alternate
-implementation provided by the tnl_dd/t_dd_imm_* files which can
-handle a small subset of GL states in execute mode only.
-
-
-STATE
-
-To create and destroy the module:
-
- GLboolean _tnl_CreateContext( GLcontext *ctx );
- void _tnl_DestroyContext( GLcontext *ctx );
-
-The module is not active by default, and must be installed by calling
-_tnl_Wakeup(). This function installs internal tnl functions into all
-the vtxfmt dispatch hooks, thus taking over the task of transformation
-and lighting entirely:
-
- void _tnl_wakeup_exec( GLcontext *ctx );
- void _tnl_wakeup_save_exec( GLcontext *ctx );
-
-
-This module tracks state changes internally and maintains derived
-values based on the current state. For this to work, the driver
-ensure the following funciton is called whenever the state changes and
-the swsetup module is 'awake':
-
- void _tnl_InvalidateState( GLcontext *ctx, GLuint new_state );
-
-There is no explicit call to put the tnl module to sleep. Simply
-install other function pointers into all the vtxfmt dispatch slots,
-and (optionally) cease calling _tnl_InvalidateState().
-
-CUSTOMIZATION
-
-The module provides customizability through several mechanisms. The
-most important is by allowing drivers to specify the pipeline through
-which vertex data is passed, including its eventual transfer to
-rasterization hardware (or software).
-
-The default pipeline is specified in t_pipeline.c, and is usually a
-starting point for driver pipelines. Some drivers will remove a stage
-where hardware provides support for the implemented operation (for
-instance fog where per-pixel hardware fog is available, as in the dri
-tdfx driver), or add stages to shortcircuit latter operations (for
-example taking advantage of hardware support for strips and other
-higher-level primitives (for example the radeon driver).
-
-In addition, the following functions provide further tweaks:
-
-extern void
-_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag );
-
- - Direct the default vertex transformation stage to
- produce/not produce projected clip coordinates.
-
-extern void
-_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag );
-
- - Direct the display list component of the tnl module to
- replay display lists as 'glVertex' type calls, rather than
- passing the display list data directly into the tnl pipeline
- mechanism.
-
- This allows display lists to be replayed by the tnl module
- even when the module is not strictly active.
-
-
-extern void
-_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag );
-
- - Direct the display list component to enable/disable caching
- 1/length values for display list normals. Doing so is
- ususally helpful when lighting is performed in software, but
- wasteful otherwise.
-
-
-DRIVER INTERFACE
-
-The module itself offers a minimal driver interface:
-
- void (*RunPipeline)( GLcontext *ctx );
-
-Normally this is set to _tnl_RunPipeline(), however the driver can use
-this hook to wrap checks or other code around this call.
-
-In addition, the driver interface for the default render pipeline
-stage is housed in the tnl context struct (this could be cleaner).
-
-
-RENDER DRIVER INTERFACE
-
-See t_context.h for the definition and explanation of this. \ No newline at end of file
diff --git a/src/mesa/x86-64/calling_convention.txt b/src/mesa/x86-64/calling_convention.txt
deleted file mode 100644
index 4147f7eba91..00000000000
--- a/src/mesa/x86-64/calling_convention.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-Register Usage
-rax temporary register; with variable arguments passes information
- about the number of SSE registers used; 1st return register
-
-rbx* callee-saved register; optionally used as base pointer
-
-rcx used to pass 4th integer argument to functions
-
-rdx used to pass 3rd argument to functions 2nd return register
-
-rsp* stack pointer
-
-rbp* callee-saved register; optionally used as frame pointer
-
-rsi used to pass 2nd argument to functions
-
-rdi used to pass 1st argument to functions
-
-r8 used to pass 5th argument to functions
-
-r9 used to pass 6th argument to functions
-
-r10 temporary register, used for passing a function's static chain pointer
-
-r11 temporary register
-
-r12-15* callee-saved registers
-
-xmm0­1 used to pass and return floating point arguments
-
-xmm2­7 used to pass floating point arguments
-
-xmm8­15 temporary registers
-
-mmx0­7 temporary registers
-
-st0 temporary register; used to return long double arguments
-
-st1 temporary registers; used to return long double arguments
-
-st2­7 temporary registers
-
-fs Reserved for system use (as thread specific data register)
-
-
-
-*) must be preserved across function calls
-
-Integer arguments from list: rdi,rsi,rdx,rcx,r8,r9,stack
-Floating point arguments from list: xmm0-xmm7 \ No newline at end of file