Add a new shader-versioning infrastructure capable of handling multiple profiles...
authorJohn Kessenich <cepheus@frii.com>
Thu, 13 Dec 2012 00:05:26 +0000 (00:05 +0000)
committerJohn Kessenich <cepheus@frii.com>
Thu, 13 Dec 2012 00:05:26 +0000 (00:05 +0000)
NB: *Use* of this infrastructure is so far only skeletal.

Fixed a few typos and minor issues along the way.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@19951 e7fa87d3-cd2b-0410-9028-fcbf551c1848

31 files changed:
StandAlone.vcproj [deleted file]
StandAlone.vcxproj [new file with mode: 0644]
StandAlone.vcxproj.filters [new file with mode: 0644]
Test/run.bat [new file with mode: 0644]
Test/runlist.bat [new file with mode: 0644]
Test/sample.frag [moved from StandAlone/sample.frag with 95% similarity]
Test/sample.frag.out [moved from StandAlone/sample.frag.out with 85% similarity]
Test/sample.vert [moved from StandAlone/sample.vert with 100% similarity]
Test/sample.vert.out [moved from StandAlone/sample.vert.out with 90% similarity]
Test/specExamples.frag [new file with mode: 0644]
Test/specExamples.vert [new file with mode: 0644]
Test/versionsClean.frag [new file with mode: 0644]
Test/versionsClean.vert [new file with mode: 0644]
Test/versionsErrors.frag [new file with mode: 0644]
Test/versionsErrors.vert [new file with mode: 0644]
Todo.txt [new file with mode: 0644]
glslang.vcproj [deleted file]
glslang.vcxproj [new file with mode: 0644]
glslang.vcxproj.filters [new file with mode: 0644]
glslang/MachineIndependent/ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.h
glslang/MachineIndependent/ShaderLang.cpp
glslang/MachineIndependent/Versions.cpp [new file with mode: 0644]
glslang/MachineIndependent/Versions.h [new file with mode: 0644]
glslang/MachineIndependent/glslang.l
glslang/MachineIndependent/glslang.y
glslang/MachineIndependent/preprocessor/compile.h
glslang/MachineIndependent/preprocessor/cpp.c
glslang/MachineIndependent/preprocessor/cpp.h
glslang/MachineIndependent/preprocessor/cppstruct.c
glslang/Public/ShaderLang.h

diff --git a/StandAlone.vcproj b/StandAlone.vcproj
deleted file mode 100644 (file)
index 411a83c..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="7.00"\r
-       Name="Tests - StandAlone"\r
-       ProjectGUID="{660D0A05-69A9-4F09-9664-02FBEB08FAE2}">\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"/>\r
-       </Platforms>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="UserM_Debug|Win32"\r
-                       OutputDirectory="UserM_Debug"\r
-                       IntermediateDirectory="UserM_Debug"\r
-                       ConfigurationType="1"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="FALSE"\r
-                       CharacterSet="2">\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               AdditionalIncludeDirectories="glslang"\r
-                               PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE,GENERIC_COMPILER"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="5"\r
-                               UsePrecompiledHeader="0"\r
-                               PrecompiledHeaderFile=""\r
-                               AssemblerListingLocation="UserM_Debug/"\r
-                               ObjectFile="UserM_Debug/"\r
-                               ProgramDataBaseFileName="UserM_Debug/Standalone"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="TRUE"\r
-                               DebugInformationFormat="3"\r
-                               CallingConvention="1"/>\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"/>\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalOptions="/MACHINE:I386"\r
-                               AdditionalDependencies="odbc32.lib odbccp32.lib psapi.lib Standalone\glslang.lib"\r
-                               OutputFile="UserM_Debug/StandAlone.exe"\r
-                               LinkIncremental="2"\r
-                               SuppressStartupBanner="TRUE"\r
-                               IgnoreDefaultLibraryNames=""\r
-                               GenerateDebugInformation="TRUE"\r
-                               ProgramDatabaseFile="UserM_Debug/StandAlone.pdb"\r
-                               SubSystem="1"/>\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName="UserM_Debug/StandAlone.tlb"/>\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                               Description="move exe"\r
-                               CommandLine="xcopy /y UserM_Debug\StandAlone.exe Standalone"/>\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"/>\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"/>\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               Culture="1033"/>\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"/>\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"/>\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="UserM_Release|Win32"\r
-                       OutputDirectory="UserM_Release"\r
-                       IntermediateDirectory="UserM_Release"\r
-                       ConfigurationType="1"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="FALSE"\r
-                       CharacterSet="2">\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="2"\r
-                               InlineFunctionExpansion="1"\r
-                               OmitFramePointers="TRUE"\r
-                               AdditionalIncludeDirectories="glslang"\r
-                               PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE,GENERIC_COMPILER"\r
-                               StringPooling="TRUE"\r
-                               BasicRuntimeChecks="0"\r
-                               RuntimeLibrary="4"\r
-                               BufferSecurityCheck="TRUE"\r
-                               EnableFunctionLevelLinking="TRUE"\r
-                               UsePrecompiledHeader="0"\r
-                               PrecompiledHeaderFile=""\r
-                               AssemblerListingLocation="UserM_Release/"\r
-                               ObjectFile="UserM_Release/"\r
-                               ProgramDataBaseFileName="UserM_Release/Standalone"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="TRUE"\r
-                               DebugInformationFormat="3"\r
-                               CallingConvention="1"/>\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"/>\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalOptions="/MACHINE:I386"\r
-                               AdditionalDependencies="odbc32.lib odbccp32.lib psapi.lib Standalone\glslang.lib"\r
-                               OutputFile="UserM_Release/StandAlone.exe"\r
-                               LinkIncremental="1"\r
-                               SuppressStartupBanner="TRUE"\r
-                               IgnoreDefaultLibraryNames=""\r
-                               GenerateDebugInformation="TRUE"\r
-                               ProgramDatabaseFile="UserM_Release/StandAlone.pdb"\r
-                               SubSystem="1"\r
-                               OptimizeReferences="2"\r
-                               EnableCOMDATFolding="2"/>\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName="UserM_Release/StandAlone.tlb"/>\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                               Description="move exe"\r
-                               CommandLine="xcopy /y UserM_Release\StandAlone.exe Standalone"/>\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"/>\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"/>\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               Culture="1033"/>\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"/>\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"/>\r
-               </Configuration>\r
-       </Configurations>\r
-       <Files>\r
-               <Filter\r
-                       Name="Source Files"\r
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">\r
-                       <File\r
-                               RelativePath="Standalone\StandAlone.cpp">\r
-                       </File>\r
-               </Filter>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
diff --git a/StandAlone.vcxproj b/StandAlone.vcxproj
new file mode 100644 (file)
index 0000000..36eec5e
--- /dev/null
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectName>StandAlone</ProjectName>\r
+    <ProjectGuid>{660D0A05-69A9-4F09-9664-02FBEB08FAE2}</ProjectGuid>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseOfMfc>false</UseOfMfc>\r
+    <CharacterSet>MultiByte</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseOfMfc>false</UseOfMfc>\r
+    <CharacterSet>MultiByte</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup>\r
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StandAlone\UserM_Debug\</OutDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StandAlone\UserM_Debug\</IntDir>\r
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UserM_Release\</OutDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UserM_Release\</IntDir>\r
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <Optimization>Disabled</Optimization>\r
+      <AdditionalIncludeDirectories>glslang;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;GENERIC_COMPILER;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <PrecompiledHeaderOutputFile>\r
+      </PrecompiledHeaderOutputFile>\r
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>\r
+      <ObjectFileName>$(IntDir)</ObjectFileName>\r
+      <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+      <CallingConvention>FastCall</CallingConvention>\r
+    </ClCompile>\r
+    <Link>\r
+      <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>\r
+      <AdditionalDependencies>odbc32.lib;odbccp32.lib;psapi.lib;UserM_Debug\generic\glslang.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <ProgramDatabaseFile>UserM_Debug/StandAlone.pdb</ProgramDatabaseFile>\r
+      <SubSystem>Console</SubSystem>\r
+    </Link>\r
+    <Midl>\r
+      <TypeLibraryName>UserM_Debug/StandAlone.tlb</TypeLibraryName>\r
+    </Midl>\r
+    <PostBuildEvent>\r
+      <Message>move exe</Message>\r
+      <Command>xcopy /y StandAlone\UserM_Debug\StandAlone.exe Test</Command>\r
+    </PostBuildEvent>\r
+    <ResourceCompile>\r
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <Culture>0x0409</Culture>\r
+    </ResourceCompile>\r
+    <PreLinkEvent>\r
+      <Command>\r
+      </Command>\r
+    </PreLinkEvent>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>\r
+      <OmitFramePointers>true</OmitFramePointers>\r
+      <AdditionalIncludeDirectories>glslang;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;GENERIC_COMPILER;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <StringPooling>true</StringPooling>\r
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r
+      <BufferSecurityCheck>true</BufferSecurityCheck>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <PrecompiledHeaderOutputFile>\r
+      </PrecompiledHeaderOutputFile>\r
+      <AssemblerListingLocation>UserM_Release/</AssemblerListingLocation>\r
+      <ObjectFileName>UserM_Release/</ObjectFileName>\r
+      <ProgramDataBaseFileName>UserM_Release/Standalone</ProgramDataBaseFileName>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+      <CallingConvention>FastCall</CallingConvention>\r
+    </ClCompile>\r
+    <Link>\r
+      <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>\r
+      <AdditionalDependencies>odbc32.lib;odbccp32.lib;psapi.lib;Standalone\glslang.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <OutputFile>UserM_Release/StandAlone.exe</OutputFile>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <ProgramDatabaseFile>UserM_Release/StandAlone.pdb</ProgramDatabaseFile>\r
+      <SubSystem>Console</SubSystem>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+    </Link>\r
+    <Midl>\r
+      <TypeLibraryName>UserM_Release/StandAlone.tlb</TypeLibraryName>\r
+    </Midl>\r
+    <PostBuildEvent>\r
+      <Message>move exe</Message>\r
+      <Command>xcopy /y StandAlone\UserM_Release\StandAlone.exe StandAlone</Command>\r
+    </PostBuildEvent>\r
+    <ResourceCompile>\r
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <Culture>0x0409</Culture>\r
+    </ResourceCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="Standalone\StandAlone.cpp" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="glslang.vcxproj">\r
+      <Project>{3b146cc5-b2b8-4573-9d46-6139e2edfea3}</Project>\r
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/StandAlone.vcxproj.filters b/StandAlone.vcxproj.filters
new file mode 100644 (file)
index 0000000..0685ca2
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup>\r
+    <Filter Include="Source Files">\r
+      <UniqueIdentifier>{fcd4a310-b19f-40bd-9324-e7d4e7d4dad1}</UniqueIdentifier>\r
+      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>\r
+    </Filter>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="Standalone\StandAlone.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+</Project>
\ No newline at end of file
diff --git a/Test/run.bat b/Test/run.bat
new file mode 100644 (file)
index 0000000..2e4d5c1
--- /dev/null
@@ -0,0 +1,5 @@
+.\StandAlone.exe -i sample.vert > sample.vert.newout \r
+diff sample.vert.out sample.vert.newout\r
+\r
+.\StandAlone.exe -i sample.frag > sample.frag.newout \r
+diff sample.frag.out sample.frag.newout\r
diff --git a/Test/runlist.bat b/Test/runlist.bat
new file mode 100644 (file)
index 0000000..8d68a47
--- /dev/null
@@ -0,0 +1 @@
+for /F "tokens=*" %%f in (testlist) do .\StandAlone.exe -i %%f\r
similarity index 95%
rename from StandAlone/sample.frag
rename to Test/sample.frag
index 0d11cb2..af3a626 100644 (file)
@@ -36,5 +36,5 @@ varying vec3 color;
 \r
 void main()\r
 {\r
-    gl_FragColor = vec4(color, 1.0);\r
+    gl_FragColor = vec4(color, 1.0f);\r
 }\r
similarity index 85%
rename from StandAlone/sample.frag.out
rename to Test/sample.frag.out
index 5af223e..ebc450c 100644 (file)
@@ -6,7 +6,7 @@
 0:39      move second child to first child (4-component vector of float)\r
 0:39        'gl_FragColor' (FragColor 4-component vector of float)\r
 0:39        Construct vec4 (4-component vector of float)\r
-0:39          'color' (varying 3-component vector of float)\r
+0:39          'color' (varying in 3-component vector of float)\r
 0:39          1.000000 (const float)\r
 \r
 #### END COMPILER 0 INFO LOG ####\r
similarity index 100%
rename from StandAlone/sample.vert
rename to Test/sample.vert
similarity index 90%
rename from StandAlone/sample.vert.out
rename to Test/sample.vert.out
index 2d50a82..ebb700d 100644 (file)
@@ -4,7 +4,7 @@
 0:37    Function Parameters: \r
 0:39    Sequence\r
 0:39      move second child to first child (3-component vector of float)\r
-0:39        'color' (varying 3-component vector of float)\r
+0:39        'color' (varying out 3-component vector of float)\r
 0:39        1.000000 (const float)\r
 0:39        1.000000 (const float)\r
 0:39        1.000000 (const float)\r
diff --git a/Test/specExamples.frag b/Test/specExamples.frag
new file mode 100644 (file)
index 0000000..3da05f4
--- /dev/null
@@ -0,0 +1,237 @@
+#version 430\r
+\r
+#extension GL_3DL_array_objects : enable\r
+\r
+int  a = 0xffffffff;  // 32 bits, a gets the value -1\r
+//int  b = 0xffffffffU; // ERROR: can't convert uint to int\r
+uint c = 0xffffffff;  // 32 bits, c gets the value 0xFFFFFFFF\r
+//uint d = 0xffffffffU; // 32 bits, d gets the value 0xFFFFFFFF\r
+int  e = -1;          // the literal is \931\94, then negation is performed,\r
+                      //   and the resulting non-literal 32-bit signed \r
+                      //   bit pattern of 0xFFFFFFFF is assigned, giving e \r
+                      //   the value of -1.\r
+//uint f = -1u;         // the literal is \931u\94, then negation is performed,\r
+                      //   and the resulting non-literal 32-bit unsigned \r
+                      //   bit pattern of 0xFFFFFFFF is assigned, giving f \r
+                      //   the value of 0xFFFFFFFF.\r
+int  g = 3000000000;  // a signed decimal literal taking 32 bits,\r
+                      //   setting the sign bit, g gets -1294967296\r
+int  h = 0xA0000000;  // okay, 32-bit signed hexadecimal\r
+//int  i = 5000000000;  // ERROR: needs more than 32 bits\r
+//int  j = 0xFFFFFFFFF; // ERROR: needs more that 32 bits\r
+int  k = 0x80000000;  // k gets -2147483648 == 0x80000000\r
+int  l = 2147483648;  // l gets -2147483648 (the literal set the sign bit)\r
+\r
+float fa, fb = 1.5;     // single-precision floating-point\r
+//double fc, fd = 2.0LF;  // double-precision floating-point\r
+\r
+vec2 texcoord1, texcoord2;\r
+vec3 position;\r
+vec4 myRGBA;\r
+ivec2 textureLookup;\r
+bvec3 less;\r
+\r
+mat2 mat2D;\r
+mat3 optMatrix;\r
+mat4 view, projection;\r
+mat4x4 view;  // an alternate way of declaring a mat4\r
+mat3x2 m;     // a matrix with 3 columns and 2 rows\r
+dmat4 highPrecisionMVP;\r
+dmat2x4 dm;\r
+\r
+struct light {\r
+    float intensity;\r
+    vec3 position;\r
+} lightVar;\r
+\r
+struct S { float f; };\r
+\r
+struct T {\r
+       //S;              // Error: anonymous structures disallowed\r
+       //struct { ... }; // Error: embedded structures disallowed\r
+       S s;            // Okay: nested structures with name are allowed\r
+};\r
+\r
+float frequencies[3];  \r
+uniform vec4 lightPosition[4];\r
+light lights[];\r
+const int numLights = 2;\r
+light lights[numLights];\r
+\r
+in vec3 normal;
+centroid in vec2 TexCoord;\r
+invariant centroid in vec4 Color;\r
+noperspective in float temperature;\r
+flat in vec3 myColor;\r
+noperspective centroid in vec2 myTexCoord;\r
+\r
+uniform vec4 lightPosition;
+uniform vec3 color = vec3(0.7, 0.7, 0.2);  // value assigned at link time\r
+\r
+in Material {
+    smooth in vec4 Color1; // legal, input inside in block
+    smooth vec4 Color2;    // legal, 'in' inherited from 'in Material'
+    vec2 TexCoord;         // legal, TexCoord is an input
+    uniform float Atten;   // illegal, mismatched  storage qualifier\r
+\r
+};\r
+\r
+in Light {\r
+    vec4 LightPos;\r
+    vec3 LightColor;\r
+};\r
+in ColoredTexture {
+    vec4 Color;
+    vec2 TexCoord;        \r
+} Material;            // instance name\r
+vec3 Color;            // different Color than Material.Color\r
+\r
+in vec4 gl_FragCoord;     // redeclaration that changes nothing is allowed\r
+\r
+// All the following are allowed redeclaration that change behavior\r
+layout(origin_upper_left) in vec4 gl_FragCoord;\r
+layout(pixel_center_integer) in vec4 gl_FragCoord;\r
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;\r
+\r
+layout(early_fragment_tests) in;\r
+\r
+// compute shader:\r
+layout (local_size_x = 32, local_size_y = 32) in;\r
+layout (local_size_x = 8) in;\r
+\r
+layout(location = 3) out vec4 color;\r
+layout(location = 3, index = 1) out vec4 factor;\r
+layout(location = 2) out vec4 colors[3];\r
+\r
+layout (depth_greater) out float gl_FragDepth;\r
+
+// redeclaration that changes nothing is allowed
+out float gl_FragDepth;\r
+\r
+// assume it may be modified in any way\r
+layout (depth_any) out float gl_FragDepth;\r
+\r
+// assume it may be modified such that its value will only increase\r
+layout (depth_greater) out float gl_FragDepth;\r
+\r
+// assume it may be modified such that its value will only decrease\r
+layout (depth_less) out float gl_FragDepth;\r
+\r
+// assume it will not be modified\r
+layout (depth_unchanged) out float gl_FragDepth;\r
+\r
+in vec4 gl_Color;             // predeclared by the fragment language
+flat  in vec4 gl_Color;       // redeclared by user to be flat\r
+\r
+\r
+float[5] foo(float[5]) \r
+{\r
+    return float[5](3.4, 4.2, 5.0, 5.2, 1.1);\r
+}\r
+\r
+precision highp float;\r
+precision highp int;\r
+precision mediump int;\r
+precision highp float;\r
+\r
+void main()\r
+{\r
+    {\r
+               float a[5] = float[5](3.4, 4.2, 5.0, 5.2, 1.1);\r
+       }\r
+       {\r
+               float a[5] = float[](3.4, 4.2, 5.0, 5.2, 1.1);  // same thing\r
+       }\r
+    {\r
+           vec4 a[3][2];  // size-3 array of size-2 array of vec4\r
+               vec4[2] a1[3];  // size-3 array of size-2 array of vec4\r
+               vec4[3][2] a2;  // size-3 array of size-2 array of vec4\r
+               vec4 b[2] = vec4[2](vec4(0.0), vec4(0.1));\r
+               vec4[3][2] a3 = vec4[3][2](b, b, b);        // constructor\r
+               void foo(vec4[3][2]);  // prototype with unnamed parameter\r
+               vec4 a4[3][2] = {vec4[2](vec4(0.0), vec4(1.0)),   \r
+                                                vec4[2](vec4(0.0), vec4(1.0)),   \r
+                                                vec4[2](vec4(0.0), vec4(1.0)) };\r
+    }\r
+       {\r
+               float a[5];\r
+               {\r
+                       float b[] = a;  // b is explicitly size 5\r
+               }\r
+               {\r
+                       float b[5] = a; // means the same thing\r
+               }\r
+               {\r
+                       float b[] = float[](1,2,3,4,5);  // also explicitly sizes to 5\r
+               }\r
+               a.length();  // returns 5 \r
+       }\r
+    {\r
+               vec4 a[3][2];\r
+               a.length();     // this is 3\r
+               a[x].length();  // this is 2\r
+    }\r
+       // for an array b containing a member array a:\r
+       b[++x].a.length();    // b is never dereferenced, but \93++x\94 is evaluated\r
+\r
+       // for an array s of a shader storage object containing a member array a:\r
+       s[x].a.length();      // s is dereferenced; x needs to be a valid index\r
+       //\r
+       //All of the following declarations result in a compile-time error.\r
+       //float a[2] = { 3.4, 4.2, 5.0 };         // illegal\r
+       //vec2 b = { 1.0, 2.0, 3.0 };             // illegal\r
+       //mat3x3 c = { vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0) };    // illegal\r
+       //mat2x2 d = { 1.0, 0.0, 0.0, 1.0 };      // illegal, can't flatten nesting\r
+       //struct {\r
+       //      float a;\r
+       //      int   b;\r
+       //} e = { 1.2, 2, 3 };                    // illegal\r
+\r
+    struct {\r
+        float a;\r
+        int   b;\r
+    } e = { 1.2, 2 };             // legal, all types match\r
+\r
+    struct {\r
+        float a;\r
+        int   b;\r
+    } e = { 1, 3 };               // legal, first initializer is converted\r
+\r
+    //All of the following declarations result in a compile-time error.\r
+    //int a = true;                           // illegal\r
+    //vec4 b[2] = { vec4(0.0), 1.0 };         // illegal\r
+    //mat4x2 c = { vec3(0.0), vec3(1.0) };    // illegal\r
+\r
+    //struct S1 {\r
+    //    vec4 a;\r
+    //    vec4 b;\r
+    //};\r
+\r
+    //struct {\r
+    //    float s;\r
+    //    float t;\r
+    //} d[] = { S1(vec4(0.0), vec4(1.1)) };   // illegal\r
+\r
+    {\r
+        float a[] = float[](3.4, 4.2, 5.0, 5.2, 1.1);\r
+        float b[] = { 3.4, 4.2, 5.0, 5.2, 1.1 };\r
+        float c[] = a;                          // c is explicitly size 5\r
+        float d[5] = b;                         // means the same thing\r
+    }\r
+    {\r
+        const vec3 zAxis = vec3 (0.0, 0.0, 1.0);\r
+        const float ceiling = a + b; // a and b not necessarily constants\r
+    }\r
+    {\r
+        in vec4 position;\r
+        in vec3 normal;\r
+        in vec2 texCoord[4];\r
+    }\r
+    {\r
+        lowp float color;\r
+        out mediump vec2 P;\r
+        lowp ivec2 foo(lowp mat3);\r
+        highp mat4 m;\r
+    }\r
+\r
+}\r
diff --git a/Test/specExamples.vert b/Test/specExamples.vert
new file mode 100644 (file)
index 0000000..5555930
--- /dev/null
@@ -0,0 +1,196 @@
+#version 110\r
+\r
+#extension GL_3DL_array_objects : enable\r
+\r
+out Vertex {\r
+    vec4 Position;  // API transform/feedback will use \93Vertex.Position\94\r
+    vec2 Texture;\r
+} Coords;           // shader will use \93Coords.Position\94\r
+\r
+out Vertex2 {\r
+    vec4 Color;     // API will use \93Color\94\r
+};\r
+\r
+uniform Transform {  // API uses \93Transform[2]\94 to refer to instance 2\r
+    mat4           ModelViewMatrix;\r
+    mat4           ModelViewProjectionMatrix;\r
+    vec4           a[];  // array will get implicitly sized\r
+    float          Deformation;\r
+} transforms[4];\r
+\r
+layout(location = 3) in vec4 normal;\r
+layout(location = 6) in vec4 colors[3];\r
+layout(location = 9) in mat4 transforms[2];\r
+\r
+layout(location = 3) struct S {\r
+    vec3 a;\r
+    mat2 b;\r
+    vec4 c[2];\r
+} s;\r
+\r
+layout(triangles, invocations = 6) in;\r
+\r
+layout(lines) in;    // legal for Color2, input size is 2, matching Color2\r
+\r
+layout(triangle_strip, max_vertices = 60) out;  // order does not matter\r
+layout(max_vertices = 60) out;      // redeclaration okay\r
+layout(triangle_strip) out;         // redeclaration okay\r
+//layout(points) out;                 // error, contradicts triangle_strip\r
+//layout(max_vertices = 30) out;      // error, contradicts 60\r
+\r
+layout(stream = 1) out;\r
+\r
+layout(stream=1) out;             // default is now stream 1\r
+out vec4 var1;                    // var1 gets default stream (1)\r
+layout(stream=2) out Block1 {     // "Block1" belongs to stream 2\r
+    layout(stream=2) vec4 var2;   // redundant block member stream decl\r
+    layout(stream=3) vec2 var3;   // ILLEGAL (must match block stream)\r
+    vec3 var4;                    // belongs to stream 2\r
+};\r
+layout(stream=0) out;             // default is now stream 0\r
+out vec4 var5;                    // var5 gets default stream (0)\r
+out Block2 {                      // "Block2" gets default stream (0)\r
+    vec4 var6;\r
+};\r
+layout(stream=3) out vec4 var7;   // var7 belongs to stream 3\r
+\r
+layout(shared, column_major) uniform;\r
+layout(shared, column_major) buffer;\r
+\r
+layout(row_major, column_major)\r
+\r
+layout(shared, row_major) uniform; // default is now shared and row_major\r
+\r
+layout(std140) uniform Transform { // layout of this block is std140
+    mat4 M1;                       // row_major\r
+    layout(column_major) mat4 M2;  // column major\r
+    mat3 N1;                       // row_major\r
+};\r
+\r
+layout(column_major) uniform T3 {  // shared and column_major
+    mat4 M3;                       // column_major\r
+    layout(row_major) mat4 m4;     // row major\r
+    mat3 N2;                       // column_major\r
+};\r
+\r
+// in one compilation unit...\r
+layout(binding=3) uniform sampler2D s; // s bound to unit 3\r
+\r
+// in another compilation unit...\r
+uniform sampler2D s;                   // okay, s still bound at 3\r
+\r
+// in another compilation unit...\r
+//layout(binding=4) uniform sampler2D s; // ERROR: contradictory bindings\r
+\r
+layout (binding = 2, offset = 4) uniform atomic_uint a;\r
+\r
+layout (binding = 2) uniform atomic_uint bar;\r
+\r
+layout (binding = 2, offset = 4) uniform atomic_uint;\r
+\r
+layout (binding = 2) uniform atomic_uint bar; // offset is 4\r
+layout (offset = 8) uniform atomic_uint bar;  // error, no default binding\r
+\r
+layout (binding=3, offset=4) uniform atomic_uint a2; // offset = 4\r
+layout (binding=2) uniform atomic_uint b2;           // offset = 0\r
+layout (binding=3) uniform atomic_uint c2;           // offset = 8\r
+layout (binding=2) uniform atomic_uint d2;           // offset = 4\r
+\r
+//layout (offset=4)                // error, must include binding\r
+layout (binding=1, offset=0)  a; // okay\r
+layout (binding=2, offset=0)  b; // okay\r
+//layout (binding=1, offset=0)  c; // error, offsets must not be shared\r
+//                                 //        between a and c\r
+//layout (binding=1, offset=2)  d; // error, overlaps offset 0 of a\r
+\r
+flat  in vec4 gl_FrontColor;  // input to geometry shader, no \93gl_in[]\94\r
+flat out vec4 gl_FrontColor;  // output from geometry shader\r
+\r
+invariant gl_Position;   // make existing gl_Position be invariant\r
+\r
+out vec3 Color;\r
+invariant Color;         // make existing Color be invariant\r
+\r
+invariant centroid out vec3 Color4;\r
+precise out vec4 position;\r
+\r
+out vec3 Color5;\r
+precise Color5;            // make existing Color be precise\r
+in vec4 a, b, c, d;\r
+precise out vec4 v;\r
+\r
+coherent buffer Block {\r
+    readonly vec4 member1;\r
+    vec4 member2;\r
+};\r
+\r
+buffer Block {\r
+    coherent readonly vec4 member1;\r
+    coherent vec4 member2;\r
+};\r
+\r
+shared vec4 shv;\r
+\r
+vec4 funcA(restrict image2D a)   {  }\r
+\r
+vec4 funcB(image2D a)            {  }\r
+layout(rgba32f) uniform image2D img1;\r
+layout(rgba32f) coherent uniform image2D img2;\r
+\r
+float func(float e, float f, float g, float h)\r
+{\r
+    return (e*f) + (g*h);            // no constraint on order or \r
+                                     // operator consistency\r
+}\r
+\r
+float func2(float e, float f, float g, float h)\r
+{\r
+    precise float result = (e*f) + (g*h);  // ensures same precision for\r
+                                           // the two multiplies\r
+    return result;\r
+}\r
+\r
+float func3(float i, float j, precise out float k)\r
+{\r
+    k = i * i + j;                   // precise, due to <k> declaration\r
+}\r
+\r
+void main()\r
+{\r
+    vec3 r = vec3(a * b);           // precise, used to compute v.xyz\r
+    vec3 s = vec3(c * d);           // precise, used to compute v.xyz\r
+    v.xyz = r + s;                          // precise                      \r
+    v.w = (a.w * b.w) + (c.w * d.w);        // precise\r
+    v.x = func(a.x, b.x, c.x, d.x);         // values computed in func()\r
+                                            // are NOT precise\r
+    v.x = func2(a.x, b.x, c.x, d.x);        // precise!\r
+    func3(a.x * b.x, c.x * d.x, v.x);       // precise!\r
+        \r
+    funcA(img1);              // OK, adding "restrict" is allowed\r
+    funcB(img2);              // illegal, stripping "coherent" is not\r
+\r
+    {\r
+        struct light {\r
+            float intensity;\r
+            vec3 position;\r
+        };\r
+\r
+        light lightVar = light(3.0, vec3(1.0, 2.0, 3.0));\r
+    }\r
+    {\r
+        const float c[3] = float[3](5.0, 7.2, 1.1);
+        const float d[3] = float[](5.0, 7.2, 1.1);\r
+\r
+        float g;\r
+        float a[5] = float[5](g, 1, g, 2.3, g);\r
+        float b[3];\r
+\r
+        b = float[3](g, g + 1.0, g + 2.0);\r
+    }\r
+    {\r
+        vec4 b[2] = { vec4(1.0), vec4(1.0) };\r
+        vec4[3][2](b, b, b);        // constructor\r
+        vec4[][2](b, b, b);         // constructor, valid, size deduced\r
+        vec4[3][](b, b, b);         // compile-time error, invalid type constructed\r
+    }\r
+}\r
diff --git a/Test/versionsClean.frag b/Test/versionsClean.frag
new file mode 100644 (file)
index 0000000..187ffb6
--- /dev/null
@@ -0,0 +1,45 @@
+//\r
+//Copyright (C) 2012 LunarG, Inc.\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+//    Redistributions of source code must retain the above copyright\r
+//    notice, this list of conditions and the following disclaimer.\r
+//\r
+//    Redistributions in binary form must reproduce the above\r
+//    copyright notice, this list of conditions and the following\r
+//    disclaimer in the documentation and/or other materials provided\r
+//    with the distribution.\r
+//\r
+//    Neither the name of LunarG Inc. nor the names of its\r
+//    contributors may be used to endorse or promote products derived\r
+//    from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+#version 300 es\r
+\r
+in vec3 color;\r
+out vec4 foo;\r
+\r
+uniform sampler2DRect bar;\r
+\r
+void main()\r
+{\r
+    foo = vec4(color, 142.0f);\r
+    discard;\r
+}\r
diff --git a/Test/versionsClean.vert b/Test/versionsClean.vert
new file mode 100644 (file)
index 0000000..7c19785
--- /dev/null
@@ -0,0 +1,43 @@
+//\r
+//Copyright (C) 2012 LunarG, Inc.\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+//    Redistributions of source code must retain the above copyright\r
+//    notice, this list of conditions and the following disclaimer.\r
+//\r
+//    Redistributions in binary form must reproduce the above\r
+//    copyright notice, this list of conditions and the following\r
+//    disclaimer in the documentation and/or other materials provided\r
+//    with the distribution.\r
+//\r
+//    Neither the name of LunarG Inc. nor the names of its\r
+//    contributors may be used to endorse or promote products derived\r
+//    from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+#version 420 compatibility\r
+\r
+attribute vec3 color;\r
+\r
+uniform sampler2DRect foo;\r
+\r
+void main()\r
+{\r
+    gl_Position = vec4(color, 142.0f);\r
+}\r
diff --git a/Test/versionsErrors.frag b/Test/versionsErrors.frag
new file mode 100644 (file)
index 0000000..021c735
--- /dev/null
@@ -0,0 +1,46 @@
+//\r
+//Copyright (C) 2012 LunarG, Inc.\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+//    Redistributions of source code must retain the above copyright\r
+//    notice, this list of conditions and the following disclaimer.\r
+//\r
+//    Redistributions in binary form must reproduce the above\r
+//    copyright notice, this list of conditions and the following\r
+//    disclaimer in the documentation and/or other materials provided\r
+//    with the distribution.\r
+//\r
+//    Neither the name of LunarG Inc. nor the names of its\r
+//    contributors may be used to endorse or promote products derived\r
+//    from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+#version 110 es\r
+\r
+#extension GL_ARB_texture_rectangle : disable\r
+\r
+attribute vec3 color;\r
+\r
+uniform sampler2DRect foo;\r
+\r
+void main()\r
+{\r
+    gl_FragColor = vec4(color, 142.0f);\r
+    discard;\r
+}\r
diff --git a/Test/versionsErrors.vert b/Test/versionsErrors.vert
new file mode 100644 (file)
index 0000000..8736f2e
--- /dev/null
@@ -0,0 +1,46 @@
+//\r
+//Copyright (C) 2012 LunarG, Inc.\r
+//All rights reserved.\r
+//\r
+//Redistribution and use in source and binary forms, with or without\r
+//modification, are permitted provided that the following conditions\r
+//are met:\r
+//\r
+//    Redistributions of source code must retain the above copyright\r
+//    notice, this list of conditions and the following disclaimer.\r
+//\r
+//    Redistributions in binary form must reproduce the above\r
+//    copyright notice, this list of conditions and the following\r
+//    disclaimer in the documentation and/or other materials provided\r
+//    with the distribution.\r
+//\r
+//    Neither the name of LunarG Inc. nor the names of its\r
+//    contributors may be used to endorse or promote products derived\r
+//    from this software without specific prior written permission.\r
+//\r
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+//POSSIBILITY OF SUCH DAMAGE.\r
+//\r
+#version 420 core\r
+\r
+#extension GL_ARB_texture_rectangle : enable\r
+\r
+attribute vec3 color;\r
+\r
+uniform sampler2DRect foo;\r
+\r
+void main()\r
+{\r
+    gl_Position = vec4(color, 142.0f);\r
+    discard;\r
+}\r
diff --git a/Todo.txt b/Todo.txt
new file mode 100644 (file)
index 0000000..8d003d6
--- /dev/null
+++ b/Todo.txt
@@ -0,0 +1,16 @@
+Minor "to do" items are identified in the source code with "TODO..." comments.
+
+Major items to do:
+
+* Use the new versioning infrastructure to identify all errors specific to
+  - profile
+  - extension
+  - version
+  - stage
+  
+* Add semantics for all new grammar (1.2 through 4.3)
+
+* Replace the preprocessor with a better one.
+
+* Verify/fix thread safety of the parse context.
+
diff --git a/glslang.vcproj b/glslang.vcproj
deleted file mode 100644 (file)
index a1fdc9a..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>\r
-<VisualStudioProject\r
-       ProjectType="Visual C++"\r
-       Version="7.00"\r
-       Name="Targets - glslang (generic)"\r
-       ProjectGUID="{3B146CC5-B2B8-4573-9D46-6139E2EDFEA3}">\r
-       <Platforms>\r
-               <Platform\r
-                       Name="Win32"/>\r
-       </Platforms>\r
-       <Configurations>\r
-               <Configuration\r
-                       Name="UserM_Debug|Win32"\r
-                       OutputDirectory="UserM_Debug"\r
-                       IntermediateDirectory="UserM_Debug"\r
-                       ConfigurationType="2"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="FALSE"\r
-                       CharacterSet="2">\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
-                               AdditionalIncludeDirectories="glslang;glslang\MachineIndependent;glslang\OSDependent\Windows;OGLCompilersDLL"\r
-                               PreprocessorDefinitions="_DEBUG,WIN32,_CONSOLE,_USRDLL,TEST_EXPORTS,GENERIC_COMPILER"\r
-                               MinimalRebuild="FALSE"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
-                               PrecompiledHeaderFile=""\r
-                               AssemblerListingLocation="UserM_Debug/"\r
-                               ObjectFile="UserM_Debug/"\r
-                               ProgramDataBaseFileName="UserM_Debug/glslang"\r
-                               BrowseInformation="0"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="TRUE"\r
-                               DebugInformationFormat="3"\r
-                               CallingConvention="1"\r
-                               CompileAs="0"/>\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"/>\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalOptions="/MACHINE:I386"\r
-                               AdditionalDependencies="odbc32.lib odbccp32.lib"\r
-                               OutputFile="UserM_Debug/generic/glslang.dll"\r
-                               LinkIncremental="2"\r
-                               SuppressStartupBanner="TRUE"\r
-                               IgnoreDefaultLibraryNames="libcmtd.lib;libcd.lib;libcmt.lib;libcmt.lib"\r
-                               GenerateDebugInformation="TRUE"\r
-                               ProgramDatabaseFile="UserM_Debug/glslang.pdb"\r
-                               SubSystem="1"\r
-                               ImportLibrary="UserM_Debug/generic/glslang.lib"/>\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName="UserM_Debug/generic/glslang.tlb"/>\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                               Description="copy dll"\r
-                               CommandLine="xcopy /y UserM_Debug\generic\glslang.* standalone"/>\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"/>\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"/>\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="_DEBUG"\r
-                               Culture="2057"/>\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"/>\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"/>\r
-               </Configuration>\r
-               <Configuration\r
-                       Name="UserM_Release|Win32"\r
-                       OutputDirectory="UserM_Release"\r
-                       IntermediateDirectory="UserM_Release"\r
-                       ConfigurationType="2"\r
-                       UseOfMFC="0"\r
-                       ATLMinimizesCRunTimeLibraryUsage="FALSE"\r
-                       CharacterSet="2">\r
-                       <Tool\r
-                               Name="VCCLCompilerTool"\r
-                               Optimization="2"\r
-                               InlineFunctionExpansion="1"\r
-                               OmitFramePointers="TRUE"\r
-                               AdditionalIncludeDirectories="glslang;glslang\MachineIndependent;glslang\OSDependent\Windows;OGLCompilersDLL"\r
-                               PreprocessorDefinitions="NDEBUG,WIN32,_CONSOLE,_USRDLL,TEST_EXPORTS,GENERIC_COMPILER"\r
-                               StringPooling="TRUE"\r
-                               MinimalRebuild="FALSE"\r
-                               BasicRuntimeChecks="0"\r
-                               RuntimeLibrary="2"\r
-                               BufferSecurityCheck="TRUE"\r
-                               EnableFunctionLevelLinking="TRUE"\r
-                               PrecompiledHeaderFile=""\r
-                               AssemblerListingLocation="UserM_Release/"\r
-                               ObjectFile="UserM_Release/"\r
-                               ProgramDataBaseFileName="UserM_Release/glslang"\r
-                               BrowseInformation="0"\r
-                               WarningLevel="3"\r
-                               SuppressStartupBanner="TRUE"\r
-                               DebugInformationFormat="3"\r
-                               CallingConvention="1"\r
-                               CompileAs="0"/>\r
-                       <Tool\r
-                               Name="VCCustomBuildTool"/>\r
-                       <Tool\r
-                               Name="VCLinkerTool"\r
-                               AdditionalOptions="/MACHINE:I386"\r
-                               AdditionalDependencies="odbc32.lib odbccp32.lib"\r
-                               OutputFile="UserM_Release/generic/glslang.dll"\r
-                               LinkIncremental="1"\r
-                               SuppressStartupBanner="TRUE"\r
-                               IgnoreDefaultLibraryNames="libcmtd.lib;libcd.lib;libcmt.lib;"\r
-                               GenerateDebugInformation="TRUE"\r
-                               ProgramDatabaseFile="UserM_Release/generic/glslang.pdb"\r
-                               SubSystem="1"\r
-                               OptimizeReferences="2"\r
-                               EnableCOMDATFolding="2"\r
-                               ImportLibrary="UserM_Release/generic/glslang.lib"/>\r
-                       <Tool\r
-                               Name="VCMIDLTool"\r
-                               TypeLibraryName="UserM_Release/generic/glslang.tlb"/>\r
-                       <Tool\r
-                               Name="VCPostBuildEventTool"\r
-                               Description="copy dll"\r
-                               CommandLine="xcopy /y UserM_Release\generic\glslang.* standalone"/>\r
-                       <Tool\r
-                               Name="VCPreBuildEventTool"/>\r
-                       <Tool\r
-                               Name="VCPreLinkEventTool"/>\r
-                       <Tool\r
-                               Name="VCResourceCompilerTool"\r
-                               PreprocessorDefinitions="NDEBUG"\r
-                               Culture="2057"/>\r
-                       <Tool\r
-                               Name="VCWebServiceProxyGeneratorTool"/>\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"/>\r
-               </Configuration>\r
-       </Configurations>\r
-       <Files>\r
-               <Filter\r
-                       Name="Machine Independent"\r
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;y;l">\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\InfoSink.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\Initialize.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\Initialize.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="OGLCompilersDLL\InitializeDll.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\IntermTraverse.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\Intermediate.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\MMap.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\ParseHelper.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\ParseHelper.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\PoolAlloc.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\QualifierAlive.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\QualifierAlive.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\RemoveTree.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\RemoveTree.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\ShaderLang.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\SymbolTable.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\glslang.l">\r
-                               <FileConfiguration\r
-                                       Name="UserM_Debug|Win32">\r
-                                       <Tool\r
-                                               Name="VCCustomBuildTool"\r
-                                               Description="Executing flex on $(InputPath)"\r
-                                               CommandLine="$(InputDir)..\..\tools\flex.exe $(InputPath)\r
-if EXIST $(InputDir)gen_glslang.cpp del $(InputDir)gen_glslang.cpp\r
-move gen_glslang.cpp $(InputDir)gen_glslang.cpp\r
-cd $(InputDir)\r
-rename gen_glslang.cpp Gen_glslang.cpp\r
-"\r
-                                               AdditionalDependencies="glslang_tab.h"\r
-                                               Outputs="$(InputDir)Gen_glslang.cpp"/>\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="UserM_Release|Win32">\r
-                                       <Tool\r
-                                               Name="VCCustomBuildTool"\r
-                                               Description="Executing flex on $(InputPath)"\r
-                                               CommandLine="$(InputDir)..\..\tools\flex.exe $(InputPath)\r
-if EXIST $(InputDir)gen_glslang.cpp del $(InputDir)gen_glslang.cpp\r
-move gen_glslang.cpp $(InputDir)gen_glslang.cpp\r
-"\r
-                                               AdditionalDependencies="glslang_tab.h"\r
-                                               Outputs="$(InputDir)Gen_glslang.cpp"/>\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\glslang.y">\r
-                               <FileConfiguration\r
-                                       Name="UserM_Debug|Win32">\r
-                                       <Tool\r
-                                               Name="VCCustomBuildTool"\r
-                                               Description="Executing Bison on $(InputPath)"\r
-                                               CommandLine="SET BISON_SIMPLE=$(InputDir)..\..\tools\bison.simple\r
-SET BISON_HAIRY=$(InputDir)..\..\tools\bison.simple\r
-cd $(InputDir)\r
-$(InputDir)..\..\tools\bison.exe -d -t -v $(InputName).y\r
-if EXIST $(InputDir)Gen_$(InputName)_tab.cpp del $(InputDir)Gen_$(InputName)_tab.cpp\r
-rename $(InputDir)$(InputName)_tab.c Gen_$(InputName)_tab.cpp\r
-"\r
-                                               Outputs="$(InputDir)Gen_$(InputName)_tab.cpp"/>\r
-                               </FileConfiguration>\r
-                               <FileConfiguration\r
-                                       Name="UserM_Release|Win32">\r
-                                       <Tool\r
-                                               Name="VCCustomBuildTool"\r
-                                               Description="Executing Bison on $(InputPath)"\r
-                                               CommandLine="SET BISON_SIMPLE=$(InputDir)..\..\tools\bison.simple\r
-SET BISON_HAIRY=$(InputDir)..\..\tools\bison.simple\r
-cd $(InputDir)\r
-$(InputDir)..\..\tools\bison.exe -d -t -v $(InputName).y\r
-if EXIST $(InputDir)Gen_$(InputName)_tab.cpp del $(InputDir)Gen_$(InputName)_tab.cpp\r
-rename $(InputDir)$(InputName)_tab.c Gen_$(InputName)_tab.cpp\r
-"\r
-                                               Outputs="$(InputDir)Gen_$(InputName)_tab.cpp"/>\r
-                               </FileConfiguration>\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\intermOut.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\localintermediate.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\parseConst.cpp">\r
-                       </File>\r
-                       <Filter\r
-                               Name="Generated Source"\r
-                               Filter="">\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\Gen_glslang.cpp">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\Gen_glslang_tab.cpp">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\glslang_tab.h">\r
-                               </File>\r
-                       </Filter>\r
-                       <Filter\r
-                               Name="CPP"\r
-                               Filter="">\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\atom.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\atom.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\compile.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\cpp.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\cpp.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\cppstruct.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\memory.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\memory.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\parser.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\preprocess.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\scanner.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\scanner.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\slglobals.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\symbols.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\symbols.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\tokens.c">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\MachineIndependent\preprocessor\tokens.h">\r
-                               </File>\r
-                       </Filter>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Header Files">\r
-                       <File\r
-                               RelativePath="glslang\Include\BaseTypes.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\Common.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\ConstantUnion.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\InfoSink.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="OGLCompilersDLL\InitializeDll.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\InitializeGlobals.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\InitializeParseContext.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\PoolAlloc.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\ResourceLimits.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\ShHandle.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\SymbolTable.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\Types.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\Include\intermediate.h">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\MachineIndependent\unistd.h">\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Public"\r
-                       Filter="">\r
-                       <File\r
-                               RelativePath="glslang\Public\ShaderLang.h">\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="Generic Code Gen"\r
-                       Filter="">\r
-                       <File\r
-                               RelativePath="glslang\GenericCodeGen\CodeGen.cpp">\r
-                       </File>\r
-                       <File\r
-                               RelativePath="glslang\GenericCodeGen\Link.cpp">\r
-                       </File>\r
-               </Filter>\r
-               <Filter\r
-                       Name="OSDependent"\r
-                       Filter="">\r
-                       <Filter\r
-                               Name="Windows"\r
-                               Filter="">\r
-                               <File\r
-                                       RelativePath="glslang\OSDependent\Windows\main.cpp">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\OSDependent\Windows\osinclude.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\OSDependent\Windows\ossource.cpp">\r
-                               </File>\r
-                       </Filter>\r
-                       <Filter\r
-                               Name="Linux"\r
-                               Filter="">\r
-                               <File\r
-                                       RelativePath="glslang\OSDependent\Linux\osinclude.h">\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="glslang\OSDependent\Linux\ossource.cpp">\r
-                                       <FileConfiguration\r
-                                               Name="UserM_Debug|Win32"\r
-                                               ExcludedFromBuild="TRUE">\r
-                                               <Tool\r
-                                                       Name="VCCLCompilerTool"\r
-                                                       ObjectFile="$(IntDir)/$(InputName)1.obj"/>\r
-                                       </FileConfiguration>\r
-                                       <FileConfiguration\r
-                                               Name="UserM_Release|Win32"\r
-                                               ExcludedFromBuild="TRUE">\r
-                                               <Tool\r
-                                                       Name="VCCLCompilerTool"\r
-                                                       ObjectFile="$(IntDir)/$(InputName)1.obj"/>\r
-                                       </FileConfiguration>\r
-                               </File>\r
-                       </Filter>\r
-               </Filter>\r
-       </Files>\r
-       <Globals>\r
-       </Globals>\r
-</VisualStudioProject>\r
diff --git a/glslang.vcxproj b/glslang.vcxproj
new file mode 100644 (file)
index 0000000..555ddf1
--- /dev/null
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectName>glslang</ProjectName>\r
+    <ProjectGuid>{3B146CC5-B2B8-4573-9D46-6139E2EDFEA3}</ProjectGuid>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>DynamicLibrary</ConfigurationType>\r
+    <UseOfMfc>false</UseOfMfc>\r
+    <CharacterSet>MultiByte</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>DynamicLibrary</ConfigurationType>\r
+    <UseOfMfc>false</UseOfMfc>\r
+    <CharacterSet>MultiByte</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup>\r
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">glslang\UserM_Debug\</OutDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">glslang\UserM_Debug\</IntDir>\r
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>\r
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UserM_Release\</OutDir>\r
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UserM_Release\</IntDir>\r
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <Optimization>Disabled</Optimization>\r
+      <AdditionalIncludeDirectories>glslang;glslang\MachineIndependent;glslang\OSDependent\Windows;OGLCompilersDLL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>_DEBUG;WIN32;_CONSOLE;_USRDLL;TEST_EXPORTS;GENERIC_COMPILER;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <MinimalRebuild>false</MinimalRebuild>\r
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
+      <PrecompiledHeaderOutputFile>\r
+      </PrecompiledHeaderOutputFile>\r
+      <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>\r
+      <ObjectFileName>$(IntDir)</ObjectFileName>\r
+      <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>\r
+      <BrowseInformation>\r
+      </BrowseInformation>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+      <CallingConvention>FastCall</CallingConvention>\r
+      <CompileAs>Default</CompileAs>\r
+    </ClCompile>\r
+    <Link>\r
+      <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>\r
+      <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <SuppressStartupBanner>false</SuppressStartupBanner>\r
+      <IgnoreSpecificDefaultLibraries>libcmtd.lib;libcd.lib;libcmt.lib;libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <ProgramDatabaseFile>UserM_Debug/glslang.pdb</ProgramDatabaseFile>\r
+      <SubSystem>Console</SubSystem>\r
+      <ImportLibrary>UserM_Debug/generic/glslang.lib</ImportLibrary>\r
+      <OutputFile>$(IntDir)$(TargetName)$(TargetExt)</OutputFile>\r
+    </Link>\r
+    <Midl>\r
+      <TypeLibraryName>UserM_Debug/generic/glslang.tlb</TypeLibraryName>\r
+    </Midl>\r
+    <PostBuildEvent>\r
+      <Message>copy dll</Message>\r
+      <Command>del Test\$(TargetName)$(TargetExt)\r
+xcopy /y $(IntDir)$(TargetName)$(TargetExt) Test</Command>\r
+    </PostBuildEvent>\r
+    <ResourceCompile>\r
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <Culture>0x0809</Culture>\r
+    </ResourceCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>\r
+      <OmitFramePointers>true</OmitFramePointers>\r
+      <AdditionalIncludeDirectories>glslang;glslang\MachineIndependent;glslang\OSDependent\Windows;OGLCompilersDLL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>NDEBUG;WIN32;_CONSOLE;_USRDLL;TEST_EXPORTS;GENERIC_COMPILER;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <StringPooling>true</StringPooling>\r
+      <MinimalRebuild>false</MinimalRebuild>\r
+      <BasicRuntimeChecks>Default</BasicRuntimeChecks>\r
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
+      <BufferSecurityCheck>true</BufferSecurityCheck>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <PrecompiledHeaderOutputFile>\r
+      </PrecompiledHeaderOutputFile>\r
+      <AssemblerListingLocation>UserM_Release/</AssemblerListingLocation>\r
+      <ObjectFileName>UserM_Release/</ObjectFileName>\r
+      <ProgramDataBaseFileName>UserM_Release/glslang</ProgramDataBaseFileName>\r
+      <BrowseInformation>\r
+      </BrowseInformation>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+      <CallingConvention>FastCall</CallingConvention>\r
+      <CompileAs>Default</CompileAs>\r
+    </ClCompile>\r
+    <Link>\r
+      <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>\r
+      <AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <OutputFile>UserM_Release/generic/glslang.dll</OutputFile>\r
+      <SuppressStartupBanner>true</SuppressStartupBanner>\r
+      <IgnoreSpecificDefaultLibraries>libcmtd.lib;libcd.lib;libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <ProgramDatabaseFile>UserM_Release/generic/glslang.pdb</ProgramDatabaseFile>\r
+      <SubSystem>Console</SubSystem>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <ImportLibrary>UserM_Release/generic/glslang.lib</ImportLibrary>\r
+    </Link>\r
+    <Midl>\r
+      <TypeLibraryName>UserM_Release/generic/glslang.tlb</TypeLibraryName>\r
+    </Midl>\r
+    <PostBuildEvent>\r
+      <Message>copy dll</Message>\r
+      <Command>xcopy /y UserM_Release\generic\glslang.* StandAlone</Command>\r
+    </PostBuildEvent>\r
+    <ResourceCompile>\r
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <Culture>0x0809</Culture>\r
+    </ResourceCompile>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="glslang\MachineIndependent\gen_glslang.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\glslang_tab.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\InfoSink.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\Initialize.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\Versions.cpp" />\r
+    <ClCompile Include="OGLCompilersDLL\InitializeDll.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\IntermTraverse.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\Intermediate.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\ParseHelper.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\PoolAlloc.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\QualifierAlive.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\RemoveTree.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\ShaderLang.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\SymbolTable.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\intermOut.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\parseConst.cpp" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\atom.c" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\cpp.c" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\cppstruct.c" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\memory.c" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\scanner.c" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\symbols.c" />\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\tokens.c" />\r
+    <ClCompile Include="glslang\GenericCodeGen\CodeGen.cpp" />\r
+    <ClCompile Include="glslang\GenericCodeGen\Link.cpp" />\r
+    <ClCompile Include="glslang\OSDependent\Windows\main.cpp" />\r
+    <ClCompile Include="glslang\OSDependent\Windows\ossource.cpp" />\r
+    <ClCompile Include="glslang\OSDependent\Linux\ossource.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ClInclude Include="glslang\MachineIndependent\glslang_tab.cpp.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\Initialize.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\MMap.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\ParseHelper.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\QualifierAlive.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\RemoveTree.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\localintermediate.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\atom.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\compile.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\cpp.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\memory.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\parser.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\preprocess.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\scanner.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\slglobals.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\symbols.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\tokens.h" />\r
+    <ClInclude Include="glslang\Include\BaseTypes.h" />\r
+    <ClInclude Include="glslang\Include\Common.h" />\r
+    <ClInclude Include="glslang\Include\ConstantUnion.h" />\r
+    <ClInclude Include="glslang\Include\InfoSink.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\Versions.h" />\r
+    <ClInclude Include="OGLCompilersDLL\InitializeDll.h" />\r
+    <ClInclude Include="glslang\Include\InitializeGlobals.h" />\r
+    <ClInclude Include="glslang\Include\InitializeParseContext.h" />\r
+    <ClInclude Include="glslang\Include\PoolAlloc.h" />\r
+    <ClInclude Include="glslang\Include\ResourceLimits.h" />\r
+    <ClInclude Include="glslang\Include\ShHandle.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\SymbolTable.h" />\r
+    <ClInclude Include="glslang\Include\Types.h" />\r
+    <ClInclude Include="glslang\Include\intermediate.h" />\r
+    <ClInclude Include="glslang\MachineIndependent\unistd.h" />\r
+    <ClInclude Include="glslang\Public\ShaderLang.h" />\r
+    <ClInclude Include="glslang\OSDependent\Windows\osinclude.h" />\r
+    <ClInclude Include="glslang\OSDependent\Linux\osinclude.h" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <CustomBuild Include="glslang\MachineIndependent\glslang.y">\r
+      <FileType>Document</FileType>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Executing Bison on glslang.y</Message>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">SET BISON_SIMPLE=%(RootDir)%(Directory)..\..\tools\bison.simple\r
+SET BISON_HAIRY=%(RootDir)%(Directory)..\..\tools\bison.simple\r
+cd %(RootDir)%(Directory)\r
+%(RootDir)%(Directory)..\..\tools\bison.exe -d -t glslang.y -o glslang_tab.cpp\r
+</Command>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(RootDir)%(Directory)glslang_tab.cpp;%(RootDir)%(Directory)glslang_tab.cpp.h</Outputs>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Executing Bison on %(FullPath)</Message>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">SET BISON_SIMPLE=%(RootDir)%(Directory)..\..\tools\bison.simple\r
+SET BISON_HAIRY=%(RootDir)%(Directory)..\..\tools\bison.simple\r
+cd %(RootDir)%(Directory)\r
+%(RootDir)%(Directory)..\..\tools\bison.exe -d -t -v %(Filename).y\r
+if EXIST %(RootDir)%(Directory)Gen_%(Filename)_tab.cpp del %(RootDir)%(Directory)Gen_%(Filename)_tab.cpp\r
+rename %(RootDir)%(Directory)%(Filename)_tab.c Gen_%(Filename)_tab.cpp\r
+</Command>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(RootDir)%(Directory)Gen_%(Filename)_tab.cpp;%(Outputs)</Outputs>\r
+    </CustomBuild>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <CustomBuild Include="glslang\MachineIndependent\glslang.l">\r
+      <FileType>Document</FileType>\r
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cd %(RootDir)%(Directory)\r
+%(RootDir)%(Directory)..\..\tools\flex.exe glslang.l\r
+</Command>\r
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Executing flex on glslang.l</Message>\r
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(RootDir)%(Directory)gen_glslang.cpp</Outputs>\r
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(RootDir)%(Directory)glslang_tab.cpp.h</AdditionalInputs>\r
+    </CustomBuild>\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/glslang.vcxproj.filters b/glslang.vcxproj.filters
new file mode 100644 (file)
index 0000000..00f33d8
--- /dev/null
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup>\r
+    <Filter Include="Machine Independent">\r
+      <UniqueIdentifier>{593f06dd-7981-4cb7-91ba-eae633fa547e}</UniqueIdentifier>\r
+      <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;y;l</Extensions>\r
+    </Filter>\r
+    <Filter Include="Machine Independent\Generated Source">\r
+      <UniqueIdentifier>{564543b5-6302-49ab-9d24-bd6bef91274a}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="Machine Independent\CPP">\r
+      <UniqueIdentifier>{5d320e20-4d64-4db1-9d8c-e7fdc234be36}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="Header Files">\r
+      <UniqueIdentifier>{d4faa328-f693-4b77-9fcb-9629ca0d8ee8}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="Public">\r
+      <UniqueIdentifier>{c79e7f4d-1836-4b72-b201-46e72e4e4b6b}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="Generic Code Gen">\r
+      <UniqueIdentifier>{b56dd525-2a9c-4ae5-a6b4-d024e624c6b4}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="OSDependent">\r
+      <UniqueIdentifier>{d48b8f48-5784-4cb6-bead-7f98647a1c44}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="OSDependent\Windows">\r
+      <UniqueIdentifier>{092b92ee-743a-407d-ad9b-92af399715d6}</UniqueIdentifier>\r
+    </Filter>\r
+    <Filter Include="OSDependent\Linux">\r
+      <UniqueIdentifier>{0c27903f-6ef2-4725-9d9c-70f50aeaa7a1}</UniqueIdentifier>\r
+    </Filter>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="glslang\MachineIndependent\InfoSink.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\Initialize.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="OGLCompilersDLL\InitializeDll.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\IntermTraverse.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\Intermediate.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\ParseHelper.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\PoolAlloc.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\QualifierAlive.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\RemoveTree.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\ShaderLang.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\SymbolTable.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\intermOut.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\parseConst.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\atom.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\cpp.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\cppstruct.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\memory.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\scanner.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\symbols.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\preprocessor\tokens.c">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\GenericCodeGen\CodeGen.cpp">\r
+      <Filter>Generic Code Gen</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\GenericCodeGen\Link.cpp">\r
+      <Filter>Generic Code Gen</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\OSDependent\Windows\main.cpp">\r
+      <Filter>OSDependent\Windows</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\OSDependent\Windows\ossource.cpp">\r
+      <Filter>OSDependent\Windows</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\OSDependent\Linux\ossource.cpp">\r
+      <Filter>OSDependent\Linux</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\gen_glslang.cpp">\r
+      <Filter>Machine Independent\Generated Source</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\glslang_tab.cpp">\r
+      <Filter>Machine Independent\Generated Source</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="glslang\MachineIndependent\Versions.cpp">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ClInclude Include="glslang\MachineIndependent\Initialize.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\MMap.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\ParseHelper.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\QualifierAlive.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\RemoveTree.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\localintermediate.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\atom.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\compile.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\cpp.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\memory.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\parser.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\preprocess.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\scanner.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\slglobals.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\symbols.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\preprocessor\tokens.h">\r
+      <Filter>Machine Independent\CPP</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\BaseTypes.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\Common.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\ConstantUnion.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\InfoSink.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="OGLCompilersDLL\InitializeDll.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\InitializeGlobals.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\InitializeParseContext.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\PoolAlloc.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\ResourceLimits.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\ShHandle.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\SymbolTable.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\Types.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Include\intermediate.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\unistd.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\Public\ShaderLang.h">\r
+      <Filter>Public</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\OSDependent\Windows\osinclude.h">\r
+      <Filter>OSDependent\Windows</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\OSDependent\Linux\osinclude.h">\r
+      <Filter>OSDependent\Linux</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\glslang_tab.cpp.h">\r
+      <Filter>Machine Independent\Generated Source</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="glslang\MachineIndependent\Versions.h">\r
+      <Filter>Machine Independent</Filter>\r
+    </ClInclude>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <CustomBuild Include="glslang\MachineIndependent\glslang.y">\r
+      <Filter>Machine Independent</Filter>\r
+    </CustomBuild>\r
+    <CustomBuild Include="glslang\MachineIndependent\glslang.l">\r
+      <Filter>Machine Independent</Filter>\r
+    </CustomBuild>\r
+  </ItemGroup>\r
+</Project>
\ No newline at end of file
index f2c7753..05575a0 100644 (file)
@@ -739,8 +739,8 @@ bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type)
         return true;
     }
 
-    if (type.qualifier == EvqConst && extensionErrorCheck(line, "GL_3DL_array_objects"))
-        return true;
+    if (type.qualifier == EvqConst)
+        profileRequires(line, ENoProfile, 120, "GL_3DL_array_objects", "const array");
 
     return false;
 }
@@ -948,20 +948,6 @@ bool TParseContext::paramErrorCheck(int line, TQualifier qualifier, TType* type)
     }
 }
 
-bool TParseContext::extensionErrorCheck(int line, const char* extension)
-{       
-    if (extensionBehavior[extension] == EBhWarn) {
-        infoSink.info.message(EPrefixWarning, ("extension " + TString(extension) + " is being used").c_str(), line);
-        return false;
-    }
-    if (extensionBehavior[extension] == EBhDisable) {
-        error(line, "extension", extension, "is disabled");
-        return true;
-    }
-
-    return false;
-}
-
 /////////////////////////////////////////////////////////////////////////////////
 //
 // Non-Errors.
@@ -1448,7 +1434,7 @@ void TParseContext::initializeExtensionBehavior()
     // example code: extensionBehavior["test"] = EBhDisable; // where "test" is the name of 
     // supported extension
     //
-    extensionBehavior["GL_ARB_texture_rectangle"] = EBhRequire;
+    extensionBehavior["GL_ARB_texture_rectangle"] = EBhDisable;
     extensionBehavior["GL_3DL_array_objects"] = EBhDisable;
 }
 
@@ -1457,7 +1443,7 @@ OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
 bool InitializeParseContextIndex()
 {
     if (GlobalParseContextIndex != OS_INVALID_TLS_INDEX) {
-        assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
+        assert(0 && "InitializeParseContextIndex(): Parse Context already initialised");
         return false;
     }
 
@@ -1467,7 +1453,7 @@ bool InitializeParseContextIndex()
     GlobalParseContextIndex = OS_AllocTLSIndex();
     
     if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
+        assert(0 && "InitializeParseContextIndex(): Parse Context already initialised");
         return false;
     }
 
@@ -1477,13 +1463,13 @@ bool InitializeParseContextIndex()
 bool InitializeGlobalParseContext()
 {
     if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "InitializeGlobalParseContext(): Parse Context index not initalised");
+        assert(0 && "InitializeGlobalParseContext(): Parse Context index not initialized");
         return false;
     }
 
     TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
     if (lpParseContext != 0) {
-        assert(0 && "InitializeParseContextIndex(): Parse Context already initalised");
+        assert(0 && "InitializeParseContextIndex(): Parse Context already initialized");
         return false;
     }
 
@@ -1513,7 +1499,7 @@ TParseContextPointer& GetGlobalParseContext()
 bool FreeParseContext()
 {
     if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "FreeParseContext(): Parse Context index not initalised");
+        assert(0 && "FreeParseContext(): Parse Context index not initialized");
         return false;
     }
 
@@ -1529,7 +1515,7 @@ bool FreeParseContextIndex()
     OS_TLSIndex tlsiIndex = GlobalParseContextIndex;
 
     if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 && "FreeParseContextIndex(): Parse Context index not initalised");
+        assert(0 && "FreeParseContextIndex(): Parse Context index not initialized");
         return false;
     }
 
index 704d3e4..3e1a125 100644 (file)
@@ -2,6 +2,8 @@
 //Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
 //All rights reserved.
 //
+//Copyright (C) 2012 LunarG, Inc.
+//
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions
 //are met:
@@ -34,6 +36,7 @@
 #ifndef _PARSER_HELPER_INCLUDED_
 #define _PARSER_HELPER_INCLUDED_
 
+#include "Versions.h"
 #include "../Include/ShHandle.h"
 #include "SymbolTable.h"
 #include "localintermediate.h"
@@ -67,8 +70,9 @@ struct TParseContext {
     TParseContext(TSymbolTable& symt, TIntermediate& interm, EShLanguage L, TInfoSink& is) : 
             intermediate(interm), symbolTable(symt), infoSink(is), language(L), treeRoot(0),
             recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
-            switchNestingLevel(0),
-            inTypeParen(false), contextPragma(true, false) {  }
+            switchNestingLevel(0), inTypeParen(false), 
+            version(110), profile(ENoProfile), futureCompatibility(false),
+            contextPragma(true, false) {  }
     TIntermediate& intermediate; // to hold and build a parse tree
     TSymbolTable& symbolTable;   // symbol table that goes with the language currently being parsed
     TInfoSink& infoSink;
@@ -82,7 +86,16 @@ struct TParseContext {
     bool inTypeParen;            // true if in parentheses, looking only for an identifier
     const TType* currentFunctionType;  // the return type of the function that's currently being parsed
     bool functionReturnsValue;   // true if a non-void function has a return
-    TMap<TString, TBehavior> extensionBehavior;
+
+    int version;                 // the declared version in the shader (110 by default)
+    EProfile profile;            // the declared profile in the shader (core by default)
+    bool futureCompatibility;    // true if requesting errors for future compatibility (false by default)
+    TMap<TString, TBehavior> extensionBehavior;    // for each extension string, what it's current enablement is
+    
+    struct TPragma contextPragma;
+       TString HashErrMsg; 
+    bool AfterEOF;
+
     void initializeExtensionBehavior();
 
     void C_DECL error(TSourceLoc, const char *szReason, const char *szToken, 
@@ -117,7 +130,6 @@ struct TParseContext {
     bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type);
     bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type);
     bool paramErrorCheck(int line, TQualifier qualifier, TType* type);
-    bool extensionErrorCheck(int line, const char*);
     const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0);
     bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType, 
                             TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
@@ -131,9 +143,12 @@ struct TParseContext {
     TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line);
     TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc);
     bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc);
-       struct TPragma contextPragma;
-       TString HashErrMsg; 
-    bool AfterEOF;
+    void requireProfile(int line, EProfileMask profileMask, const char *featureDesc);
+    void requireStage(int line, EShLanguageMask languageMask, const char *featureDesc);
+    void profileRequires(int line, EProfile callingProfile, int minVersion, int numExtensions, const char* extensions[], const char *featureDesc);
+    void profileRequires(int line, EProfile callingProfile, int minVersion, const char* extension, const char *featureDesc);
+    void checkDeprecated(int line, EProfile callingProfile, int depVersion, const char *featureDesc);
+    void requireNotRemoved(int line, EProfile callingProfile, int removedVersion, const char *featureDesc);
 };
 
 int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext&);
index 5d932d1..f38f856 100644 (file)
@@ -282,6 +282,8 @@ int ShCompile(
     
     GenerateBuiltInSymbolTable(resources, compiler->infoSink, &symbolTable, compiler->getLanguage());
 
+    // TODO: this is happening *after* initialization, which already parsed some things... what parse context was that?
+    // what extensions did it have?
     TParseContext parseContext(symbolTable, intermediate, compiler->getLanguage(), compiler->infoSink);
     parseContext.initializeExtensionBehavior();
 
diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp
new file mode 100644 (file)
index 0000000..c1341b7
--- /dev/null
@@ -0,0 +1,161 @@
+//
+//Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
+//All rights reserved.
+//
+//Copyright (C) 2012 LunarG, Inc.
+//All rights reserved.
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//    Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//
+//    Redistributions in binary form must reproduce the above
+//    copyright notice, this list of conditions and the following
+//    disclaimer in the documentation and/or other materials provided
+//    with the distribution.
+//
+//    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
+//    contributors may be used to endorse or promote products derived
+//    from this software without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//POSSIBILITY OF SUCH DAMAGE.
+//
+
+//
+// Help manage multiple profiles, versions, extensions etc.
+//
+// These don't return error codes, as the presumption is parsing
+// will always continue as if the feature were present, and there
+// is no error recovery needed to enable that.
+//
+
+#include "ParseHelper.h"
+
+char* StageName[EShLangCount] = {
+    "vertex",
+    "tessellation control",
+    "tessellation evaluation",
+    "geometry",
+    "fragment"
+};
+
+char* ProfileName[EProfileCount] = {
+    "none",
+    "core",
+    "compatibility",
+    "es"
+};
+
+//
+// If only some profiles support a feature, use requireProfile() to specify
+// which subset allows the feature.  If the current profile is not present,
+// give an error message.
+//
+void TParseContext::requireProfile(int line, EProfileMask profileMask, const char *featureDesc)
+{
+    if (((1 << profile) & profileMask) == 0) {
+        error(line, "not supported with this profile:", featureDesc, ProfileName[profile]);
+        recover();
+    }
+}
+
+//
+// If only some stages support a feature, use requireStage() to specify
+// which subset allows the feature.  If the current stage is not present,
+// give an error message.
+//
+void TParseContext::requireStage(int line, EShLanguageMask languageMask, const char *featureDesc)
+{
+    if (((1 << language) & languageMask) == 0) {
+        error(line, "not supported in this stage:", featureDesc, StageName[language]);
+        recover();
+    }
+}
+
+//
+// Within a profile, if a feature requires a version level or extension, use
+// ProfileRequires().  This only checks if the current profile matches 
+// the passed-in profile.
+//
+
+// one that takes multiple extensions
+void TParseContext::profileRequires(int line, EProfile callingProfile, int minVersion, int numExtensions, const char* extensions[], const char *featureDesc)
+{
+    if (profile == callingProfile) {
+        bool okay = false;
+        if (version >= minVersion)
+            okay = true;
+        for (int i = 0; i < numExtensions; ++i) {
+            TBehavior behavior = extensionBehavior[extensions[i]];
+            switch (behavior) {
+            case EBhWarn:
+                infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), line);
+                // fall through
+            case EBhRequire:
+            case EBhEnable:
+                okay = true;
+                break;
+            }
+        }
+
+        if (! okay) {
+            error(line, "not supported for this version or the enabled extensions", featureDesc, "");
+            recover();
+        }
+    }
+}
+
+// one that takes a single extension
+void TParseContext::profileRequires(int line, EProfile callingProfile, int minVersion, const char* extension, const char *featureDesc)
+{
+    profileRequires(line, callingProfile, minVersion, 1, &extension, featureDesc);
+}
+
+//
+// Within a profile, see if a feature is deprecated and error or warn based on whether
+// a future compatibility context is being use.
+//
+void TParseContext::checkDeprecated(int line, EProfile callingProfile, int depVersion, const char *featureDesc)
+{
+    if (profile == callingProfile) {
+        if (version >= depVersion) {
+            if (futureCompatibility) {
+                error(line, "deprecated, may be removed in future release", featureDesc, "");
+                recover();
+            } else {
+                infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " being used, but may be removed in future release").c_str(), line);
+            }
+        }
+    }
+}
+
+//
+// Within a profile, see if a feature has now been removed and if so, give an error.
+// The version argument is the first version no longer having the feature.
+//
+void TParseContext::requireNotRemoved(int line, EProfile callingProfile, int removedVersion, const char *featureDesc)
+{
+    if (profile == callingProfile) {
+        if (version >= removedVersion) {
+            const int maxSize = 60;
+            char buf[maxSize];
+            sprintf_s(buf, maxSize, "%s profile; removed in version %d", ProfileName[profile], removedVersion);
+            error(line, "no longer supported in", featureDesc, buf);
+            recover();
+        }
+    }
+}
diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h
new file mode 100644 (file)
index 0000000..11dde5b
--- /dev/null
@@ -0,0 +1,59 @@
+//
+//Copyright (C) 2002-2005  3Dlabs Inc. Ltd.
+//All rights reserved.
+//
+//Copyright (C) 2012 LunarG, Inc.
+//All rights reserved.
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//    Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+//
+//    Redistributions in binary form must reproduce the above
+//    copyright notice, this list of conditions and the following
+//    disclaimer in the documentation and/or other materials provided
+//    with the distribution.
+//
+//    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
+//    contributors may be used to endorse or promote products derived
+//    from this software without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+//FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+//COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+//BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+//LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+//CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+//ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+//POSSIBILITY OF SUCH DAMAGE.
+//
+#ifndef _VERSIONS_INCLUDED_
+#define _VERSIONS_INCLUDED_
+
+//
+// Help manage multiple profiles, versions, extensions etc.
+//
+
+typedef enum {
+    ENoProfile,              // only for desktop, before profiles showed up
+    ECoreProfile,
+    ECompatibilityProfile,
+    EEsProfile,
+    EProfileCount,
+} EProfile;
+
+typedef enum {
+    ENoProfileMask            = (1 << ENoProfile),
+    ECoreProfileMask          = (1 << ECoreProfile),
+    ECompatibilityProfileMask = (1 << ECompatibilityProfile),
+    EEsProfileMask            = (1 << EEsProfile)
+} EProfileMask;
+
+#endif // _VERSIONS_INCLUDED_
index 771d22c..25ad975 100644 (file)
@@ -3,6 +3,8 @@
 //Copyright (C) 2002-2005  3Dlabs Inc. Ltd.\r
 //All rights reserved.\r
 //\r
+//Copyright (C) 2012 LunarG, Inc.\r
+//\r
 //Redistribution and use in source and binary forms, with or without\r
 //modification, are permitted provided that the following conditions\r
 //are met:\r
@@ -568,7 +570,7 @@ void CPPShInfoLogMsg(const char *msg)
 \r
 void CPPErrorToInfoLog(char *msg)\r
 {\r
-    ((TParseContext *)cpp->pC)->error(yylineno,"syntax error", "",msg,"");\r
+    ((TParseContext *)cpp->pC)->error(yylineno, "CPP error:", "",msg,"");\r
     GlobalParseContext->recover();\r
 }\r
 \r
@@ -708,6 +710,48 @@ void ResetTString(void)
     ((TParseContext *)cpp->pC)->HashErrMsg = "";\r
 }\r
 \r
+void SetVersion(int version)\r
+{\r
+    ((TParseContext *)cpp->pC)->version = version;\r
+}\r
+\r
+const int FirstProfileVersion = 150;\r
+\r
+// Important assumption:  SetVersion() is called before SetProfile(), and is always called\r
+// if there is a version, sending in a ENoProfile if there is no profile given.\r
+void SetProfile(EProfile profile)\r
+{\r
+    int version = ((TParseContext *)cpp->pC)->version;\r
+\r
+    if (profile == ENoProfile) {\r
+        if (version == 100 || version == 300) {\r
+            CPPErrorToInfoLog("versions 100 and 300 require specifying the es profile");\r
+            ((TParseContext *)cpp->pC)->profile = ENoProfile;\r
+        } else if (version >= FirstProfileVersion)\r
+            ((TParseContext *)cpp->pC)->profile = ECoreProfile;\r
+        else\r
+            ((TParseContext *)cpp->pC)->profile = ENoProfile;\r
+    } else { \r
+        // a profile was provided...\r
+        if (version == 100 || version == 300) {\r
+            if (profile != EEsProfile)\r
+                CPPErrorToInfoLog("versions 100 and 300 only support the es profile");            \r
+            ((TParseContext *)cpp->pC)->profile = EEsProfile;\r
+        } else {\r
+            if (profile == EEsProfile) {\r
+                CPPErrorToInfoLog("only versions 100 and 300 support the es profile");\r
+                if (version >= FirstProfileVersion)\r
+                    ((TParseContext *)cpp->pC)->profile = ECoreProfile;\r
+                else\r
+                    ((TParseContext *)cpp->pC)->profile = ENoProfile;\r
+            } else {\r
+                // typical desktop case... e.g., "#version 410 core"\r
+                ((TParseContext *)cpp->pC)->profile = profile;\r
+            }\r
+        }\r
+    }\r
+}\r
+\r
 TBehavior GetBehavior(const char* behavior)\r
 {\r
     if (!strcmp("require", behavior))\r
index e1f9fd6..4d004fc 100644 (file)
@@ -2,6 +2,8 @@
 //Copyright (C) 2002-2005  3Dlabs Inc. Ltd.\r
 //All rights reserved.\r
 //\r
+//Copyright (C) 2012 LunarG, Inc.\r
+//\r
 //Redistribution and use in source and binary forms, with or without\r
 //modification, are permitted provided that the following conditions\r
 //are met:\r
@@ -70,20 +72,6 @@ Jutta Degener, 1995
     extern void yyerror(char*);\r
 #endif\r
 \r
-#define VERTEX_ONLY(S, L) {                                                     \\r
-    if (parseContext.language != EShLangVertex) {                               \\r
-        parseContext.error(L, " supported in vertex shaders only ", S, "", ""); \\r
-        parseContext.recover();                                                 \\r
-    }                                                                           \\r
-}\r
-\r
-#define FRAG_ONLY(S, L) {                                                        \\r
-    if (parseContext.language != EShLangFragment) {                              \\r
-        parseContext.error(L, " supported in fragment shaders only ", S, "", "");\\r
-        parseContext.recover();                                                  \\r
-    }                                                                            \\r
-}\r
-\r
 %}\r
 %union {\r
     struct {\r
@@ -384,12 +372,8 @@ postfix_expression
             // TODO: if next token is not "(", then this is an error\r
 \r
             if (*$3.string == "length") {\r
-                if (parseContext.extensionErrorCheck($3.line, "GL_3DL_array_objects")) {\r
-                    parseContext.recover();\r
-                    $$ = $1;\r
-                } else {\r
-                    $$ = parseContext.intermediate.addMethod($1, TType(EbtInt), $3.string, $2.line);\r
-                }\r
+                parseContext.profileRequires($3.line, ENoProfile, 120, "GL_3DL_array_objects", ".length");\r
+                $$ = parseContext.intermediate.addMethod($1, TType(EbtInt), $3.string, $2.line);\r
             } else {\r
                 parseContext.error($3.line, "only the length method is supported for array", $3.string->c_str(), "");\r
                 parseContext.recover();\r
@@ -695,10 +679,7 @@ function_identifier
         $$.intermNode = 0;\r
 \r
         if ($1.array) {\r
-            if (parseContext.extensionErrorCheck($1.line, "GL_3DL_array_objects")) {\r
-                parseContext.recover();\r
-                $1.setArray(false);\r
-            }\r
+            parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "array");\r
         }\r
 \r
         if ($1.userDef) {\r
@@ -966,8 +947,8 @@ equality_expression
             constUnion *unionArray = new constUnion[1];\r
             unionArray->setBConst(false);\r
             $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);\r
-        } else if (($1->isArray() || $3->isArray()) && parseContext.extensionErrorCheck($2.line, "GL_3DL_array_objects"))\r
-            parseContext.recover();\r
+        } else if (($1->isArray() || $3->isArray()))\r
+            parseContext.profileRequires($2.line, ENoProfile, 120, "GL_3DL_array_objects", "==");\r
     }\r
     | equality_expression NE_OP relational_expression {\r
         $$ = parseContext.intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, parseContext.symbolTable);\r
@@ -977,8 +958,8 @@ equality_expression
             constUnion *unionArray = new constUnion[1];\r
             unionArray->setBConst(false);\r
             $$ = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtBool, EvqConst), $2.line);\r
-        } else if (($1->isArray() || $3->isArray()) && parseContext.extensionErrorCheck($2.line, "GL_3DL_array_objects"))\r
-            parseContext.recover();\r
+        } else if (($1->isArray() || $3->isArray()))\r
+            parseContext.profileRequires($2.line, ENoProfile, 120, "GL_3DL_array_objects", "!=");\r
     }\r
     ;\r
 \r
@@ -1088,8 +1069,8 @@ assignment_expression
             parseContext.assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());\r
             parseContext.recover();\r
             $$ = $1;\r
-        } else if (($1->isArray() || $3->isArray()) && parseContext.extensionErrorCheck($2.line, "GL_3DL_array_objects"))\r
-            parseContext.recover();\r
+        } else if (($1->isArray() || $3->isArray()))\r
+            parseContext.profileRequires($2.line, ENoProfile, 120, "GL_3DL_array_objects", "=");\r
     }\r
     ;\r
 \r
@@ -1394,22 +1375,20 @@ init_declarator_list
                 parseContext.recover();\r
         }\r
 \r
-        if (parseContext.extensionErrorCheck($$.line, "GL_3DL_array_objects"))\r
+        parseContext.profileRequires($5.line, ENoProfile, 120, "GL_3DL_array_objects", "initializer");\r
+\r
+        TIntermNode* intermNode;\r
+        if (!parseContext.executeInitializer($3.line, *$3.string, $1.type, $6, intermNode, variable)) {\r
+            //\r
+            // build the intermediate representation\r
+            //\r
+            if (intermNode)\r
+                $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermNode, intermNode, $5.line);\r
+            else\r
+                $$.intermAggregate = $1.intermAggregate;\r
+        } else {\r
             parseContext.recover();\r
-        else {\r
-            TIntermNode* intermNode;\r
-            if (!parseContext.executeInitializer($3.line, *$3.string, $1.type, $6, intermNode, variable)) {\r
-                //\r
-                // build the intermediate representation\r
-                //\r
-                if (intermNode)\r
-                    $$.intermAggregate = parseContext.intermediate.growAggregate($1.intermNode, intermNode, $5.line);\r
-                else\r
-                    $$.intermAggregate = $1.intermAggregate;\r
-            } else {\r
-                parseContext.recover();\r
-                $$.intermAggregate = 0;\r
-            }\r
+            $$.intermAggregate = 0;\r
         }\r
     }\r
     | init_declarator_list COMMA IDENTIFIER EQUAL initializer {\r
@@ -1492,22 +1471,20 @@ single_declaration
                 parseContext.recover();\r
         }\r
 \r
-        if (parseContext.extensionErrorCheck($$.line, "GL_3DL_array_objects"))\r
-            parseContext.recover();\r
-        else {\r
-            TIntermNode* intermNode;\r
-            if (!parseContext.executeInitializer($2.line, *$2.string, $1, $5, intermNode, variable)) {\r
-                //\r
-                // Build intermediate representation\r
-                //\r
-                if (intermNode)\r
-                    $$.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, $4.line);\r
-                else\r
-                    $$.intermAggregate = 0;\r
-            } else {\r
-                parseContext.recover();\r
+        parseContext.profileRequires($4.line, ENoProfile, 120, "GL_3DL_array_objects", "initializer");\r
+\r
+        TIntermNode* intermNode;\r
+        if (!parseContext.executeInitializer($2.line, *$2.string, $1, $5, intermNode, variable)) {\r
+            //\r
+            // Build intermediate representation\r
+            //\r
+            if (intermNode)\r
+                $$.intermAggregate = parseContext.intermediate.makeAggregate(intermNode, $4.line);\r
+            else\r
                 $$.intermAggregate = 0;\r
-            }\r
+        } else {\r
+            parseContext.recover();\r
+            $$.intermAggregate = 0;\r
         }\r
     }\r
     | fully_specified_type IDENTIFIER EQUAL initializer {\r
@@ -1538,17 +1515,13 @@ fully_specified_type
         $$ = $1;\r
 \r
         if ($1.array) {\r
-            if (parseContext.extensionErrorCheck($1.line, "GL_3DL_array_objects")) {\r
-                parseContext.recover();\r
-                $1.setArray(false);\r
-            }\r
+            parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "array");\r
         }\r
     }\r
     | type_qualifier type_specifier  {\r
-        if ($2.array && parseContext.extensionErrorCheck($2.line, "GL_3DL_array_objects")) {\r
-            parseContext.recover();\r
-            $2.setArray(false);\r
-        }\r
+        if ($2.array)\r
+            parseContext.profileRequires($1.line, ENoProfile, 120, "GL_3DL_array_objects", "array");\r
+\r
         if ($2.array && parseContext.arrayQualifierErrorCheck($2.line, $1)) {\r
             parseContext.recover();\r
             $2.setArray(false);\r
@@ -1661,12 +1634,15 @@ storage_qualifier
         $$.setBasic(EbtVoid, EvqConst, $1.line);\r
     }\r
     | ATTRIBUTE {\r
-        VERTEX_ONLY("attribute", $1.line);\r
+        //parseContext.requireProfile($1.line, (EProfileMask)(ENoProfileMask | ECompatibilityProfileMask), "attribute");\r
+        parseContext.requireStage($1.line, EShLangVertexMask, "attribute");\r
+        parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute");\r
         if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))\r
             parseContext.recover();\r
         $$.setBasic(EbtVoid, EvqAttribute, $1.line);\r
     }\r
     | VARYING {\r
+        parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying");\r
         if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying"))\r
             parseContext.recover();\r
         if (parseContext.language == EShLangVertex)\r
@@ -2162,29 +2138,25 @@ type_specifier_nonarray
         $$.setBasic(EbtSampler2DShadow, qual, $1.line);\r
     }\r
     | SAMPLER2DRECT {\r
-        if (parseContext.extensionErrorCheck($1.line, "GL_ARB_texture_rectangle"))\r
-            parseContext.recover();\r
+        parseContext.profileRequires($1.line, ENoProfile, 140, "GL_ARB_texture_rectangle", "rectangle texture");\r
 \r
         TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
         $$.setBasic(EbtSamplerRect, qual, $1.line);\r
     }\r
     | SAMPLER2DRECTSHADOW {\r
-        if (parseContext.extensionErrorCheck($1.line, "GL_ARB_texture_rectangle"))\r
-            parseContext.recover();\r
+        parseContext.profileRequires($1.line, ECoreProfile, 140, "GL_ARB_texture_rectangle", "rectangle texture");\r
 \r
         TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
         $$.setBasic(EbtSamplerRectShadow, qual, $1.line);\r
     }\r
     | ISAMPLER2DRECT {\r
-        if (parseContext.extensionErrorCheck($1.line, "GL_ARB_texture_rectangle"))\r
-            parseContext.recover();\r
+        parseContext.profileRequires($1.line, ECoreProfile, 140, "GL_ARB_texture_rectangle", "rectangle texture");\r
 \r
         TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
         $$.setBasic(EbtSamplerRect, qual, $1.line);\r
     }\r
     | USAMPLER2DRECT {\r
-        if (parseContext.extensionErrorCheck($1.line, "GL_ARB_texture_rectangle"))\r
-            parseContext.recover();\r
+        parseContext.profileRequires($1.line, ECoreProfile, 140, "GL_ARB_texture_rectangle", "rectangle texture");\r
 \r
         TQualifier qual = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;\r
         $$.setBasic(EbtSamplerRect, qual, $1.line);\r
@@ -2760,7 +2732,7 @@ jump_statement
         }\r
     }\r
     | DISCARD SEMICOLON {\r
-        FRAG_ONLY("discard", $1.line);\r
+        parseContext.requireStage($1.line, EShLangFragmentMask, "discard");\r
         $$ = parseContext.intermediate.addBranch(EOpKill, $1.line);\r
     }\r
     ;\r
index 140a215..08a9280 100644 (file)
@@ -127,10 +127,6 @@ struct CPPStruct_Rec {
     int    PaArgc;                // count of strings in the array
     char** PaArgv;                // our array of strings to parse    
     unsigned int tokensBeforeEOF : 1;
-
-    // Declared version of the shader
-    int version;
-    int profileAtom;
 };
 
 #endif // !defined(__COMPILE_H)
index 7283705..83bb4b3 100644 (file)
@@ -685,18 +685,22 @@ static int CPPversion(yystypepp * yylvalpp)
        
     yylvalpp->sc_int=atoi(yylvalpp->symbol_name);
 
-    cpp->version = yylvalpp->sc_int;
+    SetVersion(yylvalpp->sc_int);
 
     token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
     
-       if (token == '\n'){
+       if (token == '\n') {
+        SetProfile(ENoProfile);
                return token;
        }
-       else{
-        cpp->profileAtom = yylvalpp->sc_ident;
-        if (cpp->profileAtom != coreAtom &&
-            cpp->profileAtom != compatibilityAtom &&
-            cpp->profileAtom != esAtom)
+       else {
+        if (yylvalpp->sc_ident == coreAtom)
+            SetProfile(ECoreProfile);
+        else if (yylvalpp->sc_ident == compatibilityAtom)
+            SetProfile(ECompatibilityProfile);
+        else if (yylvalpp->sc_ident == esAtom)
+            SetProfile(EEsProfile);
+        else 
             CPPErrorToInfoLog("#version profile name");
 
         token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
index 10ecd12..f7195cd 100644 (file)
@@ -83,6 +83,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "parser.h"
 #include "tokens.h"
+#include "Versions.h"
 
 int InitCPP(void);
 int FinalCPP(void);
@@ -113,6 +114,8 @@ void  SetStringNumber(int);                 // Set string number.
 int   GetLineNumber(void);                  // Get the current String Number. 
 int   GetStringNumber(void);                // Get the current String Number. 
 const char* GetStrfromTStr(void);           // Convert TString to String.  
+void  SetVersion(int);
+void  SetProfile(EProfile);
 void  updateExtensionBehavior(const char* extName, const char* behavior);
 int   FreeCPP(void);
 
index c924dc2..b1b15fa 100644 (file)
@@ -132,8 +132,6 @@ int ResetPreprocessor(void)
                cpp->elsedepth[cpp->elsetracker]=0; 
        cpp->elsetracker=0;
     cpp->tokensBeforeEOF = 0;
-    cpp->version = 110;
-    cpp->profileAtom = 0;
     return 1;
 }
 
index 96e35d4..c4b6984 100644 (file)
@@ -71,10 +71,23 @@ SH_IMPORT_EXPORT int __fastcall ShFinalize();
 //
 typedef enum {
        EShLangVertex,
+    EShLangTessControl,
+    EShLangTessEvaluation,
+    EShLangGeometry,
        EShLangFragment,
     EShLangCount,
 } EShLanguage;
 
+typedef enum {
+       EShLangVertexMask         = (1 << EShLangVertex),
+    EShLangTessControlMask    = (1 << EShLangTessControl),
+    EShLangTessEvaluationMask = (1 << EShLangTessEvaluation),
+    EShLangGeometryMask       = (1 << EShLangGeometry),
+       EShLangFragmentMask       = (1 << EShLangFragment),
+} EShLanguageMask;
+
+extern char* StageName[EShLangCount];
+
 //
 // Types of output the linker will create.
 //