summaryrefslogtreecommitdiff
path: root/ddl/out/java/LambdaCube/IR/JSON.java
diff options
context:
space:
mode:
Diffstat (limited to 'ddl/out/java/LambdaCube/IR/JSON.java')
-rw-r--r--ddl/out/java/LambdaCube/IR/JSON.java1765
1 files changed, 1764 insertions, 1 deletions
diff --git a/ddl/out/java/LambdaCube/IR/JSON.java b/ddl/out/java/LambdaCube/IR/JSON.java
index a25af3d..953f675 100644
--- a/ddl/out/java/LambdaCube/IR/JSON.java
+++ b/ddl/out/java/LambdaCube/IR/JSON.java
@@ -1,11 +1,12 @@
1// generated file, do not modify! 1// generated file, do not modify!
2// 2016-03-21T14:06:54.700322000000Z 2// 2016-03-21T15:32:16.153401000000Z
3 3
4package LambdaCube.IR; 4package LambdaCube.IR;
5 5
6import java.util.ArrayList; 6import java.util.ArrayList;
7import java.util.HashMap; 7import java.util.HashMap;
8import java.util.Iterator; 8import java.util.Iterator;
9import java.util.Map;
9import org.json.*; 10import org.json.*;
10import RT.*; 11import RT.*;
11 12
@@ -1564,4 +1565,1766 @@ public class JSON {
1564 } 1565 }
1565 throw new Exception("unknown type"); 1566 throw new Exception("unknown type");
1566 } 1567 }
1568
1569 public static Object toJSON(Type type, Object rawObj) throws JSONException, Exception {
1570 switch (type) {
1571 case ArrayValue: {
1572 ArrayValue v = (ArrayValue)rawObj;
1573 JSONObject obj = new JSONObject();
1574 switch (v.tag) {
1575 case VBoolArray:
1576 obj.put("tag", "VBoolArray");
1577 {
1578 ArrayValue.VBoolArray_ tv = (ArrayValue.VBoolArray_)v;
1579 obj.put("arg0", toJSON(Type.Array_Bool,tv._0));
1580 }
1581 break;
1582 case VIntArray:
1583 obj.put("tag", "VIntArray");
1584 {
1585 ArrayValue.VIntArray_ tv = (ArrayValue.VIntArray_)v;
1586 obj.put("arg0", toJSON(Type.Array_Int32,tv._0));
1587 }
1588 break;
1589 case VWordArray:
1590 obj.put("tag", "VWordArray");
1591 {
1592 ArrayValue.VWordArray_ tv = (ArrayValue.VWordArray_)v;
1593 obj.put("arg0", toJSON(Type.Array_Word32,tv._0));
1594 }
1595 break;
1596 case VFloatArray:
1597 obj.put("tag", "VFloatArray");
1598 {
1599 ArrayValue.VFloatArray_ tv = (ArrayValue.VFloatArray_)v;
1600 obj.put("arg0", toJSON(Type.Array_Float,tv._0));
1601 }
1602 break;
1603 }
1604 return obj;
1605 }
1606 case Value: {
1607 Value v = (Value)rawObj;
1608 JSONObject obj = new JSONObject();
1609 switch (v.tag) {
1610 case VBool:
1611 obj.put("tag", "VBool");
1612 {
1613 Value.VBool_ tv = (Value.VBool_)v;
1614 obj.put("arg0", toJSON(Type.Bool,tv._0));
1615 }
1616 break;
1617 case VV2B:
1618 obj.put("tag", "VV2B");
1619 {
1620 Value.VV2B_ tv = (Value.VV2B_)v;
1621 obj.put("arg0", toJSON(Type.V2_Bool,tv._0));
1622 }
1623 break;
1624 case VV3B:
1625 obj.put("tag", "VV3B");
1626 {
1627 Value.VV3B_ tv = (Value.VV3B_)v;
1628 obj.put("arg0", toJSON(Type.V3_Bool,tv._0));
1629 }
1630 break;
1631 case VV4B:
1632 obj.put("tag", "VV4B");
1633 {
1634 Value.VV4B_ tv = (Value.VV4B_)v;
1635 obj.put("arg0", toJSON(Type.V4_Bool,tv._0));
1636 }
1637 break;
1638 case VWord:
1639 obj.put("tag", "VWord");
1640 {
1641 Value.VWord_ tv = (Value.VWord_)v;
1642 obj.put("arg0", toJSON(Type.Word32,tv._0));
1643 }
1644 break;
1645 case VV2U:
1646 obj.put("tag", "VV2U");
1647 {
1648 Value.VV2U_ tv = (Value.VV2U_)v;
1649 obj.put("arg0", toJSON(Type.V2_Word,tv._0));
1650 }
1651 break;
1652 case VV3U:
1653 obj.put("tag", "VV3U");
1654 {
1655 Value.VV3U_ tv = (Value.VV3U_)v;
1656 obj.put("arg0", toJSON(Type.V3_Word,tv._0));
1657 }
1658 break;
1659 case VV4U:
1660 obj.put("tag", "VV4U");
1661 {
1662 Value.VV4U_ tv = (Value.VV4U_)v;
1663 obj.put("arg0", toJSON(Type.V4_Word,tv._0));
1664 }
1665 break;
1666 case VInt:
1667 obj.put("tag", "VInt");
1668 {
1669 Value.VInt_ tv = (Value.VInt_)v;
1670 obj.put("arg0", toJSON(Type.Int32,tv._0));
1671 }
1672 break;
1673 case VV2I:
1674 obj.put("tag", "VV2I");
1675 {
1676 Value.VV2I_ tv = (Value.VV2I_)v;
1677 obj.put("arg0", toJSON(Type.V2_Int,tv._0));
1678 }
1679 break;
1680 case VV3I:
1681 obj.put("tag", "VV3I");
1682 {
1683 Value.VV3I_ tv = (Value.VV3I_)v;
1684 obj.put("arg0", toJSON(Type.V3_Int,tv._0));
1685 }
1686 break;
1687 case VV4I:
1688 obj.put("tag", "VV4I");
1689 {
1690 Value.VV4I_ tv = (Value.VV4I_)v;
1691 obj.put("arg0", toJSON(Type.V4_Int,tv._0));
1692 }
1693 break;
1694 case VFloat:
1695 obj.put("tag", "VFloat");
1696 {
1697 Value.VFloat_ tv = (Value.VFloat_)v;
1698 obj.put("arg0", toJSON(Type.Float,tv._0));
1699 }
1700 break;
1701 case VV2F:
1702 obj.put("tag", "VV2F");
1703 {
1704 Value.VV2F_ tv = (Value.VV2F_)v;
1705 obj.put("arg0", toJSON(Type.V2_Float,tv._0));
1706 }
1707 break;
1708 case VV3F:
1709 obj.put("tag", "VV3F");
1710 {
1711 Value.VV3F_ tv = (Value.VV3F_)v;
1712 obj.put("arg0", toJSON(Type.V3_Float,tv._0));
1713 }
1714 break;
1715 case VV4F:
1716 obj.put("tag", "VV4F");
1717 {
1718 Value.VV4F_ tv = (Value.VV4F_)v;
1719 obj.put("arg0", toJSON(Type.V4_Float,tv._0));
1720 }
1721 break;
1722 case VM22F:
1723 obj.put("tag", "VM22F");
1724 {
1725 Value.VM22F_ tv = (Value.VM22F_)v;
1726 obj.put("arg0", toJSON(Type.V2_V2_Float,tv._0));
1727 }
1728 break;
1729 case VM23F:
1730 obj.put("tag", "VM23F");
1731 {
1732 Value.VM23F_ tv = (Value.VM23F_)v;
1733 obj.put("arg0", toJSON(Type.V3_V2_Float,tv._0));
1734 }
1735 break;
1736 case VM24F:
1737 obj.put("tag", "VM24F");
1738 {
1739 Value.VM24F_ tv = (Value.VM24F_)v;
1740 obj.put("arg0", toJSON(Type.V4_V2_Float,tv._0));
1741 }
1742 break;
1743 case VM32F:
1744 obj.put("tag", "VM32F");
1745 {
1746 Value.VM32F_ tv = (Value.VM32F_)v;
1747 obj.put("arg0", toJSON(Type.V2_V3_Float,tv._0));
1748 }
1749 break;
1750 case VM33F:
1751 obj.put("tag", "VM33F");
1752 {
1753 Value.VM33F_ tv = (Value.VM33F_)v;
1754 obj.put("arg0", toJSON(Type.V3_V3_Float,tv._0));
1755 }
1756 break;
1757 case VM34F:
1758 obj.put("tag", "VM34F");
1759 {
1760 Value.VM34F_ tv = (Value.VM34F_)v;
1761 obj.put("arg0", toJSON(Type.V4_V3_Float,tv._0));
1762 }
1763 break;
1764 case VM42F:
1765 obj.put("tag", "VM42F");
1766 {
1767 Value.VM42F_ tv = (Value.VM42F_)v;
1768 obj.put("arg0", toJSON(Type.V2_V4_Float,tv._0));
1769 }
1770 break;
1771 case VM43F:
1772 obj.put("tag", "VM43F");
1773 {
1774 Value.VM43F_ tv = (Value.VM43F_)v;
1775 obj.put("arg0", toJSON(Type.V3_V4_Float,tv._0));
1776 }
1777 break;
1778 case VM44F:
1779 obj.put("tag", "VM44F");
1780 {
1781 Value.VM44F_ tv = (Value.VM44F_)v;
1782 obj.put("arg0", toJSON(Type.V4_V4_Float,tv._0));
1783 }
1784 break;
1785 }
1786 return obj;
1787 }
1788 case InputType: {
1789 InputType v = (InputType)rawObj;
1790 JSONObject obj = new JSONObject();
1791 switch (v.tag) {
1792 case Bool:
1793 obj.put("tag", "Bool");
1794 break;
1795 case V2B:
1796 obj.put("tag", "V2B");
1797 break;
1798 case V3B:
1799 obj.put("tag", "V3B");
1800 break;
1801 case V4B:
1802 obj.put("tag", "V4B");
1803 break;
1804 case Word:
1805 obj.put("tag", "Word");
1806 break;
1807 case V2U:
1808 obj.put("tag", "V2U");
1809 break;
1810 case V3U:
1811 obj.put("tag", "V3U");
1812 break;
1813 case V4U:
1814 obj.put("tag", "V4U");
1815 break;
1816 case Int:
1817 obj.put("tag", "Int");
1818 break;
1819 case V2I:
1820 obj.put("tag", "V2I");
1821 break;
1822 case V3I:
1823 obj.put("tag", "V3I");
1824 break;
1825 case V4I:
1826 obj.put("tag", "V4I");
1827 break;
1828 case Float:
1829 obj.put("tag", "Float");
1830 break;
1831 case V2F:
1832 obj.put("tag", "V2F");
1833 break;
1834 case V3F:
1835 obj.put("tag", "V3F");
1836 break;
1837 case V4F:
1838 obj.put("tag", "V4F");
1839 break;
1840 case M22F:
1841 obj.put("tag", "M22F");
1842 break;
1843 case M23F:
1844 obj.put("tag", "M23F");
1845 break;
1846 case M24F:
1847 obj.put("tag", "M24F");
1848 break;
1849 case M32F:
1850 obj.put("tag", "M32F");
1851 break;
1852 case M33F:
1853 obj.put("tag", "M33F");
1854 break;
1855 case M34F:
1856 obj.put("tag", "M34F");
1857 break;
1858 case M42F:
1859 obj.put("tag", "M42F");
1860 break;
1861 case M43F:
1862 obj.put("tag", "M43F");
1863 break;
1864 case M44F:
1865 obj.put("tag", "M44F");
1866 break;
1867 case STexture1D:
1868 obj.put("tag", "STexture1D");
1869 break;
1870 case STexture2D:
1871 obj.put("tag", "STexture2D");
1872 break;
1873 case STextureCube:
1874 obj.put("tag", "STextureCube");
1875 break;
1876 case STexture1DArray:
1877 obj.put("tag", "STexture1DArray");
1878 break;
1879 case STexture2DArray:
1880 obj.put("tag", "STexture2DArray");
1881 break;
1882 case STexture2DRect:
1883 obj.put("tag", "STexture2DRect");
1884 break;
1885 case FTexture1D:
1886 obj.put("tag", "FTexture1D");
1887 break;
1888 case FTexture2D:
1889 obj.put("tag", "FTexture2D");
1890 break;
1891 case FTexture3D:
1892 obj.put("tag", "FTexture3D");
1893 break;
1894 case FTextureCube:
1895 obj.put("tag", "FTextureCube");
1896 break;
1897 case FTexture1DArray:
1898 obj.put("tag", "FTexture1DArray");
1899 break;
1900 case FTexture2DArray:
1901 obj.put("tag", "FTexture2DArray");
1902 break;
1903 case FTexture2DMS:
1904 obj.put("tag", "FTexture2DMS");
1905 break;
1906 case FTexture2DMSArray:
1907 obj.put("tag", "FTexture2DMSArray");
1908 break;
1909 case FTextureBuffer:
1910 obj.put("tag", "FTextureBuffer");
1911 break;
1912 case FTexture2DRect:
1913 obj.put("tag", "FTexture2DRect");
1914 break;
1915 case ITexture1D:
1916 obj.put("tag", "ITexture1D");
1917 break;
1918 case ITexture2D:
1919 obj.put("tag", "ITexture2D");
1920 break;
1921 case ITexture3D:
1922 obj.put("tag", "ITexture3D");
1923 break;
1924 case ITextureCube:
1925 obj.put("tag", "ITextureCube");
1926 break;
1927 case ITexture1DArray:
1928 obj.put("tag", "ITexture1DArray");
1929 break;
1930 case ITexture2DArray:
1931 obj.put("tag", "ITexture2DArray");
1932 break;
1933 case ITexture2DMS:
1934 obj.put("tag", "ITexture2DMS");
1935 break;
1936 case ITexture2DMSArray:
1937 obj.put("tag", "ITexture2DMSArray");
1938 break;
1939 case ITextureBuffer:
1940 obj.put("tag", "ITextureBuffer");
1941 break;
1942 case ITexture2DRect:
1943 obj.put("tag", "ITexture2DRect");
1944 break;
1945 case UTexture1D:
1946 obj.put("tag", "UTexture1D");
1947 break;
1948 case UTexture2D:
1949 obj.put("tag", "UTexture2D");
1950 break;
1951 case UTexture3D:
1952 obj.put("tag", "UTexture3D");
1953 break;
1954 case UTextureCube:
1955 obj.put("tag", "UTextureCube");
1956 break;
1957 case UTexture1DArray:
1958 obj.put("tag", "UTexture1DArray");
1959 break;
1960 case UTexture2DArray:
1961 obj.put("tag", "UTexture2DArray");
1962 break;
1963 case UTexture2DMS:
1964 obj.put("tag", "UTexture2DMS");
1965 break;
1966 case UTexture2DMSArray:
1967 obj.put("tag", "UTexture2DMSArray");
1968 break;
1969 case UTextureBuffer:
1970 obj.put("tag", "UTextureBuffer");
1971 break;
1972 case UTexture2DRect:
1973 obj.put("tag", "UTexture2DRect");
1974 break;
1975 }
1976 return obj;
1977 }
1978 case PointSpriteCoordOrigin: {
1979 PointSpriteCoordOrigin v = (PointSpriteCoordOrigin)rawObj;
1980 JSONObject obj = new JSONObject();
1981 switch (v.tag) {
1982 case LowerLeft:
1983 obj.put("tag", "LowerLeft");
1984 break;
1985 case UpperLeft:
1986 obj.put("tag", "UpperLeft");
1987 break;
1988 }
1989 return obj;
1990 }
1991 case PointSize: {
1992 PointSize v = (PointSize)rawObj;
1993 JSONObject obj = new JSONObject();
1994 switch (v.tag) {
1995 case PointSize:
1996 obj.put("tag", "PointSize");
1997 {
1998 PointSize.PointSize_ tv = (PointSize.PointSize_)v;
1999 obj.put("arg0", toJSON(Type.Float,tv._0));
2000 }
2001 break;
2002 case ProgramPointSize:
2003 obj.put("tag", "ProgramPointSize");
2004 break;
2005 }
2006 return obj;
2007 }
2008 case PolygonOffset: {
2009 PolygonOffset v = (PolygonOffset)rawObj;
2010 JSONObject obj = new JSONObject();
2011 switch (v.tag) {
2012 case NoOffset:
2013 obj.put("tag", "NoOffset");
2014 break;
2015 case Offset:
2016 obj.put("tag", "Offset");
2017 {
2018 PolygonOffset.Offset_ tv = (PolygonOffset.Offset_)v;
2019 obj.put("arg0", toJSON(Type.Float,tv._0));
2020 obj.put("arg1", toJSON(Type.Float,tv._1));
2021 }
2022 break;
2023 }
2024 return obj;
2025 }
2026 case FrontFace: {
2027 FrontFace v = (FrontFace)rawObj;
2028 JSONObject obj = new JSONObject();
2029 switch (v.tag) {
2030 case CCW:
2031 obj.put("tag", "CCW");
2032 break;
2033 case CW:
2034 obj.put("tag", "CW");
2035 break;
2036 }
2037 return obj;
2038 }
2039 case PolygonMode: {
2040 PolygonMode v = (PolygonMode)rawObj;
2041 JSONObject obj = new JSONObject();
2042 switch (v.tag) {
2043 case PolygonPoint:
2044 obj.put("tag", "PolygonPoint");
2045 {
2046 PolygonMode.PolygonPoint_ tv = (PolygonMode.PolygonPoint_)v;
2047 obj.put("arg0", toJSON(Type.PointSize,tv._0));
2048 }
2049 break;
2050 case PolygonLine:
2051 obj.put("tag", "PolygonLine");
2052 {
2053 PolygonMode.PolygonLine_ tv = (PolygonMode.PolygonLine_)v;
2054 obj.put("arg0", toJSON(Type.Float,tv._0));
2055 }
2056 break;
2057 case PolygonFill:
2058 obj.put("tag", "PolygonFill");
2059 break;
2060 }
2061 return obj;
2062 }
2063 case ProvokingVertex: {
2064 ProvokingVertex v = (ProvokingVertex)rawObj;
2065 JSONObject obj = new JSONObject();
2066 switch (v.tag) {
2067 case FirstVertex:
2068 obj.put("tag", "FirstVertex");
2069 break;
2070 case LastVertex:
2071 obj.put("tag", "LastVertex");
2072 break;
2073 }
2074 return obj;
2075 }
2076 case CullMode: {
2077 CullMode v = (CullMode)rawObj;
2078 JSONObject obj = new JSONObject();
2079 switch (v.tag) {
2080 case CullNone:
2081 obj.put("tag", "CullNone");
2082 break;
2083 case CullFront:
2084 obj.put("tag", "CullFront");
2085 {
2086 CullMode.CullFront_ tv = (CullMode.CullFront_)v;
2087 obj.put("arg0", toJSON(Type.FrontFace,tv._0));
2088 }
2089 break;
2090 case CullBack:
2091 obj.put("tag", "CullBack");
2092 {
2093 CullMode.CullBack_ tv = (CullMode.CullBack_)v;
2094 obj.put("arg0", toJSON(Type.FrontFace,tv._0));
2095 }
2096 break;
2097 }
2098 return obj;
2099 }
2100 case ComparisonFunction: {
2101 ComparisonFunction v = (ComparisonFunction)rawObj;
2102 JSONObject obj = new JSONObject();
2103 switch (v.tag) {
2104 case Never:
2105 obj.put("tag", "Never");
2106 break;
2107 case Less:
2108 obj.put("tag", "Less");
2109 break;
2110 case Equal:
2111 obj.put("tag", "Equal");
2112 break;
2113 case Lequal:
2114 obj.put("tag", "Lequal");
2115 break;
2116 case Greater:
2117 obj.put("tag", "Greater");
2118 break;
2119 case Notequal:
2120 obj.put("tag", "Notequal");
2121 break;
2122 case Gequal:
2123 obj.put("tag", "Gequal");
2124 break;
2125 case Always:
2126 obj.put("tag", "Always");
2127 break;
2128 }
2129 return obj;
2130 }
2131 case StencilOperation: {
2132 StencilOperation v = (StencilOperation)rawObj;
2133 JSONObject obj = new JSONObject();
2134 switch (v.tag) {
2135 case OpZero:
2136 obj.put("tag", "OpZero");
2137 break;
2138 case OpKeep:
2139 obj.put("tag", "OpKeep");
2140 break;
2141 case OpReplace:
2142 obj.put("tag", "OpReplace");
2143 break;
2144 case OpIncr:
2145 obj.put("tag", "OpIncr");
2146 break;
2147 case OpIncrWrap:
2148 obj.put("tag", "OpIncrWrap");
2149 break;
2150 case OpDecr:
2151 obj.put("tag", "OpDecr");
2152 break;
2153 case OpDecrWrap:
2154 obj.put("tag", "OpDecrWrap");
2155 break;
2156 case OpInvert:
2157 obj.put("tag", "OpInvert");
2158 break;
2159 }
2160 return obj;
2161 }
2162 case BlendEquation: {
2163 BlendEquation v = (BlendEquation)rawObj;
2164 JSONObject obj = new JSONObject();
2165 switch (v.tag) {
2166 case FuncAdd:
2167 obj.put("tag", "FuncAdd");
2168 break;
2169 case FuncSubtract:
2170 obj.put("tag", "FuncSubtract");
2171 break;
2172 case FuncReverseSubtract:
2173 obj.put("tag", "FuncReverseSubtract");
2174 break;
2175 case Min:
2176 obj.put("tag", "Min");
2177 break;
2178 case Max:
2179 obj.put("tag", "Max");
2180 break;
2181 }
2182 return obj;
2183 }
2184 case BlendingFactor: {
2185 BlendingFactor v = (BlendingFactor)rawObj;
2186 JSONObject obj = new JSONObject();
2187 switch (v.tag) {
2188 case Zero:
2189 obj.put("tag", "Zero");
2190 break;
2191 case One:
2192 obj.put("tag", "One");
2193 break;
2194 case SrcColor:
2195 obj.put("tag", "SrcColor");
2196 break;
2197 case OneMinusSrcColor:
2198 obj.put("tag", "OneMinusSrcColor");
2199 break;
2200 case DstColor:
2201 obj.put("tag", "DstColor");
2202 break;
2203 case OneMinusDstColor:
2204 obj.put("tag", "OneMinusDstColor");
2205 break;
2206 case SrcAlpha:
2207 obj.put("tag", "SrcAlpha");
2208 break;
2209 case OneMinusSrcAlpha:
2210 obj.put("tag", "OneMinusSrcAlpha");
2211 break;
2212 case DstAlpha:
2213 obj.put("tag", "DstAlpha");
2214 break;
2215 case OneMinusDstAlpha:
2216 obj.put("tag", "OneMinusDstAlpha");
2217 break;
2218 case ConstantColor:
2219 obj.put("tag", "ConstantColor");
2220 break;
2221 case OneMinusConstantColor:
2222 obj.put("tag", "OneMinusConstantColor");
2223 break;
2224 case ConstantAlpha:
2225 obj.put("tag", "ConstantAlpha");
2226 break;
2227 case OneMinusConstantAlpha:
2228 obj.put("tag", "OneMinusConstantAlpha");
2229 break;
2230 case SrcAlphaSaturate:
2231 obj.put("tag", "SrcAlphaSaturate");
2232 break;
2233 }
2234 return obj;
2235 }
2236 case LogicOperation: {
2237 LogicOperation v = (LogicOperation)rawObj;
2238 JSONObject obj = new JSONObject();
2239 switch (v.tag) {
2240 case Clear:
2241 obj.put("tag", "Clear");
2242 break;
2243 case And:
2244 obj.put("tag", "And");
2245 break;
2246 case AndReverse:
2247 obj.put("tag", "AndReverse");
2248 break;
2249 case Copy:
2250 obj.put("tag", "Copy");
2251 break;
2252 case AndInverted:
2253 obj.put("tag", "AndInverted");
2254 break;
2255 case Noop:
2256 obj.put("tag", "Noop");
2257 break;
2258 case Xor:
2259 obj.put("tag", "Xor");
2260 break;
2261 case Or:
2262 obj.put("tag", "Or");
2263 break;
2264 case Nor:
2265 obj.put("tag", "Nor");
2266 break;
2267 case Equiv:
2268 obj.put("tag", "Equiv");
2269 break;
2270 case Invert:
2271 obj.put("tag", "Invert");
2272 break;
2273 case OrReverse:
2274 obj.put("tag", "OrReverse");
2275 break;
2276 case CopyInverted:
2277 obj.put("tag", "CopyInverted");
2278 break;
2279 case OrInverted:
2280 obj.put("tag", "OrInverted");
2281 break;
2282 case Nand:
2283 obj.put("tag", "Nand");
2284 break;
2285 case Set:
2286 obj.put("tag", "Set");
2287 break;
2288 }
2289 return obj;
2290 }
2291 case StencilOps: {
2292 StencilOps v = (StencilOps)rawObj;
2293 JSONObject obj = new JSONObject();
2294 switch (v.tag) {
2295 case StencilOps:
2296 obj.put("tag", "StencilOps");
2297 {
2298 StencilOps.StencilOps_ tv = (StencilOps.StencilOps_)v;
2299 obj.put("frontStencilOp", toJSON(Type.StencilOperation,tv.frontStencilOp));
2300 obj.put("backStencilOp", toJSON(Type.StencilOperation,tv.backStencilOp));
2301 }
2302 break;
2303 }
2304 return obj;
2305 }
2306 case StencilTest: {
2307 StencilTest v = (StencilTest)rawObj;
2308 JSONObject obj = new JSONObject();
2309 switch (v.tag) {
2310 case StencilTest:
2311 obj.put("tag", "StencilTest");
2312 {
2313 StencilTest.StencilTest_ tv = (StencilTest.StencilTest_)v;
2314 obj.put("stencilComparision", toJSON(Type.ComparisonFunction,tv.stencilComparision));
2315 obj.put("stencilReference", toJSON(Type.Int32,tv.stencilReference));
2316 obj.put("stencilMask", toJSON(Type.Word32,tv.stencilMask));
2317 }
2318 break;
2319 }
2320 return obj;
2321 }
2322 case StencilTests: {
2323 StencilTests v = (StencilTests)rawObj;
2324 JSONObject obj = new JSONObject();
2325 switch (v.tag) {
2326 case StencilTests:
2327 obj.put("tag", "StencilTests");
2328 {
2329 StencilTests.StencilTests_ tv = (StencilTests.StencilTests_)v;
2330 obj.put("arg0", toJSON(Type.StencilTest,tv._0));
2331 obj.put("arg1", toJSON(Type.StencilTest,tv._1));
2332 }
2333 break;
2334 }
2335 return obj;
2336 }
2337 case FetchPrimitive: {
2338 FetchPrimitive v = (FetchPrimitive)rawObj;
2339 JSONObject obj = new JSONObject();
2340 switch (v.tag) {
2341 case Points:
2342 obj.put("tag", "Points");
2343 break;
2344 case Lines:
2345 obj.put("tag", "Lines");
2346 break;
2347 case Triangles:
2348 obj.put("tag", "Triangles");
2349 break;
2350 case LinesAdjacency:
2351 obj.put("tag", "LinesAdjacency");
2352 break;
2353 case TrianglesAdjacency:
2354 obj.put("tag", "TrianglesAdjacency");
2355 break;
2356 }
2357 return obj;
2358 }
2359 case OutputPrimitive: {
2360 OutputPrimitive v = (OutputPrimitive)rawObj;
2361 JSONObject obj = new JSONObject();
2362 switch (v.tag) {
2363 case TrianglesOutput:
2364 obj.put("tag", "TrianglesOutput");
2365 break;
2366 case LinesOutput:
2367 obj.put("tag", "LinesOutput");
2368 break;
2369 case PointsOutput:
2370 obj.put("tag", "PointsOutput");
2371 break;
2372 }
2373 return obj;
2374 }
2375 case ColorArity: {
2376 ColorArity v = (ColorArity)rawObj;
2377 JSONObject obj = new JSONObject();
2378 switch (v.tag) {
2379 case Red:
2380 obj.put("tag", "Red");
2381 break;
2382 case RG:
2383 obj.put("tag", "RG");
2384 break;
2385 case RGB:
2386 obj.put("tag", "RGB");
2387 break;
2388 case RGBA:
2389 obj.put("tag", "RGBA");
2390 break;
2391 }
2392 return obj;
2393 }
2394 case Blending: {
2395 Blending v = (Blending)rawObj;
2396 JSONObject obj = new JSONObject();
2397 switch (v.tag) {
2398 case NoBlending:
2399 obj.put("tag", "NoBlending");
2400 break;
2401 case BlendLogicOp:
2402 obj.put("tag", "BlendLogicOp");
2403 {
2404 Blending.BlendLogicOp_ tv = (Blending.BlendLogicOp_)v;
2405 obj.put("arg0", toJSON(Type.LogicOperation,tv._0));
2406 }
2407 break;
2408 case Blend:
2409 obj.put("tag", "Blend");
2410 {
2411 Blending.Blend_ tv = (Blending.Blend_)v;
2412 obj.put("colorEqSrc", toJSON(Type.BlendEquation,tv.colorEqSrc));
2413 obj.put("alphaEqSrc", toJSON(Type.BlendEquation,tv.alphaEqSrc));
2414 obj.put("colorFSrc", toJSON(Type.BlendingFactor,tv.colorFSrc));
2415 obj.put("colorFDst", toJSON(Type.BlendingFactor,tv.colorFDst));
2416 obj.put("alphaFSrc", toJSON(Type.BlendingFactor,tv.alphaFSrc));
2417 obj.put("alphaFDst", toJSON(Type.BlendingFactor,tv.alphaFDst));
2418 obj.put("color", toJSON(Type.V4_Float,tv.color));
2419 }
2420 break;
2421 }
2422 return obj;
2423 }
2424 case RasterContext: {
2425 RasterContext v = (RasterContext)rawObj;
2426 JSONObject obj = new JSONObject();
2427 switch (v.tag) {
2428 case PointCtx:
2429 obj.put("tag", "PointCtx");
2430 {
2431 RasterContext.PointCtx_ tv = (RasterContext.PointCtx_)v;
2432 obj.put("arg0", toJSON(Type.PointSize,tv._0));
2433 obj.put("arg1", toJSON(Type.Float,tv._1));
2434 obj.put("arg2", toJSON(Type.PointSpriteCoordOrigin,tv._2));
2435 }
2436 break;
2437 case LineCtx:
2438 obj.put("tag", "LineCtx");
2439 {
2440 RasterContext.LineCtx_ tv = (RasterContext.LineCtx_)v;
2441 obj.put("arg0", toJSON(Type.Float,tv._0));
2442 obj.put("arg1", toJSON(Type.ProvokingVertex,tv._1));
2443 }
2444 break;
2445 case TriangleCtx:
2446 obj.put("tag", "TriangleCtx");
2447 {
2448 RasterContext.TriangleCtx_ tv = (RasterContext.TriangleCtx_)v;
2449 obj.put("arg0", toJSON(Type.CullMode,tv._0));
2450 obj.put("arg1", toJSON(Type.PolygonMode,tv._1));
2451 obj.put("arg2", toJSON(Type.PolygonOffset,tv._2));
2452 obj.put("arg3", toJSON(Type.ProvokingVertex,tv._3));
2453 }
2454 break;
2455 }
2456 return obj;
2457 }
2458 case FragmentOperation: {
2459 FragmentOperation v = (FragmentOperation)rawObj;
2460 JSONObject obj = new JSONObject();
2461 switch (v.tag) {
2462 case DepthOp:
2463 obj.put("tag", "DepthOp");
2464 {
2465 FragmentOperation.DepthOp_ tv = (FragmentOperation.DepthOp_)v;
2466 obj.put("arg0", toJSON(Type.ComparisonFunction,tv._0));
2467 obj.put("arg1", toJSON(Type.Bool,tv._1));
2468 }
2469 break;
2470 case StencilOp:
2471 obj.put("tag", "StencilOp");
2472 {
2473 FragmentOperation.StencilOp_ tv = (FragmentOperation.StencilOp_)v;
2474 obj.put("arg0", toJSON(Type.StencilTests,tv._0));
2475 obj.put("arg1", toJSON(Type.StencilOps,tv._1));
2476 obj.put("arg2", toJSON(Type.StencilOps,tv._2));
2477 }
2478 break;
2479 case ColorOp:
2480 obj.put("tag", "ColorOp");
2481 {
2482 FragmentOperation.ColorOp_ tv = (FragmentOperation.ColorOp_)v;
2483 obj.put("arg0", toJSON(Type.Blending,tv._0));
2484 obj.put("arg1", toJSON(Type.Value,tv._1));
2485 }
2486 break;
2487 }
2488 return obj;
2489 }
2490 case AccumulationContext: {
2491 AccumulationContext v = (AccumulationContext)rawObj;
2492 JSONObject obj = new JSONObject();
2493 switch (v.tag) {
2494 case AccumulationContext:
2495 obj.put("tag", "AccumulationContext");
2496 {
2497 AccumulationContext.AccumulationContext_ tv = (AccumulationContext.AccumulationContext_)v;
2498 obj.put("accViewportName", toJSON(Type.Maybe_String,tv.accViewportName));
2499 obj.put("accOperations", toJSON(Type.List_FragmentOperation,tv.accOperations));
2500 }
2501 break;
2502 }
2503 return obj;
2504 }
2505 case TextureDataType: {
2506 TextureDataType v = (TextureDataType)rawObj;
2507 JSONObject obj = new JSONObject();
2508 switch (v.tag) {
2509 case FloatT:
2510 obj.put("tag", "FloatT");
2511 {
2512 TextureDataType.FloatT_ tv = (TextureDataType.FloatT_)v;
2513 obj.put("arg0", toJSON(Type.ColorArity,tv._0));
2514 }
2515 break;
2516 case IntT:
2517 obj.put("tag", "IntT");
2518 {
2519 TextureDataType.IntT_ tv = (TextureDataType.IntT_)v;
2520 obj.put("arg0", toJSON(Type.ColorArity,tv._0));
2521 }
2522 break;
2523 case WordT:
2524 obj.put("tag", "WordT");
2525 {
2526 TextureDataType.WordT_ tv = (TextureDataType.WordT_)v;
2527 obj.put("arg0", toJSON(Type.ColorArity,tv._0));
2528 }
2529 break;
2530 case ShadowT:
2531 obj.put("tag", "ShadowT");
2532 break;
2533 }
2534 return obj;
2535 }
2536 case TextureType: {
2537 TextureType v = (TextureType)rawObj;
2538 JSONObject obj = new JSONObject();
2539 switch (v.tag) {
2540 case Texture1D:
2541 obj.put("tag", "Texture1D");
2542 {
2543 TextureType.Texture1D_ tv = (TextureType.Texture1D_)v;
2544 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2545 obj.put("arg1", toJSON(Type.Int,tv._1));
2546 }
2547 break;
2548 case Texture2D:
2549 obj.put("tag", "Texture2D");
2550 {
2551 TextureType.Texture2D_ tv = (TextureType.Texture2D_)v;
2552 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2553 obj.put("arg1", toJSON(Type.Int,tv._1));
2554 }
2555 break;
2556 case Texture3D:
2557 obj.put("tag", "Texture3D");
2558 {
2559 TextureType.Texture3D_ tv = (TextureType.Texture3D_)v;
2560 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2561 }
2562 break;
2563 case TextureCube:
2564 obj.put("tag", "TextureCube");
2565 {
2566 TextureType.TextureCube_ tv = (TextureType.TextureCube_)v;
2567 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2568 }
2569 break;
2570 case TextureRect:
2571 obj.put("tag", "TextureRect");
2572 {
2573 TextureType.TextureRect_ tv = (TextureType.TextureRect_)v;
2574 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2575 }
2576 break;
2577 case Texture2DMS:
2578 obj.put("tag", "Texture2DMS");
2579 {
2580 TextureType.Texture2DMS_ tv = (TextureType.Texture2DMS_)v;
2581 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2582 obj.put("arg1", toJSON(Type.Int,tv._1));
2583 obj.put("arg2", toJSON(Type.Int,tv._2));
2584 obj.put("arg3", toJSON(Type.Bool,tv._3));
2585 }
2586 break;
2587 case TextureBuffer:
2588 obj.put("tag", "TextureBuffer");
2589 {
2590 TextureType.TextureBuffer_ tv = (TextureType.TextureBuffer_)v;
2591 obj.put("arg0", toJSON(Type.TextureDataType,tv._0));
2592 }
2593 break;
2594 }
2595 return obj;
2596 }
2597 case MipMap: {
2598 MipMap v = (MipMap)rawObj;
2599 JSONObject obj = new JSONObject();
2600 switch (v.tag) {
2601 case Mip:
2602 obj.put("tag", "Mip");
2603 {
2604 MipMap.Mip_ tv = (MipMap.Mip_)v;
2605 obj.put("arg0", toJSON(Type.Int,tv._0));
2606 obj.put("arg1", toJSON(Type.Int,tv._1));
2607 }
2608 break;
2609 case NoMip:
2610 obj.put("tag", "NoMip");
2611 break;
2612 case AutoMip:
2613 obj.put("tag", "AutoMip");
2614 {
2615 MipMap.AutoMip_ tv = (MipMap.AutoMip_)v;
2616 obj.put("arg0", toJSON(Type.Int,tv._0));
2617 obj.put("arg1", toJSON(Type.Int,tv._1));
2618 }
2619 break;
2620 }
2621 return obj;
2622 }
2623 case Filter: {
2624 Filter v = (Filter)rawObj;
2625 JSONObject obj = new JSONObject();
2626 switch (v.tag) {
2627 case Nearest:
2628 obj.put("tag", "Nearest");
2629 break;
2630 case Linear:
2631 obj.put("tag", "Linear");
2632 break;
2633 case NearestMipmapNearest:
2634 obj.put("tag", "NearestMipmapNearest");
2635 break;
2636 case NearestMipmapLinear:
2637 obj.put("tag", "NearestMipmapLinear");
2638 break;
2639 case LinearMipmapNearest:
2640 obj.put("tag", "LinearMipmapNearest");
2641 break;
2642 case LinearMipmapLinear:
2643 obj.put("tag", "LinearMipmapLinear");
2644 break;
2645 }
2646 return obj;
2647 }
2648 case EdgeMode: {
2649 EdgeMode v = (EdgeMode)rawObj;
2650 JSONObject obj = new JSONObject();
2651 switch (v.tag) {
2652 case Repeat:
2653 obj.put("tag", "Repeat");
2654 break;
2655 case MirroredRepeat:
2656 obj.put("tag", "MirroredRepeat");
2657 break;
2658 case ClampToEdge:
2659 obj.put("tag", "ClampToEdge");
2660 break;
2661 case ClampToBorder:
2662 obj.put("tag", "ClampToBorder");
2663 break;
2664 }
2665 return obj;
2666 }
2667 case ImageSemantic: {
2668 ImageSemantic v = (ImageSemantic)rawObj;
2669 JSONObject obj = new JSONObject();
2670 switch (v.tag) {
2671 case Depth:
2672 obj.put("tag", "Depth");
2673 break;
2674 case Stencil:
2675 obj.put("tag", "Stencil");
2676 break;
2677 case Color:
2678 obj.put("tag", "Color");
2679 break;
2680 }
2681 return obj;
2682 }
2683 case ImageRef: {
2684 ImageRef v = (ImageRef)rawObj;
2685 JSONObject obj = new JSONObject();
2686 switch (v.tag) {
2687 case TextureImage:
2688 obj.put("tag", "TextureImage");
2689 {
2690 ImageRef.TextureImage_ tv = (ImageRef.TextureImage_)v;
2691 obj.put("arg0", toJSON(Type.Int,tv._0));
2692 obj.put("arg1", toJSON(Type.Int,tv._1));
2693 obj.put("arg2", toJSON(Type.Maybe_Int,tv._2));
2694 }
2695 break;
2696 case Framebuffer:
2697 obj.put("tag", "Framebuffer");
2698 {
2699 ImageRef.Framebuffer_ tv = (ImageRef.Framebuffer_)v;
2700 obj.put("arg0", toJSON(Type.ImageSemantic,tv._0));
2701 }
2702 break;
2703 }
2704 return obj;
2705 }
2706 case ClearImage: {
2707 ClearImage v = (ClearImage)rawObj;
2708 JSONObject obj = new JSONObject();
2709 switch (v.tag) {
2710 case ClearImage:
2711 obj.put("tag", "ClearImage");
2712 {
2713 ClearImage.ClearImage_ tv = (ClearImage.ClearImage_)v;
2714 obj.put("imageSemantic", toJSON(Type.ImageSemantic,tv.imageSemantic));
2715 obj.put("clearValue", toJSON(Type.Value,tv.clearValue));
2716 }
2717 break;
2718 }
2719 return obj;
2720 }
2721 case Command: {
2722 Command v = (Command)rawObj;
2723 JSONObject obj = new JSONObject();
2724 switch (v.tag) {
2725 case SetRasterContext:
2726 obj.put("tag", "SetRasterContext");
2727 {
2728 Command.SetRasterContext_ tv = (Command.SetRasterContext_)v;
2729 obj.put("arg0", toJSON(Type.RasterContext,tv._0));
2730 }
2731 break;
2732 case SetAccumulationContext:
2733 obj.put("tag", "SetAccumulationContext");
2734 {
2735 Command.SetAccumulationContext_ tv = (Command.SetAccumulationContext_)v;
2736 obj.put("arg0", toJSON(Type.AccumulationContext,tv._0));
2737 }
2738 break;
2739 case SetRenderTarget:
2740 obj.put("tag", "SetRenderTarget");
2741 {
2742 Command.SetRenderTarget_ tv = (Command.SetRenderTarget_)v;
2743 obj.put("arg0", toJSON(Type.Int,tv._0));
2744 }
2745 break;
2746 case SetProgram:
2747 obj.put("tag", "SetProgram");
2748 {
2749 Command.SetProgram_ tv = (Command.SetProgram_)v;
2750 obj.put("arg0", toJSON(Type.Int,tv._0));
2751 }
2752 break;
2753 case SetSamplerUniform:
2754 obj.put("tag", "SetSamplerUniform");
2755 {
2756 Command.SetSamplerUniform_ tv = (Command.SetSamplerUniform_)v;
2757 obj.put("arg0", toJSON(Type.String,tv._0));
2758 obj.put("arg1", toJSON(Type.Int,tv._1));
2759 }
2760 break;
2761 case SetTexture:
2762 obj.put("tag", "SetTexture");
2763 {
2764 Command.SetTexture_ tv = (Command.SetTexture_)v;
2765 obj.put("arg0", toJSON(Type.Int,tv._0));
2766 obj.put("arg1", toJSON(Type.Int,tv._1));
2767 }
2768 break;
2769 case SetSampler:
2770 obj.put("tag", "SetSampler");
2771 {
2772 Command.SetSampler_ tv = (Command.SetSampler_)v;
2773 obj.put("arg0", toJSON(Type.Int,tv._0));
2774 obj.put("arg1", toJSON(Type.Maybe_Int,tv._1));
2775 }
2776 break;
2777 case RenderSlot:
2778 obj.put("tag", "RenderSlot");
2779 {
2780 Command.RenderSlot_ tv = (Command.RenderSlot_)v;
2781 obj.put("arg0", toJSON(Type.Int,tv._0));
2782 }
2783 break;
2784 case RenderStream:
2785 obj.put("tag", "RenderStream");
2786 {
2787 Command.RenderStream_ tv = (Command.RenderStream_)v;
2788 obj.put("arg0", toJSON(Type.Int,tv._0));
2789 }
2790 break;
2791 case ClearRenderTarget:
2792 obj.put("tag", "ClearRenderTarget");
2793 {
2794 Command.ClearRenderTarget_ tv = (Command.ClearRenderTarget_)v;
2795 obj.put("arg0", toJSON(Type.Array_ClearImage,tv._0));
2796 }
2797 break;
2798 case GenerateMipMap:
2799 obj.put("tag", "GenerateMipMap");
2800 {
2801 Command.GenerateMipMap_ tv = (Command.GenerateMipMap_)v;
2802 obj.put("arg0", toJSON(Type.Int,tv._0));
2803 }
2804 break;
2805 case SaveImage:
2806 obj.put("tag", "SaveImage");
2807 {
2808 Command.SaveImage_ tv = (Command.SaveImage_)v;
2809 obj.put("arg0", toJSON(Type.Int,tv._0));
2810 obj.put("arg1", toJSON(Type.ImageRef,tv._1));
2811 }
2812 break;
2813 case LoadImage:
2814 obj.put("tag", "LoadImage");
2815 {
2816 Command.LoadImage_ tv = (Command.LoadImage_)v;
2817 obj.put("arg0", toJSON(Type.ImageRef,tv._0));
2818 obj.put("arg1", toJSON(Type.Int,tv._1));
2819 }
2820 break;
2821 }
2822 return obj;
2823 }
2824 case SamplerDescriptor: {
2825 SamplerDescriptor v = (SamplerDescriptor)rawObj;
2826 JSONObject obj = new JSONObject();
2827 switch (v.tag) {
2828 case SamplerDescriptor:
2829 obj.put("tag", "SamplerDescriptor");
2830 {
2831 SamplerDescriptor.SamplerDescriptor_ tv = (SamplerDescriptor.SamplerDescriptor_)v;
2832 obj.put("samplerWrapS", toJSON(Type.EdgeMode,tv.samplerWrapS));
2833 obj.put("samplerWrapT", toJSON(Type.Maybe_EdgeMode,tv.samplerWrapT));
2834 obj.put("samplerWrapR", toJSON(Type.Maybe_EdgeMode,tv.samplerWrapR));
2835 obj.put("samplerMinFilter", toJSON(Type.Filter,tv.samplerMinFilter));
2836 obj.put("samplerMagFilter", toJSON(Type.Filter,tv.samplerMagFilter));
2837 obj.put("samplerBorderColor", toJSON(Type.Value,tv.samplerBorderColor));
2838 obj.put("samplerMinLod", toJSON(Type.Maybe_Float,tv.samplerMinLod));
2839 obj.put("samplerMaxLod", toJSON(Type.Maybe_Float,tv.samplerMaxLod));
2840 obj.put("samplerLodBias", toJSON(Type.Float,tv.samplerLodBias));
2841 obj.put("samplerCompareFunc", toJSON(Type.Maybe_ComparisonFunction,tv.samplerCompareFunc));
2842 }
2843 break;
2844 }
2845 return obj;
2846 }
2847 case TextureDescriptor: {
2848 TextureDescriptor v = (TextureDescriptor)rawObj;
2849 JSONObject obj = new JSONObject();
2850 switch (v.tag) {
2851 case TextureDescriptor:
2852 obj.put("tag", "TextureDescriptor");
2853 {
2854 TextureDescriptor.TextureDescriptor_ tv = (TextureDescriptor.TextureDescriptor_)v;
2855 obj.put("textureType", toJSON(Type.TextureType,tv.textureType));
2856 obj.put("textureSize", toJSON(Type.Value,tv.textureSize));
2857 obj.put("textureSemantic", toJSON(Type.ImageSemantic,tv.textureSemantic));
2858 obj.put("textureSampler", toJSON(Type.SamplerDescriptor,tv.textureSampler));
2859 obj.put("textureBaseLevel", toJSON(Type.Int,tv.textureBaseLevel));
2860 obj.put("textureMaxLevel", toJSON(Type.Int,tv.textureMaxLevel));
2861 }
2862 break;
2863 }
2864 return obj;
2865 }
2866 case Parameter: {
2867 Parameter v = (Parameter)rawObj;
2868 JSONObject obj = new JSONObject();
2869 switch (v.tag) {
2870 case Parameter:
2871 obj.put("tag", "Parameter");
2872 {
2873 Parameter.Parameter_ tv = (Parameter.Parameter_)v;
2874 obj.put("name", toJSON(Type.String,tv.name));
2875 obj.put("ty", toJSON(Type.InputType,tv.ty));
2876 }
2877 break;
2878 }
2879 return obj;
2880 }
2881 case Program: {
2882 Program v = (Program)rawObj;
2883 JSONObject obj = new JSONObject();
2884 switch (v.tag) {
2885 case Program:
2886 obj.put("tag", "Program");
2887 {
2888 Program.Program_ tv = (Program.Program_)v;
2889 obj.put("programUniforms", toJSON(Type.Map_String_InputType,tv.programUniforms));
2890 obj.put("programStreams", toJSON(Type.Map_String_Parameter,tv.programStreams));
2891 obj.put("programInTextures", toJSON(Type.Map_String_InputType,tv.programInTextures));
2892 obj.put("programOutput", toJSON(Type.Array_Parameter,tv.programOutput));
2893 obj.put("vertexShader", toJSON(Type.String,tv.vertexShader));
2894 obj.put("geometryShader", toJSON(Type.Maybe_String,tv.geometryShader));
2895 obj.put("fragmentShader", toJSON(Type.String,tv.fragmentShader));
2896 }
2897 break;
2898 }
2899 return obj;
2900 }
2901 case Slot: {
2902 Slot v = (Slot)rawObj;
2903 JSONObject obj = new JSONObject();
2904 switch (v.tag) {
2905 case Slot:
2906 obj.put("tag", "Slot");
2907 {
2908 Slot.Slot_ tv = (Slot.Slot_)v;
2909 obj.put("slotName", toJSON(Type.String,tv.slotName));
2910 obj.put("slotStreams", toJSON(Type.Map_String_InputType,tv.slotStreams));
2911 obj.put("slotUniforms", toJSON(Type.Map_String_InputType,tv.slotUniforms));
2912 obj.put("slotPrimitive", toJSON(Type.FetchPrimitive,tv.slotPrimitive));
2913 obj.put("slotPrograms", toJSON(Type.Array_Int,tv.slotPrograms));
2914 }
2915 break;
2916 }
2917 return obj;
2918 }
2919 case StreamData: {
2920 StreamData v = (StreamData)rawObj;
2921 JSONObject obj = new JSONObject();
2922 switch (v.tag) {
2923 case StreamData:
2924 obj.put("tag", "StreamData");
2925 {
2926 StreamData.StreamData_ tv = (StreamData.StreamData_)v;
2927 obj.put("streamData", toJSON(Type.Map_String_ArrayValue,tv.streamData));
2928 obj.put("streamType", toJSON(Type.Map_String_InputType,tv.streamType));
2929 obj.put("streamPrimitive", toJSON(Type.FetchPrimitive,tv.streamPrimitive));
2930 obj.put("streamPrograms", toJSON(Type.Array_Int,tv.streamPrograms));
2931 }
2932 break;
2933 }
2934 return obj;
2935 }
2936 case TargetItem: {
2937 TargetItem v = (TargetItem)rawObj;
2938 JSONObject obj = new JSONObject();
2939 switch (v.tag) {
2940 case TargetItem:
2941 obj.put("tag", "TargetItem");
2942 {
2943 TargetItem.TargetItem_ tv = (TargetItem.TargetItem_)v;
2944 obj.put("targetSemantic", toJSON(Type.ImageSemantic,tv.targetSemantic));
2945 obj.put("targetRef", toJSON(Type.Maybe_ImageRef,tv.targetRef));
2946 }
2947 break;
2948 }
2949 return obj;
2950 }
2951 case RenderTarget: {
2952 RenderTarget v = (RenderTarget)rawObj;
2953 JSONObject obj = new JSONObject();
2954 switch (v.tag) {
2955 case RenderTarget:
2956 obj.put("tag", "RenderTarget");
2957 {
2958 RenderTarget.RenderTarget_ tv = (RenderTarget.RenderTarget_)v;
2959 obj.put("renderTargets", toJSON(Type.Array_TargetItem,tv.renderTargets));
2960 }
2961 break;
2962 }
2963 return obj;
2964 }
2965 case Backend: {
2966 Backend v = (Backend)rawObj;
2967 JSONObject obj = new JSONObject();
2968 switch (v.tag) {
2969 case WebGL1:
2970 obj.put("tag", "WebGL1");
2971 break;
2972 case OpenGL33:
2973 obj.put("tag", "OpenGL33");
2974 break;
2975 }
2976 return obj;
2977 }
2978 case Pipeline: {
2979 Pipeline v = (Pipeline)rawObj;
2980 JSONObject obj = new JSONObject();
2981 switch (v.tag) {
2982 case Pipeline:
2983 obj.put("tag", "Pipeline");
2984 {
2985 Pipeline.Pipeline_ tv = (Pipeline.Pipeline_)v;
2986 obj.put("info", toJSON(Type.String,tv.info));
2987 obj.put("backend", toJSON(Type.Backend,tv.backend));
2988 obj.put("textures", toJSON(Type.Array_TextureDescriptor,tv.textures));
2989 obj.put("samplers", toJSON(Type.Array_SamplerDescriptor,tv.samplers));
2990 obj.put("targets", toJSON(Type.Array_RenderTarget,tv.targets));
2991 obj.put("programs", toJSON(Type.Array_Program,tv.programs));
2992 obj.put("slots", toJSON(Type.Array_Slot,tv.slots));
2993 obj.put("streams", toJSON(Type.Array_StreamData,tv.streams));
2994 obj.put("commands", toJSON(Type.Array_Command,tv.commands));
2995 }
2996 break;
2997 }
2998 return obj;
2999 }
3000
3001 case Word32: { return rawObj; }
3002 case Float: { return rawObj; }
3003 case Bool: { return rawObj; }
3004 case String: { return rawObj; }
3005 case V2_Word: {
3006 V2<Integer> v = (V2<Integer>)rawObj;
3007 JSONObject obj = new JSONObject();
3008 obj.put("x", toJSON(Type.Word,v.x));
3009 obj.put("y", toJSON(Type.Word,v.y));
3010 return obj;
3011 }
3012 case V2_Float: {
3013 V2<Float> v = (V2<Float>)rawObj;
3014 JSONObject obj = new JSONObject();
3015 obj.put("x", toJSON(Type.Float,v.x));
3016 obj.put("y", toJSON(Type.Float,v.y));
3017 return obj;
3018 }
3019 case V2_Bool: {
3020 V2<Boolean> v = (V2<Boolean>)rawObj;
3021 JSONObject obj = new JSONObject();
3022 obj.put("x", toJSON(Type.Bool,v.x));
3023 obj.put("y", toJSON(Type.Bool,v.y));
3024 return obj;
3025 }
3026 case V2_V2_Float: {
3027 V2<V2<Float>> v = (V2<V2<Float>>)rawObj;
3028 JSONObject obj = new JSONObject();
3029 obj.put("x", toJSON(Type.V2_Float,v.x));
3030 obj.put("y", toJSON(Type.V2_Float,v.y));
3031 return obj;
3032 }
3033 case V2_V3_Float: {
3034 V2<V3<Float>> v = (V2<V3<Float>>)rawObj;
3035 JSONObject obj = new JSONObject();
3036 obj.put("x", toJSON(Type.V3_Float,v.x));
3037 obj.put("y", toJSON(Type.V3_Float,v.y));
3038 return obj;
3039 }
3040 case V2_V4_Float: {
3041 V2<V4<Float>> v = (V2<V4<Float>>)rawObj;
3042 JSONObject obj = new JSONObject();
3043 obj.put("x", toJSON(Type.V4_Float,v.x));
3044 obj.put("y", toJSON(Type.V4_Float,v.y));
3045 return obj;
3046 }
3047 case V3_Word: {
3048 V3<Integer> v = (V3<Integer>)rawObj;
3049 JSONObject obj = new JSONObject();
3050 obj.put("x", toJSON(Type.Word,v.x));
3051 obj.put("y", toJSON(Type.Word,v.y));
3052 obj.put("z", toJSON(Type.Word,v.z));
3053 return obj;
3054 }
3055 case V3_Float: {
3056 V3<Float> v = (V3<Float>)rawObj;
3057 JSONObject obj = new JSONObject();
3058 obj.put("x", toJSON(Type.Float,v.x));
3059 obj.put("y", toJSON(Type.Float,v.y));
3060 obj.put("z", toJSON(Type.Float,v.z));
3061 return obj;
3062 }
3063 case V3_Bool: {
3064 V3<Boolean> v = (V3<Boolean>)rawObj;
3065 JSONObject obj = new JSONObject();
3066 obj.put("x", toJSON(Type.Bool,v.x));
3067 obj.put("y", toJSON(Type.Bool,v.y));
3068 obj.put("z", toJSON(Type.Bool,v.z));
3069 return obj;
3070 }
3071 case V3_V2_Float: {
3072 V3<V2<Float>> v = (V3<V2<Float>>)rawObj;
3073 JSONObject obj = new JSONObject();
3074 obj.put("x", toJSON(Type.V2_Float,v.x));
3075 obj.put("y", toJSON(Type.V2_Float,v.y));
3076 obj.put("z", toJSON(Type.V2_Float,v.z));
3077 return obj;
3078 }
3079 case V3_V3_Float: {
3080 V3<V3<Float>> v = (V3<V3<Float>>)rawObj;
3081 JSONObject obj = new JSONObject();
3082 obj.put("x", toJSON(Type.V3_Float,v.x));
3083 obj.put("y", toJSON(Type.V3_Float,v.y));
3084 obj.put("z", toJSON(Type.V3_Float,v.z));
3085 return obj;
3086 }
3087 case V3_V4_Float: {
3088 V3<V4<Float>> v = (V3<V4<Float>>)rawObj;
3089 JSONObject obj = new JSONObject();
3090 obj.put("x", toJSON(Type.V4_Float,v.x));
3091 obj.put("y", toJSON(Type.V4_Float,v.y));
3092 obj.put("z", toJSON(Type.V4_Float,v.z));
3093 return obj;
3094 }
3095 case V4_Word: {
3096 V4<Integer> v = (V4<Integer>)rawObj;
3097 JSONObject obj = new JSONObject();
3098 obj.put("x", toJSON(Type.Word,v.x));
3099 obj.put("y", toJSON(Type.Word,v.y));
3100 obj.put("z", toJSON(Type.Word,v.z));
3101 obj.put("w", toJSON(Type.Word,v.w));
3102 return obj;
3103 }
3104 case V4_Float: {
3105 V4<Float> v = (V4<Float>)rawObj;
3106 JSONObject obj = new JSONObject();
3107 obj.put("x", toJSON(Type.Float,v.x));
3108 obj.put("y", toJSON(Type.Float,v.y));
3109 obj.put("z", toJSON(Type.Float,v.z));
3110 obj.put("w", toJSON(Type.Float,v.w));
3111 return obj;
3112 }
3113 case V4_Bool: {
3114 V4<Boolean> v = (V4<Boolean>)rawObj;
3115 JSONObject obj = new JSONObject();
3116 obj.put("x", toJSON(Type.Bool,v.x));
3117 obj.put("y", toJSON(Type.Bool,v.y));
3118 obj.put("z", toJSON(Type.Bool,v.z));
3119 obj.put("w", toJSON(Type.Bool,v.w));
3120 return obj;
3121 }
3122 case V4_V2_Float: {
3123 V4<V2<Float>> v = (V4<V2<Float>>)rawObj;
3124 JSONObject obj = new JSONObject();
3125 obj.put("x", toJSON(Type.V2_Float,v.x));
3126 obj.put("y", toJSON(Type.V2_Float,v.y));
3127 obj.put("z", toJSON(Type.V2_Float,v.z));
3128 obj.put("w", toJSON(Type.V2_Float,v.w));
3129 return obj;
3130 }
3131 case V4_V3_Float: {
3132 V4<V3<Float>> v = (V4<V3<Float>>)rawObj;
3133 JSONObject obj = new JSONObject();
3134 obj.put("x", toJSON(Type.V3_Float,v.x));
3135 obj.put("y", toJSON(Type.V3_Float,v.y));
3136 obj.put("z", toJSON(Type.V3_Float,v.z));
3137 obj.put("w", toJSON(Type.V3_Float,v.w));
3138 return obj;
3139 }
3140 case V4_V4_Float: {
3141 V4<V4<Float>> v = (V4<V4<Float>>)rawObj;
3142 JSONObject obj = new JSONObject();
3143 obj.put("x", toJSON(Type.V4_Float,v.x));
3144 obj.put("y", toJSON(Type.V4_Float,v.y));
3145 obj.put("z", toJSON(Type.V4_Float,v.z));
3146 obj.put("w", toJSON(Type.V4_Float,v.w));
3147 return obj;
3148 }
3149 case Array_Word32: {
3150 ArrayList<Integer> v = (ArrayList<Integer>)rawObj;
3151 JSONArray obj = new JSONArray();
3152 for(Integer i : v) {
3153 obj.put(toJSON(Type.Word32,i));
3154 }
3155 return obj;
3156 }
3157 case Array_Float: {
3158 ArrayList<Float> v = (ArrayList<Float>)rawObj;
3159 JSONArray obj = new JSONArray();
3160 for(Float i : v) {
3161 obj.put(toJSON(Type.Float,i));
3162 }
3163 return obj;
3164 }
3165 case Array_Bool: {
3166 ArrayList<Boolean> v = (ArrayList<Boolean>)rawObj;
3167 JSONArray obj = new JSONArray();
3168 for(Boolean i : v) {
3169 obj.put(toJSON(Type.Bool,i));
3170 }
3171 return obj;
3172 }
3173 case Array_ClearImage: {
3174 ArrayList<ClearImage> v = (ArrayList<ClearImage>)rawObj;
3175 JSONArray obj = new JSONArray();
3176 for(ClearImage i : v) {
3177 obj.put(toJSON(Type.ClearImage,i));
3178 }
3179 return obj;
3180 }
3181 case Array_Command: {
3182 ArrayList<Command> v = (ArrayList<Command>)rawObj;
3183 JSONArray obj = new JSONArray();
3184 for(Command i : v) {
3185 obj.put(toJSON(Type.Command,i));
3186 }
3187 return obj;
3188 }
3189 case Array_Parameter: {
3190 ArrayList<Parameter> v = (ArrayList<Parameter>)rawObj;
3191 JSONArray obj = new JSONArray();
3192 for(Parameter i : v) {
3193 obj.put(toJSON(Type.Parameter,i));
3194 }
3195 return obj;
3196 }
3197 case Array_Program: {
3198 ArrayList<Program> v = (ArrayList<Program>)rawObj;
3199 JSONArray obj = new JSONArray();
3200 for(Program i : v) {
3201 obj.put(toJSON(Type.Program,i));
3202 }
3203 return obj;
3204 }
3205 case Array_RenderTarget: {
3206 ArrayList<RenderTarget> v = (ArrayList<RenderTarget>)rawObj;
3207 JSONArray obj = new JSONArray();
3208 for(RenderTarget i : v) {
3209 obj.put(toJSON(Type.RenderTarget,i));
3210 }
3211 return obj;
3212 }
3213 case Array_SamplerDescriptor: {
3214 ArrayList<SamplerDescriptor> v = (ArrayList<SamplerDescriptor>)rawObj;
3215 JSONArray obj = new JSONArray();
3216 for(SamplerDescriptor i : v) {
3217 obj.put(toJSON(Type.SamplerDescriptor,i));
3218 }
3219 return obj;
3220 }
3221 case Array_Slot: {
3222 ArrayList<Slot> v = (ArrayList<Slot>)rawObj;
3223 JSONArray obj = new JSONArray();
3224 for(Slot i : v) {
3225 obj.put(toJSON(Type.Slot,i));
3226 }
3227 return obj;
3228 }
3229 case Array_StreamData: {
3230 ArrayList<StreamData> v = (ArrayList<StreamData>)rawObj;
3231 JSONArray obj = new JSONArray();
3232 for(StreamData i : v) {
3233 obj.put(toJSON(Type.StreamData,i));
3234 }
3235 return obj;
3236 }
3237 case Array_TargetItem: {
3238 ArrayList<TargetItem> v = (ArrayList<TargetItem>)rawObj;
3239 JSONArray obj = new JSONArray();
3240 for(TargetItem i : v) {
3241 obj.put(toJSON(Type.TargetItem,i));
3242 }
3243 return obj;
3244 }
3245 case Array_TextureDescriptor: {
3246 ArrayList<TextureDescriptor> v = (ArrayList<TextureDescriptor>)rawObj;
3247 JSONArray obj = new JSONArray();
3248 for(TextureDescriptor i : v) {
3249 obj.put(toJSON(Type.TextureDescriptor,i));
3250 }
3251 return obj;
3252 }
3253 case List_FragmentOperation: {
3254 ArrayList<FragmentOperation> v = (ArrayList<FragmentOperation>)rawObj;
3255 JSONArray obj = new JSONArray();
3256 for(FragmentOperation i : v) {
3257 obj.put(toJSON(Type.FragmentOperation,i));
3258 }
3259 return obj;
3260 }
3261 case Maybe_Int: {
3262 Maybe<Integer> v = (Maybe<Integer>)rawObj;
3263 if (v.valid) {
3264 return toJSON(Type.Int,v.data);
3265 }
3266 return JSONObject.NULL;
3267 }
3268 case Maybe_Float: {
3269 Maybe<Float> v = (Maybe<Float>)rawObj;
3270 if (v.valid) {
3271 return toJSON(Type.Float,v.data);
3272 }
3273 return JSONObject.NULL;
3274 }
3275 case Maybe_String: {
3276 Maybe<String> v = (Maybe<String>)rawObj;
3277 if (v.valid) {
3278 return toJSON(Type.String,v.data);
3279 }
3280 return JSONObject.NULL;
3281 }
3282 case Maybe_ComparisonFunction: {
3283 Maybe<ComparisonFunction> v = (Maybe<ComparisonFunction>)rawObj;
3284 if (v.valid) {
3285 return toJSON(Type.ComparisonFunction,v.data);
3286 }
3287 return JSONObject.NULL;
3288 }
3289 case Maybe_EdgeMode: {
3290 Maybe<EdgeMode> v = (Maybe<EdgeMode>)rawObj;
3291 if (v.valid) {
3292 return toJSON(Type.EdgeMode,v.data);
3293 }
3294 return JSONObject.NULL;
3295 }
3296 case Maybe_ImageRef: {
3297 Maybe<ImageRef> v = (Maybe<ImageRef>)rawObj;
3298 if (v.valid) {
3299 return toJSON(Type.ImageRef,v.data);
3300 }
3301 return JSONObject.NULL;
3302 }
3303 case Map_String_ArrayValue: {
3304 HashMap<String, ArrayValue> v = (HashMap<String, ArrayValue>)rawObj;
3305 JSONObject obj = new JSONObject();
3306 for (Map.Entry<String,ArrayValue> i : v.entrySet()) {
3307 obj.put(i.getKey(), toJSON(Type.ArrayValue,i.getValue()));
3308 }
3309 return obj;
3310 }
3311 case Map_String_InputType: {
3312 HashMap<String, InputType> v = (HashMap<String, InputType>)rawObj;
3313 JSONObject obj = new JSONObject();
3314 for (Map.Entry<String,InputType> i : v.entrySet()) {
3315 obj.put(i.getKey(), toJSON(Type.InputType,i.getValue()));
3316 }
3317 return obj;
3318 }
3319 case Map_String_Parameter: {
3320 HashMap<String, Parameter> v = (HashMap<String, Parameter>)rawObj;
3321 JSONObject obj = new JSONObject();
3322 for (Map.Entry<String,Parameter> i : v.entrySet()) {
3323 obj.put(i.getKey(), toJSON(Type.Parameter,i.getValue()));
3324 }
3325 return obj;
3326 }
3327 }
3328 return null;
3329 }
1567} \ No newline at end of file 3330} \ No newline at end of file