Commit Graph

130 Commits

Author SHA1 Message Date
John Kessenich
6c0928d924 Fix bug dropping some qualifiers when merging with block member default qualification.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22240 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-07-01 04:54:28 +00:00
John Kessenich
69c3d8c1a0 Use the default of "smooth" for interpolation qualification for vertex outs and fragment ins (rather than all fragment IO).
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22222 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-28 05:32:15 +00:00
John Kessenich
554c854143 Fix preprocessor memory leak.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22195 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-26 23:41:30 +00:00
John Kessenich
db4cd54dac Handle bad input file.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22194 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-26 22:42:55 +00:00
John Kessenich
e369bfccfe Semantic checks for .length(), switch/case/default, and multidimensional arrays.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22175 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-26 05:54:40 +00:00
John Kessenich
ef84d10e4c Add semantic check for precision qualifier on wrong kind of type. Added a few more tests.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22170 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-25 21:53:59 +00:00
John Kessenich
d3f85891a7 Support line-continuation (backslash before newline) for tokens and one-line comments in the preprocessor.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22168 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-25 21:09:47 +00:00
John Kessenich
e5f80b8054 Remove the -a option, it doesn't belong here.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22166 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-25 18:31:47 +00:00
John Kessenich
41cf6b540b Add scanner that can find '#version' across an array of non-null terminated, length-based, strings. Handle the ES error where #version is not the first thing found, while still supporting desktop behavior, and more generally support length-based multiple strings for a single shader.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22165 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-25 18:10:05 +00:00
John Kessenich
ebf0825ec4 Add the 6 hyperbolic trig functions.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22149 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-24 22:40:19 +00:00
John Kessenich
eebed6f60b Disallow variable indexing into sampler array for ES and desktop before version 400.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22148 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-24 21:52:41 +00:00
John Kessenich
01fc0645cb Add semantic checks for order of qualification and repetition within a class of qualifiers.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22145 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-24 21:22:03 +00:00
John Kessenich
f5c1075031 Address a g++ complaint.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22143 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-24 18:24:23 +00:00
John Kessenich
06f8464fb5 Create linkage symbol nodes in the AST so a linker has access to all global objects that were declared, for error checking, etc. Use it now for all ins/outs/uniforms as well as gl_VertexID and gl_InstanceID.
Also fixed a confusing name and added more 'const'.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22142 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-24 17:26:56 +00:00
John Kessenich
b29ba33089 Fix bug of accidentally overriding initial layout location with 0, which does not mean no location. Added in/out structure tests.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22120 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-21 19:43:44 +00:00
John Kessenich
211cba242b Add grammar productions for the syntax "layout(...) uniform;" for setting global defaults.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22112 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-20 22:54:40 +00:00
John Kessenich
60d9f7a881 Add grammar productions for adding 'invariant' to already declared variables.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22083 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-19 20:44:17 +00:00
John Kessenich
41a36bbb2f Track separate precision defaults for each kind of sampler, give initial defaults as per spec. Also make fragment floats have no default. Modify/add tests to adapt to these changes.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22066 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-19 05:41:25 +00:00
John Kessenich
c59d0cd9e6 Encapsulate warnings like errors. Add warning for missing #version.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22041 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-17 21:47:23 +00:00
John Kessenich
a622cf2dc5 Fix linux build problem.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22002 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-14 17:32:46 +00:00
John Kessenich
f78fff94e9 Implement __VERSION__ macro, make ftransform() non-ES only, add more tests.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22000 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-13 23:56:04 +00:00
John Kessenich
fb7044a9a8 Semantic checks: ES doesn't have unsized arrays or noise*().
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21998 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-13 20:16:43 +00:00
John Kessenich
3da5a3267e Add semantic checks for nested blocks/structures.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21960 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-13 00:13:36 +00:00
John Kessenich
fd8e101072 Simply compile-time error handling: mostly removed the need to test an error occurred and the need to call recover().
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21959 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-12 22:41:21 +00:00
John Kessenich
fbe01520b6 Get all the scoping rules right for ES and non ES, name hiding, built-in overriding, etc.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21948 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-12 06:13:17 +00:00
John Kessenich
3c31bc3289 Fix a linux build issue.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21945 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-11 18:30:26 +00:00
John Kessenich
a5cecfc6b6 Add constant folding for the exp*(), log*(), *sqrt(), round*(), floor(), fract(), ceil(), abs(), and sign() built in functions.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21927 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-11 00:09:48 +00:00
John Kessenich
fddf3ce3a1 Unify constant floats and constant doubles; they can all be constant doubles.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21921 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-10 21:56:23 +00:00
John Kessenich
50a8cabbbb Add constant folding for length(), normalize(), fwidth(), dFdx(), and dFdy().
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21918 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-10 07:37:49 +00:00
John Kessenich
00f605b930 A round of increasing robustness against buffer overruns.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21917 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-10 07:36:26 +00:00
John Kessenich
7408a69952 Add semantic check for ES variably indexing a uniform block.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21894 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-07 19:07:39 +00:00
John Kessenich
3ce5745ade Add more tests for built-in variables.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21893 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-07 18:54:19 +00:00
John Kessenich
0fbb0c4930 Block/structure fixes: Merge qualifiers with multiple declarators, handle arrays of blocks, more semantic checks for what's allowed.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21883 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-06 18:31:21 +00:00
John Kessenich
ceb0623823 Fix another problem with undefined macros needing to evaluate to 0 within a preprocessor expression, but not outside a preprocessor expression.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21815 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-03 04:15:57 +00:00
John Kessenich
04de88f990 The new test that was to have been added with the previous check in.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21814 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-02 22:57:37 +00:00
John Kessenich
2327da4784 Add test for operation semantics, fix one bug it found.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21798 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-30 23:31:38 +00:00
John Kessenich
69762564de A bunch of semantic checks were missing for binary arithmetic operations. Refactor the "promote" logic to fix these.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21784 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-30 19:15:35 +00:00
John Kessenich
0f359f0e35 Change warning to error for use of double underscore.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21765 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-29 22:40:31 +00:00
John Kessenich
8d00fd0e29 Add missing type check for operands having the same type (after conversion) around the ":" in a "?:" operation.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21721 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-28 07:29:58 +00:00
John Kessenich
2d0f1e5424 Add precision qualifier propagation for swizzling, texture lookups, built-in funtions mapped to operators, comma op, and more robustly propagate for all binary/unary ops.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21622 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-17 02:51:45 +00:00
John Kessenich
61f205ecd8 Remove too aggressive and redundant lexical keyword check: attribute and varying can always be error checked in the grammar.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21443 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-07 23:48:06 +00:00
John Kessenich
52ac67e913 Make the PP report an error on undefined macro in "#if ..." for ES profiles, unless relaxed error checking is requested. Still works as normal CPP on non-ES.
Also, improved error reporting in general for the PP.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21417 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-05 23:46:22 +00:00
John Kessenich
465f452749 Add 3 missing reserved keywords.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21296 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-26 09:36:42 +00:00
John Kessenich
c2ff7702be For all keywords already present, get correct when they could be identifiers, are reserved words, or are keywords, for all versions of ESSL and GLSL.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21282 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-25 16:44:03 +00:00
John Kessenich
09da79e190 Put memory counter stuff in #ifdef _WIN32.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21181 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-17 19:34:23 +00:00
John Kessenich
1d923219fe Add some more qualifier helper functions.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21173 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-17 05:02:12 +00:00
John Kessenich
6e4d1087a4 Fix dependency misspelling that caused unnecessary grammar rebuilds.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21142 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-15 00:14:34 +00:00
John Kessenich
8df53cc057 Rationalize command-line options: controlling memory leak testing, AST output, and info log output.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21141 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-14 19:23:50 +00:00
John Kessenich
4d5de020d8 Force "smooth" interpolation qualification when in a fragment shader.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21140 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-13 06:05:31 +00:00
John Kessenich
78016eff17 Small tweak to switch statements: use a smaller base class.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21138 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-12 22:57:28 +00:00