Граф коммитов

691 Коммитов

Автор SHA1 Сообщение Дата
John Kessenich 61d9fb9048 Semantics: 'invocations' defaults to 1, not 0.
'invocations' was using 0 as the "shader never set" flag and as the
default. Formalize this and explicit set to 1 and link time.
2015-12-13 10:59:17 -07:00
John Kessenich 04bb8a01d6 SPV: Implement all matrix operators {+,-,*,/} for {matrix,scalar,vector}. 2015-12-12 12:28:14 -07:00
John Kessenich 494a02a2b0 Semantics: Geometry stage can support max_vertices = 0.
To do this, more generally use a named -1 as a not set value.
2015-12-11 17:54:35 -07:00
John Kessenich 3c24a06c8c SPV tests: Turn on some more tests related to currently pending issues. 2015-12-11 15:08:26 -07:00
John Kessenich 76f7139789 SPV: Modify last merge: Have promoteScalar() generate the correct vectorType. 2015-12-09 19:08:42 -07:00
Rex Xu e553ace049 Parser: Extension requirement of gl_PrimitiveID and gl_Layer should be checked only for ESSL instead of GLSL. 2015-12-09 15:03:41 +08:00
John Kessenich e00e72ded1 SPV: Protect getStorageClass() with a test that the thing is pointer. 2015-12-08 20:48:49 -07:00
John Kessenich 33661450c7 SPV: Implement OpImage functionality (emit before query). 2015-12-08 19:32:47 -07:00
John Kessenich 8c1c2ca0d7 Built-ins: fix mapping of packDouble2x32 and unpackDouble2x32. 2015-12-06 19:33:07 -07:00
John Kessenich 2359bd0a1d SPV: Fix extra operands when using the "struct" form of a built-in taking an 'out' param. 2015-12-06 19:29:11 -07:00
John Kessenich e721f49dbd SPV: Distinguish between std140 and std430 layouts, and correctly use alignments as the base for strides. 2015-12-06 19:17:49 -07:00
John Kessenich dd6ca17845 Semantics: Correct that std430 is universally disallowed with 'uniform'. 2015-12-06 18:10:27 -07:00
John Kessenich 71e04d62a4 Merge pull request #100 from mawww/scanner-optim
Scanner optimisations
2015-12-06 17:12:53 -07:00
Aaron Hamilton af5a123652 In addUnaryMath, check for 'child' being null before dereferencing it. 2015-12-06 01:10:54 +00:00
John Kessenich c9d6477ee2 Merge pull request #108 from mgadams/extensions_compile_fix
Fix ordered pointer comparison build warning/error
2015-12-03 17:56:53 -07:00
John Kessenich bd0726be34 Build: Fix CMake files to find osinclude.h 2015-12-03 17:46:03 -07:00
Mark Adams a3f53e54d2 Fix ordered pointer comparison build warning/error 2015-12-03 15:31:58 -05:00
Pyry Haulos 5f6892e23c Use generic osinclude.h
Using platform-neutral osinclude.h makes it easier to substitute
implementation when necessary and eliminates some variability between
build configurations.
2015-12-01 13:01:34 -08:00
John Kessenich 1be8063e01 Require l-value patch-out indexing to be gl_InvocationID.
Also, generally allow ES variable indexing of in/out blocks.
2015-11-28 16:52:25 -07:00
John Kessenich 989df85dcd Array-sizing bug fix: multiple array initializers of different size in the same declaration.
Handles the case of
    float[] x = float[] (1.0, 2.0, 3.0),
            y = float[] (1.0, 2.0, 3.0, 4.0);
where a shallow copy of the type arrayness from the left-most float[]
was getting used twice.
2015-11-28 12:52:29 -07:00
baldurk 5100d5603f Remove legacy build system 2015-11-16 23:51:35 +01:00
baldurk 876a0e392e Add an osinclude.h below each OS directory, redirects by platform macro
* Linux folder has been renamed to Unix, to match defines and so that it
  compiles on OS X.
* This removes the need for a per-platform include search path for the
  right OS folder
2015-11-16 18:05:18 +01:00
baldurk 08dee03d18 Remove include_directories from CMakeLists, to enforce relative includes
* This also moves bison generated files into the source tree, so that
  include of glslang_tab.cpp.h and includes from glslang_tab.cpp work
  the same way.
2015-11-16 18:05:18 +01:00
John Kessenich 085371d9d4 SPV testing: Add missing test case. 2015-11-16 09:31:26 -07:00
John Kessenich 55e7d11ce8 SPIR-V: Move from Version .99 Rev 31 to Version 1.0, Rev 2. 2015-11-15 22:31:41 -07:00
Maxime Coste 6998987ecf Avoid costly indirect calls of tStringInput::(un)?getch through TPpContext
There is no calls to the TPpContext that could change the current input,
so every calls to pp->getChar and pp->ungetChar ultimately call this->getch
and this->ungetch while adding overhead of virtual calls and vector::back.
2015-11-11 18:24:37 +00:00
Maxime Coste 29051bd148 Avoid creation of temporary std::string when looking up keywords and reserved words 2015-11-11 18:24:37 +00:00
Mark Adams ea9112e0a5 Remove obsolete unistd.h file
The presence of this file can cause build issues when integrating glslang
into other projects.
2015-10-27 14:27:18 -04:00
Mark Adams c11e95f6e5 Various build fixes when using newer GCC versions with warnings enabled
Encountered with GCC-4.7.3 in a build environment where warnings are enabled
and treated as errors.
2015-10-26 12:38:46 -04:00
Mark Adams 4123a04ca9 Replace sprintf() usage with snprintf()
This fixes compilation in build environments with stricter warnings enabled
2015-10-15 16:16:52 -04:00
John Kessenich fa540d1414 SPV: Remove accidental inclusion of a test. 2015-10-15 13:55:18 -06:00
John Kessenich 7c1aa1026e SPV: Implement short circuiting of && and || when emitting SPIR-V. 2015-10-15 13:50:48 -06:00
John Kessenich da581a2b95 GL_ARB_shader_draw_parameters: From @amdrexu, implement extension. 2015-10-14 14:10:30 -06:00
John Kessenich b5c046e58b Front-end: Fix missing tessellation shader built-in qualifiers.
The gl_in array has a special path due to context-specific
gl_MaxPatchVertices, making the code out of order for tagging built-ins.
This commit moves the tagging to the correct location.
This also fixes issue #80.
2015-10-13 17:23:10 -06:00
John Kessenich e690332c3c SPV: Add modes for spacing, depth, depth replacing, winding, and point mode. 2015-10-13 16:29:02 -06:00
John Kessenich 716312771c SPV constants and constOffsets completion: isConstant() and disassembler to see results.
Expand to full isConstant() implementation.
Fix disassembler to generate texture look-up masks.
2015-10-13 10:45:22 -06:00
Rex Xu 19c6e5919f Fix an issue related with texelFetchOffset 2015-10-12 17:02:21 +08:00
John Kessenich 820a22fcc8 Give error for calling a user-defined function at global scope. 2015-10-06 13:11:38 -06:00
John Kessenich 894c1c109f Add another frexp() test. 2015-10-05 10:00:27 -06:00
John Kessenich eb505e4262 Allow future keywords to be accessed as members in a struct.
This fixes a bug where a token that could be a keyword in one version
is not a keyword in another version, but treated like a non-member after
a "." dereference.
2015-10-02 15:01:53 -06:00
John Kessenich 6373574b13 Front-end: Fix: Cubemap arrays only use 3-component coord when accessed as an image.
4 components are needed when used a texture, but not an image, which multiplies
layers and faces into the same coordinate.  This fixes it from using 4 everywhere,
to only using 4 for textures and 3 for images.
2015-10-01 12:40:48 -06:00
John Kessenich 3cd0024ea8 GLSL front-end: Check recursively for opaque types in a block; these are all illegal. 2015-09-30 18:57:47 -06:00
John Kessenich ee21fc9081 SPV: Fix missing 'Member' operand to OpArrayLength. 2015-09-21 21:50:29 -06:00
John Kessenich 142d7780a4 SPV 31: Remove obsolete and unused ../SPIRV/GLSL450Lib.h. 2015-09-21 10:39:20 -06:00
John Kessenich f82c661462 SPV: Remove old Rev. 30 header spirv.h (glslang has been using Rev. 31 spirv.hpp). 2015-09-21 08:59:47 -06:00
John Kessenich b9cd3996c7 PP: Restore a line of code deleted by commit bb63bd5e37. 2015-09-16 18:23:20 -06:00
John Kessenich 56bab0483a SPV: Minor corrections to previous big merge for images and atomics. 2015-09-16 11:42:16 -06:00
Rex Xu 6b86d496c2 Add new test case for image functions and fix issues caught by this test 2015-09-16 17:48:22 +08:00
Rex Xu bba5c80957 Merge master branch from upstream 2015-09-16 13:20:37 +08:00
Rex Xu 04db3f5aa4 Fix issues from review comments and those relevant to texelFetch 2015-09-16 11:44:02 +08:00
John Kessenich 2398b3a458 Full stack: implement textureQueryLod(*) and textureQueryLevels(*). 2015-09-15 19:38:56 -06:00
John Kessenich ef0118b26e Update the Todo.txt file with recent AEP, 3.1, and textureQuery progress. 2015-09-15 19:17:30 -06:00
John Kessenich 3e60a6ff13 SPV OpAtomicCompareSwap: Generate correct operand order and number of operands. 2015-09-14 22:45:16 -06:00
John Kessenich e770b3e6cf SPV return from main: Simplify a legacy design such returns are not jumps to exit block.
Structured control-flow rules allow leaving the middle of a construct through
a return, but not through a jump to a block that does a return.

Addresses issue #58.
2015-09-14 21:08:58 -06:00
John Kessenich 5f5b205ce9 Bump up layout(location) limit from 62 to 4094, to handle bigger uniform locations. 2015-09-13 21:03:33 -06:00
Rex Xu 30f9258d5e Merge master branch from upstream 2015-09-14 10:38:56 +08:00
John Kessenich c9a808319a SPV arrays: Add support for runtime-sized array types and arrays of arrays.
This includes run-time block.member.length() (OpArrayLength).
2015-09-13 10:18:19 -06:00
John Kessenich 9312269d09 Front-end Arrays of arrays: Add ES-specific checks and tests. AoA should be quite close to done now. 2015-09-11 15:25:38 -06:00
John Kessenich a06bd527ca SPV: Correct generation of transparent offsets for implicitly assigned offsets. 2015-09-11 15:15:23 -06:00
John Kessenich 31ed4830d1 SPV: Only decorate array and matrix strides for transparent types requiring explicit layouts. 2015-09-09 17:51:38 -06:00
John Kessenich 874b1f8858 Add test results for merge pull request #69. 2015-09-09 16:36:37 -06:00
John Kessenich 79807811b5 README: Update testing section. 2015-09-09 16:34:13 -06:00
John Kessenich 358dd560c5 Update test results for pull request #68, SPIRV: Decorate matrices and arrays with their strides. 2015-09-09 16:19:15 -06:00
John Kessenich 68e1c454da Merge pull request #60 from xorgy/no-define-defined
Preprocessor:  'defined' cannot be used as a macro name in #define or #undef.
2015-09-09 15:45:23 -06:00
John Kessenich ebb7bf37fd Remove executables from the source tree. This addresses issue #48. 2015-09-09 15:33:41 -06:00
Rex Xu fc6189197d SPIRV: Add the support of missing image functions #72 2015-09-09 16:42:49 +08:00
Rex Xu 0c81156c2d SPIRV: Fix a comment issue 2015-09-06 14:55:45 +08:00
John Kessenich c8b2e36f52 Implement GL_KHR_blend_equation_advanced. 2015-08-30 05:43:51 -06:00
Aaron Hamilton 7d3b73bfff 'defined' cannot be used as a macro name in #define or #undef. 2015-08-29 23:15:13 +00:00
John Kessenich d6c37b190b GL_OES_shader_multisample_interpolation: Include scalar swizzles as valid for interpolateAt*. 2015-08-22 16:54:35 -06:00
John Kessenich 0fc4338f3e Implement GL_OES_shader_multisample_interpolation, as well as core desktop versions of it. 2015-08-22 13:11:12 -06:00
John Kessenich ba01ebd5ba Link-check fix: Don't include built-in variables in the fragment output ES rule:
"No layout(location=) is required if there is only one output" should not count
built-in variables like gl_SampleMask.  This is fixed.
2015-08-21 09:19:52 -06:00
John Kessenich 78258d3d40 Fix misspelled EOpFrexp and EOpLdexp. 2015-08-19 17:30:12 -06:00
John Kessenich fc51d284aa Backward incompatible: Turn on PureOperatorBuiltins: use only enum-based built-in functions in the AST.
If this breaks your AST consumer, best is to modify it to test
against the enum values instead of doing string comparisons on
built-in function names.  This is the reason the change was made.

If you need the old behavior, you should be able to get it back by changing
PureOperatorBuiltins to be false instead of true.  This path will work for
a while, but is marked deprecated.

Also, the old behavior is tagged as release 2.4.
2015-08-19 13:43:25 -06:00
John Kessenich a32d8f620d Create last version before moving to pure enums for built-in functions. 2015-08-19 12:13:44 -06:00
John Kessenich 81639827d5 More preparation for pure built-in functions as enums: Add texturing op cracker. 2015-08-19 10:46:52 -06:00
John Kessenich ef676b0a59 Front-end "pure" built-in TOperator: Finish adding full support, but still turned off.
This is to avoid all need to do text comparison of built-in function names
when consuming the AST.  All built-in functions get enumerants.

Will want to turn on soon.  See PureOperatorBuiltins.  See issue #8.
2015-08-18 23:17:15 -06:00
John Kessenich e88217b7d8 Add more TOperator: fma/frexp/ldexp, AddCarry/SubBorrow/MulExtended/Bit*/Find*, (un)pack4x8/2x32, ftransform.
Also corrects some existing ones missing the "Op" part of their name.
2015-08-18 22:27:23 -06:00
John Kessenich f5b2c06b32 Turn on the gpu_shader5 of the AEP .tesc test. 2015-08-18 22:27:22 -06:00
John Kessenich 156af43c25 Merge pull request #57 from google/glslang-android
Fixes for compiling glslang on Android.
2015-08-17 10:27:11 -06:00
Andrew Woloszyn 8b64fa5474 Fixes for compiling glslang on Android.
Primarily fix is due to Android not supporting std::to_string().
2015-08-17 11:39:38 -04:00
John Kessenich fb5ba510ca Implement GL_OES_shader_image_atomic. 2015-08-16 23:40:15 -06:00
John Kessenich 556ab3ac96 Implement GL_OES_sample_variables. 2015-08-16 21:55:59 -06:00
John Kessenich a39159a192 Implement GL_OES_texture_storage_multisample_2d_array. 2015-08-16 21:10:38 -06:00
John Kessenich 2b0a11351f Fix two multi-sample bugs: 1) include MS in name mangling, 2) add 'sample' argument texelFetch(*MS*,...). 2015-08-16 21:04:07 -06:00
John Kessenich dc9eff7221 Implement GL_OES_texture_cube_map_array. 2015-08-16 14:21:20 -06:00
John Kessenich 302b46aebc Implement GL_OES_texture_buffer. 2015-08-16 13:11:01 -06:00
John Kessenich 30314590ff Implement GL_OES_primitive_bounding_box. 2015-08-16 12:09:15 -06:00
John Kessenich cee88e3644 Whitespace in preprocessor results; trying to eliminate differences. 2015-08-16 11:35:30 -06:00
Neil Richardson c8a96f45f7 Fixed VS2015 build 2015-08-15 08:29:37 -07:00
John Kessenich 65c78a0b62 Array of array: Implement the core functionality: types, constructors, operations.
There will be subsequent commits to refine semantics, esp. version-specific semantics,
as well as I/O functionality and restrictions.

Note: I'm getting white-space differences in the preprocessor test results,
which I'm not checking in.  I think they need to be tagged as binary or something.
2015-08-10 17:08:55 -06:00
John Kessenich b35483587f Array of Array prep: Turn a batch of 0's into nullptr or UnsizedArraySize.
Added some const as well. This will remove camouflage of the next commit,
which will add the bulk of Array of Array semantics and functionality.
(Note the basic grammar and data structure is already in place.)
2015-08-09 18:15:25 -06:00
John Kessenich 5e4b1242bf Move to revision 31 of SPIR-V. 2015-08-06 22:55:01 -06:00
John Kessenich e24a74c320 Create last version before going to SPIR-V Revision 31. 2015-08-06 22:22:22 -06:00
John Kessenich 3473a4b98f Merge pull request #53 from google/get-string-name-or-num
Add getStringNameOrNum() in TSourceLoc.
2015-08-06 22:06:34 -06:00
John Kessenich 306695360d Fixes to 8f1684b7bb, merge pull request 52. 2015-08-06 22:02:24 -06:00
John Kessenich 8f1684b7bb Merge pull request #52 from baldurk/gcc-warn-fixes
Compile fixes for gcc -Wall
2015-08-06 21:03:57 -06:00
Lei Zhang bb63bd5e37 Create a new method to return string name or number to DRY code. 2015-08-06 15:24:56 -04:00
baldurk d7c5ead6a1 Compile fixes for gcc -Wall 2015-08-05 21:04:23 +02:00
baldurk 36a78b5541 Remove unsigned/size_t downcast (warning when building on x64) 2015-08-05 20:25:55 +02:00
David Neto 1ee1f88b40 Remove unused members from TPpContext.
The ErrMsg and ifloc members were unused or had no effect.
2015-08-05 13:15:27 -04:00
John Kessenich d618070ab0 Merge pull request #46 from google/include-directive
#include directive support
2015-08-05 10:29:23 -06:00
Lei Zhang 484bb12703 Create a new ppRequireExtensions method for preprocessor.
Now extensions required by preprocessor should be checked via
the ppRequireExtensions method. This is more clear and coherent
with the rest of the code.
2015-08-05 11:56:14 -04:00
John Kessenich 61d7d7ad73 Revisioning: Include GLSL.std.450 version. Also, the revision.h script now includes redirection to revision.h. 2015-08-03 12:04:56 -06:00
John Kessenich 0da9eaabe8 Version reporting: Restart active use of revision.h, now based on a git tag.
The new make-revision script regenerates glslang/Include/revision.h,
used as it always has been, but made with a git-tag version and the
the number of commits on master.

I have a pre-commit hook that will automatically do this on master,
likely often enough to work in practice, without needing pull requests
to include it.
2015-08-02 10:21:10 -06:00
Lei Zhang 1eed969b2d Output wrapping #line directives for included content.
Also changed the includer interface to let it return the actual
full path of the included file.
2015-07-31 19:41:19 -04:00
Lei Zhang 2b4ebbb1e1 Update scanner in TParseContext when changing the input stream.
After parsing a #include directive, we push a TokenizableString
which contains the content of the included file into the input
stack. Henceforth, tokens will be read from the newly pushed
TokenizableString. However, the scanner in TParseContext still
points to the previous input stream. We need to update the scanner
to point to the new input stream inside TokenizableString. Thus,
the setCurrent{String|Line|..} method in TParseContext updates
the status of the correct input stream. After finishing the newly
pushed TokenizableString, we need to restore the scanner to the
previous input stream.
2015-07-31 19:41:19 -04:00
Lei Zhang 9c1280b225 Use extension framework to enable #include directive.
This patch introduces a new extension, GL_GOOGLE_include_directive,
to enable support #include directives. It depends on the extension
GL_GOOGLE_cpp_style_line_directive.
2015-07-31 19:41:19 -04:00
Dejan Mircevski 7be4b8282d Add #include processing to glslang (though turned off by default).
When an include directive is recognized by the preprocessor, it
executes a callback on the filepath argument to obtain the file
contents.  That way the compilation client can deal with the file
system, include paths, etc.

Currently only accepts quoted filepaths -- no angle brackets yet.
2015-07-31 19:41:18 -04:00
Lei Zhang 1719fb207a Add mechanism for specifying names for source strings.
Expose a new method setStringsWithLengthsAndNames() in the interface
which allows the caller to set descriptive names for source strings.
These names can be used in error messages.
2015-07-29 09:59:04 -04:00
John Kessenich b9e5424792 Non-functional: Slight change to the Google #include implementation to separate it from AEP. 2015-07-28 19:01:16 -06:00
Lei Zhang 54e47cc275 Use const reference for TSourceLoc in interfaces. 2015-07-28 12:45:41 -04:00
Lei Zhang 780a2f4426 Use requireExtensions() to check extension and turn on more tests.
Use requireExtensions() to check GL_GOOGLE_cpp_style_line_directive
is turned on. Add register more tests for running.
2015-07-28 12:21:00 -04:00
Lei Zhang 5011fbebc3 Extend the syntax of #line and __FILE__ to support filename strings.
According to the GLSL spec, the second parameter to #line should be
an integer source string number and __FILE__ will be substituted
with the integer source string number currently processed. This
patch extends the syntax of #line and __FILE__. Now #line accepts
as the second parameter a filename string quoted by double quotation
marks. And if such a #line is set, __FILE__ will be substituted with
the currently set filename string. The implementation is done via
introducing a new extension GL_GOOGLE_cpp_style_line_directive using
the extension framework.

The purpose is to support cpp-style #line directives, which is
required by #include.
2015-07-27 13:07:52 -04:00
John Kessenich c777fc2c4c Scanning: 1) rationalize end-of-input everywhere, 2) prevent infinite loop at end-of-input, 3) use positive chars.
Fixes issue #25. (char 255 aliased to -1 and missing tests for end of input).

1) All layers of input scanning now share a single EndOfInput value.
This avoids translation of it across layers of encapsulation.

2) Some places looking for end of line were not stopping on EndOfInput.

3) Use of "char" for the input made char values > 127 be negative numbers.
This allowed for aliasing of 255 to -1, etc.  This is fixed by using
unsigned char.
2015-07-27 09:37:55 -06:00
John Kessenich 91b977e172 Issue #39: Prevent problem of inserting a zero-length symbol after cascading errors. 2015-07-25 18:14:09 -06:00
John Kessenich aead93aafd Preprocessor: Allow '\' as a token, which gets actual use in #error, but should have no other use.
This is just for '\' that's not before a new line.
Note the specification says it has no use other than as line continuation,
but #error is a grey area. (There are no escape sequences.)
2015-07-25 17:34:32 -06:00
John Kessenich f330f08129 Consolidate all token length limits (1024), including one bad one (80) hardcoded on the stack (issue #40, issue #41). 2015-07-25 14:02:53 -06:00
Felix Kaaman 09d16c3ec1 Fix missing const qualifier on TUnorderedMap template type 2015-07-25 16:31:50 +02:00
John Kessenich 2b3442ada1 Portability: Make previous merge work with MSVS 2012. 2015-07-24 15:15:55 -06:00
Lei Zhang 79f6451b53 DoPreprocessing() should consider source string change.
Everytime we switch to a new source string, the line are reset.
We need to reset lastLine and also output newlines appropriately.
2015-07-23 12:29:19 -04:00
Lei Zhang d67e15e9b4 Create a new class to keep track of line number in preprocessor.
SourceLineSynchronizer is added for keeping track of the last
line number and output newlines appropriately if we switch to
a new line in the preprocessor.
2015-07-23 12:29:19 -04:00
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 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 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 d2762564dc Preprocessor: Prevent (and give an error on) expression division by 0. 2015-07-20 12:29:41 -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
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
John Kessenich e3933d684d Front-end: Implement GL_OES_gpu_shader5. 2015-07-15 19:42:59 -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 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