aboutsummaryrefslogtreecommitdiff
path: root/glslang/MachineIndependent/Intermediate.cpp
AgeCommit message (Collapse)Author
2014-01-07GL_ARB_enhanced_layouts, part 1: Track whether constants are literals, to ↵John Kessenich
enable version-specific checking of layout(... = literal) vs. layout(... = expression). git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24675 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-02Fix crash from attempting ES precision propagation through a constant folded ↵John Kessenich
built-in function call when the expression tree has unknown precisions. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24267 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-01Simplify and rationalize constant folding for dereferences (array, matrix, ↵John Kessenich
vector, swizzle, struct). git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24259 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-11-09Added constant folding for relational (e.g. lessThan) built-ins, relational ↵John Kessenich
built-ins for uints, and bitwise ops for mixed scalars and vectors. Also, allow comments to precede "#version 100". git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23974 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-11-05Clean up/resolve a bunch of TODO, which included implementing ↵John Kessenich
pixel_center_integer and origin_upper_left and adjusting what versions see legacy texturing names. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23874 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-15Add ES 3.0 fragment output link-time test for outputs having or not having ↵John Kessenich
location qualifiers. Also split linker validation into its own file, removed dead "QualifierAlive" files, printed errors for parsing problems with built-in symbols, updated the Windows binary, and added some tests. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23490 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-14Implement ES 2.0 (version 100) limitations for non-inductive loop detection ↵John Kessenich
and array indexes needing "constant-index-expressions" (inductive variables and constant expressions). git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23478 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-11Generalize the symbol hierarchy to transparently handle anonymous-block ↵John Kessenich
members better. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23469 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-05Non-functional changes: Typo in error message and in comment, remove ↵John Kessenich
unneeded arguments, separate constructor-op mapping from handling constructors. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23389 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-04Make some portability improvements identified by Christophe: A few size_t, a ↵John Kessenich
couple "../Include", and a whole bunch of parenthesizing "(A && B) || (C && D)", because some compilers don't believe humans know && is higher precedence than ||. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23379 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-03Document how to add a new feature enabled by an extension in Versions.cpp. ↵John Kessenich
Also reorganized slightly to localize related functions. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23376 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-10-01Add function recursion testing to the link-time validation.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23309 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-28Add full support for uniforms with initializers, including intra-stage link ↵John Kessenich
validation of aggregate constant initializers. This included - encapsulating aggregate constants - removal of constant-aggregate comparison algorithms, instead using a flattened and direct std::vector comparison - adding structure type comparison for independently declared structures that still might match types git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23274 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-26Unify the 8 grammar productions for declaring variables. This greatly ↵John Kessenich
simplifies making changes for this set of productions. This change also naturally picks up redeclarations of built-in arrays and the addition of the remaining linker objects of const, arrays, etc. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23246 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-24Add basic intra-stage linking validation for matching types and ↵John Kessenich
qualification of uniforms/ins/outs/globals, function body duplication, and mixing ES/non-ES shaders. Still need to handle arrays and built-in redeclarations, and many more rules, but this puts the basics in place. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23225 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-20Test for and prevent any dead-code elimination, as all code is needed in the ↵John Kessenich
AST for static-use analysis. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23163 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-08Full thread safety working:John Kessenich
- don't use [] for map lookups, it can modify the map - copy up built-in symbols out of shared symbol table levels before modifying them - enforce shallow vs. deep TType copies - combine maxArraySize with the array dimensions vector, encapsulate - remove chaining of array types git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22953 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-04Add link validation infrastructure for multiple compilation units per stage. ↵John Kessenich
Includes a new, straightforward, C++ interface to the front end. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22927 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-03Some rationalization of TIntermediate (to own it's own tree root) and ↵John Kessenich
TParseHelper for better encapsulation. Needed by some upcoming intra-stage link validation. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22914 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-09-03Remove TIntermediate's dependency on infoSink, simplify folding of constant ↵John Kessenich
aggregates, and infoSink use in constant folding. Added a few deep aggregate constant folding testing cases. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22912 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-08-29Put all glslang internals (but not the external interface) into the glslang ↵John Kessenich
namespace. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22882 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-08-09Put in infrastructure for tessellation, geometry, and compute stages, and ↵John Kessenich
partially flesh out with built-in functions. Added the built-in functions EmitVertex(), EndPrimitive(), barrier(), memoryBarrier(), memoryBarrierAtomicCounter(), memoryBarrierBuffer(), memoryBarrierImage(), memoryBarrierShared(), and groupMemoryBarrier(). Have not added any new built-in variables. Also changed the linear performance relateToOperator() to a high-performance version. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22659 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-07-06Eliminate flex as the GLSL lexical analyzer, going from two nested lexical ↵John Kessenich
analyzers down to one, leaving just the preprocessor's lexical analysis. A new layer replaces it, to translate from the preprocessor's view of tokenization to glslang's view of tokenization. Also: - change source locations from an int to TSourceLoc (shader number, line number) throughout - various improvements to the preprocessor git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22277 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-07-011) Don't propagate precision of built-in function arguments to return type ↵John Kessenich
when return type is bool (e.g., isnan). 2) Check an additional path for missing default precision qualification, except allow built-in declarations to pass the check. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22241 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-24Create linkage symbol nodes in the AST so a linker has access to all global ↵John Kessenich
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-10Unify constant floats and constant doubles; they can all be constant doubles.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21921 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-30Add test for operation semantics, fix one bug it found.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21798 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-30A bunch of semantic checks were missing for binary arithmetic operations. ↵John Kessenich
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-28Add missing type check for operands having the same type (after conversion) ↵John Kessenich
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-17Add precision qualifier propagation for swizzling, texture lookups, built-in ↵John Kessenich
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-04-12Update all "TODO", add some comments.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21137 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-10Add interface blocks as a basic type and handle uniform blocks that have an ↵John Kessenich
instance name. Includes handling qualifiers on structure members. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21093 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-07Split out the unary-argument built-in function path from the addUnaryMath() ↵John Kessenich
path, allowing the return types to be treated correctly without any special casing. Also, implement the correct precision qualifier propagation rules for built-in functions mapped to operators. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21062 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-04-05Add uint type (big change). For both int/uint, add the operators >>, <<, &, ↵John Kessenich
|, and ^. Also added unsigned literals and uint precision support. Also fixed how int/uint literal underflow/overflow is handled. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21054 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-03-08Another round of gcc/g++ fixes.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20819 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-03-07Change infrastructure to support constant folding across built-in functions, ↵John Kessenich
as required by 1.2 semantics. Partially fleshed out with min/max and some trig functions. Still have to complete all operations. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20806 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-28Implement operator-based implicit type conversions.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20724 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-21Replace flat 110 sampler type space with an orthogonalized 430 sampler type ↵John Kessenich
space. Invoke it for all the sampler types in the 4.3 grammar. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20652 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-20Add ES 300 matrix operations: outerProduct, determinant, inverse, and ↵John Kessenich
transpose, and missing ES 300 limit gl_MaxFragmentInputVectors. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20643 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-11Pass 1 at building on linux: remove compile errors from machine independent.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20536 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-04Implement non-square matrices, and make a few type improvements. Cleaned up ↵John Kessenich
a few old issues. Added two tests. Details - added all the new non-square types - separated concepts of matrix size and vector size - removed VS 6.0 comments/workarounds - removed obsolete concept of matrix fields git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20436 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-01-29Have non-ES profiles always use EpqNone (no precision qualifier) rather than ↵John Kessenich
using highp. This keeps precision qualifiers out of error messages, IL dumps, etc., and avoids the precision propagation algorithm. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20364 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-01-28Put in basic propagation algorithm for precision qualifiers. Some corner ↵John Kessenich
cases are document as TODO. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20360 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-01-24Implement the full scheme for ES precision qualifiers, generalizing existing ↵John Kessenich
storage qualifiers to be able to include multiple independent kinds of qualifiers. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20317 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-01-11Update copyrights to 2013 for files with real change in them.John Kessenich
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20101 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2012-12-19Bug fix: Make the type of the result of a structure assignment be the type ↵John Kessenich
of the structure assigned. That is, the type of the result of the "=" itself, if used in a broader expression. This probably fixes some other subtle problems as well. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20001 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2012-12-12Support suffixes for floats and doubles (none were supported in 110).John Kessenich
Add preprocessor support for parsing doubles. Add double support to the flex stage. Put in some of the basic double supported needed in the front end. Add generic support for version numbers in the preprocessor, and the core, compatibility, and es profiles. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@19949 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2012-12-12Remove the pack/unpack languages and bring grammar up from 1.1 to 4.2 and ↵John Kessenich
fix the affected 1.1 productions and semantics to still work correctly for 1.1 shaders. For 4.2, largely, it is only the grammar that is working. Productions and semantics are mostly missing. Lexical analysis is mostly done, but not in the preprocessor, which still can't handle uint and double literals. The grammar and token names are reorganized to match the specification, to allow easier comparison between the specification and the working grammar. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@19946 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2012-12-12Create a base GLSL front-end from the 3Dlabs glslang front-end from ↵John Kessenich
20-Sep-2005. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@19944 e7fa87d3-cd2b-0410-9028-fcbf551c1848