Commit Graph

663 Commits

Author SHA1 Message Date
John Kessenich
917ec4ac8c Front-end atomics: Finish adding atomic built-in functions (non-image) into the AST. 2015-07-22 19:58:15 -06:00
John Kessenich
d1a6846ba2 Todo.txt: Added key, including notation for who's working on something. 2015-07-22 16:39:12 -06:00
John Kessenich
7ed16efaf6 Update Todo.txt. 2015-07-22 16:36:38 -06:00
John Kessenich
c040e76c58 Portability: Remove unneeded "= default" to work with older compilers. 2015-07-22 15:25:59 -06:00
John Kessenich
96d8042a64 Merge pull request #31 from google/explicit-extension-directive
Only output explicit extension directives in preprocessing.
2015-07-22 15:20:54 -06:00
John Kessenich
12a383379c Issue 32: Guard against constructors consuming unsized arrays. 2015-07-22 11:44:59 -06:00
John Kessenich
f498400945 Merge pull request #33 from google/spv-builder-loop-ctor-inits-all-members
spv::Builder::Loop constructor inits all members.
2015-07-22 11:39:29 -06:00
David Neto
3e6a33cedf spv::Builder::Loop constructor inits all members.
After construction, the Loop is effectively const.

This perturbs the IDs in SPIR-V tests because the body block
is created before generating any of the loop code, rather than
only when the body is first referenced.
2015-07-22 12:24:21 -04:00
John Kessenich
8ba301c7c2 Issue #28: Correctly handle a single input argument conversion when the input argument is an aggregate. 2015-07-21 16:00:34 -06:00
Lei Zhang
1d2996db68 Only output explicit extension directives in preprocessing.
Preprocessing output shouldn't contain extensions enabled as
dependencies.
2015-07-21 17:47:47 -04:00
John Kessenich
efb8461722 Issue #26: Detect empty array constructors, require at least on operand. 2015-07-21 14:35:39 -06:00
John Kessenich
222457054e g++: Fix compilation issue with templates in g++. 2015-07-21 00:07:52 -06:00
John Kessenich
1056110c30 Perf: Put in a portable std::hash that works with the pool. This turns on the 10-15% perf gain. 2015-07-20 23:59:32 -06:00
John Kessenich
96f4911351 SPV: Make previous commit compile with MSVC 2012. 2015-07-20 22:34:49 -06:00
John Kessenich
37e8337958 Merge pull request #22 from google/structured-do-while
Generate correctly structured do-while loops.
2015-07-20 22:14:38 -06:00
John Kessenich
d2762564dc Preprocessor: Prevent (and give an error on) expression division by 0. 2015-07-20 12:29:41 -06:00
John Kessenich
e9022e1ffe Tests: Increase testing around incorrect use of block names and instances. 2015-07-20 12:03:04 -06:00
John Kessenich
78a5a0d7d8 Front end: Prevent use of a block name, which has no other use in a shader. 2015-07-20 11:35:51 -06:00
John Kessenich
68965c0fa9 Fix g++ build break (portibility problems with stl hash). This partly turns off the stl improvements.
It also removes some old code that ancient compilers used to need.
However, the main issue is getting access to hash functions for
unordered_map in portable way.
2015-07-20 02:06:22 -06:00
John Kessenich
6ab3d582d6 Preprocessor: 1) Rationalize the "fixed atom" scheme, 2) remove redundant lookups when the text is already available.
This simplification is a prelude to eliminating what I appear unnecessary
symbol inserts into tables when tokenizing in the preprecessor, which
show up as taking notable time. (Performance issue.)  It also simply makes
the preprocessor easier to understand, which it is badly in need of.
2015-07-19 22:59:24 -06:00
John Kessenich
2f273369e4 Performance: Simple upgrade/cleanup of stl c++11 containers (10% perf. increase). 2015-07-19 12:03:51 -06:00
John Kessenich
f4673162b7 Building: Fix a couple of new warnings. 2015-07-18 11:25:54 -06:00
John Kessenich
2b4b9bd65b Front-end: Add error-recovery code for a switch statement that ends with a case/default that has no statements. 2015-07-18 11:13:14 -06:00
David Neto
c22f37cfb4 Generate correctly structured do-while loops.
The loop test is always emitted before the loop body.

For do-while loops, use a phi node to track whether we're
on the first loop iteration, and only check the loop test
on the second and subsequent iterations.

For do-while loops, the loop test branch no longer occurs
at the top of the loop, so it must get its own selection
merge instruction.

A block can't be the target of more than one merge instruction.
So when the loop test executes after the body (as in do-while in GLSL)
we need to introduce a dummy block to be the target of the selection
merge just before the loop test conditional branch.

The other arm of the branch exits the loop and hence is the
"break block" exception in the structured control flow rules.
2015-07-17 17:51:51 -04:00
John Kessenich
51b31b5785 Merge pull request #21 from google/allow_non_null_strings
Added a setStringsWithLengths() method to TShader.
2015-07-17 11:51:56 -06:00
John Kessenich
72becbe5a2 Merge pull request #20 from google/remove_exception
Removed the single usage of exceptions in all of glslang.
2015-07-17 11:45:31 -06:00
Andrew Woloszyn
6a6aaeffd3 Added a setStringsWithLengths() method to TShader.
This allows us to pass through non null-terminated strings.
2015-07-17 13:37:02 -04:00
Andrew Woloszyn
e837f99afb Removed the single usage of exceptions in all of glslang. 2015-07-17 13:31:25 -04:00
John Kessenich
e3933d684d Front-end: Implement GL_OES_gpu_shader5. 2015-07-15 19:42:59 -06:00
John Kessenich
ace4c45afc Merge pull request #18 from srk-lunarg/v30_static_analysis_fixes
Comment out some dead assignments per suggestion from static analysis…
2015-07-15 15:06:39 -06:00
Steve
465a14666a Comment out some dead assignments per suggestion from static analysis tools.
Code is left in as comments for clarity to humans.
2015-07-15 14:34:35 -06:00
John Kessenich
a417f01041 Merge pull request #17 from google/non-existing-string
Protect location setting methods from writing to non-existing strings.
2015-07-15 14:03:33 -06:00
Lei Zhang
6c9a38161b Protect location setting methods from writing to non-existing strings.
TInputScanner advances its internal indices to the next character at
the end of get(), which means, after reading in the last character
in the user-provided shader string, internal index (currentSource)
will point to the next shader string (currentSource == numSources),
which doesn't exist. Then if a location setting method is called,
we will write to some out-of-bound memory.

A test case for this is "#line 10000\n". The eval() method in CPPline()
will evaluate 10000, but at the same time it reads in the next
token, '\n', and the currentSource will be numSources in TInputScanner.
Then a parseContext.setCurrentLine() is called, we are writing to
out-of-bound memory. Another test case will be "#line 10000 0\n".
2015-07-15 13:03:27 -04:00
John Kessenich
9e55f633bc Include specification revision as part of the version string. 2015-07-15 10:03:39 -06:00
John Kessenich
279012d8c4 Merge pull request #16 from google/pp-directive
Preprocessing directive handling
2015-07-14 19:36:29 -06:00
John Kessenich
fdfa6bbdfe Front-end: enforce qualifiers that cannot appear on block declarations.
Also seems to pick up some white-space (line-ending) test differences with a
prevoius checkin.
2015-07-14 19:30:11 -06:00
John Kessenich
8318878c89 Fix compile errors: about 25 .PpError didn't compile, need to be .ppError. 2015-07-14 15:33:38 -06:00
John Kessenich
4a22f9a4e2 Merge pull request #15 from google/preprocessing-error
Added error output to the preprocessor.

This patch distinguishes preprocessing errors with normal parsing
errors and gives glslangValidator the ability to output preprocessing
errors.
2015-07-14 15:29:13 -06:00
Andrew Woloszyn
aae1ad8296 Added error output to the preprocessor.
This patch distinguishes preprocessing errors with normal parsing
errors and gives glslangValidator the ability to output preprocessing
errors.
2015-07-14 16:02:25 -04:00
Lei Zhang
6aa6d9d3d0 Remove uncessary line break.
We output empty lines before processing non-whitespace tokens,
not after done processing them.
2015-07-14 14:39:19 -04:00
Lei Zhang
46ea5396ef Fix empty line handling in line directive callback.
The current line number for the #line directive should be passed
in as parameter to the line directive callback. Without it, we
don't know how many empty lines we should output.
2015-07-14 14:38:14 -04:00
Lei Zhang
5cbc990a0a Fix line number handling in line directive callback.
The line argument passed into the lineCallback function is the
literal value of the first argument of the #line directive.
lastLine in DoPreprocessing() should be updated taking into
consideration the different definitions for #line between specs.

Add a test to reveal the bug.
2015-07-14 14:37:59 -04:00
John Kessenich
4d036c455e Merge pull request #14 from google/extensionturnedon
Simplify function calls for extensionsTurnedOn().

Lots of places in the code use extensionsTurnedOn(1, ...). This
patch introduces a new method, extensionTurnedOn(), for testing
if a single extension is turned on.
2015-07-14 12:30:26 -06:00
John Kessenich
eebb20511f Merge pull request #11 from baldurk/size-t-int-warning-fixes
Fix warnings compiling on x64 with size_t to int casts
2015-07-14 12:25:55 -06:00
Lei Zhang
c4d20e0041 Simplify function calls for extensionsTurnedOn().
Lots of places in the code use extensionsTurnedOn(1, ...). This
patch introduces a new method, extensionTurnedOn(), for testing
if a single extension is turned on.
2015-07-14 11:26:52 -04:00
John Kessenich
3a194f7ba4 Update readme to point to Khronos landing page. 2015-07-13 11:41:06 -06:00
John Kessenich
f98ee23415 Fix incorrect used of snprintf() 2015-07-12 19:39:51 -06:00
John Kessenich
68d78fd31e Updated command-line options, adding -o for saving binaries, -G for OpenGL SPIR-V validation, -v etc.
Old uses should still work as they did before.
Also encapsulated use of these flags during parsing, for the parse context.
Added SPIR-V version to -v.
2015-07-12 19:28:10 -06:00
baldurk
d76692dfb8 on x64, size_t is 64-bit and int is 32-bit, so needs an explicit cast 2015-07-12 11:32:58 +02:00
John Kessenich
b329715caf Fix clang static analyzer issues, as reported by floooh. 2015-07-11 18:01:03 -06:00