summaryrefslogtreecommitdiffstats
path: root/main/mesa/mesa-7.8-git.patch
blob: 169b38b05bb73b95568efb39bdbb5c1f6bdf53b7 (plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
diff --git a/Makefile b/Makefile
index 84d0038..63fdf87 100644
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ ultrix-gcc:
 
 # Rules for making release tarballs
 
-VERSION=7.8.2
+VERSION=7.8.3
 DIRECTORY = Mesa-$(VERSION)
 LIB_NAME = MesaLib-$(VERSION)
 DEMO_NAME = MesaDemos-$(VERSION)
@@ -285,9 +285,6 @@ MAIN_FILES = \
 	$(DIRECTORY)/src/mesa/x86-64/*.[chS]				\
 	$(DIRECTORY)/src/mesa/x86-64/Makefile				\
 	$(DIRECTORY)/progs/Makefile					\
-	$(DIRECTORY)/progs/util/README					\
-	$(DIRECTORY)/progs/util/*.[ch]					\
-	$(DIRECTORY)/progs/util/sampleMakefile				\
 	$(DIRECTORY)/windows/VC8/
 
 ES_FILES = \
@@ -438,7 +435,10 @@ DEMO_FILES = \
 	$(DIRECTORY)/progs/glsl/*.c			\
 	$(DIRECTORY)/progs/glsl/*.frag			\
 	$(DIRECTORY)/progs/glsl/*.vert			\
-	$(DIRECTORY)/progs/glsl/*.shtest
+	$(DIRECTORY)/progs/glsl/*.shtest		\
+	$(DIRECTORY)/progs/util/README			\
+	$(DIRECTORY)/progs/util/*.[ch]			\
+	$(DIRECTORY)/progs/util/sampleMakefile
 
 GLUT_FILES = \
 	$(DIRECTORY)/include/GL/glut.h			\
diff --git a/configs/autoconf.in b/configs/autoconf.in
index fbd5faa..6218be9 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -26,6 +26,11 @@ INTEL_LIBS = @INTEL_LIBS@
 INTEL_CFLAGS = @INTEL_CFLAGS@
 X11_LIBS = @X11_LIBS@
 X11_CFLAGS = @X11_CFLAGS@
+GLW_CFLAGS = @GLW_CFLAGS@
+GLUT_CFLAGS = @GLUT_CFLAGS@
+
+# dlopen
+DLOPEN_LIBS = @DLOPEN_LIBS@
 
 # Assembler
 MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
diff --git a/configs/default b/configs/default
index f12bec8..d4b45a3 100644
--- a/configs/default
+++ b/configs/default
@@ -121,6 +121,8 @@ APP_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LI
 APP_LIB_DEPS = -lm
 X11_LIBS = -lX11
 
+DLOPEN_LIBS = -ldl
+
 # Installation directories (for make install)
 INSTALL_DIR = /usr/local
 INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR)
diff --git a/configure.ac b/configure.ac
index e711634..e15371f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -398,6 +398,7 @@ dnl Check to see if dlopen is in default libraries (like Solaris, which
 dnl has it in libc), or if libdl is needed to get it.
 AC_CHECK_FUNC([dlopen], [],
     [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
+AC_SUBST([DLOPEN_LIBS])
 
 dnl See if posix_memalign is available
 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
@@ -699,7 +700,7 @@ AC_SUBST([DRI_DRIVER_SEARCH_DIR])
 dnl Direct rendering or just indirect rendering
 AC_ARG_ENABLE([driglx-direct],
     [AS_HELP_STRING([--disable-driglx-direct],
-        [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
+        [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
     [driglx_direct="$enableval"],
     [driglx_direct="yes"])
 dnl Which drivers to build - default is chosen by platform
@@ -1102,10 +1103,6 @@ fi
 
 if test "x$enable_glut" = xyes; then
     SRC_DIRS="$SRC_DIRS glut/glx"
-    GLUT_CFLAGS=""
-    if test "x$GCC" = xyes; then
-        GLUT_CFLAGS="-fexceptions"
-    fi
     if test "$x11_pkgconfig" = yes; then
         PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
         GLUT_PC_REQ_PRIV="x11 xmu xi"
@@ -1116,6 +1113,9 @@ if test "x$enable_glut" = xyes; then
         GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
         GLUT_PC_CFLAGS="$X11_INCLUDES"
     fi
+    if test "x$GCC" = xyes; then
+        GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
+    fi
     GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
     GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
 
@@ -1217,6 +1217,10 @@ yes)
             if test "x$enable_egl" != xyes; then
                 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
             fi
+            # define GLX_DIRECT_RENDERING even when the driver is not dri
+            if test "x$mesa_driver" != xdri -a "x$driglx_direct" = xyes; then
+                DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
+            fi
             ;;
         xorg)
             PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
diff --git a/docs/news.html b/docs/news.html
index 92e2a18..01e2834 100644
--- a/docs/news.html
+++ b/docs/news.html
@@ -11,6 +11,14 @@
 <H1>News</H1>
 
 
+<h2>TBD, 2010</h2>
+
+<p>
+<a href="relnotes-7.8.3.html">Mesa 7.8.3</a> is released.  This is a bug-fix
+release collecting fixes since the 7.8.2 release.
+</p>
+
+
 <h2>June 16, 2010</h2>
 
 <p>
diff --git a/docs/relnotes-7.8.2.html b/docs/relnotes-7.8.2.html
index 4d7758d..1393b2e 100644
--- a/docs/relnotes-7.8.2.html
+++ b/docs/relnotes-7.8.2.html
@@ -142,7 +142,5 @@ a471807b65e49c325808ba4551be93ed  MesaGLUT-7.8.2.tar.bz2
 </ul>
 
 
-<h2>Changes</h2>
-<p>None.</p>
 </body>
 </html>
diff --git a/docs/relnotes-7.8.3.html b/docs/relnotes-7.8.3.html
new file mode 100644
index 0000000..1e9f433
--- /dev/null
+++ b/docs/relnotes-7.8.3.html
@@ -0,0 +1,89 @@
+<HTML>
+
+<TITLE>Mesa Release Notes</TITLE>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.8.3 Release Notes / (date tbd)</H1>
+
+<p>
+Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release.
+</p>
+<p>
+Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+x  MesaLib-7.8.3.tar.gz
+x  MesaLib-7.8.3.tar.bz2
+x  MesaLib-7.8.3.zip
+x  MesaDemos-7.8.3.tar.gz
+x  MesaDemos-7.8.3.tar.bz2
+x  MesaDemos-7.8.3.zip
+x  MesaGLUT-7.8.3.tar.gz
+x  MesaGLUT-7.8.3.tar.bz2
+x  MesaGLUT-7.8.3.zip
+</pre>
+
+
+<h2>New features</h2>
+<p>None.</p>
+
+
+<h2>Changes</h2>
+<ul>
+<li>The radeon driver should use less memory when searching for a valid mip
+image.</li>
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+<li>Fix unsupported FB with D24S8 (bug 
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">29116</a>)</li>
+<li>Fix ReadPixels crash when reading depth/stencil from an FBO</li>
+<li>Fixed a bug rendering to 16-bit buffers using swrast.</li>
+<li>Fixed a state tracker/TGSI bug that caused crashes when using Windows'
+    memory debugging features.</li>
+<li>Fixed an issue rendering to 32-bit channels with swrast (bug
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29487">29487</a>)</li>
+<li>GLSL: fix indirect <TT>gl_TextureMatrix</TT> addressing (bug
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">28967</a>)</li>
+<li>GLSL: fix for bug
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">27216</a></li>
+<li>GLSL: fix zw fragcoord entries in some cases (bug
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29183">29183</a>)</li>
+<li>Fix texture env generation in some cases (bug
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28169">28169</a>)</li>
+<li>osmesa: a fix for calling <TT>OSMesaMakeCurrent</TT> twice was applied (bug 
+    <a href="https://bugs.freedesktop.org/show_bug.cgi?id=10966">10966</a></li>
+<li>A bug was fixed which could cause Mesa to ignore the
+    <TT>MESA_EXTENSION_OVERRIDE</TT> environment variable.</li>
+<li>A bug related to specular highlights on backfaces was fixed.</li>
+<li>A radeon-specific issue with <TT>glCopyTex(Sub)Image</TT> was
+    corrected.</li>
+<li>radeon/wine: flush command stream in more cases, fixing wine d3d9
+    tests.</li>
+<li>r600: fix sin+cos normalization.</li>
+<li>r600: (properly) ignore <TT>GL_COORD_REPLACE</TT> when point sprites are
+    disabled.</li>
+<li>radeon: avoid flushing when the context is not current.</li>
+<li>r300c: a bug affecting unaligned BOs was fixed.</li>
+<li>r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.</li>
+</ul>
+
+
+</body>
+</html>
diff --git a/docs/relnotes.html b/docs/relnotes.html
index 39b02b8..46f6469 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
 </p>
 
 <UL>
+<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
 <LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
 <LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
 <LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
diff --git a/include/GL/gl_mangle.h b/include/GL/gl_mangle.h
index 43d2e89..15589d8 100644
--- a/include/GL/gl_mangle.h
+++ b/include/GL/gl_mangle.h
@@ -56,6 +56,7 @@
 #define glBeginOcclusionQueryNV		MANGLE(BeginOcclusionQueryNV)
 #define glBeginPerfMonitorAMD		MANGLE(BeginPerfMonitorAMD)
 #define glBeginQueryARB		MANGLE(BeginQueryARB)
+#define glBeginQueryIndexed		MANGLE(BeginQueryIndexed)
 #define glBeginQuery		MANGLE(BeginQuery)
 #define glBeginTransformFeedbackEXT		MANGLE(BeginTransformFeedbackEXT)
 #define glBeginTransformFeedback		MANGLE(BeginTransformFeedback)
@@ -75,6 +76,7 @@
 #define glBindBufferRange		MANGLE(BindBufferRange)
 #define glBindBufferRangeNV		MANGLE(BindBufferRangeNV)
 #define glBindFragDataLocationEXT		MANGLE(BindFragDataLocationEXT)
+#define glBindFragDataLocationIndexed		MANGLE(BindFragDataLocationIndexed)
 #define glBindFragDataLocation		MANGLE(BindFragDataLocation)
 #define glBindFragmentShaderATI		MANGLE(BindFragmentShaderATI)
 #define glBindFramebufferEXT		MANGLE(BindFramebufferEXT)
@@ -87,10 +89,12 @@
 #define glBindProgramNV		MANGLE(BindProgramNV)
 #define glBindRenderbufferEXT		MANGLE(BindRenderbufferEXT)
 #define glBindRenderbuffer		MANGLE(BindRenderbuffer)
+#define glBindSampler		MANGLE(BindSampler)
 #define glBindTexGenParameterEXT		MANGLE(BindTexGenParameterEXT)
 #define glBindTextureEXT		MANGLE(BindTextureEXT)
 #define glBindTexture		MANGLE(BindTexture)
 #define glBindTextureUnitParameterEXT		MANGLE(BindTextureUnitParameterEXT)
+#define glBindTransformFeedback		MANGLE(BindTransformFeedback)
 #define glBindTransformFeedbackNV		MANGLE(BindTransformFeedbackNV)
 #define glBindVertexArrayAPPLE		MANGLE(BindVertexArrayAPPLE)
 #define glBindVertexArray		MANGLE(BindVertexArray)
@@ -215,6 +219,10 @@
 #define glColorMaskIndexedEXT		MANGLE(ColorMaskIndexedEXT)
 #define glColorMask		MANGLE(ColorMask)
 #define glColorMaterial		MANGLE(ColorMaterial)
+#define glColorP3ui		MANGLE(ColorP3ui)
+#define glColorP3uiv		MANGLE(ColorP3uiv)
+#define glColorP4ui		MANGLE(ColorP4ui)
+#define glColorP4uiv		MANGLE(ColorP4uiv)
 #define glColorPointerEXT		MANGLE(ColorPointerEXT)
 #define glColorPointerListIBM		MANGLE(ColorPointerListIBM)
 #define glColorPointer		MANGLE(ColorPointer)
@@ -236,6 +244,7 @@
 #define glCombinerParameterivNV		MANGLE(CombinerParameterivNV)
 #define glCombinerStageParameterfvNV		MANGLE(CombinerStageParameterfvNV)
 #define glCompileShaderARB		MANGLE(CompileShaderARB)
+#define glCompileShaderIncludeARB		MANGLE(CompileShaderIncludeARB)
 #define glCompileShader		MANGLE(CompileShader)
 #define glCompressedMultiTexImage1DEXT		MANGLE(CompressedMultiTexImage1DEXT)
 #define glCompressedMultiTexImage2DEXT		MANGLE(CompressedMultiTexImage2DEXT)
@@ -326,6 +335,7 @@
 #define glDeleteFramebuffersEXT		MANGLE(DeleteFramebuffersEXT)
 #define glDeleteFramebuffers		MANGLE(DeleteFramebuffers)
 #define glDeleteLists		MANGLE(DeleteLists)
+#define glDeleteNamedStringARB		MANGLE(DeleteNamedStringARB)
 #define glDeleteObjectARB		MANGLE(DeleteObjectARB)
 #define glDeleteOcclusionQueriesNV		MANGLE(DeleteOcclusionQueriesNV)
 #define glDeletePerfMonitorsAMD		MANGLE(DeletePerfMonitorsAMD)
@@ -336,10 +346,12 @@
 #define glDeleteQueries		MANGLE(DeleteQueries)
 #define glDeleteRenderbuffersEXT		MANGLE(DeleteRenderbuffersEXT)
 #define glDeleteRenderbuffers		MANGLE(DeleteRenderbuffers)
+#define glDeleteSamplers		MANGLE(DeleteSamplers)
 #define glDeleteShader		MANGLE(DeleteShader)
 #define glDeleteSync		MANGLE(DeleteSync)
 #define glDeleteTexturesEXT		MANGLE(DeleteTexturesEXT)
 #define glDeleteTextures		MANGLE(DeleteTextures)
+#define glDeleteTransformFeedbacks		MANGLE(DeleteTransformFeedbacks)
 #define glDeleteTransformFeedbacksNV		MANGLE(DeleteTransformFeedbacksNV)
 #define glDeleteVertexArraysAPPLE		MANGLE(DeleteVertexArraysAPPLE)
 #define glDeleteVertexArrays		MANGLE(DeleteVertexArrays)
@@ -363,6 +375,7 @@
 #define glDisableVertexAttribArrayARB		MANGLE(DisableVertexAttribArrayARB)
 #define glDisableVertexAttribArray		MANGLE(DisableVertexAttribArray)
 #define glDrawArraysEXT		MANGLE(DrawArraysEXT)
+#define glDrawArraysIndirect		MANGLE(DrawArraysIndirect)
 #define glDrawArraysInstancedARB		MANGLE(DrawArraysInstancedARB)
 #define glDrawArraysInstancedEXT		MANGLE(DrawArraysInstancedEXT)
 #define glDrawArraysInstanced		MANGLE(DrawArraysInstanced)
@@ -374,6 +387,7 @@
 #define glDrawElementArrayAPPLE		MANGLE(DrawElementArrayAPPLE)
 #define glDrawElementArrayATI		MANGLE(DrawElementArrayATI)
 #define glDrawElementsBaseVertex		MANGLE(DrawElementsBaseVertex)
+#define glDrawElementsIndirect		MANGLE(DrawElementsIndirect)
 #define glDrawElementsInstancedARB		MANGLE(DrawElementsInstancedARB)
 #define glDrawElementsInstancedBaseVertex		MANGLE(DrawElementsInstancedBaseVertex)
 #define glDrawElementsInstancedEXT		MANGLE(DrawElementsInstancedEXT)
@@ -386,7 +400,9 @@
 #define glDrawRangeElementsBaseVertex		MANGLE(DrawRangeElementsBaseVertex)
 #define glDrawRangeElementsEXT		MANGLE(DrawRangeElementsEXT)
 #define glDrawRangeElements		MANGLE(DrawRangeElements)
+#define glDrawTransformFeedback		MANGLE(DrawTransformFeedback)
 #define glDrawTransformFeedbackNV		MANGLE(DrawTransformFeedbackNV)
+#define glDrawTransformFeedbackStream		MANGLE(DrawTransformFeedbackStream)
 #define glEdgeFlagFormatNV		MANGLE(EdgeFlagFormatNV)
 #define glEdgeFlag		MANGLE(EdgeFlag)
 #define glEdgeFlagPointerEXT		MANGLE(EdgeFlagPointerEXT)
@@ -414,6 +430,7 @@
 #define glEndOcclusionQueryNV		MANGLE(EndOcclusionQueryNV)
 #define glEndPerfMonitorAMD		MANGLE(EndPerfMonitorAMD)
 #define glEndQueryARB		MANGLE(EndQueryARB)
+#define glEndQueryIndexed		MANGLE(EndQueryIndexed)
 #define glEndQuery		MANGLE(EndQuery)
 #define glEndTransformFeedbackEXT		MANGLE(EndTransformFeedbackEXT)
 #define glEndTransformFeedback		MANGLE(EndTransformFeedback)
@@ -498,7 +515,6 @@
 #define glFramebufferTextureEXT		MANGLE(FramebufferTextureEXT)
 #define glFramebufferTextureFaceARB		MANGLE(FramebufferTextureFaceARB)
 #define glFramebufferTextureFaceEXT		MANGLE(FramebufferTextureFaceEXT)
-#define glFramebufferTextureFace		MANGLE(FramebufferTextureFace)
 #define glFramebufferTextureLayerARB		MANGLE(FramebufferTextureLayerARB)
 #define glFramebufferTextureLayerEXT		MANGLE(FramebufferTextureLayerEXT)
 #define glFramebufferTextureLayer		MANGLE(FramebufferTextureLayer)
@@ -529,15 +545,20 @@
 #define glGenQueries		MANGLE(GenQueries)
 #define glGenRenderbuffersEXT		MANGLE(GenRenderbuffersEXT)
 #define glGenRenderbuffers		MANGLE(GenRenderbuffers)
+#define glGenSamplers		MANGLE(GenSamplers)
 #define glGenSymbolsEXT		MANGLE(GenSymbolsEXT)
 #define glGenTexturesEXT		MANGLE(GenTexturesEXT)
 #define glGenTextures		MANGLE(GenTextures)
+#define glGenTransformFeedbacks		MANGLE(GenTransformFeedbacks)
 #define glGenTransformFeedbacksNV		MANGLE(GenTransformFeedbacksNV)
 #define glGenVertexArraysAPPLE		MANGLE(GenVertexArraysAPPLE)
 #define glGenVertexArrays		MANGLE(GenVertexArrays)
 #define glGenVertexShadersEXT		MANGLE(GenVertexShadersEXT)
 #define glGetActiveAttribARB		MANGLE(GetActiveAttribARB)
 #define glGetActiveAttrib		MANGLE(GetActiveAttrib)
+#define glGetActiveSubroutineName		MANGLE(GetActiveSubroutineName)
+#define glGetActiveSubroutineUniformiv		MANGLE(GetActiveSubroutineUniformiv)
+#define glGetActiveSubroutineUniformName		MANGLE(GetActiveSubroutineUniformName)
 #define glGetActiveUniformARB		MANGLE(GetActiveUniformARB)
 #define glGetActiveUniformBlockiv		MANGLE(GetActiveUniformBlockiv)
 #define glGetActiveUniformBlockName		MANGLE(GetActiveUniformBlockName)
@@ -599,6 +620,7 @@
 #define glGetFloatIndexedvEXT		MANGLE(GetFloatIndexedvEXT)
 #define glGetFloatv		MANGLE(GetFloatv)
 #define glGetFogFuncSGIS		MANGLE(GetFogFuncSGIS)
+#define glGetFragDataIndex		MANGLE(GetFragDataIndex)
 #define glGetFragDataLocationEXT		MANGLE(GetFragDataLocationEXT)
 #define glGetFragDataLocation		MANGLE(GetFragDataLocation)
 #define glGetFragmentLightfvSGIX		MANGLE(GetFragmentLightfvSGIX)
@@ -678,6 +700,8 @@
 #define glGetNamedProgramLocalParameterIuivEXT		MANGLE(GetNamedProgramLocalParameterIuivEXT)
 #define glGetNamedProgramStringEXT		MANGLE(GetNamedProgramStringEXT)
 #define glGetNamedRenderbufferParameterivEXT		MANGLE(GetNamedRenderbufferParameterivEXT)
+#define glGetNamedStringARB		MANGLE(GetNamedStringARB)
+#define glGetNamedStringivARB		MANGLE(GetNamedStringivARB)
 #define glGetObjectBufferfvATI		MANGLE(GetObjectBufferfvATI)
 #define glGetObjectBufferivATI		MANGLE(GetObjectBufferivATI)
 #define glGetObjectParameterfvARB		MANGLE(GetObjectParameterfvARB)
@@ -717,18 +741,26 @@
 #define glGetProgramParameterdvNV		MANGLE(GetProgramParameterdvNV)
 #define glGetProgramParameterfvNV		MANGLE(GetProgramParameterfvNV)
 #define glGetProgramRegisterfvMESA		MANGLE(GetProgramRegisterfvMESA)
+#define glGetProgramStageiv		MANGLE(GetProgramStageiv)
 #define glGetProgramStringARB		MANGLE(GetProgramStringARB)
 #define glGetProgramStringNV		MANGLE(GetProgramStringNV)
+#define glGetQueryIndexediv		MANGLE(GetQueryIndexediv)
 #define glGetQueryivARB		MANGLE(GetQueryivARB)
 #define glGetQueryiv		MANGLE(GetQueryiv)
 #define glGetQueryObjecti64vEXT		MANGLE(GetQueryObjecti64vEXT)
+#define glGetQueryObjecti64v		MANGLE(GetQueryObjecti64v)
 #define glGetQueryObjectivARB		MANGLE(GetQueryObjectivARB)
 #define glGetQueryObjectiv		MANGLE(GetQueryObjectiv)
 #define glGetQueryObjectui64vEXT		MANGLE(GetQueryObjectui64vEXT)
+#define glGetQueryObjectui64v		MANGLE(GetQueryObjectui64v)
 #define glGetQueryObjectuivARB		MANGLE(GetQueryObjectuivARB)
 #define glGetQueryObjectuiv		MANGLE(GetQueryObjectuiv)
 #define glGetRenderbufferParameterivEXT		MANGLE(GetRenderbufferParameterivEXT)
 #define glGetRenderbufferParameteriv		MANGLE(GetRenderbufferParameteriv)
+#define glGetSamplerParameterfv		MANGLE(GetSamplerParameterfv)
+#define glGetSamplerParameterIfv		MANGLE(GetSamplerParameterIfv)
+#define glGetSamplerParameterIiv		MANGLE(GetSamplerParameterIiv)
+#define glGetSamplerParameteriv		MANGLE(GetSamplerParameteriv)
 #define glGetSeparableFilterEXT		MANGLE(GetSeparableFilterEXT)
 #define glGetSeparableFilter		MANGLE(GetSeparableFilter)
 #define glGetShaderInfoLog		MANGLE(GetShaderInfoLog)
@@ -738,6 +770,8 @@
 #define glGetSharpenTexFuncSGIS		MANGLE(GetSharpenTexFuncSGIS)
 #define glGetStringi		MANGLE(GetStringi)
 #define glGetString		MANGLE(GetString)
+#define glGetSubroutineIndex		MANGLE(GetSubroutineIndex)
+#define glGetSubroutineUniformLocation		MANGLE(GetSubroutineUniformLocation)
 #define glGetSynciv		MANGLE(GetSynciv)
 #define glGetTexBumpParameterfvATI		MANGLE(GetTexBumpParameterfvATI)
 #define glGetTexBumpParameterivATI		MANGLE(GetTexBumpParameterivATI)
@@ -770,6 +804,7 @@
 #define glGetTransformFeedbackVaryingNV		MANGLE(GetTransformFeedbackVaryingNV)
 #define glGetUniformBlockIndex		MANGLE(GetUniformBlockIndex)
 #define glGetUniformBufferSizeEXT		MANGLE(GetUniformBufferSizeEXT)
+#define glGetUniformdv		MANGLE(GetUniformdv)
 #define glGetUniformfvARB		MANGLE(GetUniformfvARB)
 #define glGetUniformfv		MANGLE(GetUniformfv)
 #define glGetUniformIndices		MANGLE(GetUniformIndices)
@@ -778,6 +813,7 @@
 #define glGetUniformLocationARB		MANGLE(GetUniformLocationARB)
 #define glGetUniformLocation		MANGLE(GetUniformLocation)
 #define glGetUniformOffsetEXT		MANGLE(GetUniformOffsetEXT)
+#define glGetUniformSubroutineuiv		MANGLE(GetUniformSubroutineuiv)
 #define glGetUniformui64vNV		MANGLE(GetUniformui64vNV)
 #define glGetUniformuivEXT		MANGLE(GetUniformuivEXT)
 #define glGetUniformuiv		MANGLE(GetUniformuiv)
@@ -865,6 +901,7 @@
 #define glIsFramebuffer		MANGLE(IsFramebuffer)
 #define glIsList		MANGLE(IsList)
 #define glIsNamedBufferResidentNV		MANGLE(IsNamedBufferResidentNV)
+#define glIsNamedStringARB		MANGLE(IsNamedStringARB)
 #define glIsObjectBufferATI		MANGLE(IsObjectBufferATI)
 #define glIsOcclusionQueryNV		MANGLE(IsOcclusionQueryNV)
 #define glIsProgramARB		MANGLE(IsProgramARB)
@@ -874,10 +911,12 @@
 #define glIsQuery		MANGLE(IsQuery)
 #define glIsRenderbufferEXT		MANGLE(IsRenderbufferEXT)
 #define glIsRenderbuffer		MANGLE(IsRenderbuffer)
+#define glIsSampler		MANGLE(IsSampler)
 #define glIsShader		MANGLE(IsShader)
 #define glIsSync		MANGLE(IsSync)
 #define glIsTextureEXT		MANGLE(IsTextureEXT)
 #define glIsTexture		MANGLE(IsTexture)
+#define glIsTransformFeedback		MANGLE(IsTransformFeedback)
 #define glIsTransformFeedbackNV		MANGLE(IsTransformFeedbackNV)
 #define glIsVariantEnabledEXT		MANGLE(IsVariantEnabledEXT)
 #define glIsVertexArrayAPPLE		MANGLE(IsVertexArrayAPPLE)
@@ -915,6 +954,8 @@
 #define glLogicOp		MANGLE(LogicOp)
 #define glMakeBufferNonResidentNV		MANGLE(MakeBufferNonResidentNV)
 #define glMakeBufferResidentNV		MANGLE(MakeBufferResidentNV)
+#define glMakeNamedBufferNonResidentNV		MANGLE(MakeNamedBufferNonResidentNV)
+#define glMakeNamedBufferResidentNV		MANGLE(MakeNamedBufferResidentNV)
 #define glMap1d		MANGLE(Map1d)
 #define glMap1f		MANGLE(Map1f)
 #define glMap2d		MANGLE(Map2d)
@@ -1048,6 +1089,14 @@
 #define glMultiTexCoord4s		MANGLE(MultiTexCoord4s)
 #define glMultiTexCoord4svARB		MANGLE(MultiTexCoord4svARB)
 #define glMultiTexCoord4sv		MANGLE(MultiTexCoord4sv)
+#define glMultiTexCoordP1ui		MANGLE(MultiTexCoordP1ui)
+#define glMultiTexCoordP1uiv		MANGLE(MultiTexCoordP1uiv)
+#define glMultiTexCoordP2ui		MANGLE(MultiTexCoordP2ui)
+#define glMultiTexCoordP2uiv		MANGLE(MultiTexCoordP2uiv)
+#define glMultiTexCoordP3ui		MANGLE(MultiTexCoordP3ui)
+#define glMultiTexCoordP3uiv		MANGLE(MultiTexCoordP3uiv)
+#define glMultiTexCoordP4ui		MANGLE(MultiTexCoordP4ui)
+#define glMultiTexCoordP4uiv		MANGLE(MultiTexCoordP4uiv)
 #define glMultiTexCoordPointerEXT		MANGLE(MultiTexCoordPointerEXT)
 #define glMultiTexEnvfEXT		MANGLE(MultiTexEnvfEXT)
 #define glMultiTexEnvfvEXT		MANGLE(MultiTexEnvfvEXT)
@@ -1087,8 +1136,6 @@
 #define glNamedFramebufferTextureEXT		MANGLE(NamedFramebufferTextureEXT)
 #define glNamedFramebufferTextureFaceEXT		MANGLE(NamedFramebufferTextureFaceEXT)
 #define glNamedFramebufferTextureLayerEXT		MANGLE(NamedFramebufferTextureLayerEXT)
-#define glNamedMakeBufferNonResidentNV		MANGLE(NamedMakeBufferNonResidentNV)
-#define glNamedMakeBufferResidentNV		MANGLE(NamedMakeBufferResidentNV)
 #define glNamedProgramLocalParameter4dEXT		MANGLE(NamedProgramLocalParameter4dEXT)
 #define glNamedProgramLocalParameter4dvEXT		MANGLE(NamedProgramLocalParameter4dvEXT)
 #define glNamedProgramLocalParameter4fEXT		MANGLE(NamedProgramLocalParameter4fEXT)
@@ -1104,6 +1151,7 @@
 #define glNamedRenderbufferStorageEXT		MANGLE(NamedRenderbufferStorageEXT)
 #define glNamedRenderbufferStorageMultisampleCoverageEXT		MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT)
 #define glNamedRenderbufferStorageMultisampleEXT		MANGLE(NamedRenderbufferStorageMultisampleEXT)
+#define glNamedStringARB		MANGLE(NamedStringARB)
 #define glNewList		MANGLE(NewList)
 #define glNewObjectBufferATI		MANGLE(NewObjectBufferATI)
 #define glNormal3b		MANGLE(Normal3b)
@@ -1121,6 +1169,8 @@
 #define glNormal3s		MANGLE(Normal3s)
 #define glNormal3sv		MANGLE(Normal3sv)
 #define glNormalFormatNV		MANGLE(NormalFormatNV)
+#define glNormalP3ui		MANGLE(NormalP3ui)
+#define glNormalP3uiv		MANGLE(NormalP3uiv)
 #define glNormalPointerEXT		MANGLE(NormalPointerEXT)
 #define glNormalPointerListIBM		MANGLE(NormalPointerListIBM)
 #define glNormalPointer		MANGLE(NormalPointer)
@@ -1140,6 +1190,9 @@
 #define glOrtho		MANGLE(Ortho)
 #define glPassTexCoordATI		MANGLE(PassTexCoordATI)
 #define glPassThrough		MANGLE(PassThrough)
+#define glPatchParameterfv		MANGLE(PatchParameterfv)
+#define glPatchParameteri		MANGLE(PatchParameteri)
+#define glPauseTransformFeedback		MANGLE(PauseTransformFeedback)
 #define glPauseTransformFeedbackNV		MANGLE(PauseTransformFeedbackNV)
 #define glPixelDataRangeNV		MANGLE(PixelDataRangeNV)
 #define glPixelMapfv		MANGLE(PixelMapfv)
@@ -1231,38 +1284,55 @@
 #define glProgramParameters4dvNV		MANGLE(ProgramParameters4dvNV)
 #define glProgramParameters4fvNV		MANGLE(ProgramParameters4fvNV)
 #define glProgramStringARB		MANGLE(ProgramStringARB)
+#define glProgramUniform1dEXT		MANGLE(ProgramUniform1dEXT)
+#define glProgramUniform1dvEXT		MANGLE(ProgramUniform1dvEXT)
 #define glProgramUniform1fEXT		MANGLE(ProgramUniform1fEXT)
 #define glProgramUniform1fvEXT		MANGLE(ProgramUniform1fvEXT)
 #define glProgramUniform1iEXT		MANGLE(ProgramUniform1iEXT)
 #define glProgramUniform1ivEXT		MANGLE(ProgramUniform1ivEXT)
 #define glProgramUniform1uiEXT		MANGLE(ProgramUniform1uiEXT)
 #define glProgramUniform1uivEXT		MANGLE(ProgramUniform1uivEXT)
+#define glProgramUniform2dEXT		MANGLE(ProgramUniform2dEXT)
+#define glProgramUniform2dvEXT		MANGLE(ProgramUniform2dvEXT)
 #define glProgramUniform2fEXT		MANGLE(ProgramUniform2fEXT)
 #define glProgramUniform2fvEXT		MANGLE(ProgramUniform2fvEXT)
 #define glProgramUniform2iEXT		MANGLE(ProgramUniform2iEXT)
 #define glProgramUniform2ivEXT		MANGLE(ProgramUniform2ivEXT)
 #define glProgramUniform2uiEXT		MANGLE(ProgramUniform2uiEXT)
 #define glProgramUniform2uivEXT		MANGLE(ProgramUniform2uivEXT)
+#define glProgramUniform3dEXT		MANGLE(ProgramUniform3dEXT)
+#define glProgramUniform3dvEXT		MANGLE(ProgramUniform3dvEXT)
 #define glProgramUniform3fEXT		MANGLE(ProgramUniform3fEXT)
 #define glProgramUniform3fvEXT		MANGLE(ProgramUniform3fvEXT)
 #define glProgramUniform3iEXT		MANGLE(ProgramUniform3iEXT)
 #define glProgramUniform3ivEXT		MANGLE(ProgramUniform3ivEXT)
 #define glProgramUniform3uiEXT		MANGLE(ProgramUniform3uiEXT)
 #define glProgramUniform3uivEXT		MANGLE(ProgramUniform3uivEXT)
+#define glProgramUniform4dEXT		MANGLE(ProgramUniform4dEXT)
+#define glProgramUniform4dvEXT		MANGLE(ProgramUniform4dvEXT)
 #define glProgramUniform4fEXT		MANGLE(ProgramUniform4fEXT)
 #define glProgramUniform4fvEXT		MANGLE(ProgramUniform4fvEXT)
 #define glProgramUniform4iEXT		MANGLE(ProgramUniform4iEXT)
 #define glProgramUniform4ivEXT		MANGLE(ProgramUniform4ivEXT)
 #define glProgramUniform4uiEXT		MANGLE(ProgramUniform4uiEXT)
 #define glProgramUniform4uivEXT		MANGLE(ProgramUniform4uivEXT)
+#define glProgramUniformMatrix2dvEXT		MANGLE(ProgramUniformMatrix2dvEXT)
 #define glProgramUniformMatrix2fvEXT		MANGLE(ProgramUniformMatrix2fvEXT)
+#define glProgramUniformMatrix2x3dvEXT		MANGLE(ProgramUniformMatrix2x3dvEXT)
 #define glProgramUniformMatrix2x3fvEXT		MANGLE(ProgramUniformMatrix2x3fvEXT)
+#define glProgramUniformMatrix2x4dvEXT		MANGLE(ProgramUniformMatrix2x4dvEXT)
 #define glProgramUniformMatrix2x4fvEXT		MANGLE(ProgramUniformMatrix2x4fvEXT)
+#define glProgramUniformMatrix3dvEXT		MANGLE(ProgramUniformMatrix3dvEXT)
 #define glProgramUniformMatrix3fvEXT		MANGLE(ProgramUniformMatrix3fvEXT)
+#define glProgramUniformMatrix3x2dvEXT		MANGLE(ProgramUniformMatrix3x2dvEXT)
 #define glProgramUniformMatrix3x2fvEXT		MANGLE(ProgramUniformMatrix3x2fvEXT)
+#define glProgramUniformMatrix3x4dvEXT		MANGLE(ProgramUniformMatrix3x4dvEXT)
 #define glProgramUniformMatrix3x4fvEXT		MANGLE(ProgramUniformMatrix3x4fvEXT)
+#define glProgramUniformMatrix4dvEXT		MANGLE(ProgramUniformMatrix4dvEXT)
 #define glProgramUniformMatrix4fvEXT		MANGLE(ProgramUniformMatrix4fvEXT)
+#define glProgramUniformMatrix4x2dvEXT		MANGLE(ProgramUniformMatrix4x2dvEXT)
 #define glProgramUniformMatrix4x2fvEXT		MANGLE(ProgramUniformMatrix4x2fvEXT)
+#define glProgramUniformMatrix4x3dvEXT		MANGLE(ProgramUniformMatrix4x3dvEXT)
 #define glProgramUniformMatrix4x3fvEXT		MANGLE(ProgramUniformMatrix4x3fvEXT)
 #define glProgramUniformui64NV		MANGLE(ProgramUniformui64NV)
 #define glProgramUniformui64vNV		MANGLE(ProgramUniformui64vNV)
@@ -1274,6 +1344,7 @@
 #define glPushClientAttrib		MANGLE(PushClientAttrib)
 #define glPushMatrix		MANGLE(PushMatrix)
 #define glPushName		MANGLE(PushName)
+#define glQueryCounter		MANGLE(QueryCounter)
 #define glRasterPos2d		MANGLE(RasterPos2d)
 #define glRasterPos2dv		MANGLE(RasterPos2dv)
 #define glRasterPos2f		MANGLE(RasterPos2f)
@@ -1345,6 +1416,7 @@
 #define glResetMinmaxEXT		MANGLE(ResetMinmaxEXT)
 #define glResetMinmax		MANGLE(ResetMinmax)
 #define glResizeBuffersMESA		MANGLE(ResizeBuffersMESA)
+#define glResumeTransformFeedback		MANGLE(ResumeTransformFeedback)
 #define glResumeTransformFeedbackNV		MANGLE(ResumeTransformFeedbackNV)
 #define glRotated		MANGLE(Rotated)
 #define glRotatef		MANGLE(Rotatef)
@@ -1357,6 +1429,12 @@
 #define glSampleMaskSGIS		MANGLE(SampleMaskSGIS)
 #define glSamplePatternEXT		MANGLE(SamplePatternEXT)
 #define glSamplePatternSGIS		MANGLE(SamplePatternSGIS)
+#define glSamplerParameterf		MANGLE(SamplerParameterf)
+#define glSamplerParameterfv		MANGLE(SamplerParameterfv)
+#define glSamplerParameterIiv		MANGLE(SamplerParameterIiv)
+#define glSamplerParameteri		MANGLE(SamplerParameteri)
+#define glSamplerParameterIuiv		MANGLE(SamplerParameterIuiv)
+#define glSamplerParameteriv		MANGLE(SamplerParameteriv)
 #define glScaled		MANGLE(Scaled)
 #define glScalef		MANGLE(Scalef)
 #define glScissor		MANGLE(Scissor)
@@ -1395,6 +1473,8 @@
 #define glSecondaryColor3usvEXT		MANGLE(SecondaryColor3usvEXT)
 #define glSecondaryColor3usv		MANGLE(SecondaryColor3usv)
 #define glSecondaryColorFormatNV		MANGLE(SecondaryColorFormatNV)
+#define glSecondaryColorP3ui		MANGLE(SecondaryColorP3ui)
+#define glSecondaryColorP3uiv		MANGLE(SecondaryColorP3uiv)
 #define glSecondaryColorPointerEXT		MANGLE(SecondaryColorPointerEXT)
 #define glSecondaryColorPointerListIBM		MANGLE(SecondaryColorPointerListIBM)
 #define glSecondaryColorPointer		MANGLE(SecondaryColorPointer)
@@ -1509,6 +1589,14 @@
 #define glTexCoord4s		MANGLE(TexCoord4s)
 #define glTexCoord4sv		MANGLE(TexCoord4sv)
 #define glTexCoordFormatNV		MANGLE(TexCoordFormatNV)
+#define glTexCoordP1ui		MANGLE(TexCoordP1ui)
+#define glTexCoordP1uiv		MANGLE(TexCoordP1uiv)
+#define glTexCoordP2ui		MANGLE(TexCoordP2ui)
+#define glTexCoordP2uiv		MANGLE(TexCoordP2uiv)
+#define glTexCoordP3ui		MANGLE(TexCoordP3ui)
+#define glTexCoordP3uiv		MANGLE(TexCoordP3uiv)
+#define glTexCoordP4ui		MANGLE(TexCoordP4ui)
+#define glTexCoordP4uiv		MANGLE(TexCoordP4uiv)
 #define glTexCoordPointerEXT		MANGLE(TexCoordPointerEXT)
 #define glTexCoordPointerListIBM		MANGLE(TexCoordPointerListIBM)
 #define glTexCoordPointer		MANGLE(TexCoordPointer)
@@ -1574,6 +1662,8 @@
 #define glTransformFeedbackVaryingsNV		MANGLE(TransformFeedbackVaryingsNV)
 #define glTranslated		MANGLE(Translated)
 #define glTranslatef		MANGLE(Translatef)
+#define glUniform1d		MANGLE(Uniform1d)
+#define glUniform1dv		MANGLE(Uniform1dv)
 #define glUniform1fARB		MANGLE(Uniform1fARB)
 #define glUniform1f		MANGLE(Uniform1f)
 #define glUniform1fvARB		MANGLE(Uniform1fvARB)
@@ -1586,6 +1676,8 @@
 #define glUniform1ui		MANGLE(Uniform1ui)
 #define glUniform1uivEXT		MANGLE(Uniform1uivEXT)
 #define glUniform1uiv		MANGLE(Uniform1uiv)
+#define glUniform2d		MANGLE(Uniform2d)
+#define glUniform2dv		MANGLE(Uniform2dv)
 #define glUniform2fARB		MANGLE(Uniform2fARB)
 #define glUniform2f		MANGLE(Uniform2f)
 #define glUniform2fvARB		MANGLE(Uniform2fvARB)
@@ -1598,6 +1690,8 @@
 #define glUniform2ui		MANGLE(Uniform2ui)
 #define glUniform2uivEXT		MANGLE(Uniform2uivEXT)
 #define glUniform2uiv		MANGLE(Uniform2uiv)
+#define glUniform3d		MANGLE(Uniform3d)
+#define glUniform3dv		MANGLE(Uniform3dv)
 #define glUniform3fARB		MANGLE(Uniform3fARB)
 #define glUniform3f		MANGLE(Uniform3f)
 #define glUniform3fvARB		MANGLE(Uniform3fvARB)
@@ -1610,6 +1704,8 @@
 #define glUniform3ui		MANGLE(Uniform3ui)
 #define glUniform3uivEXT		MANGLE(Uniform3uivEXT)
 #define glUniform3uiv		MANGLE(Uniform3uiv)
+#define glUniform4d		MANGLE(Uniform4d)
+#define glUniform4dv		MANGLE(Uniform4dv)
 #define glUniform4fARB		MANGLE(Uniform4fARB)
 #define glUniform4f		MANGLE(Uniform4f)
 #define glUniform4fvARB		MANGLE(Uniform4fvARB)
@@ -1624,18 +1720,28 @@
 #define glUniform4uiv		MANGLE(Uniform4uiv)
 #define glUniformBlockBinding		MANGLE(UniformBlockBinding)
 #define glUniformBufferEXT		MANGLE(UniformBufferEXT)
+#define glUniformMatrix2dv		MANGLE(UniformMatrix2dv)
 #define glUniformMatrix2fvARB		MANGLE(UniformMatrix2fvARB)
 #define glUniformMatrix2fv		MANGLE(UniformMatrix2fv)
+#define glUniformMatrix2x3dv		MANGLE(UniformMatrix2x3dv)
 #define glUniformMatrix2x3fv		MANGLE(UniformMatrix2x3fv)
+#define glUniformMatrix2x4dv		MANGLE(UniformMatrix2x4dv)
 #define glUniformMatrix2x4fv		MANGLE(UniformMatrix2x4fv)
+#define glUniformMatrix3dv		MANGLE(UniformMatrix3dv)
 #define glUniformMatrix3fvARB		MANGLE(UniformMatrix3fvARB)
 #define glUniformMatrix3fv		MANGLE(UniformMatrix3fv)
+#define glUniformMatrix3x2dv		MANGLE(UniformMatrix3x2dv)
 #define glUniformMatrix3x2fv		MANGLE(UniformMatrix3x2fv)
+#define glUniformMatrix3x4dv		MANGLE(UniformMatrix3x4dv)
 #define glUniformMatrix3x4fv		MANGLE(UniformMatrix3x4fv)
+#define glUniformMatrix4dv		MANGLE(UniformMatrix4dv)
 #define glUniformMatrix4fvARB		MANGLE(UniformMatrix4fvARB)
 #define glUniformMatrix4fv		MANGLE(UniformMatrix4fv)
+#define glUniformMatrix4x2dv		MANGLE(UniformMatrix4x2dv)
 #define glUniformMatrix4x2fv		MANGLE(UniformMatrix4x2fv)
+#define glUniformMatrix4x3dv		MANGLE(UniformMatrix4x3dv)
 #define glUniformMatrix4x3fv		MANGLE(UniformMatrix4x3fv)
+#define glUniformSubroutinesuiv		MANGLE(UniformSubroutinesuiv)
 #define glUniformui64NV		MANGLE(Uniformui64NV)
 #define glUniformui64vNV		MANGLE(Uniformui64vNV)
 #define glUnlockArraysEXT		MANGLE(UnlockArraysEXT)
@@ -1844,6 +1950,14 @@
 #define glVertexAttribIFormatNV		MANGLE(VertexAttribIFormatNV)
 #define glVertexAttribIPointerEXT		MANGLE(VertexAttribIPointerEXT)
 #define glVertexAttribIPointer		MANGLE(VertexAttribIPointer)
+#define glVertexAttribP1ui		MANGLE(VertexAttribP1ui)
+#define glVertexAttribP1uiv		MANGLE(VertexAttribP1uiv)
+#define glVertexAttribP2ui		MANGLE(VertexAttribP2ui)
+#define glVertexAttribP2uiv		MANGLE(VertexAttribP2uiv)
+#define glVertexAttribP3ui		MANGLE(VertexAttribP3ui)
+#define glVertexAttribP3uiv		MANGLE(VertexAttribP3uiv)
+#define glVertexAttribP4ui		MANGLE(VertexAttribP4ui)
+#define glVertexAttribP4uiv		MANGLE(VertexAttribP4uiv)
 #define glVertexAttribPointerARB		MANGLE(VertexAttribPointerARB)
 #define glVertexAttribPointer		MANGLE(VertexAttribPointer)
 #define glVertexAttribPointerNV		MANGLE(VertexAttribPointerNV)
@@ -1868,6 +1982,12 @@
 #define glVertexBlendEnvfATI		MANGLE(VertexBlendEnvfATI)
 #define glVertexBlendEnviATI		MANGLE(VertexBlendEnviATI)
 #define glVertexFormatNV		MANGLE(VertexFormatNV)
+#define glVertexP2ui		MANGLE(VertexP2ui)
+#define glVertexP2uiv		MANGLE(VertexP2uiv)
+#define glVertexP3ui		MANGLE(VertexP3ui)
+#define glVertexP3uiv		MANGLE(VertexP3uiv)
+#define glVertexP4ui		MANGLE(VertexP4ui)
+#define glVertexP4uiv		MANGLE(VertexP4uiv)
 #define glVertexPointerEXT		MANGLE(VertexPointerEXT)
 #define glVertexPointerListIBM		MANGLE(VertexPointerListIBM)
 #define glVertexPointer		MANGLE(VertexPointer)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 3d0455d..db7bf17 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -1489,6 +1489,12 @@ const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg,
 }
 
 
+void ureg_free_tokens( const struct tgsi_token *tokens )
+{
+   FREE((struct tgsi_token *)tokens);
+}
+
+
 struct ureg_program *ureg_create( unsigned processor )
 {
    struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 0130a77..8302d1b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -104,6 +104,10 @@ ureg_get_tokens( struct ureg_program *ureg,
                  unsigned *nr_tokens );
 
 
+/* Free the tokens created by ureg_get_tokens() */
+void ureg_free_tokens( const struct tgsi_token *tokens );
+
+
 void 
 ureg_destroy( struct ureg_program * );
 
diff --git a/src/gallium/state_trackers/egl/x11/glxinit.c b/src/gallium/state_trackers/egl/x11/glxinit.c
index 1ed2afd..dd35189 100644
--- a/src/gallium/state_trackers/egl/x11/glxinit.c
+++ b/src/gallium/state_trackers/egl/x11/glxinit.c
@@ -16,6 +16,8 @@
 
 #include "glxinit.h"
 
+#ifdef GLX_DIRECT_RENDERING
+
 typedef struct GLXGenericGetString
 {
    CARD8 reqType;
@@ -680,3 +682,5 @@ __glXInitialize(Display * dpy)
 
    return dpyPriv;
 }
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 8d2a8b1..a8bdd34 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -37,6 +37,8 @@
 #include "native_x11.h"
 #include "x11_screen.h"
 
+#ifdef GLX_DIRECT_RENDERING
+
 enum dri2_surface_type {
    DRI2_SURFACE_TYPE_WINDOW,
    DRI2_SURFACE_TYPE_PIXMAP,
@@ -878,3 +880,15 @@ x11_create_dri2_display(EGLNativeDisplayType dpy,
 
    return &dri2dpy->base;
 }
+
+#else /* GLX_DIRECT_RENDERING */
+
+struct native_display *
+x11_create_dri2_display(EGLNativeDisplayType dpy,
+                        struct native_event_handler *event_handler,
+                        struct drm_api *api)
+{
+   return NULL;
+}
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index 7b4fe63..0c25e4d 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -70,7 +70,9 @@ native_create_probe(EGLNativeDisplayType dpy)
    xscr = x11_screen_create(xdpy, scr);
    if (xscr) {
       if (x11_screen_support(xscr, X11_SCREEN_EXTENSION_DRI2)) {
+#ifdef GLX_DIRECT_RENDERING
          driver_name = x11_screen_probe_dri2(xscr, NULL, NULL);
+#endif
          if (driver_name)
             nprobe->data = strdup(driver_name);
       }
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index f409611..1706120 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -39,8 +39,10 @@
 #include "glxinit.h"
 
 struct x11_screen {
+#ifdef GLX_DIRECT_RENDERING
    /* dummy base class */
    struct __GLXDRIdisplayRec base;
+#endif
 
    Display *dpy;
    int number;
@@ -103,15 +105,19 @@ x11_screen_destroy(struct x11_screen *xscr)
    if (xscr->dri_device)
       Xfree(xscr->dri_device);
 
+#ifdef GLX_DIRECT_RENDERING
    /* xscr->glx_dpy will be destroyed with the X display */
    if (xscr->glx_dpy)
       xscr->glx_dpy->dri2Display = NULL;
+#endif
 
    if (xscr->visuals)
       XFree(xscr->visuals);
    free(xscr);
 }
 
+#ifdef GLX_DIRECT_RENDERING
+
 static boolean
 x11_screen_init_dri2(struct x11_screen *xscr)
 {
@@ -133,6 +139,8 @@ x11_screen_init_glx(struct x11_screen *xscr)
    return (xscr->glx_dpy != NULL);
 }
 
+#endif /* GLX_DIRECT_RENDERING */
+
 /**
  * Return true if the screen supports the extension.
  */
@@ -145,12 +153,14 @@ x11_screen_support(struct x11_screen *xscr, enum x11_screen_extension ext)
    case X11_SCREEN_EXTENSION_XSHM:
       supported = XShmQueryExtension(xscr->dpy);
       break;
+#ifdef GLX_DIRECT_RENDERING
    case X11_SCREEN_EXTENSION_GLX:
       supported = x11_screen_init_glx(xscr);
       break;
    case X11_SCREEN_EXTENSION_DRI2:
       supported = x11_screen_init_dri2(xscr);
       break;
+#endif
    default:
       break;
    }
@@ -234,6 +244,39 @@ x11_screen_convert_visual(struct x11_screen *xscr, const XVisualInfo *visual,
 }
 
 /**
+ * Return the depth of a drawable.
+ *
+ * Unlike other drawable functions, the drawable needs not be a DRI2 drawable.
+ */
+uint
+x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable)
+{
+   unsigned int depth;
+
+   if (drawable != xscr->last_drawable) {
+      Window root;
+      int x, y;
+      unsigned int w, h, border;
+      Status ok;
+
+      ok = XGetGeometry(xscr->dpy, drawable, &root,
+            &x, &y, &w, &h, &border, &depth);
+      if (!ok)
+         depth = 0;
+
+      xscr->last_drawable = drawable;
+      xscr->last_depth = depth;
+   }
+   else {
+      depth = xscr->last_depth;
+   }
+
+   return depth;
+}
+
+#ifdef GLX_DIRECT_RENDERING
+
+/**
  * Return the GLX fbconfigs.
  */
 const __GLcontextModes *
@@ -392,37 +435,6 @@ x11_drawable_get_buffers(struct x11_screen *xscr, Drawable drawable,
 }
 
 /**
- * Return the depth of a drawable.
- *
- * Unlike other drawable functions, the drawable needs not be a DRI2 drawable.
- */
-uint
-x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable)
-{
-   unsigned int depth;
-
-   if (drawable != xscr->last_drawable) {
-      Window root;
-      int x, y;
-      unsigned int w, h, border;
-      Status ok;
-
-      ok = XGetGeometry(xscr->dpy, drawable, &root,
-            &x, &y, &w, &h, &border, &depth);
-      if (!ok)
-         depth = 0;
-
-      xscr->last_drawable = drawable;
-      xscr->last_depth = depth;
-   }
-   else {
-      depth = xscr->last_depth;
-   }
-
-   return depth;
-}
-
-/**
  * Create a mode list of the given size.
  */
 __GLcontextModes *
@@ -489,3 +501,5 @@ dri2InvalidateBuffers(Display *dpy, XID drawable)
 
    xscr->dri_invalidate_buffers(xscr, drawable, xscr->dri_user_data);
 }
+
+#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.h b/src/gallium/state_trackers/egl/x11/x11_screen.h
index 37e8d5a..55e1201 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.h
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.h
@@ -68,20 +68,18 @@ void
 x11_screen_convert_visual(struct x11_screen *xscr, const XVisualInfo *visual,
                           __GLcontextModes *mode);
 
+uint
+x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable);
+
+#ifdef GLX_DIRECT_RENDERING
+
+/* GLX */
 const __GLcontextModes *
 x11_screen_get_glx_configs(struct x11_screen *xscr);
 
 const __GLcontextModes *
 x11_screen_get_glx_visuals(struct x11_screen *xscr);
 
-const char *
-x11_screen_probe_dri2(struct x11_screen *xscr, int *major, int *minor);
-
-int
-x11_screen_enable_dri2(struct x11_screen *xscr,
-                       x11_drawable_invalidate_buffers invalidate_buffers,
-                       void *user_data);
-
 __GLcontextModes *
 x11_context_modes_create(unsigned count);
 
@@ -91,6 +89,15 @@ x11_context_modes_destroy(__GLcontextModes *modes);
 unsigned
 x11_context_modes_count(const __GLcontextModes *modes);
 
+/* DRI2 */
+const char *
+x11_screen_probe_dri2(struct x11_screen *xscr, int *major, int *minor);
+
+int
+x11_screen_enable_dri2(struct x11_screen *xscr,
+                       x11_drawable_invalidate_buffers invalidate_buffers,
+                       void *user_data);
+
 void
 x11_drawable_enable_dri2(struct x11_screen *xscr,
                          Drawable drawable, boolean on);
@@ -105,7 +112,6 @@ x11_drawable_get_buffers(struct x11_screen *xscr, Drawable drawable,
                          int *width, int *height, unsigned int *attachments,
                          boolean with_format, int num_ins, int *num_outs);
 
-uint
-x11_drawable_get_depth(struct x11_screen *xscr, Drawable drawable);
+#endif /* GLX_DIRECT_RENDERING */
 
 #endif /* _X11_SCREEN_H_ */
diff --git a/src/gallium/winsys/drm/Makefile.egl b/src/gallium/winsys/drm/Makefile.egl
index 8363de6..c48967f 100644
--- a/src/gallium/winsys/drm/Makefile.egl
+++ b/src/gallium/winsys/drm/Makefile.egl
@@ -11,7 +11,7 @@
 
 EGL_DRIVER_OBJECTS = $(EGL_DRIVER_SOURCES:.c=.o)
 
-common_LIBS = -ldrm -lm -ldl
+common_LIBS = -ldrm -lm $(DLOPEN_LIBS)
 
 x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a
 x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes
diff --git a/src/glw/Makefile b/src/glw/Makefile
index 1fb3d3c..39352f0 100644
--- a/src/glw/Makefile
+++ b/src/glw/Makefile
@@ -17,7 +17,7 @@ OBJECTS = $(GLW_SOURCES:.c=.o)
 ##### RULES #####
 
 .c.o:
-	$(CC) -c $(INCDIRS) $(CFLAGS) $<
+	$(CC) -c $(INCDIRS) $(CFLAGS) $(GLW_CFLAGS) $<
 
 
 
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
index df67aaf..b8ee288 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
@@ -141,12 +141,28 @@ static void add_inst_to_list(struct schedule_instruction ** list, struct schedul
 	*list = inst;
 }
 
+static void add_inst_to_list_end(struct schedule_instruction ** list,
+					struct schedule_instruction * inst)
+{
+	if(!*list){
+		*list = inst;
+	}else{
+		struct schedule_instruction * temp = *list;
+		while(temp->NextReady){
+			temp = temp->NextReady;
+		}
+		temp->NextReady = inst;
+	}
+}
+
 static void instruction_ready(struct schedule_state * s, struct schedule_instruction * sinst)
 {
 	DBG("%i is now ready\n", sinst->Instruction->IP);
 
+	/* Adding Ready TEX instructions to the end of the "Ready List" helps
+	 * us emit TEX instructions in blocks without losing our place. */
 	if (sinst->Instruction->Type == RC_INSTRUCTION_NORMAL)
-		add_inst_to_list(&s->ReadyTEX, sinst);
+		add_inst_to_list_end(&s->ReadyTEX, sinst);
 	else if (sinst->Instruction->U.P.Alpha.Opcode == RC_OPCODE_NOP)
 		add_inst_to_list(&s->ReadyRGB, sinst);
 	else if (sinst->Instruction->U.P.RGB.Opcode == RC_OPCODE_NOP)
@@ -163,11 +179,14 @@ static void decrease_dependencies(struct schedule_state * s, struct schedule_ins
 		instruction_ready(s, sinst);
 }
 
-static void commit_instruction(struct schedule_state * s, struct schedule_instruction * sinst)
-{
-	DBG("%i: commit\n", sinst->Instruction->IP);
-
-	for(unsigned int i = 0; i < sinst->NumReadValues; ++i) {
+/**
+ * This function decreases the dependencies of the next instruction that
+ * wants to write to each of sinst's read values.
+ */
+static void commit_update_reads(struct schedule_state * s,
+					struct schedule_instruction * sinst){
+	unsigned int i;
+	for(i = 0; i < sinst->NumReadValues; ++i) {
 		struct reg_value * v = sinst->ReadValues[i];
 		assert(v->NumReaders > 0);
 		v->NumReaders--;
@@ -176,8 +195,12 @@ static void commit_instruction(struct schedule_state * s, struct schedule_instru
 				decrease_dependencies(s, v->Next->Writer);
 		}
 	}
+}
 
-	for(unsigned int i = 0; i < sinst->NumWriteValues; ++i) {
+static void commit_update_writes(struct schedule_state * s,
+					struct schedule_instruction * sinst){
+	unsigned int i;
+	for(i = 0; i < sinst->NumWriteValues; ++i) {
 		struct reg_value * v = sinst->WriteValues[i];
 		if (v->NumReaders) {
 			for(struct reg_value_reader * r = v->Readers; r; r = r->Next) {
@@ -196,6 +219,15 @@ static void commit_instruction(struct schedule_state * s, struct schedule_instru
 	}
 }
 
+static void commit_alu_instruction(struct schedule_state * s, struct schedule_instruction * sinst)
+{
+	DBG("%i: commit\n", sinst->Instruction->IP);
+
+	commit_update_reads(s, sinst);
+
+	commit_update_writes(s, sinst);
+}
+
 /**
  * Emit all ready texture instructions in a single block.
  *
@@ -208,21 +240,37 @@ static void emit_all_tex(struct schedule_state * s, struct rc_instruction * befo
 
 	assert(s->ReadyTEX);
 
-	/* Don't let the ready list change under us! */
-	readytex = s->ReadyTEX;
-	s->ReadyTEX = 0;
-
 	/* Node marker for R300 */
 	struct rc_instruction * inst_begin = rc_insert_new_instruction(s->C, before->Prev);
 	inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX;
 
 	/* Link texture instructions back in */
+	readytex = s->ReadyTEX;
 	while(readytex) {
-		struct schedule_instruction * tex = readytex;
+		rc_insert_instruction(before->Prev, readytex->Instruction);
+		DBG("%i: commit TEX reads\n", readytex->Instruction->IP);
+
+		/* All of the TEX instructions in the same TEX block have
+		 * their source registers read from before any of the
+		 * instructions in that block write to their destination
+		 * registers.  This means that when we commit a TEX
+		 * instruction, any other TEX instruction that wants to write
+		 * to one of the committed instruction's source register can be
+		 * marked as ready and should be emitted in the same TEX
+		 * block. This prevents the following sequence from being
+		 * emitted in two different TEX blocks:
+		 * 0: TEX temp[0].xyz, temp[1].xy__, 2D[0];
+		 * 1: TEX temp[1].xyz, temp[2].xy__, 2D[0];
+		 */
+		commit_update_reads(s, readytex);
+		readytex = readytex->NextReady;
+	}
+	readytex = s->ReadyTEX;
+	s->ReadyTEX = 0;
+	while(readytex){
+		DBG("%i: commit TEX writes\n", readytex->Instruction->IP);
+		commit_update_writes(s, readytex);
 		readytex = readytex->NextReady;
-
-		rc_insert_instruction(before->Prev, tex->Instruction);
-		commit_instruction(s, tex);
 	}
 }
 
@@ -328,7 +376,7 @@ static void emit_one_alu(struct schedule_state *s, struct rc_instruction * befor
 		}
 
 		rc_insert_instruction(before->Prev, sinst->Instruction);
-		commit_instruction(s, sinst);
+		commit_alu_instruction(s, sinst);
 	} else {
 		struct schedule_instruction **prgb;
 		struct schedule_instruction **palpha;
@@ -346,8 +394,8 @@ static void emit_one_alu(struct schedule_state *s, struct rc_instruction * befor
 				*prgb = (*prgb)->NextReady;
 				*palpha = (*palpha)->NextReady;
 				rc_insert_instruction(before->Prev, psirgb->Instruction);
-				commit_instruction(s, psirgb);
-				commit_instruction(s, psialpha);
+				commit_alu_instruction(s, psirgb);
+				commit_alu_instruction(s, psialpha);
 				goto success;
 			}
 		}
@@ -357,7 +405,7 @@ static void emit_one_alu(struct schedule_state *s, struct rc_instruction * befor
 		s->ReadyRGB = s->ReadyRGB->NextReady;
 
 		rc_insert_instruction(before->Prev, sinst->Instruction);
-		commit_instruction(s, sinst);
+		commit_alu_instruction(s, sinst);
 	success: ;
 	}
 }
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 689bb13..4cbd4f2 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -456,7 +456,7 @@ static void r300InitGLExtensions(GLcontext *ctx)
 	if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) {
 		_mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
 	}
-	if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV350)
+        if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_R420)
   		_mesa_enable_extension(ctx, "GL_ARB_half_float_vertex");
 
 	if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index 282c0e1..5ae9f49 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -523,8 +523,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in
 			r300ConvertAttrib(ctx, count, input[i], &vbuf->attribs[index]);
 		} else {
 			if (input[i]->BufferObj->Name) {
-				if (stride % 4 != 0) {
-					assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 0);
+				if (stride % 4 != 0 || (intptr_t)input[i]->Ptr % 4 != 0) {
 					r300AlignDataToDword(ctx, input[i], count, &vbuf->attribs[index]);
 					vbuf->attribs[index].is_named_bo = GL_FALSE;
 				} else {
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 834bcc6..7b957fb 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -293,7 +293,9 @@ GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size)
                 case 2:
                     format = FMT_16_16; break;
                 case 3:
-                    format = FMT_16_16_16; break;
+                    /* 3 comp GL_SHORT vertex format doesnt work on r700
+                       4 somehow works, test - sauerbraten  */
+                    format = FMT_16_16_16_16; break;
                 case 4:
                     format = FMT_16_16_16_16; break;
                 default:
@@ -1051,6 +1053,67 @@ void checkop_init(r700_AssemblerBase* pAsm)
     pAsm->aArgSubst[3] = -1;
 }
 
+static GLboolean next_ins(r700_AssemblerBase *pAsm)
+{
+    struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]);
+
+    if (GL_TRUE == pAsm->is_tex)
+    {
+        if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX)
+        {
+            if (GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE))
+            {
+                radeon_error("Error assembling TEX instruction\n");
+                return GL_FALSE;
+            }
+        }
+        else
+        {
+            if (GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE))
+            {
+                radeon_error("Error assembling TEX instruction\n");
+                return GL_FALSE;
+            }
+        }
+    }
+    else
+    {   //ALU
+        if (GL_FALSE == assemble_alu_instruction(pAsm))
+        {
+            radeon_error("Error assembling ALU instruction\n");
+            return GL_FALSE;
+        }
+    }
+
+    if (pAsm->D.dst.rtype == DST_REG_OUT)
+    {
+        assert(pAsm->D.dst.reg >= pAsm->starting_export_register_number);
+
+        if (pAsm->D.dst.op3)
+        {
+            // There is no mask for OP3 instructions, so all channels are written
+            pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF;
+        }
+        else
+        {
+            pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number]
+               |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask;
+        }
+    }
+
+    //reset for next inst.
+    pAsm->D.bits    = 0;
+    pAsm->D2.bits   = 0;
+    pAsm->S[0].bits = 0;
+    pAsm->S[1].bits = 0;
+    pAsm->S[2].bits = 0;
+    pAsm->is_tex = GL_FALSE;
+    pAsm->need_tex_barrier = GL_FALSE;
+    pAsm->D2.bits = 0;
+    pAsm->C[0].bits = pAsm->C[1].bits = pAsm->C[2].bits = pAsm->C[3].bits = 0;
+    return GL_TRUE;
+}
+
 GLboolean mov_temp(r700_AssemblerBase* pAsm, int src)
 {
     GLuint tmp = gethelpr(pAsm);
@@ -1201,7 +1264,7 @@ GLboolean checkop3(r700_AssemblerBase* pAsm)
 	    {
             if( GL_FALSE == mov_temp(pAsm, 1) )
             {
-                return 1;
+                return GL_FALSE;
             }
         }
 
@@ -2578,62 +2641,6 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm)
     return GL_TRUE;
 }
 
-GLboolean next_ins(r700_AssemblerBase *pAsm)
-{
-    struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]);
-
-    if( GL_TRUE == pAsm->is_tex )
-    {
-	    if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) {
-		    if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) ) 
-		    {
-			    radeon_error("Error assembling TEX instruction\n");
-			    return GL_FALSE;
-		    }
-	    } else {
-		    if( GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE) ) 
-		    {
-			    radeon_error("Error assembling TEX instruction\n");
-			    return GL_FALSE;
-		    }
-	    }
-    }
-    else 
-    {   //ALU      
-        if( GL_FALSE == assemble_alu_instruction(pAsm) ) 
-        {
-            radeon_error("Error assembling ALU instruction\n");
-            return GL_FALSE;
-        }
-    } 
-      
-    if(pAsm->D.dst.rtype == DST_REG_OUT) 
-    {
-        if(pAsm->D.dst.op3) 
-        {        
-            // There is no mask for OP3 instructions, so all channels are written        
-            pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF;
-        }
-        else 
-        {
-            pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] 
-               |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask;
-        }
-    }
-    
-    //reset for next inst.
-    pAsm->D.bits    = 0;
-    pAsm->D2.bits   = 0;
-    pAsm->S[0].bits = 0;
-    pAsm->S[1].bits = 0;
-    pAsm->S[2].bits = 0;
-    pAsm->is_tex = GL_FALSE;
-    pAsm->need_tex_barrier = GL_FALSE;
-    pAsm->D2.bits = 0;
-    pAsm->C[0].bits = pAsm->C[1].bits = pAsm->C[2].bits = pAsm->C[3].bits = 0;
-    return GL_TRUE;
-}
-
 GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode)
 {
     BITS tmp;
@@ -2865,25 +2872,92 @@ GLboolean assemble_CMP(r700_AssemblerBase *pAsm)
 
 GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode)
 {
+    /* 
+     * r600 - trunc to -PI..PI range
+     * r700 - normalize by dividing by 2PI
+     * see fdo bug 27901
+     */
+  
     int tmp;
     checkop1(pAsm);
 
     tmp = gethelpr(pAsm);
 
-    pAsm->D.dst.opcode = SQ_OP2_INST_MUL;
+    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    pAsm->D.dst.op3    = 1;
+
     setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
     pAsm->D.dst.rtype  = DST_REG_TEMPORARY;
     pAsm->D.dst.reg    = tmp;
-    pAsm->D.dst.writex = 1;
 
     assemble_src(pAsm, 0, -1);
 
     pAsm->S[1].src.rtype = SRC_REC_LITERAL;
     setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X);
+    
+    pAsm->S[2].src.rtype = SRC_REC_LITERAL;
+    setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y);
+
     pAsm->D2.dst2.literal_slots = 1;
     pAsm->C[0].f = 1/(3.1415926535 * 2);
-    pAsm->C[1].f = 0.0F;
-    next_ins(pAsm);
+    pAsm->C[1].f = 0.5f;
+    
+    if ( GL_FALSE == next_ins(pAsm) )
+    {
+        return GL_FALSE;
+    }
+
+    pAsm->D.dst.opcode = SQ_OP2_INST_FRACT;
+
+    setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+    pAsm->D.dst.rtype  = DST_REG_TEMPORARY;
+    pAsm->D.dst.reg    = tmp;
+    pAsm->D.dst.writex = 1;
+
+    setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+    pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+    pAsm->S[0].src.reg   = tmp;
+    setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X);
+
+    if(( GL_FALSE == next_ins(pAsm) ))
+    {
+        return GL_FALSE;
+    }
+    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    pAsm->D.dst.op3    = 1;
+
+    setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+    pAsm->D.dst.rtype  = DST_REG_TEMPORARY;
+    pAsm->D.dst.reg    = tmp;
+
+    setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+    pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+    pAsm->S[0].src.reg   = tmp;
+    setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X);
+
+    pAsm->S[1].src.rtype = SRC_REC_LITERAL;
+    setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X);
+
+    pAsm->S[2].src.rtype = SRC_REC_LITERAL;
+    setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y);
+
+    pAsm->D2.dst2.literal_slots = 1;
+
+    if (pAsm->bR6xx)
+    {
+       pAsm->C[0].f = 3.1415926535897f * 2.0f;
+       pAsm->C[1].f = -3.1415926535897f;
+    }
+    else 
+    {
+       pAsm->C[0].f = 1.0f;
+       pAsm->C[1].f = -0.5f;
+    }
+
+    if(( GL_FALSE == next_ins(pAsm) ))
+    {
+        return GL_FALSE;
+    }
 
     pAsm->D.dst.opcode = opcode;
     pAsm->D.dst.math = 1;
@@ -4023,22 +4097,79 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm)
     checkop1(pAsm);
 
     tmp = gethelpr(pAsm);
-    /* tmp.x = src /2*PI */
-    pAsm->D.dst.opcode = SQ_OP2_INST_MUL;
+
+    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    pAsm->D.dst.op3    = 1;
+
     setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
     pAsm->D.dst.rtype  = DST_REG_TEMPORARY;
     pAsm->D.dst.reg    = tmp;
-    pAsm->D.dst.writex = 1;
 
     assemble_src(pAsm, 0, -1);
 
     pAsm->S[1].src.rtype = SRC_REC_LITERAL;
     setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X);
+
+    pAsm->S[2].src.rtype = SRC_REC_LITERAL;
+    setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y);
+
     pAsm->D2.dst2.literal_slots = 1;
     pAsm->C[0].f = 1/(3.1415926535 * 2);
-    pAsm->C[1].f = 0.0F;
+    pAsm->C[1].f = 0.5F;
 
-    next_ins(pAsm);
+    if ( GL_FALSE == next_ins(pAsm) )
+    {
+        return GL_FALSE;
+    }
+
+    pAsm->D.dst.opcode = SQ_OP2_INST_FRACT;
+
+    setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+    pAsm->D.dst.rtype  = DST_REG_TEMPORARY;
+    pAsm->D.dst.reg    = tmp;
+    pAsm->D.dst.writex = 1;
+
+    setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+    pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+    pAsm->S[0].src.reg   = tmp;
+    setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X);
+
+    if(( GL_FALSE == next_ins(pAsm) ))
+    {
+        return GL_FALSE;
+    }
+    pAsm->D.dst.opcode = SQ_OP3_INST_MULADD;
+    pAsm->D.dst.op3    = 1;
+
+    setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+    pAsm->D.dst.rtype  = DST_REG_TEMPORARY;
+    pAsm->D.dst.reg    = tmp;
+
+    setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+    pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+    pAsm->S[0].src.reg   = tmp;
+    setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X);
+
+    pAsm->S[1].src.rtype = SRC_REC_LITERAL;
+    setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X);
+
+    pAsm->S[2].src.rtype = SRC_REC_LITERAL;
+    setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_Y);
+
+    pAsm->D2.dst2.literal_slots = 1;
+
+    if(pAsm->bR6xx) {
+       pAsm->C[0].f = 3.1415926535897f * 2.0f;
+       pAsm->C[1].f = -3.1415926535897f;
+    } else {
+       pAsm->C[0].f = 1.0f;
+       pAsm->C[1].f = -0.5f;
+    }
+
+    if(( GL_FALSE == next_ins(pAsm) ))
+    {
+        return GL_FALSE;
+    }
 
     // COS dst.x,    a.x
     pAsm->D.dst.opcode = SQ_OP2_INST_COS;
@@ -6154,7 +6285,7 @@ GLboolean callPreSub(r700_AssemblerBase* pAsm,
     }
     if(uNumValidSrc > 0)
     {
-        prelude_cf_ptr     = pAsm->cf_current_alu_clause_ptr;
+        prelude_cf_ptr     = (R700ControlFlowGenericClause*) pAsm->cf_current_alu_clause_ptr;
         pAsm->alu_x_opcode = SQ_CF_INST_ALU;
     }
 
@@ -6274,7 +6405,7 @@ GLboolean callPreSub(r700_AssemblerBase* pAsm,
 
         next_ins(pAsm);        
 
-        pAsm->callers[pAsm->unCallerArrayPointer - 1].finale_cf_ptr  = pAsm->cf_current_alu_clause_ptr;
+        pAsm->callers[pAsm->unCallerArrayPointer - 1].finale_cf_ptr  = (R700ControlFlowGenericClause*) pAsm->cf_current_alu_clause_ptr;
         pAsm->callers[pAsm->unCallerArrayPointer - 1].prelude_cf_ptr = prelude_cf_ptr;
         pAsm->alu_x_opcode = SQ_CF_INST_ALU;
     }
@@ -6347,6 +6478,8 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm,
 
     if (export_count == 1) 
     {
+        assert(starting_register_number >= pAsm->starting_export_register_number);
+
         ucWriteMask = pAsm->pucOutMask[starting_register_number - pAsm->starting_export_register_number];
 	/* exports Z as a float into Red channel */
 	if (GL_TRUE == is_depth_export)
@@ -6437,6 +6570,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
 { 
     unsigned int unBit;
     GLuint export_count = 0;
+    unsigned int i;
 
     if(pR700AsmCode->depth_export_register_number >= 0) 
     {
@@ -6446,39 +6580,24 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
 		}
     }
 
-    unBit = 1 << FRAG_RESULT_COLOR;
-	if(OutputsWritten & unBit)
-	{
-		if( GL_FALSE == Process_Export(pR700AsmCode,
-                                       SQ_EXPORT_PIXEL, 
-                                       0, 
-                                       1, 
-                                       pR700AsmCode->uiFP_OutputMap[FRAG_RESULT_COLOR], 
-                                       GL_FALSE) ) 
-        {
-            return GL_FALSE;
-        }
-        export_count++;
-	}
-	unBit = 1 << FRAG_RESULT_DEPTH;
-	if(OutputsWritten & unBit)
-	{
-        if( GL_FALSE == Process_Export(pR700AsmCode,
-                                       SQ_EXPORT_PIXEL, 
-                                       0, 
-                                       1, 
-                                       pR700AsmCode->uiFP_OutputMap[FRAG_RESULT_DEPTH], 
-                                       GL_TRUE)) 
+    for (i = 0; i < FRAG_RESULT_MAX; ++i)
+    {
+        unBit = 1 << i;
+
+        if (OutputsWritten & unBit)
         {
-            return GL_FALSE;
+            GLboolean is_depth = i == FRAG_RESULT_DEPTH ? GL_TRUE : GL_FALSE;
+            if (!Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, pR700AsmCode->uiFP_OutputMap[i], is_depth))
+                return GL_FALSE;
+            ++export_count;
         }
-        export_count++;
-	}
+    }
+
     /* Need to export something, otherwise we'll hang
      * results are undefined anyway */
     if(export_count == 0)
     {
-        Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, 0, GL_FALSE);
+        Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, pR700AsmCode->starting_export_register_number, GL_FALSE);
     }
     
     if(pR700AsmCode->cf_last_export_ptr != NULL) 
@@ -6511,13 +6630,30 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode,
         {
             return GL_FALSE;
         }
+        export_starting_index++;
+        export_count--;
+        }
 
+    unBit = 1 << VERT_RESULT_PSIZ;
+    if(OutputsWritten & unBit)
+    {
+        if( GL_FALSE == Process_Export(pR700AsmCode,
+                                       SQ_EXPORT_POS,
+                                       export_starting_index,
+                                       1,
+                                       pR700AsmCode->ucVP_OutputMap[VERT_RESULT_PSIZ],
+                                       GL_FALSE) )
+        {
+            return GL_FALSE;
+        }
         export_count--;
+    }
+
+    pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE;
 
-        pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE;
-	}
 
     pR700AsmCode->number_of_exports = export_count;
+    export_starting_index = 0;
 
 	unBit = 1 << VERT_RESULT_COL0;
 	if(OutputsWritten & unBit)
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index 0064d08..2d3c324 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -582,7 +582,6 @@ GLboolean check_scalar(r700_AssemblerBase* pAsm,
 GLboolean check_vector(r700_AssemblerBase* pAsm,
                        R700ALUInstruction* alu_instruction_ptr);
 GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm);
-GLboolean next_ins(r700_AssemblerBase *pAsm);
 
 GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops);
 GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset);
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index 84d51e6..39234af 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -226,22 +226,23 @@ void Map_Fragment_Program(r700_AssemblerBase         *pAsm,
 	pAsm->number_of_exports = 0;
 	pAsm->number_of_colorandz_exports = 0; /* don't include stencil and mask out. */
 	pAsm->starting_export_register_number = pAsm->number_used_registers;
-	unBit = 1 << FRAG_RESULT_COLOR;
-	if(mesa_fp->Base.OutputsWritten & unBit)
-	{
-		pAsm->uiFP_OutputMap[FRAG_RESULT_COLOR] = pAsm->number_used_registers++;
-		pAsm->number_of_exports++;
-		pAsm->number_of_colorandz_exports++;
-	}
-	unBit = 1 << FRAG_RESULT_DEPTH;
-	if(mesa_fp->Base.OutputsWritten & unBit)
-	{
-        pAsm->depth_export_register_number = pAsm->number_used_registers;
-		pAsm->uiFP_OutputMap[FRAG_RESULT_DEPTH] = pAsm->number_used_registers++;
-		pAsm->number_of_exports++;
-		pAsm->number_of_colorandz_exports++;
-		pAsm->pR700Shader->depthIsExported = 1;
-	}
+
+    for (i = 0; i < FRAG_RESULT_MAX; ++i)
+    {
+        unBit = 1 << i;
+        if (mesa_fp->Base.OutputsWritten & unBit)
+        {
+            if (i == FRAG_RESULT_DEPTH)
+            {
+                pAsm->depth_export_register_number = pAsm->number_used_registers;
+                pAsm->pR700Shader->depthIsExported = 1;
+            }
+
+            pAsm->uiFP_OutputMap[i] = pAsm->number_used_registers++;
+            ++pAsm->number_of_exports;
+            ++pAsm->number_of_colorandz_exports;
+        }
+    }
 
     pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
     for(ui=0; ui<pAsm->number_of_exports; ui++)
@@ -560,27 +561,34 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
         CLEARbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit);
     }
 
-    /* see if we need any point_sprite replacements */
-    for (i = VERT_RESULT_TEX0; i<= VERT_RESULT_TEX7; i++)
+    /* see if we need any point_sprite replacements, also increase num_interp
+     * as there's no vp output for them */
+    if (ctx->Point.PointSprite)
     {
-        if(ctx->Point.CoordReplace[i - VERT_RESULT_TEX0] == GL_TRUE)
-            point_sprite = GL_TRUE;
+        for (i = FRAG_ATTRIB_TEX0; i<= FRAG_ATTRIB_TEX7; i++)
+        {
+            if (ctx->Point.CoordReplace[i - FRAG_ATTRIB_TEX0] == GL_TRUE)
+            {
+                ui++;
+                point_sprite = GL_TRUE;
+            }
+        }
     }
 
+    if( mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC))
+        ui++;
+
     if ((mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC)) || point_sprite)
     {
-        /* for FRAG_ATTRIB_PNTC we need to increase num_interp */
-        if(mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_PNTC))
-        {
-            ui++;
-            SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask);
-        }
+        SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask);
         SETbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_ENA_bit);
         SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_S, PNT_SPRITE_OVRD_X_shift, PNT_SPRITE_OVRD_X_mask);
         SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_T, PNT_SPRITE_OVRD_Y_shift, PNT_SPRITE_OVRD_Y_mask);
         SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_0, PNT_SPRITE_OVRD_Z_shift, PNT_SPRITE_OVRD_Z_mask);
         SETfield(r700->SPI_INTERP_CONTROL_0.u32All, SPI_PNT_SPRITE_SEL_1, PNT_SPRITE_OVRD_W_shift, PNT_SPRITE_OVRD_W_mask);
-        if(ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
+        /* Like e.g. viewport and winding, point sprite coordinates are
+         * inverted when rendering to FBO. */
+        if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) == !ctx->DrawBuffer->Name)
             SETbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit);
         else
             CLEARbit(r700->SPI_INTERP_CONTROL_0.u32All, PNT_SPRITE_TOP_1_bit);
@@ -668,8 +676,9 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
 
     for(i=0; i<8; i++)
     {
+	    GLboolean coord_replace = ctx->Point.PointSprite && ctx->Point.CoordReplace[i];
 	    unBit = 1 << (VERT_RESULT_TEX0 + i);
-	    if(OutputsWritten & unBit)
+	    if ((OutputsWritten & unBit) || coord_replace)
 	    {
 		    ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i];
 		    SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit);
@@ -677,7 +686,7 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx)
 			     SEMANTIC_shift, SEMANTIC_mask);
 		    CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit);
 		    /* ARB_point_sprite */
-		    if(ctx->Point.CoordReplace[i] == GL_TRUE)
+		    if (coord_replace)
 		    {
 			     SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, PT_SPRITE_TEX_bit);
 		    }
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index 05c6516..14dd2a5 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -628,6 +628,16 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx)
 
     R600_STATECHANGE(context, spi);
 
+    if(vp->mesa_program->Base.OutputsWritten & (1 << VERT_RESULT_PSIZ)) {
+        R600_STATECHANGE(context, cl);
+        SETbit(r700->PA_CL_VS_OUT_CNTL.u32All, USE_VTX_POINT_SIZE_bit);
+        SETbit(r700->PA_CL_VS_OUT_CNTL.u32All, VS_OUT_MISC_VEC_ENA_bit);
+    } else if (r700->PA_CL_VS_OUT_CNTL.u32All != 0) {
+        R600_STATECHANGE(context, cl);
+        CLEARbit(r700->PA_CL_VS_OUT_CNTL.u32All, USE_VTX_POINT_SIZE_bit);
+        CLEARbit(r700->PA_CL_VS_OUT_CNTL.u32All, VS_OUT_MISC_VEC_ENA_bit);
+    }
+
     SETfield(r700->SPI_VS_OUT_CONFIG.u32All,
 	     vp->r700Shader.nParamExports ? (vp->r700Shader.nParamExports - 1) : 0,
              VS_EXPORT_COUNT_shift, VS_EXPORT_COUNT_mask);
diff --git a/src/mesa/drivers/dri/radeon/radeon_chipset.h b/src/mesa/drivers/dri/radeon/radeon_chipset.h
index 98732c8..6dbfdc9 100644
--- a/src/mesa/drivers/dri/radeon/radeon_chipset.h
+++ b/src/mesa/drivers/dri/radeon/radeon_chipset.h
@@ -413,9 +413,9 @@ enum {
    CHIP_FAMILY_R350,
    CHIP_FAMILY_RV350,
    CHIP_FAMILY_RV380,
+   CHIP_FAMILY_RS400,
    CHIP_FAMILY_R420,
    CHIP_FAMILY_RV410,
-   CHIP_FAMILY_RS400,
    CHIP_FAMILY_RS600,
    CHIP_FAMILY_RS690,
    CHIP_FAMILY_RS740,
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 94f4766..5a7d52c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -300,10 +300,10 @@ void radeonDestroyContext(__DRIcontext *driContextPriv )
 	_mesa_meta_free(radeon->glCtx);
 
 	if (radeon == current) {
-		radeon_firevertices(radeon);
 		_mesa_make_current(NULL, NULL, NULL);
 	}
 
+	radeon_firevertices(radeon);
 	if (!is_empty_list(&radeon->dma.reserved)) {
 		rcommonFlushCmdBuf( radeon, __FUNCTION__ );
 	}
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index 6c570a5..f3ce852 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -588,17 +588,17 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t
 			__FUNCTION__, texObj ,t->minLod, t->maxLod);
 
 	radeon_mipmap_tree *dst_miptree;
-	dst_miptree = get_biggest_matching_miptree(t, t->minLod, t->maxLod);
+	dst_miptree = get_biggest_matching_miptree(t, t->base.BaseLevel, t->base.MaxLevel);
 
+	radeon_miptree_unreference(&t->mt);
 	if (!dst_miptree) {
-		radeon_miptree_unreference(&t->mt);
 		radeon_try_alloc_miptree(rmesa, t);
-		dst_miptree = t->mt;
 		radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
 			"%s: No matching miptree found, allocated new one %p\n",
 			__FUNCTION__, t->mt);
 
 	} else {
+		radeon_miptree_reference(dst_miptree, &t->mt);
 		radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
 			"%s: Using miptree %p\n", __FUNCTION__, t->mt);
 	}
@@ -615,7 +615,7 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t
 				"Checking image level %d, face %d, mt %p ... ",
 				level, face, img->mt);
 			
-			if (img->mt != dst_miptree) {
+			if (img->mt != t->mt) {
 				radeon_print(RADEON_TEXTURE, RADEON_TRACE,
 					"MIGRATING\n");
 
@@ -623,7 +623,7 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t
 				if (src_bo && radeon_bo_is_referenced_by_cs(src_bo, rmesa->cmdbuf.cs)) {
 					radeon_firevertices(rmesa);
 				}
-				migrate_image_to_miptree(dst_miptree, img, face, level);
+				migrate_image_to_miptree(t->mt, img, face, level);
 			} else
 				radeon_print(RADEON_TEXTURE, RADEON_TRACE, "OK\n");
 		}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
index 5cfad6f..fb6f2e5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
@@ -52,22 +52,34 @@ do_copy_texsubimage(GLcontext *ctx,
     gl_format dst_mesaformat;
     unsigned src_width;
     unsigned dst_width;
+    unsigned flip_y;
 
     if (!radeon->vtbl.blit) {
         return GL_FALSE;
     }
 
     if (_mesa_get_format_bits(timg->base.TexFormat, GL_DEPTH_BITS) > 0) {
-        rrb = radeon_get_depthbuffer(radeon);
+        if (ctx->ReadBuffer->_DepthBuffer && ctx->ReadBuffer->_DepthBuffer->Wrapped) {
+            rrb = radeon_renderbuffer(ctx->ReadBuffer->_DepthBuffer->Wrapped);
+        } else {
+            rrb = radeon_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
+        }
+        flip_y = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Type == GL_NONE;
     } else {
-        rrb = radeon_get_colorbuffer(radeon);
+        rrb = radeon_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+        flip_y = ctx->ReadBuffer->Attachment[BUFFER_COLOR0].Type == GL_NONE;
+    }
+
+    // This is software renderbuffer, fallback to swrast
+    if (!rrb) {
+        return GL_FALSE;
     }
 
     if (!timg->mt) {
         radeon_validate_texture_miptree(ctx, &tobj->base);
     }
 
-    assert(rrb && rrb->bo);
+    assert(rrb->bo);
     assert(timg->mt);
     assert(timg->mt->bo);
     assert(timg->base.Width >= dstx + width);
@@ -124,7 +136,7 @@ do_copy_texsubimage(GLcontext *ctx,
                              timg->mt->bo, dst_offset, dst_mesaformat,
                              timg->mt->levels[level].rowstride / dst_bpp,
                              dst_width, timg->base.Height,
-                             dstx, dsty, width, height, 1);
+                             dstx, dsty, width, height, flip_y);
 }
 
 void
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index ff37fd3..caa55d2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -1016,7 +1016,15 @@ radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
 			__func__, ctx, texObj, image, compressed);
 
 	if (image->mt) {
+		radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
 		/* Map the texture image read-only */
+		if (radeon_bo_is_referenced_by_cs(image->mt->bo, rmesa->cmdbuf.cs)) {
+				radeon_print(RADEON_TEXTURE, RADEON_VERBOSE,
+				    "%s: called for texture that is queued for GPU processing\n",
+				    __func__);
+				radeon_firevertices(rmesa);
+		}
+
 		radeon_teximage_map(image, GL_FALSE);
 	} else {
 		/* Image hasn't been uploaded to a miptree yet */
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index e376f12..c5e874b 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1061,7 +1061,6 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
    struct dd_function_table functions;
    GLint rind, gind, bind, aind;
    GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits =0;
-   GLenum type = CHAN_TYPE;
 
    rind = gind = bind = aind = 0;
    if (format==OSMESA_RGBA) {
@@ -1329,6 +1328,7 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
     * size.
     */
    osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
+   _mesa_remove_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT);
    _mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
    assert(osmesa->rb->RefCount == 2);
 
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 71d1514..98bb7fa 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1880,7 +1880,7 @@ _mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
 
    bufObj->Purgeable = GL_FALSE;
 
-   retval = GL_RETAINED_APPLE;
+   retval = option;
    if (ctx->Driver.BufferObjectUnpurgeable)
       retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option);
 
@@ -1910,11 +1910,11 @@ _mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
 
    bufObj->Purgeable = GL_FALSE;
 
-   retval = GL_RETAINED_APPLE;
+   retval = option;
    if (ctx->Driver.RenderObjectUnpurgeable)
       retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option);
 
-   return option;
+   return retval;
 }
 
 
@@ -1940,7 +1940,7 @@ _mesa_TextureObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
 
    bufObj->Purgeable = GL_FALSE;
 
-   retval = GL_RETAINED_APPLE;
+   retval = option;
    if (ctx->Driver.TextureObjectUnpurgeable)
       retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option);
 
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 73126b9..1dc0c9c 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1358,6 +1358,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
       if (newCtx->FirstTimeCurrent) {
          _mesa_compute_version(newCtx);
 
+         newCtx->Extensions.String = _mesa_make_extension_string(newCtx);
+
          check_context_limits(newCtx);
 
          /* We can use this to help debug user's problems.  Tell them to set
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 51dd5f7..b9daaba 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -71,8 +71,6 @@ _mesa_GetString( GLenum name )
       case GL_VERSION:
          return (const GLubyte *) ctx->VersionString;
       case GL_EXTENSIONS:
-         if (!ctx->Extensions.String)
-            ctx->Extensions.String = _mesa_make_extension_string(ctx);
          return (const GLubyte *) ctx->Extensions.String;
 #if FEATURE_ARB_shading_language_100
       case GL_SHADING_LANGUAGE_VERSION_ARB:
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index b971cc9..db84de2 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -537,7 +537,7 @@ _mesa_update_state_locked( GLcontext *ctx )
 
    /* Determine which state flags effect vertex/fragment program state */
    if (ctx->FragmentProgram._MaintainTexEnvProgram) {
-      prog_flags |= (_NEW_TEXTURE | _NEW_FOG |
+      prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
 		     _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE |
 		     _NEW_PROGRAM);
    }
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 964ba13..df09c12 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -98,6 +98,7 @@ struct state_key {
    GLuint fog_enabled:1;
    GLuint fog_mode:2;          /**< FOG_x */
    GLuint inputs_available:12;
+   GLuint num_draw_buffers:4;
 
    /* NOTE: This array of structs must be last! (see "keySize" below) */
    struct {
@@ -485,6 +486,9 @@ static GLuint make_state_key( GLcontext *ctx,  struct state_key *key )
       inputs_referenced |= FRAG_BIT_FOGC; /* maybe */
    }
 
+   /* _NEW_BUFFERS */
+   key->num_draw_buffers = ctx->DrawBuffer->_NumColorDrawBuffers;
+
    key->inputs_available = (inputs_available & inputs_referenced);
 
    /* compute size of state key, ignoring unused texture units */
@@ -1199,11 +1203,14 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
    else
       alpha_saturate = GL_FALSE;
 
-   /* If this is the very last calculation, emit direct to output reg:
+   /* If this is the very last calculation (and various other conditions
+    * are met), emit directly to the color output register.  Otherwise,
+    * emit to a temporary register.
     */
    if (key->separate_specular ||
        unit != p->last_tex_stage ||
        alpha_shift ||
+       key->num_draw_buffers != 1 ||
        rgb_shift)
       dest = get_temp( p );
    else
@@ -1438,10 +1445,10 @@ create_new_program(GLcontext *ctx, struct state_key *key,
    p.program->Base.Parameters = _mesa_new_parameter_list();
    p.program->Base.InputsRead = 0x0;
 
-   if (ctx->DrawBuffer->_NumColorDrawBuffers == 1)
+   if (key->num_draw_buffers == 1)
       p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
    else {
-      for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++)
+      for (i = 0; i < key->num_draw_buffers; i++)
 	 p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i));
    }
 
@@ -1493,8 +1500,8 @@ create_new_program(GLcontext *ctx, struct state_key *key,
 
    cf = get_source( &p, SRC_PREVIOUS, 0 );
 
-   for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
-      if (ctx->DrawBuffer->_NumColorDrawBuffers == 1)
+   for (i = 0; i < key->num_draw_buffers; i++) {
+      if (key->num_draw_buffers == 1)
 	 out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
       else {
 	 out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i );
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 9955be2..af4e69f 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -34,8 +34,8 @@
 /* Mesa version */
 #define MESA_MAJOR 7
 #define MESA_MINOR 8
-#define MESA_PATCH 2
-#define MESA_VERSION_STRING "7.8.2"
+#define MESA_PATCH 3
+#define MESA_VERSION_STRING "7.8.3"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index 791e751..f265285 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -399,7 +399,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
    }
 
    if (isMatrix) {
-      /* load all four columns of matrix */
+      /* load all four rows (or columns) of matrix */
       GLint pos[4];
       GLuint j;
       for (j = 0; j < 4; j++) {
@@ -489,9 +489,26 @@ emit_statevars(const char *name, int array_len,
          tokens[0] = STATE_TEXGEN;
          tokens[2] = STATE_TEXGEN_OBJECT_Q;
       }
+      else if (strcmp(name, "gl_TextureMatrix") == 0) {
+         tokens[0] = STATE_TEXTURE_MATRIX;
+         tokens[4] = STATE_MATRIX_TRANSPOSE;
+      }
+      else if (strcmp(name, "gl_TextureMatrixInverse") == 0) {
+         tokens[0] = STATE_TEXTURE_MATRIX;
+         tokens[4] = STATE_MATRIX_INVTRANS;
+      }
+      else if (strcmp(name, "gl_TextureMatrixTranspose") == 0) {
+         tokens[0] = STATE_TEXTURE_MATRIX;
+         tokens[4] = 0;
+      }
+      else if (strcmp(name, "gl_TextureMatrixInverseTranspose") == 0) {
+         tokens[0] = STATE_TEXTURE_MATRIX;
+         tokens[4] = STATE_MATRIX_INVERSE;
+      }
       else {
          return -1; /* invalid array name */
       }
+      /* emit state vars for each array element */
       for (i = 0; i < array_len; i++) {
          GLint p;
          tokens[1] = i;
@@ -513,6 +530,19 @@ emit_statevars(const char *name, int array_len,
       }
       return pos;
    }
+   else if (type->type == SLANG_SPEC_MAT4) {
+      /* unroll/emit 4 array rows (or columns) */
+      slang_type_specifier vec4;
+      GLint i, p, pos = -1;
+      vec4.type = SLANG_SPEC_VEC4;
+      for (i = 0; i < 4; i++) {
+         tokens[2] = tokens[3] = i; /* row[i] (or column[i]) of matrix */
+         p = emit_statevars(NULL, 0, &vec4, tokens, paramList);
+         if (pos == -1)
+            pos = p;
+      }
+      return pos;
+   }
    else {
       GLint pos;
       assert(type->type == SLANG_SPEC_VEC4 ||
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 7c0ea0c..4155052 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -2362,7 +2362,10 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
 #if 0
       assert(!n->Store);
 #endif
-      n->Store = n->Children[1]->Store;
+      if (n->Children[1]->Store)
+         n->Store = n->Children[1]->Store;
+      else
+         n->Store = n->Children[0]->Store;
       return inst;
 
    case IR_SCOPE:
@@ -2370,6 +2373,7 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
       _slang_push_var_table(emitInfo->vt);
       inst = emit(emitInfo, n->Children[0]);
       _slang_pop_var_table(emitInfo->vt);
+      n->Store = n->Children[0]->Store;
       return inst;
 
    case IR_VAR_DECL:
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 5fcfa86..a64c561 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -1135,7 +1135,7 @@ st_destroy_drawpix(struct st_context *st)
    st_reference_fragprog(st, &st->drawpix.z_shader, NULL);
    st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
    if (st->drawpix.vert_shaders[0])
-      free(st->drawpix.vert_shaders[0]);
+      ureg_free_tokens(st->drawpix.vert_shaders[0]);
    if (st->drawpix.vert_shaders[1])
-      free(st->drawpix.vert_shaders[1]);
+      ureg_free_tokens(st->drawpix.vert_shaders[1]);
 }
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 00e9d1d..df5674d 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -460,26 +460,38 @@ static void
 st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
 {
    struct pipe_screen *screen = ctx->st->pipe->screen;
-   const struct gl_renderbuffer *depthRb =
-      fb->Attachment[BUFFER_DEPTH].Renderbuffer;
-   const struct gl_renderbuffer *stencilRb =
-      fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+   const struct gl_renderbuffer_attachment *depth =
+         &fb->Attachment[BUFFER_DEPTH];
+   const struct gl_renderbuffer_attachment *stencil =
+         &fb->Attachment[BUFFER_STENCIL];
    GLuint i;
 
-   if (stencilRb && depthRb && stencilRb != depthRb) {
+   if (depth->Type && stencil->Type && depth->Type != stencil->Type) {
+      fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+      return;
+   }
+   if (depth->Type == GL_RENDERBUFFER_EXT &&
+       stencil->Type == GL_RENDERBUFFER_EXT &&
+       depth->Renderbuffer != stencil->Renderbuffer) {
+      fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+      return;
+   }
+   if (depth->Type == GL_TEXTURE &&
+       stencil->Type == GL_TEXTURE &&
+       depth->Texture != stencil->Texture) {
       fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
       return;
    }
 
    if (!st_validate_attachment(screen,
-			       &fb->Attachment[BUFFER_DEPTH],
-			       PIPE_TEXTURE_USAGE_DEPTH_STENCIL)) {
+                               depth,
+                               PIPE_TEXTURE_USAGE_DEPTH_STENCIL)) {
       fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
       return;
    }
    if (!st_validate_attachment(screen,
-			       &fb->Attachment[BUFFER_STENCIL],
-			       PIPE_TEXTURE_USAGE_DEPTH_STENCIL)) {
+                               stencil,
+                               PIPE_TEXTURE_USAGE_DEPTH_STENCIL)) {
       fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
       return;
    }
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 952d9ce..7ff10d4 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -69,6 +69,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    ubyte *stmap;
    GLint j;
 
+   if (strb->Base.Wrapped) {
+      strb = st_renderbuffer(strb->Base.Wrapped);
+   }
+
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
       y = ctx->DrawBuffer->Height - y - height;
    }
@@ -366,6 +370,9 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
    }
    else if (format == GL_DEPTH_COMPONENT) {
       strb = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
+      if (strb->Base.Wrapped) {
+         strb = st_renderbuffer(strb->Base.Wrapped);
+      }
    }
    else {
       /* Read color buffer */
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index d7ef57e..d08af62 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -683,8 +683,12 @@ emit_adjusted_wpos( struct st_translate *t,
    struct ureg_dst wpos_temp = ureg_DECL_temporary(ureg);
    struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]];
 
-   ureg_ADD(ureg, ureg_writemask(wpos_temp, TGSI_WRITEMASK_X | TGSI_WRITEMASK_Y),
-		   wpos_input, ureg_imm1f(ureg, value));
+   /* Note that we bias X and Y and pass Z and W through unchanged.
+    * The shader might also use gl_FragCoord.w and .z.
+    */
+   ureg_ADD(ureg,
+            ureg_writemask(wpos_temp, TGSI_WRITEMASK_XYZW),
+            wpos_input, ureg_imm4f(ureg, value, value, 0.0f, 0.0f));
 
    t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp);
 }
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 687c8eb..32d4f52 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -971,6 +971,10 @@ shade_texture_span(GLcontext *ctx, SWspan *span)
       if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) {
          convert_color_type(span, GL_FLOAT, 0);
       }
+      else {
+         span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0];
+      }
+
       if (span->primitive != GL_POINT ||
 	  (span->interpMask & SPAN_RGBA) ||
 	  ctx->Point.PointSprite) {
@@ -1222,9 +1226,22 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
             GLchan rgbaSave[MAX_WIDTH][4];
             const GLuint fragOutput = multiFragOutputs ? buf : 0;
 
+            /* set span->array->rgba to colors for render buffer's datatype */
             if (rb->DataType != span->array->ChanType || fragOutput > 0) {
                convert_color_type(span, rb->DataType, fragOutput);
             }
+            else {
+               if (rb->DataType == GL_UNSIGNED_BYTE) {
+                  span->array->rgba = span->array->rgba8;
+               }
+               else if (rb->DataType == GL_UNSIGNED_SHORT) {
+                  span->array->rgba = (void *) span->array->rgba16;
+               }
+               else {
+                  span->array->rgba = (void *)
+                     span->array->attribs[FRAG_ATTRIB_COL0];
+               }
+            }
 
             if (!multiFragOutputs && numBuffers > 1) {
                /* save colors for second, third renderbuffer writes */
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index ebd1574..0fcb7c7 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -115,7 +115,7 @@ setup_vertex_format(GLcontext *ctx)
    GLboolean intColors = !ctx->FragmentProgram._Current
                       && !ctx->ATIFragmentShader._Enabled
                       && ctx->RenderMode == GL_RENDER
-                      && CHAN_TYPE == GL_UNSIGNED_BYTE;
+                      && CHAN_TYPE != GL_FLOAT;
 
    if (intColors != swsetup->intColors ||
        !RENDERINPUTS_EQUAL(tnl->render_inputs_bitset,
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index bad0d81..f22bc52 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -159,7 +159,7 @@ static void _swsetup_render_tri(GLcontext *ctx,
 }
 
 #define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b)
-#define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b)
+#define SS_SPEC(a,b) COPY_4V(a,b)
 #define SS_IND(a,b) (a = b)
 
 #define IND (0)